Skip to content

ICE: type_of with TyProjection #29991

Closed
Closed
@frankmcsherry

Description

@frankmcsherry

I didn't see any obvious duplicates, but the following ICEs on playpen.

https://play.rust-lang.org/?gist=5bf75eadd36cf418734c&version=stable

trait Test<'a> {
    type Inner:'a;
}

impl<'a> Test<'a> for &'a String {
    type Inner = &'a String;
}

fn test<L>(func: L) where L : for<'b> Fn(&'b <&'b String as Test<'b>>::Inner) { }

fn main() {
    test(|x| println!("{:?}", x));
}

As an aside, this showed up because I was really hoping the below would work, but it doesn't seem to (for reasons I don't understand). Opinions on this are welcome too; the code above isn't particularly well motivated (I didn't actually want to write it; Syntaf on irc observed the ICE).

trait Test<'a> {
    type Inner:'a;
}

impl<'a> Test<'a> for &'a String {
    type Inner = &'a String;
}

fn test<L>(func: L) where L : for<'b,'a:'b> Fn(&'b <&'a String as Test<'a>>::Inner) { }

fn main() {
    test(|x| println!("{:?}", x));
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions