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 when trying to make trait inheritence + 'self region work #8873

Closed
olsonjeffery opened this issue Aug 30, 2013 · 2 comments
Closed

ICE when trying to make trait inheritence + 'self region work #8873

olsonjeffery opened this issue Aug 30, 2013 · 2 comments
Labels
A-lifetimes Area: lifetime related I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@olsonjeffery
Copy link
Contributor

Was working on trying to inherit from a trait with a <'self> lifetime parameter, like so:

trait A<'self> { fn foo(&self) -> &'self str; }  trait B : A { fn bar(&self); }

and was getting this compile error:

error: Illegal anonymous lifetime: anonymous lifetimes are not permitted here
trait A<'self> { fn foo(&self) -> &'self str; }  trait B : A { fn bar(&self); }
                                                                              ^~
aborting due to previous error

So I thought maybe I could just annotate the inherited trait with the lifetime:

trait A<'self> { fn foo(&self) -> &'self str; }  trait B<'self> : A<'self> { fn bar(&self); }

which produced this ice:

task <unnamed> failed at 'region parameterization should have inferred that this type is RP', /home/rustbuild/src/rust-buildbot/slave/snap3-linux/build/src/librustc/middle/typeck/rscope.rs:238
error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. this is a bug
note: try running with RUST_LOG=rustc=1,::rt::backtrace to get further details and report the results to github.com/mozilla/rust/issues
task <unnamed> failed at 'explicit failure', /home/rustbuild/src/rust-buildbot/slave/snap3-linux/build/src/librustc/rustc.rs:371
make: *** [x86_64-unknown-linux-gnu/stage0/lib/rustc/x86_64-unknown-linux-gnu/lib/libstd.so] Error 101

AFAICT, it's putting <'self> on A when declaring B is what's causing the ICE.

@nikomatsakis
Copy link
Contributor

Related to #4846 (should be fixed when this code is reworked)

@pnkfelix
Copy link
Member

pnkfelix commented Oct 2, 2013

closing as duplicate of #6551

@pnkfelix pnkfelix closed this as completed Oct 2, 2013
flip1995 pushed a commit to flip1995/rust that referenced this issue Jun 4, 2022
…r=dswij,xFrednet

`cast_abs_to_unsigned`: do not remove cast if it's required

Fixes rust-lang#8873

If `iX` is not cast to `uX` then keep the cast rather than removing it

changelog: [`cast_abs_to_unsigned`]: do not remove cast if it's required
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lifetimes Area: lifetime related I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

3 participants