Skip to content

Unexpected compiler error when changing pointer type of self #7061

Closed
@jedestep

Description

@jedestep

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-type-systemArea: Type systemE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions