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

Unexpected compiler error when changing pointer type of self #7061

Closed
jedestep opened this issue Jun 11, 2013 · 4 comments · Fixed by #12738
Closed

Unexpected compiler error when changing pointer type of self #7061

jedestep opened this issue Jun 11, 2013 · 4 comments · Fixed by #12738
Labels
A-typesystem Area: The 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

@jedestep
Copy link
Contributor

Came up with the following program:

struct BarStruct;

impl<'self> BarStruct {
  fn foo(&'self mut self) -> @mut BarStruct { self }
}

Produced this output when compiled:

rust: task failed at 'assertion failed: self.variance.is_some()', /Users/jedestep/rust/rust/src/librustc/middle/typeck/rscope.rs:182
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
rust: task failed at 'explicit failure', /Users/jedestep/rust/rust/src/librustc/rustc.rc:400
rust: domain main @0x7f8fe900c610 root task failed
@catamorphism
Copy link
Contributor

Reproduced with 26fd428. Nominating for milestone 5, production-ready.

@catamorphism
Copy link
Contributor

Accepted for production-ready

@nikomatsakis
Copy link
Contributor

Should go away when #4846 is fixed

@luqmana
Copy link
Member

luqmana commented Mar 4, 2014

After a s/'self/'a/ and s/@mut/@/ I can't reproduce the ICE. Instead it fails with a much more reasonable error:

7061.rs:6:42: 6:46 error: mismatched types: expected `@BarStruct` but found `&'a mut BarStruct` (expected @-ptr but found &-ptr)
7061.rs:6     fn foo(&'a mut self) -> @BarStruct { self }
                                                   ^~~~

This is with rustc 0.10-pre (6e7f170 2014-03-03 05:51:38 -0800). Marking as needs-test.

bors added a commit that referenced this issue Mar 6, 2014
Closes #6738
Closes #7061
Closes #7899
Closes #9719
Closes #10028
Closes #10228
Closes #10401
Closes #11192
Closes #11508
Closes #11529
Closes #11873
Closes #11925
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-typesystem Area: The 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.

4 participants