Closed
Description
auto-reduced (treereduce-rust):
macro_rules! foo {
($abi:expr) => {
extern $abi
unsafe extern $abi
extern $abi fn _export
type _PTR = extern $abi fn;
};
}
fn main() {
foo!(-2);
bar!(-2);
}
original:
//@ check-pass
macro_rules! foo {
($abi:expr) => {
extern $abi {
fn _import();
}
unsafe extern $abi {}
extern $abi fn _export() {}
type _PTR = extern $abi fn();
};
}
macro_rules! bar {
($b:literal) => {};
}
fn main() {
foo!(-2);
bar!(-2);
}
Version information
rustc 1.88.0-nightly (e643f59f6 2025-04-07)
binary: rustc
commit-hash: e643f59f6da3a84f43e75dea99afaa5b041ea6bf
commit-date: 2025-04-07
host: x86_64-unknown-linux-gnu
release: 1.88.0-nightly
LLVM version: 20.1.2
Possibly related line of code:
rust/compiler/rustc_parse/src/parser/expr.rs
Lines 2164 to 2176 in e643f59
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc
Program output
thread 'rustc' panicked at compiler/rustc_parse/src/parser/expr.rs:2170:21:
didn't reparse an expr
stack backtrace:
0: 0x7dea1ea9bb23 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hf5dc873791abf135
1: 0x7dea1f206111 - core::fmt::write::ha776e938852cf3cc
2: 0x7dea203760d1 - std::io::Write::write_fmt::h20ffaced5034a7d9
3: 0x7dea1ea9b982 - std::sys::backtrace::BacktraceLock::print::hb886f83202af1df7
4: 0x7dea1ea9f46a - std::panicking::default_hook::{{closure}}::h6c1c8b305374519f
5: 0x7dea1ea9efef - std::panicking::default_hook::h20bf230235c76f2b
6: 0x7dea1daf7d13 - std[9466cf876ee11eca]::panicking::update_hook::<alloc[d3b838bf054e3104]::boxed::Box<rustc_driver_impl[4339cf40f8e3ed89]::install_ice_hook::{closure#1}>>::{closure#0}
7: 0x7dea1ea9fce3 - std::panicking::rust_panic_with_hook::h636edd46b6e2975a
8: 0x7dea1ea9f9a6 - std::panicking::begin_panic_handler::{{closure}}::h188310d1379a79a3
9: 0x7dea1ea9bfe9 - std::sys::backtrace::__rust_end_short_backtrace::h66ee93ae65c27ed6
10: 0x7dea1ea9f69d - __rustc[f84ae5861e8c8fa0]::rust_begin_unwind
11: 0x7dea1b4989c0 - core::panicking::panic_fmt::h3d5144c0032eb82c
12: 0x7dea1f9ce788 - <rustc_parse[1c249f3fc41a849c]::parser::Parser>::parse_opt_meta_item_lit
13: 0x7dea1f9cd361 - <rustc_parse[1c249f3fc41a849c]::parser::Parser>::parse_abi
14: 0x7dea1fa59216 - <rustc_parse[1c249f3fc41a849c]::parser::Parser>::parse_item_foreign_mod
15: 0x7dea1fd43e87 - <rustc_parse[1c249f3fc41a849c]::parser::Parser>::parse_item_kind
16: 0x7dea1fd3fc54 - <rustc_parse[1c249f3fc41a849c]::parser::Parser>::parse_item_common
17: 0x7dea1fa9fbd9 - <rustc_parse[1c249f3fc41a849c]::parser::Parser>::parse_stmt_without_recovery
18: 0x7dea1fd3a262 - <rustc_parse[1c249f3fc41a849c]::parser::Parser>::parse_full_stmt
19: 0x7dea1fd36de8 - <rustc_expand[bede3020a56ef279]::mbe::macro_rules::ParserAnyMacro>::make
20: 0x7dea2058e920 - <rustc_expand[bede3020a56ef279]::expand::MacroExpander>::fully_expand_fragment
21: 0x7dea2057dd0d - <rustc_expand[bede3020a56ef279]::expand::MacroExpander>::expand_crate
22: 0x7dea1f9b5ce5 - rustc_interface[adb8a737eb8b1c5b]::passes::resolver_for_lowering_raw
23: 0x7dea1f9b50e1 - rustc_query_impl[75a3021f06b975a9]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[75a3021f06b975a9]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[3618dc43a4e0fd99]::query::erase::Erased<[u8; 16usize]>>
24: 0x7dea1f9b50cf - <rustc_query_impl[75a3021f06b975a9]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2} as core[5fdad39456196c28]::ops::function::FnOnce<(rustc_middle[3618dc43a4e0fd99]::ty::context::TyCtxt, ())>>::call_once
25: 0x7dea201f6511 - rustc_query_system[4850d857ad6bbb48]::query::plumbing::try_execute_query::<rustc_query_impl[75a3021f06b975a9]::DynamicConfig<rustc_query_system[4850d857ad6bbb48]::query::caches::SingleCache<rustc_middle[3618dc43a4e0fd99]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[75a3021f06b975a9]::plumbing::QueryCtxt, false>
26: 0x7dea201f6088 - rustc_query_impl[75a3021f06b975a9]::query_impl::resolver_for_lowering_raw::get_query_non_incr::__rust_end_short_backtrace
27: 0x7dea20517731 - rustc_interface[adb8a737eb8b1c5b]::passes::create_and_enter_global_ctxt::<core[5fdad39456196c28]::option::Option<rustc_interface[adb8a737eb8b1c5b]::queries::Linker>, rustc_driver_impl[4339cf40f8e3ed89]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
28: 0x7dea20386e39 - rustc_interface[adb8a737eb8b1c5b]::interface::run_compiler::<(), rustc_driver_impl[4339cf40f8e3ed89]::run_compiler::{closure#0}>::{closure#1}
29: 0x7dea201726cf - std[9466cf876ee11eca]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[adb8a737eb8b1c5b]::util::run_in_thread_with_globals<rustc_interface[adb8a737eb8b1c5b]::util::run_in_thread_pool_with_globals<rustc_interface[adb8a737eb8b1c5b]::interface::run_compiler<(), rustc_driver_impl[4339cf40f8e3ed89]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
30: 0x7dea20172fab - <<std[9466cf876ee11eca]::thread::Builder>::spawn_unchecked_<rustc_interface[adb8a737eb8b1c5b]::util::run_in_thread_with_globals<rustc_interface[adb8a737eb8b1c5b]::util::run_in_thread_pool_with_globals<rustc_interface[adb8a737eb8b1c5b]::interface::run_compiler<(), rustc_driver_impl[4339cf40f8e3ed89]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[5fdad39456196c28]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
31: 0x7dea201743ab - std::sys::pal::unix::thread::Thread::new::thread_start::h6582d45fad4b4756
32: 0x7dea1a0a370a - <unknown>
33: 0x7dea1a127aac - <unknown>
34: 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 (e643f59f6 2025-04-07) 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