Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE: type_of with TyProjection #29991

Closed
frankmcsherry opened this issue Nov 22, 2015 · 2 comments
Closed

ICE: type_of with TyProjection #29991

frankmcsherry opened this issue Nov 22, 2015 · 2 comments

Comments

@frankmcsherry
Copy link
Contributor

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));
}
@apasel422
Copy link
Contributor

This doesn't seem to ICE on nightly.

@alexcrichton
Copy link
Member

Looks like it, closing as presumably fixed between beta/stable and a test is probably also checked in for the relevant change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants