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: 'called Option::unwrap() on a None value', compiler/rustc_middle/src/hir/map/collector.rs:227:50 #84149

Closed
dwrensha opened this issue Apr 13, 2021 · 1 comment · Fixed by #84168
Assignees
Labels
C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@dwrensha
Copy link
Contributor

dwrensha commented Apr 13, 2021

rustc crashes on the following input, found by fuzz-rustc:

trait C{async fn b(){fn a()}}
$ rustc bug.rs
error[E0670]: `async fn` is not permitted in Rust 2015
 --> bug.rs:1:9
  |
1 | trait C{async fn b(){fn a()}}
  |         ^^^^^ to use `async fn`, switch to Rust 2018 or later
  |
  = help: set `edition = "2018"` in `Cargo.toml`
  = note: for more on editions, read https://doc.rust-lang.org/edition-guide

error: expected one of `->`, `;`, `where`, or `{`, found `}`
 --> bug.rs:1:28
  |
1 | trait C{async fn b(){fn a()}}
  |                         -  ^ expected one of `->`, `;`, `where`, or `{`
  |                         |
  |                         while parsing this `fn`

error[E0706]: functions in traits cannot be declared `async`
 --> bug.rs:1:9
  |
1 | trait C{async fn b(){fn a()}}
  |         -----^^^^^^^^^^^^^^^
  |         |
  |         `async` because of this
  |
  = note: `async` trait functions are not currently supported
  = note: consider using the `async-trait` crate: https://crates.io/crates/async-trait

error: free function without a body
 --> bug.rs:1:22
  |
1 | trait C{async fn b(){fn a()}}
  |                      ^^^^^-
  |                           |
  |                           help: provide a definition for the function: `{ <body> }`

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', compiler/rustc_middle/src/hir/map/collector.rs:227:50
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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.53.0-nightly (a86612456 2021-04-11) running on x86_64-unknown-linux-gnu

query stack during panic:
thread 'rustc' panicked at 'already borrowed: BorrowMutError', /rustc/a8661245649f3d1c0dc5b23270bdac0bbd2d8f64/compiler/rustc_data_structures/src/sync.rs:481:16
stack backtrace:
   0:     0x7ff7b6025e90 - std::backtrace_rs::backtrace::libunwind::trace::h6a5a16c17f2319af
                               at /rustc/a8661245649f3d1c0dc5b23270bdac0bbd2d8f64/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x7ff7b6025e90 - std::backtrace_rs::backtrace::trace_unsynchronized::hcafc938d846f3b80
                               at /rustc/a8661245649f3d1c0dc5b23270bdac0bbd2d8f64/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7ff7b6025e90 - std::sys_common::backtrace::_print_fmt::h7b5e8e740a969b2e
                               at /rustc/a8661245649f3d1c0dc5b23270bdac0bbd2d8f64/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7ff7b6025e90 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h111ecac9cf62ba00
                               at /rustc/a8661245649f3d1c0dc5b23270bdac0bbd2d8f64/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x7ff7b609711f - core::fmt::write::h7aa6cd0067dca82a
                               at /rustc/a8661245649f3d1c0dc5b23270bdac0bbd2d8f64/library/core/src/fmt/mod.rs:1094:17
   5:     0x7ff7b601a805 - std::io::Write::write_fmt::h3f775e769673afe3
                               at /rustc/a8661245649f3d1c0dc5b23270bdac0bbd2d8f64/library/std/src/io/mod.rs:1580:15
...

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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.53.0-nightly (a86612456 2021-04-11) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack
thread panicked while panicking. aborting.
Illegal instruction (core dumped)

The error happens on nightly and beta, but not on stable.

@dwrensha dwrensha added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 13, 2021
@dwrensha
Copy link
Contributor Author

Looks like this regressed in #82891.

@cjgillot


searched nightlies: from nightly-2021-01-05 to nightly-2021-04-10
regressed nightly: nightly-2021-03-14
searched commits: from b3e19a2 to acca818
regressed commit: 32dce35

bisected with cargo-bisect-rustc v0.6.0

Host triple: x86_64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc --start=2021-01-05 --end=2021-04-10 --regress ice 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ 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