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

Region#subst ICE: trait A<'self, T> { fn f() -> &'self T;} #5518

Closed
nielsle opened this issue Mar 23, 2013 · 5 comments
Closed

Region#subst ICE: trait A<'self, T> { fn f() -> &'self T;} #5518

nielsle opened this issue Mar 23, 2013 · 5 comments
Labels
A-type-system Area: Type system E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@nielsle
Copy link
Contributor

nielsle commented Mar 23, 2013

The following program causes a compiler error

#[crate_type = "lib"];
trait A<'self, T> { fn f() -> &'self T;}

$ rustc --version
/home/niels/local/src/rust/x86_64-unknown-linux-gnu/stage2/bin/rustc 0.6 (28efc23 2013-03-22 23:09:15 -0700)

$ rustc tests.rs
error: internal compiler error: ty::subst: Reference to self region when given substs with no self region, ty = &'self 'a

@graydon
Copy link
Contributor

graydon commented May 8, 2013

reproduced today. seems relatively minor, though real: should be caught earlier.

@emberian
Copy link
Member

emberian commented Jul 1, 2013

reproduces, error: internal compiler error: ty::Region#subst(): Reference to self region when given substs with no self region: substs(self_r=None, self_ty=Some(U), tps=[T])

@bblum
Copy link
Contributor

bblum commented Aug 16, 2013

Doesn't need the crate type lib. Definitely should just be an error.

@sruggier
Copy link

I just hit this yesterday. Using commit 433fbe8 (August 13th), the following program:

#[crate_type = "lib"];

trait A<'self, T> {
    fn f(&mut self) -> &'self mut T;
    fn p() -> T;
}

triggers the same ICE:

error: internal compiler error: ty::Region#subst(): Reference to self region when given substs with no self region: substs(regions=[], self_ty=Some(BUG[1]), tps=[T])

However, if either of those two functions is removed, the remaining code compiles successfully. I realize this is a bit of a different problem than the original report. I can open a new issue, if that's preferred.

@flaper87
Copy link
Contributor

'self is no longer a special lifetime. This can't be reproduced using a normal lifetime:

#[crate_type = "lib"];

trait A<'a, T> {
    fn f(&mut self) -> &'a mut T;
    fn p() -> T;
}

This probably needs a test. Flagging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-type-system Area: Type system E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants