Skip to content

ICE: cannot encode region variables, for trait object method calls. #17662

Closed
@eddyb

Description

@eddyb
#![crate_type="lib"]
pub trait Foo<'a, T> {
    fn foo(&self);
}
pub fn foo<'a, T>(x: &'a Foo<'a, T>) {
    let x: &'a Foo<T> = x;
    //            ^ the lifetime parameter of Foo is left to be infered.
    x.foo();
    // ^ encoding this method call in metadata triggers an ICE. 
}

This is caused by writeback leaving around ReInfer in the MethodCallee associated with a method call (because MethodOrigin is not type-folded at all).
cc @nikomatsakis

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions