Skip to content

ICE with mismatching lifetime generics between trait and impl #16218

Closed
@Kimundi

Description

@Kimundi

Example: (Difference is 'a paramter in the bar signature)

trait Bar<'a> {}

trait Foo<'a> {
    fn bar<'a, T: Bar<'a>>(self) -> &'a str;
}

impl<'a> Foo<'a> for &'a str {
    fn bar<T: Bar<'a>>(self) -> &'a str { fail!() }
}

fn main() {
}
<anon>:1:1: 1:1 error: internal compiler error: Type parameter out of range when substituting in region 'a (root type=fn(Self) -> 'astr) (space=FnSpace, index=0)
<anon>:1 trait Bar<'a> {}
         ^
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'Box<Any>', /build/rust-git/src/rust/src/libsyntax/ast_util.rs:784


playpen: application terminated with error code 101

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.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