Internal Compiler Error: unexpected resolution for an identifier in pattern: SelfCtor(DefId(0:4)) · Issue #70549 · rust-lang/rust (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

@dwrensha

Description

@dwrensha

I'm seeing an internal compiler error on the following input (found by fuzz-rustc):

struct S {} impl S { fn foo(&mur Self) {} } fn main() {}

$ rustc main.rs 
error: expected identifier, found keyword `Self`
 --> main.rs:3:17
  |
3 |     fn foo(&mur Self) {}
  |                 ^^^^ expected identifier, found keyword

error: expected one of `:`, `@`, or `|`, found keyword `Self`
 --> main.rs:3:17
  |
3 |     fn foo(&mur Self) {}
  |            -----^^^^
  |            |    |
  |            |    expected one of `:`, `@`, or `|`
  |            help: declare the type after the parameter binding: `<identifier>: <type>`

thread 'rustc' panicked at 'src/librustc_resolve/late.rs:1572: unexpected resolution for an identifier in pattern: SelfCtor(DefId(0:4))', /rustc/699f83f525c985000c1f70bf85117ba383adde87/src/libstd/macros.rs:13:23
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.44.0-nightly (699f83f52 2020-03-29) running on x86_64-unknown-linux-gnu

error: aborting due to 2 previous errors

The error happens on nightly but not on beta or stable.