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

thread 'rustc' panicked at 'no label after fn', compiler/rustc_span/src/source_map.rs:958:18 #94432

Closed
Badel2 opened this issue Feb 27, 2022 · 2 comments · Fixed by #98682
Closed
Assignees
Labels
C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. 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

@Badel2
Copy link
Contributor

Badel2 commented Feb 27, 2022

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

Code

fna<e>(){fnp(){e}}

Error output

   Compiling playground v0.0.1 (/playground)
error: unknown start of token: \u{fffd}
 --> src/lib.rs:1:3
  |
1 | fn�a<e>(){fn�p(){e}}
  |   ^

error: unknown start of token: \u{fffd}
 --> src/lib.rs:1:13
  |
1 | fn�a<e>(){fn�p(){e}}
  |             ^

thread 'rustc' panicked at 'no label after fn', compiler/rustc_span/src/source_map.rs:958:18

The ICE happens after correctly reporting the error "unknown start of token", so low priority. I guess that one part of the code treats as whitespace, while another part of the code treats it as not whitespace, causing a logic error with this input. Affected versions: nightly 2022-02-26 and beta 1.60.0-beta1 are affected, but stable 1.59.0 does not ICE.

Backtrace

   Compiling playground v0.0.1 (/playground)
error: unknown start of token: \u{fffd}
 --> src/lib.rs:1:3
  |
1 | fn�a<e>(){fn�p(){e}}
  |   ^

error: unknown start of token: \u{fffd}
 --> src/lib.rs:1:13
  |
1 | fn�a<e>(){fn�p(){e}}
  |             ^

thread 'rustc' panicked at 'no label after fn', compiler/rustc_span/src/source_map.rs:958:18
stack backtrace:
   0:     0x7fd3804f4c1c - std::backtrace_rs::backtrace::libunwind::trace::h7c3070cb81dd0024
                               at /rustc/10cc7a6d031fd607f594f4c7af113bfaa9a879e9/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fd3804f4c1c - std::backtrace_rs::backtrace::trace_unsynchronized::h129f364a0750ab76
                               at /rustc/10cc7a6d031fd607f594f4c7af113bfaa9a879e9/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fd3804f4c1c - std::sys_common::backtrace::_print_fmt::h3c104a8a0383955d
                               at /rustc/10cc7a6d031fd607f594f4c7af113bfaa9a879e9/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7fd3804f4c1c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h940a7f8f5de484d7
                               at /rustc/10cc7a6d031fd607f594f4c7af113bfaa9a879e9/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7fd38055483c - core::fmt::write::h27ac5c2512a100f3
                               at /rustc/10cc7a6d031fd607f594f4c7af113bfaa9a879e9/library/core/src/fmt/mod.rs:1190:17
   5:     0x7fd3804e4d48 - std::io::Write::write_fmt::hd4b8be36d77e5a08
                               at /rustc/10cc7a6d031fd607f594f4c7af113bfaa9a879e9/library/std/src/io/mod.rs:1657:15
   6:     0x7fd3804f8bf7 - std::sys_common::backtrace::_print::h65e4e62ae12d787f
                               at /rustc/10cc7a6d031fd607f594f4c7af113bfaa9a879e9/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7fd3804f8bf7 - std::sys_common::backtrace::print::he64debcdf0537427
                               at /rustc/10cc7a6d031fd607f594f4c7af113bfaa9a879e9/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7fd3804f8bf7 - std::panicking::default_hook::{{closure}}::hcd202f51b1ab7d9b
                               at /rustc/10cc7a6d031fd607f594f4c7af113bfaa9a879e9/library/std/src/panicking.rs:295:22
   9:     0x7fd3804f88af - std::panicking::default_hook::hce3c74efe341dfb8
                               at /rustc/10cc7a6d031fd607f594f4c7af113bfaa9a879e9/library/std/src/panicking.rs:314:9
  10:     0x7fd380c90f91 - rustc_driver[27fdb45c6d63455f]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7fd3804f94c6 - std::panicking::rust_panic_with_hook::ha0edfd54e80bef59
                               at /rustc/10cc7a6d031fd607f594f4c7af113bfaa9a879e9/library/std/src/panicking.rs:702:17
  12:     0x7fd3804f9177 - std::panicking::begin_panic_handler::{{closure}}::h968f7b19f1564476
                               at /rustc/10cc7a6d031fd607f594f4c7af113bfaa9a879e9/library/std/src/panicking.rs:588:13
  13:     0x7fd3804f50e4 - std::sys_common::backtrace::__rust_end_short_backtrace::h4b69be26095274cc
                               at /rustc/10cc7a6d031fd607f594f4c7af113bfaa9a879e9/library/std/src/sys_common/backtrace.rs:138:18
  14:     0x7fd3804f8e89 - rust_begin_unwind
                               at /rustc/10cc7a6d031fd607f594f4c7af113bfaa9a879e9/library/std/src/panicking.rs:584:5
  15:     0x7fd3804c1913 - core::panicking::panic_fmt::h74e85b388cc5eea2
                               at /rustc/10cc7a6d031fd607f594f4c7af113bfaa9a879e9/library/core/src/panicking.rs:143:14
  16:     0x7fd380551641 - core::panicking::panic_display::hd8c5c6145f7843ad
                               at /rustc/10cc7a6d031fd607f594f4c7af113bfaa9a879e9/library/core/src/panicking.rs:72:5
  17:     0x7fd3805515eb - core::panicking::panic_str::h5b28b81c4c9b2d81
                               at /rustc/10cc7a6d031fd607f594f4c7af113bfaa9a879e9/library/core/src/panicking.rs:56:5
  18:     0x7fd3804c1786 - core::option::expect_failed::h8786578558ede675
                               at /rustc/10cc7a6d031fd607f594f4c7af113bfaa9a879e9/library/core/src/option.rs:1852:5
  19:     0x7fd381df657d - <rustc_span[559d849e8363120e]::source_map::SourceMap>::generate_fn_name_span
  20:     0x7fd3810b5d75 - <rustc_resolve[d438b2f733e802ab]::Resolver>::into_struct_error
  21:     0x7fd3810b2f0c - <rustc_resolve[d438b2f733e802ab]::Resolver>::report_error
  22:     0x7fd38218110a - <rustc_resolve[d438b2f733e802ab]::Resolver>::resolve_path_with_ribs
  23:     0x7fd38219c4b1 - <rustc_resolve[d438b2f733e802ab]::late::LateResolutionVisitor>::smart_resolve_path_fragment
  24:     0x7fd38219ea1a - <rustc_resolve[d438b2f733e802ab]::late::LateResolutionVisitor>::resolve_expr
  25:     0x7fd382191cbc - <rustc_resolve[d438b2f733e802ab]::late::LateResolutionVisitor as rustc_ast[503e33a30ca156de]::visit::Visitor>::visit_block
  26:     0x7fd382192d6f - <rustc_resolve[d438b2f733e802ab]::late::LateResolutionVisitor as rustc_ast[503e33a30ca156de]::visit::Visitor>::visit_fn
  27:     0x7fd38214898e - rustc_ast[503e33a30ca156de]::visit::walk_item::<rustc_resolve[d438b2f733e802ab]::late::LateResolutionVisitor>
  28:     0x7fd382196468 - <rustc_resolve[d438b2f733e802ab]::late::LateResolutionVisitor>::resolve_item
  29:     0x7fd382191e48 - <rustc_resolve[d438b2f733e802ab]::late::LateResolutionVisitor as rustc_ast[503e33a30ca156de]::visit::Visitor>::visit_block
  30:     0x7fd382192d6f - <rustc_resolve[d438b2f733e802ab]::late::LateResolutionVisitor as rustc_ast[503e33a30ca156de]::visit::Visitor>::visit_fn
  31:     0x7fd38214898e - rustc_ast[503e33a30ca156de]::visit::walk_item::<rustc_resolve[d438b2f733e802ab]::late::LateResolutionVisitor>
  32:     0x7fd382196468 - <rustc_resolve[d438b2f733e802ab]::late::LateResolutionVisitor>::resolve_item
  33:     0x7fd382df80dc - <rustc_resolve[d438b2f733e802ab]::Resolver>::late_resolve_crate
  34:     0x7fd382de17bb - <rustc_session[a6da21e65b3d36fd]::session::Session>::time::<(), <rustc_resolve[d438b2f733e802ab]::Resolver>::resolve_crate::{closure#0}>
  35:     0x7fd382ad3c3e - rustc_interface[e15285c328f6dde8]::passes::configure_and_expand
  36:     0x7fd382ad8f31 - <rustc_interface[e15285c328f6dde8]::queries::Queries>::expansion
  37:     0x7fd382aac479 - <rustc_interface[e15285c328f6dde8]::interface::Compiler>::enter::<rustc_driver[27fdb45c6d63455f]::run_compiler::{closure#1}::{closure#2}, core[c2e0b789170cc5fa]::result::Result<core[c2e0b789170cc5fa]::option::Option<rustc_interface[e15285c328f6dde8]::queries::Linker>, rustc_errors[9da8cfde5692a04f]::ErrorReported>>
  38:     0x7fd382aae33c - rustc_span[559d849e8363120e]::with_source_map::<core[c2e0b789170cc5fa]::result::Result<(), rustc_errors[9da8cfde5692a04f]::ErrorReported>, rustc_interface[e15285c328f6dde8]::interface::create_compiler_and_run<core[c2e0b789170cc5fa]::result::Result<(), rustc_errors[9da8cfde5692a04f]::ErrorReported>, rustc_driver[27fdb45c6d63455f]::run_compiler::{closure#1}>::{closure#1}>
  39:     0x7fd382aabd77 - <scoped_tls[cb501334321ad8d4]::ScopedKey<rustc_span[559d849e8363120e]::SessionGlobals>>::set::<rustc_interface[e15285c328f6dde8]::interface::run_compiler<core[c2e0b789170cc5fa]::result::Result<(), rustc_errors[9da8cfde5692a04f]::ErrorReported>, rustc_driver[27fdb45c6d63455f]::run_compiler::{closure#1}>::{closure#0}, core[c2e0b789170cc5fa]::result::Result<(), rustc_errors[9da8cfde5692a04f]::ErrorReported>>
  40:     0x7fd382a9708d - std[b48f0f8e93cbe429]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[e15285c328f6dde8]::util::run_in_thread_pool_with_globals<rustc_interface[e15285c328f6dde8]::interface::run_compiler<core[c2e0b789170cc5fa]::result::Result<(), rustc_errors[9da8cfde5692a04f]::ErrorReported>, rustc_driver[27fdb45c6d63455f]::run_compiler::{closure#1}>::{closure#0}, core[c2e0b789170cc5fa]::result::Result<(), rustc_errors[9da8cfde5692a04f]::ErrorReported>>::{closure#0}, core[c2e0b789170cc5fa]::result::Result<(), rustc_errors[9da8cfde5692a04f]::ErrorReported>>
  41:     0x7fd382a95619 - <<std[b48f0f8e93cbe429]::thread::Builder>::spawn_unchecked_<rustc_interface[e15285c328f6dde8]::util::run_in_thread_pool_with_globals<rustc_interface[e15285c328f6dde8]::interface::run_compiler<core[c2e0b789170cc5fa]::result::Result<(), rustc_errors[9da8cfde5692a04f]::ErrorReported>, rustc_driver[27fdb45c6d63455f]::run_compiler::{closure#1}>::{closure#0}, core[c2e0b789170cc5fa]::result::Result<(), rustc_errors[9da8cfde5692a04f]::ErrorReported>>::{closure#0}, core[c2e0b789170cc5fa]::result::Result<(), rustc_errors[9da8cfde5692a04f]::ErrorReported>>::{closure#1} as core[c2e0b789170cc5fa]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  42:     0x7fd380505053 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hd400eedbdf19ac5a
                               at /rustc/10cc7a6d031fd607f594f4c7af113bfaa9a879e9/library/alloc/src/boxed.rs:1854:9
  43:     0x7fd380505053 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::he262f0a88c6384ec
                               at /rustc/10cc7a6d031fd607f594f4c7af113bfaa9a879e9/library/alloc/src/boxed.rs:1854:9
  44:     0x7fd380505053 - std::sys::unix::thread::Thread::new::thread_start::haa0f92689c2258f1
                               at /rustc/10cc7a6d031fd607f594f4c7af113bfaa9a879e9/library/std/src/sys/unix/thread.rs:108:17
  45:     0x7fd380439609 - start_thread
  46:     0x7fd380353293 - clone
  47:                0x0 - <unknown>

error: internal compiler error: unexpected panic

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

note: we would appreciate a bug report: https:/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.61.0-nightly (10cc7a6d0 2022-02-26) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: could not compile `playground` due to 2 previous errors

@Badel2 Badel2 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 Feb 27, 2022
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Mar 2, 2022
@chordtoll
Copy link
Contributor

@rustbot claim

@Alexendoo
Copy link
Member

Fixed by #98609, different enough to the added test that I'll mark as needs-test. But anybody feel free to close this if we don't generally add fuzzed inputs to tests

@Alexendoo Alexendoo added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Jun 29, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jun 29, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jun 29, 2022
@bors bors closed this as completed in 726d613 Jun 30, 2022
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. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. 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.

4 participants