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

'rustc' panicked at 'called Option::unwrap() on a None value' #110014

Closed
dwrensha opened this issue Apr 6, 2023 · 3 comments · Fixed by #110022
Closed

'rustc' panicked at 'called Option::unwrap() on a None value' #110014

dwrensha opened this issue Apr 6, 2023 · 3 comments · Fixed by #110022
Labels
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.

Comments

@dwrensha
Copy link
Contributor

dwrensha commented Apr 6, 2023

rustc crashes on the following input, found by fuzz_rustc:

fn`2222222222222222222222222222222222222222
error: unknown start of token: `
 --> bug2.rs:1:3
  |
1 | fn`2222222222222222222222222222222222222222
  |   ^
  |
help: Unicode character '`' (Grave Accent) looks like ''' (Single Quote), but it is not
  |
1 | fn'2222222222222222222222222222222222222222
  |   ~

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', compiler/rustc_parse/src/parser/diagnostics.rs:430:49
stack backtrace:
   0:     0x7f65a4b65f8a - std::backtrace_rs::backtrace::libunwind::trace::h543e5a71eb1b5eeb
                               at /rustc/2eaeb1eee1b21772de8b935236d16ff8e03fdcf5/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f65a4b65f8a - std::backtrace_rs::backtrace::trace_unsynchronized::h8798c87c5fd54c42
                               at /rustc/2eaeb1eee1b21772de8b935236d16ff8e03fdcf5/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f65a4b65f8a - std::sys_common::backtrace::_print_fmt::h982e629a02833f3b
                               at /rustc/2eaeb1eee1b21772de8b935236d16ff8e03fdcf5/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f65a4b65f8a - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hd16097abfc45a49a
                               at /rustc/2eaeb1eee1b21772de8b935236d16ff8e03fdcf5/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f65a4bca04f - core::fmt::write::haccd80b41eab472e
                               at /rustc/2eaeb1eee1b21772de8b935236d16ff8e03fdcf5/library/core/src/fmt/mod.rs:1254:17
   5:     0x7f65a4b58bc5 - std::io::Write::write_fmt::h578b3def4330fd2b
                               at /rustc/2eaeb1eee1b21772de8b935236d16ff8e03fdcf5/library/std/src/io/mod.rs:1698:15
   6:     0x7f65a4b65d55 - std::sys_common::backtrace::_print::he237786f41276d1a
                               at /rustc/2eaeb1eee1b21772de8b935236d16ff8e03fdcf5/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f65a4b65d55 - std::sys_common::backtrace::print::h504fa2bef175cc1e
                               at /rustc/2eaeb1eee1b21772de8b935236d16ff8e03fdcf5/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f65a4b689fe - std::panicking::default_hook::{{closure}}::hac9a65d5f66db25e
                               at /rustc/2eaeb1eee1b21772de8b935236d16ff8e03fdcf5/library/std/src/panicking.rs:269:22
   9:     0x7f65a4b687a5 - std::panicking::default_hook::h4e334937c58bdca9
                               at /rustc/2eaeb1eee1b21772de8b935236d16ff8e03fdcf5/library/std/src/panicking.rs:288:9
  10:     0x7f65a7e73635 - rustc_driver_impl[bd452c501c51eef0]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f65a4b691f4 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h2c058cd2c0afd653
                               at /rustc/2eaeb1eee1b21772de8b935236d16ff8e03fdcf5/library/alloc/src/boxed.rs:1990:9
  12:     0x7f65a4b691f4 - std::panicking::rust_panic_with_hook::h1fcbef96fdc6ec0c
                               at /rustc/2eaeb1eee1b21772de8b935236d16ff8e03fdcf5/library/std/src/panicking.rs:694:13
  13:     0x7f65a4b68f22 - std::panicking::begin_panic_handler::{{closure}}::h246d986a28aa7c83
                               at /rustc/2eaeb1eee1b21772de8b935236d16ff8e03fdcf5/library/std/src/panicking.rs:579:13
  14:     0x7f65a4b663f6 - std::sys_common::backtrace::__rust_end_short_backtrace::h99f10a55eb368f21
                               at /rustc/2eaeb1eee1b21772de8b935236d16ff8e03fdcf5/library/std/src/sys_common/backtrace.rs:150:18
  15:     0x7f65a4b68cc2 - rust_begin_unwind
                               at /rustc/2eaeb1eee1b21772de8b935236d16ff8e03fdcf5/library/std/src/panicking.rs:577:5
  16:     0x7f65a4bc6363 - core::panicking::panic_fmt::h493527ddc74034ba
                               at /rustc/2eaeb1eee1b21772de8b935236d16ff8e03fdcf5/library/core/src/panicking.rs:67:14
  17:     0x7f65a4bc63fd - core::panicking::panic::hb2955f7731e01f3f
                               at /rustc/2eaeb1eee1b21772de8b935236d16ff8e03fdcf5/library/core/src/panicking.rs:117:5
  18:     0x7f65a6e53556 - <rustc_parse[77f428f3632bd5e8]::parser::Parser>::expected_ident_found
  19:     0x7f65a6e14a3e - <rustc_parse[77f428f3632bd5e8]::parser::Parser>::parse_ident_common
  20:     0x7f65a6e06245 - <rustc_parse[77f428f3632bd5e8]::parser::Parser>::parse_fn
  21:     0x7f65a6df3df8 - <rustc_parse[77f428f3632bd5e8]::parser::Parser>::parse_item_kind
  22:     0x7f65a6df0449 - <rustc_parse[77f428f3632bd5e8]::parser::Parser>::parse_item_common
  23:     0x7f65a6b71b18 - <rustc_parse[77f428f3632bd5e8]::parser::Parser>::parse_mod
  24:     0x7f65a70c66d8 - rustc_parse[77f428f3632bd5e8]::parse_crate_from_file
  25:     0x7f65a70c62bf - <rustc_session[8a142d07c6ec552f]::session::Session>::time::<core[d2a11d220902df1]::result::Result<rustc_ast[ce4ca91d19d8f3b]::ast::Crate, rustc_errors[b273ccddd230f82e]::diagnostic_builder::DiagnosticBuilder<rustc_span[b847b06bcddf9aef]::ErrorGuaranteed>>, rustc_interface[c7956fe9641ea70c]::passes::parse::{closure#0}>
  26:     0x7f65a70c09ff - rustc_interface[c7956fe9641ea70c]::passes::parse
  27:     0x7f65a70c0134 - <rustc_interface[c7956fe9641ea70c]::queries::Queries>::parse
  28:     0x7f65a70bf650 - <rustc_interface[c7956fe9641ea70c]::interface::Compiler>::enter::<rustc_driver_impl[bd452c501c51eef0]::run_compiler::{closure#1}::{closure#2}, core[d2a11d220902df1]::result::Result<core[d2a11d220902df1]::option::Option<rustc_interface[c7956fe9641ea70c]::queries::Linker>, rustc_span[b847b06bcddf9aef]::ErrorGuaranteed>>
  29:     0x7f65a70baae1 - rustc_span[b847b06bcddf9aef]::set_source_map::<core[d2a11d220902df1]::result::Result<(), rustc_span[b847b06bcddf9aef]::ErrorGuaranteed>, rustc_interface[c7956fe9641ea70c]::interface::run_compiler<core[d2a11d220902df1]::result::Result<(), rustc_span[b847b06bcddf9aef]::ErrorGuaranteed>, rustc_driver_impl[bd452c501c51eef0]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  30:     0x7f65a70ba08f - std[1137eeb067dcff5d]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[c7956fe9641ea70c]::util::run_in_thread_pool_with_globals<rustc_interface[c7956fe9641ea70c]::interface::run_compiler<core[d2a11d220902df1]::result::Result<(), rustc_span[b847b06bcddf9aef]::ErrorGuaranteed>, rustc_driver_impl[bd452c501c51eef0]::run_compiler::{closure#1}>::{closure#0}, core[d2a11d220902df1]::result::Result<(), rustc_span[b847b06bcddf9aef]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d2a11d220902df1]::result::Result<(), rustc_span[b847b06bcddf9aef]::ErrorGuaranteed>>
  31:     0x7f65a77278b1 - <<std[1137eeb067dcff5d]::thread::Builder>::spawn_unchecked_<rustc_interface[c7956fe9641ea70c]::util::run_in_thread_pool_with_globals<rustc_interface[c7956fe9641ea70c]::interface::run_compiler<core[d2a11d220902df1]::result::Result<(), rustc_span[b847b06bcddf9aef]::ErrorGuaranteed>, rustc_driver_impl[bd452c501c51eef0]::run_compiler::{closure#1}>::{closure#0}, core[d2a11d220902df1]::result::Result<(), rustc_span[b847b06bcddf9aef]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d2a11d220902df1]::result::Result<(), rustc_span[b847b06bcddf9aef]::ErrorGuaranteed>>::{closure#1} as core[d2a11d220902df1]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  32:     0x7f65a4b732d5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hcb3c543eabd3883a
                               at /rustc/2eaeb1eee1b21772de8b935236d16ff8e03fdcf5/library/alloc/src/boxed.rs:1976:9
  33:     0x7f65a4b732d5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h4c6155c5f5f14f7d
                               at /rustc/2eaeb1eee1b21772de8b935236d16ff8e03fdcf5/library/alloc/src/boxed.rs:1976:9
  34:     0x7f65a4b732d5 - std::sys::unix::thread::Thread::new::thread_start::he5347f8288d9936e
                               at /rustc/2eaeb1eee1b21772de8b935236d16ff8e03fdcf5/library/std/src/sys/unix/thread.rs:108:17
  35:     0x7f65a4894b43 - start_thread
                               at ./nptl/./nptl/pthread_create.c:442:8
  36:     0x7f65a4926a00 - clone3
                               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
  37:                0x0 - <unknown>

error: 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.70.0-nightly (2eaeb1eee 2023-04-05) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack
error: aborting due to previous error
@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 6, 2023
@dwrensha
Copy link
Contributor Author

dwrensha commented Apr 6, 2023

searched nightlies: from nightly-2022-03-27 to nightly-2023-04-05
regressed nightly: nightly-2023-03-24
searched commit range: a266f11...1459b31
regressed commit: 84dd6df

bisected with cargo-bisect-rustc v0.6.6

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

cargo bisect-rustc --end=2023-04-05 --regress ice 

@dwrensha
Copy link
Contributor Author

dwrensha commented Apr 6, 2023

Attempting to search unrolled perf builds
Found commits ["fe8da10f", "1fa4eb1d", "879a5ec7", "ca7d1e93", "23779c7b", "ebeccc8e", "82edea25", "bfaae772", "6331a0c6"]
...
installing bfaae77226bf50fc37da98b8cf5781dcc97ad3a0
rust-std-nightly-x86_64-unknown-linux-gnu: 28.88 MB / 28.88 MB [=========================================================] 100.00 % 8.90 MB/s testing...
RESULT: bfaae77226bf50fc37da98b8cf5781dcc97ad3a0, ===> Yes
uninstalling bfaae77226bf50fc37da98b8cf5781dcc97ad3a0

Regression in https://github.com/rust-lang-ci/rust/commit/bfaae77226bf50fc37da98b8cf5781dcc97ad3a0

@dwrensha
Copy link
Contributor Author

dwrensha commented Apr 6, 2023

Looks like this regressed in #109203. cc @Ezrashaw

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

1 participant