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 with certain uses of 'self #7331

Closed
emberian opened this issue Jun 23, 2013 · 6 comments
Closed

Region#subst ICE with certain uses of 'self #7331

emberian opened this issue Jun 23, 2013 · 6 comments
Labels
A-lifetimes Area: lifetime related A-typesystem Area: The type system I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@emberian
Copy link
Member

Stripped-down and updated version of original source:

pub trait Interner<T> {
    fn new() -> Self;
    fn get(&'self self, tag: uint) -> Option<&'self T>;
}

pub struct SimpleInterner<T: Eq + IterBytes + Hash + Clone>;

impl<T> Interner<T> for SimpleInterner<T> {
    pub fn new() -> SimpleInterner<T> { SimpleInterner }
    pub fn get(&'self self, tag: uint) -> Option<&'self T> { None }
}
% rustc --version
/Users/fklock/opt/rust-dbg/bin/rustc 0.9-pre (97cd495 2013-10-02 01:16:31 -0700)
host: x86_64-apple-darwin
% rustc --lib /tmp/s.rs
error: internal compiler error: ty::Region#subst(): Reference to self region when given substs with no self region: substs(regions=[], self_ty=Some(BUG[1u]), tps=[T])

Original bug report: https://gist.github.com/pnkfelix/6905109

@erickt
Copy link
Contributor

erickt commented Jul 26, 2013

@dwrensha ran into a similar bug, but it's a bit shorter than the one you posted:

trait Constructable<'self> { fn construct(v : &'self[u8]) -> Self; }
fn main() { }

errored with:

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(BUG[0]), tps=[])

@emberian
Copy link
Member Author

"a bit shorter": understatement of the month!

@pnkfelix
Copy link
Member

pnkfelix commented Oct 2, 2013

visiting for triage, email from 2013 sep 30.

Stripped bug down. Reviewing other bugs with 'self lifetime issues now to see how many dupes there are.

@nikomatsakis
Copy link
Contributor

cc me

@dwrensha dwrensha mentioned this issue Oct 14, 2013
@nikomatsakis
Copy link
Contributor

cc me

@luqmana
Copy link
Member

luqmana commented Mar 4, 2014

The special 'self lifetime no longer exists and rewriting the code sample above to use some lifetime 'a doesn't trigger an ICE.

Tested with rustc 0.10-pre (6e7f170 2014-03-03 05:51:38 -0800)

@luqmana luqmana closed this as completed Mar 4, 2014
flip1995 pushed a commit to flip1995/rust that referenced this issue Jul 1, 2021
Improve lint message for match-same-arms lint

fixes rust-lang#7331

Follow-up to rust-lang#7377

This PR improves the lint message for `match-same-arms` lint and adds `todo!(..)`  example to the lint docs.

*Please write a short comment explaining your change (or "none" for internal only changes)*

changelog: None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lifetimes Area: lifetime related A-typesystem Area: The type system 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.

5 participants