Skip to content

internal compiler error with undeclared 'self lifetime #8196

Closed
@stepancheg

Description

@stepancheg
Contributor
struct Foo {
    dummy: ()
}

impl Foo {
    fn xx(&'self self) {
    }
}

fn main() {
}

Compiler crashes with:

rust: task failed at 'assertion failed: self.variance.is_some()', /private/tmp/rust-CauM/rust-0.7/src/librustc/middle/typeck/rscope.rs:181
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', /private/tmp/rust-CauM/rust-0.7/src/librustc/rustc.rs:354
rust: domain main @0x7f94e9008a10 root task failed

If program is incorrect, compiler should print message and exit.

Activity

pnkfelix

pnkfelix commented on Oct 2, 2013

@pnkfelix
Member

probably a subbug of #4846

nikomatsakis

nikomatsakis commented on Oct 9, 2013

@nikomatsakis
Contributor

cc me

eminence

eminence commented on Jan 25, 2014

@eminence
Contributor

Testing on the latest master (dc48adc)

After changing 'self to 'a, there is no longer an ICE. A correct error message is produced:

a.rs:6:12: 6:14 error: use of undeclared lifetime name `'a`
a.rs:6     fn xx(&'a self) {
                  ^~
error: aborting due to previous error
steveklabnik

steveklabnik commented on Aug 12, 2014

@steveklabnik
Member

I see the same as @eminence . I think this can be closed.

added a commit that references this issue on Dec 30, 2021

Auto merge of rust-lang#8196 - flip1995:rustup, r=flip1995

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @steveklabnik@stepancheg@alexcrichton@nikomatsakis@pnkfelix

        Issue actions

          internal compiler error with undeclared 'self lifetime · Issue #8196 · rust-lang/rust