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

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

Closed
dwrensha opened this issue Mar 30, 2020 · 4 comments · Fixed by #70555
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-parser Area: The parsing of Rust source code to an AST A-resolve Area: Name/path resolution done by `rustc_resolve` specifically I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@dwrensha
Copy link
Contributor

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.

@dwrensha
Copy link
Contributor Author

dwrensha commented Mar 30, 2020

Report from cargo bisect-rustc:

searched nightlies: from nightly-2020-03-09 to nightly-2020-03-30
regressed nightly: nightly-2020-03-16
searched commits: from 7cdbc87 to 45ebd58
regressed commit: e0f5df0

@dwrensha
Copy link
Contributor Author

#70006 looks like the probable culprit. cc @petrochenkov

@Centril Centril added I-nominated P-medium Medium priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ A-parser Area: The parsing of Rust source code to an AST A-resolve Area: Name/path resolution done by `rustc_resolve` specifically A-diagnostics Area: Messages for errors, warnings, and lints labels Mar 30, 2020
@petrochenkov petrochenkov self-assigned this Mar 30, 2020
@petrochenkov
Copy link
Contributor

Will fix.

@Centril
Copy link
Contributor

Centril commented Mar 30, 2020

@petrochenkov Was already looking at this hehe, I have a fix for you in #70555.

@Centril Centril self-assigned this Mar 30, 2020
Centril added a commit to Centril/rust that referenced this issue Mar 30, 2020
resolve, `try_resolve_as_non_binding`: use `delay_span_bug` due to parser recovery

Fixes rust-lang#70549

r? @petrochenkov
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Mar 30, 2020
resolve, `try_resolve_as_non_binding`: use `delay_span_bug` due to parser recovery

Fixes rust-lang#70549

r? @petrochenkov
Centril added a commit to Centril/rust that referenced this issue Mar 31, 2020
resolve, `try_resolve_as_non_binding`: use `delay_span_bug` due to parser recovery

Fixes rust-lang#70549

r? @petrochenkov
Centril added a commit to Centril/rust that referenced this issue Mar 31, 2020
resolve, `try_resolve_as_non_binding`: use `delay_span_bug` due to parser recovery

Fixes rust-lang#70549

r? @petrochenkov
@bors bors closed this as completed in 65b85a5 Mar 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-parser Area: The parsing of Rust source code to an AST A-resolve Area: Name/path resolution done by `rustc_resolve` specifically I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants