Closed
Description
auto-reduced (treereduce-rust):
thread_local!(static FOO: () = (Some(_) if true));
original:
#![allow(dead_code)]
extern crate internal_unstable;
thread_local!(static FOO: () = (Some(_) if true));
thread_local!(static BAR: () = internal_unstable::unstable()); //~ ERROR use of unstable
fn main() {}
Version information
rustc 1.88.0-nightly (70dab5a27 2025-04-02)
binary: rustc
commit-hash: 70dab5a27c03a5637cc1d4ba36a5139760d25e38
commit-date: 2025-04-02
host: x86_64-unknown-linux-gnu
release: 1.88.0-nightly
LLVM version: 20.1.1
Possibly related line of code:
rust/compiler/rustc_parse/src/parser/mod.rs
Lines 775 to 787 in 70dab5a
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc
Program output
error: expected one of `)`, `,`, `.`, `?`, or an operator, found keyword `if`
--> /tmp/icemaker_global_tempdir.JszNqlxytzk5/rustc_testrunner_tmpdir_reporting.afx1czPWR74u/mvce.rs:1:41
|
1 | thread_local!(static FOO: () = (Some(_) if true));
| ^^ expected one of `)`, `,`, `.`, `?`, or an operator
|
note: the `if` expression is missing a block after this condition
--> /tmp/icemaker_global_tempdir.JszNqlxytzk5/rustc_testrunner_tmpdir_reporting.afx1czPWR74u/mvce.rs:1:44
|
1 | thread_local!(static FOO: () = (Some(_) if true));
| ^^^^
thread 'rustc' panicked at compiler/rustc_parse/src/parser/mod.rs:781:17:
no close delim when reparsing Expr { kind: Expr, can_begin_literal_maybe_minus: false, can_begin_string_literal: false }
stack backtrace:
0: 0x734ec84742e3 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h0d20e02a42c28e77
1: 0x734ec8c06051 - core::fmt::write::ha11650f05943f050
2: 0x734eca09b711 - std::io::Write::write_fmt::h4725cc71f5ccdd14
3: 0x734ec8474142 - std::sys::backtrace::BacktraceLock::print::ha49279534bdd8405
4: 0x734ec8477c2a - std::panicking::default_hook::{{closure}}::he2b473d14b492917
5: 0x734ec84777af - std::panicking::default_hook::h94bf168dec0438af
6: 0x734ec74ec060 - std[a3614366cf36fca]::panicking::update_hook::<alloc[640acc83d37ac0c6]::boxed::Box<rustc_driver_impl[258d0b2789ae3140]::install_ice_hook::{closure#1}>>::{closure#0}
7: 0x734ec84784a3 - std::panicking::rust_panic_with_hook::hd1a99e1f2ceddb73
8: 0x734ec847819a - std::panicking::begin_panic_handler::{{closure}}::h39e0458c3e9f47c2
9: 0x734ec84747a9 - std::sys::backtrace::__rust_end_short_backtrace::h1c88b7d57b2b4a5b
10: 0x734ec8477e5d - __rustc[c0f065669feb0858]::rust_begin_unwind
11: 0x734ec4e9e650 - core::panicking::panic_fmt::h95804a24bd880cae
12: 0x734ec95c5b11 - <rustc_parse[66a3a4bf497d7e73]::parser::Parser>::collect_tokens_for_expr::<<rustc_parse[66a3a4bf497d7e73]::parser::Parser>::parse_expr_dot_or_call::{closure#0}>
13: 0x734ec959f053 - <rustc_parse[66a3a4bf497d7e73]::parser::Parser>::parse_expr_prefix
14: 0x734ec959b6d8 - <rustc_parse[66a3a4bf497d7e73]::parser::Parser>::parse_expr_assoc_with
15: 0x734ec958cd87 - <rustc_parse[66a3a4bf497d7e73]::parser::Parser>::parse_expr_force_collect
16: 0x734ec9fd8318 - <rustc_expand[f68c4233fdee0d14]::expand::MacroExpander>::fully_expand_fragment
17: 0x734ec9fd41cd - <rustc_expand[f68c4233fdee0d14]::expand::MacroExpander>::expand_crate
18: 0x734ec93813e8 - rustc_interface[39027d339c08cb35]::passes::resolver_for_lowering_raw
19: 0x734ec938084d - rustc_query_impl[7fb01f35c2f99b72]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[7fb01f35c2f99b72]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[8233a2d01af7ac42]::query::erase::Erased<[u8; 16usize]>>
20: 0x734ec9380827 - <rustc_query_impl[7fb01f35c2f99b72]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2} as core[136cc9b5a64fd165]::ops::function::FnOnce<(rustc_middle[8233a2d01af7ac42]::ty::context::TyCtxt, ())>>::call_once
21: 0x734ec9bd0811 - rustc_query_system[60985fba87d58500]::query::plumbing::try_execute_query::<rustc_query_impl[7fb01f35c2f99b72]::DynamicConfig<rustc_query_system[60985fba87d58500]::query::caches::SingleCache<rustc_middle[8233a2d01af7ac42]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[7fb01f35c2f99b72]::plumbing::QueryCtxt, false>
22: 0x734ec9bd038c - rustc_query_impl[7fb01f35c2f99b72]::query_impl::resolver_for_lowering_raw::get_query_non_incr::__rust_end_short_backtrace
23: 0x734ec9db19b3 - rustc_interface[39027d339c08cb35]::passes::create_and_enter_global_ctxt::<core[136cc9b5a64fd165]::option::Option<rustc_interface[39027d339c08cb35]::queries::Linker>, rustc_driver_impl[258d0b2789ae3140]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
24: 0x734ec9da276a - rustc_interface[39027d339c08cb35]::interface::run_compiler::<(), rustc_driver_impl[258d0b2789ae3140]::run_compiler::{closure#0}>::{closure#1}
25: 0x734ec9d16052 - std[a3614366cf36fca]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[39027d339c08cb35]::util::run_in_thread_with_globals<rustc_interface[39027d339c08cb35]::util::run_in_thread_pool_with_globals<rustc_interface[39027d339c08cb35]::interface::run_compiler<(), rustc_driver_impl[258d0b2789ae3140]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
26: 0x734ec9d16934 - <<std[a3614366cf36fca]::thread::Builder>::spawn_unchecked_<rustc_interface[39027d339c08cb35]::util::run_in_thread_with_globals<rustc_interface[39027d339c08cb35]::util::run_in_thread_pool_with_globals<rustc_interface[39027d339c08cb35]::interface::run_compiler<(), rustc_driver_impl[258d0b2789ae3140]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[136cc9b5a64fd165]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
27: 0x734ec9d17d2b - std::sys::pal::unix::thread::Thread::new::thread_start::h4563a82fa88a7542
28: 0x734ec3a5370a - <unknown>
29: 0x734ec3ad7aac - <unknown>
30: 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: please make sure that you have updated to the latest nightly
note: rustc 1.88.0-nightly (70dab5a27 2025-04-02) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [resolver_for_lowering_raw] getting the resolver for lowering
end of query stack
error: aborting due to 1 previous error
Metadata
Metadata
Assignees
Labels
Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: The lexing & parsing of Rust source code to an ASTCategory: This is a bug.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Relevant to the compiler team, which will review and decide on the PR/issue.