Skip to content

Internal Compiler Error: unexpected resolution for an identifier in pattern: SelfCtor(DefId(0:4)) #70549

Closed
@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.

Metadata

Metadata

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsA-parserArea: The lexing & parsing of Rust source code to an ASTA-resolveArea: Name/path resolution done by `rustc_resolve` specificallyI-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions