ICE: `type_of called on const argument's anon const before the const argument was lowered`
Opened this issue · 1 comments
cushionbadak commented
Code
#[allow(dead_code)]
use std::arch::global_asm;
mod a {
pub static X: isize = 3;
}
global_asm! {
"{}",
sym a::X::<{}>,
}
fn main() {}A mutant of glacier2's fixed/137179.rs
Meta
rustc --version --verbose:
rustc 1.93.0-nightly (c90bcb957 2025-11-06)
binary: rustc
commit-hash: c90bcb9571b7aab0d8beaa2ce8a998ffaf079d38
commit-date: 2025-11-06
host: x86_64-apple-darwin
release: 1.93.0-nightly
LLVM version: 21.1.3
Error output
Command: rustc
note: no errors encountered even though delayed bugs were created
note: those delayed bugs will now be shown as internal compiler errors
error: internal compiler error: `type_of` called on const argument's anon const before the const argument was lowered
--> 01.rs:10:16
|
10 | sym a::X::<{}>,
| ^^
|
note: delayed at compiler/rustc_hir_analysis/src/collect/type_of.rs:109:14
--> 01.rs:10:16
|
10 | sym a::X::<{}>,
| ^^
error: internal compiler error: mir_const_qualif: MIR had errors
--> 01.rs:10:16
|
10 | sym a::X::<{}>,
| ^^
|
note: delayed at compiler/rustc_mir_transform/src/lib.rs:369:19
Backtrace
note: no errors encountered even though delayed bugs were created
note: those delayed bugs will now be shown as internal compiler errors
error: internal compiler error: `type_of` called on const argument's anon const before the const argument was lowered
--> 01.rs:10:16
|
10 | sym a::X::<{}>,
| ^^
|
note: delayed at compiler/rustc_hir_analysis/src/collect/type_of.rs:109:14
0: std::backtrace::Backtrace::create
1: std::backtrace::Backtrace::capture
2: <rustc_errors::DiagCtxtInner>::emit_diagnostic
3: <rustc_errors::DiagCtxtHandle>::emit_diagnostic
4: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
5: <rustc_errors::DiagCtxtHandle>::span_delayed_bug::<rustc_span::span_encoding::Span, &str>
6: rustc_hir_analysis::collect::type_of::type_of
7: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::type_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
8: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefIdCache<rustc_middle::query::erase::Erased<[u8; 8]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
9: rustc_query_impl::query_impl::type_of::get_query_non_incr::__rust_end_short_backtrace
10: rustc_hir_typeck::typeck_with_inspect::{closure#0}
11: rustc_hir_typeck::typeck
12: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
13: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::CrateNum, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
14: rustc_query_impl::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
15: rustc_hir_typeck::used_trait_imports
16: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::used_trait_imports::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
17: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::CrateNum, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
18: rustc_query_impl::query_impl::used_trait_imports::get_query_non_incr::__rust_end_short_backtrace
19: rustc_hir_analysis::check_unused::check_unused_traits
20: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::check_unused_traits::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>
21: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
22: rustc_query_impl::query_impl::check_unused_traits::get_query_non_incr::__rust_end_short_backtrace
23: rustc_hir_analysis::check_crate
24: rustc_interface::passes::analysis
25: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>
26: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
27: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
28: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>
29: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
30: std::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
31: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
32: std::sys::thread::unix::Thread::new::thread_start
33: __pthread_start
--> 01.rs:10:16
|
10 | sym a::X::<{}>,
| ^^
error: internal compiler error: mir_const_qualif: MIR had errors
--> 01.rs:10:16
|
10 | sym a::X::<{}>,
| ^^
|
note: delayed at compiler/rustc_mir_transform/src/lib.rs:369:19
0: std::backtrace::Backtrace::create
1: std::backtrace::Backtrace::capture
2: <rustc_errors::DiagCtxtInner>::emit_diagnostic
3: <rustc_errors::DiagCtxtHandle>::emit_diagnostic
4: <rustc_span::ErrorGuaranteed as rustc_errors::diagnostic::EmissionGuarantee>::emit_producing_guarantee
5: <rustc_errors::DiagCtxtHandle>::span_delayed_bug::<rustc_span::span_encoding::Span, &str>
6: rustc_mir_transform::mir_const_qualif
7: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::mir_const_qualif::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 4]>>
8: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::DefIdCache<rustc_middle::query::erase::Erased<[u8; 4]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
9: rustc_query_impl::query_impl::mir_const_qualif::get_query_non_incr::__rust_end_short_backtrace
10: rustc_mir_transform::mir_promoted
11: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::mir_promoted::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 16]>>
12: <rustc_query_impl::query_impl::mir_promoted::dynamic_query::{closure#2} as core::ops::function::FnOnce<(rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId)>>::call_once
13: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::CrateNum, rustc_middle::query::erase::Erased<[u8; 16]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
14: rustc_query_impl::query_impl::mir_promoted::get_query_non_incr::__rust_end_short_backtrace
15: rustc_borrowck::mir_borrowck
16: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::mir_borrowck::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 8]>>
17: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::CrateNum, rustc_middle::query::erase::Erased<[u8; 8]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
18: rustc_query_impl::query_impl::mir_borrowck::get_query_non_incr::__rust_end_short_backtrace
19: <rustc_middle::ty::context::TyCtxt>::par_hir_body_owners::<rustc_interface::passes::run_required_analyses::{closure#1}::{closure#0}>::{closure#0}
20: rustc_interface::passes::analysis
21: rustc_query_impl::plumbing::__rust_begin_short_backtrace::<rustc_query_impl::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle::query::erase::Erased<[u8; 0]>>
22: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::DynamicConfig<rustc_query_system::query::caches::SingleCache<rustc_middle::query::erase::Erased<[u8; 0]>>, false, false, false>, rustc_query_impl::plumbing::QueryCtxt, false>
23: rustc_query_impl::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
24: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>
25: rustc_interface::interface::run_compiler::<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}
26: std::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
27: <<std::thread::Builder>::spawn_unchecked_<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
28: std::sys::thread::unix::Thread::new::thread_start
29: __pthread_start
--> 01.rs:10:16
|
10 | sym a::X::<{}>,
| ^^
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: please attach the file at `/Users/jb/Library/CloudStorage/Dropbox/Desk/2503_rustc_ice/20251106 ice 보고용/rustc-ice-2025-11-07T01_50_01-47253.txt` to your bug report
query stack during panic:
end of query stack
Notes
-
ICE locations
- delayed at
compiler/rustc_hir_analysis/src/collect/type_of.rs Line-109 - delayed at
compiler/rustc_mir_transform/src/lib.rs Line-369
rust/compiler/rustc_hir_analysis/src/collect/type_of.rs
Lines 107 to 113 in c90bcb9
rust/compiler/rustc_mir_transform/src/lib.rs
Lines 367 to 371 in c90bcb9
- delayed at
-
Duplication check
- I searched for ICE issues with "called on const arguments", and "mir_const_qualif: MIR had errors", but all those issues are closed.
- https://github.com/rust-lang/rust/issues?q=is%3Aissue%20state%3Aclosed%20label%3AI-ICE%20%22called%20on%20const%20arguments%22
- https://github.com/rust-lang/rust/issues?q=is%3Aissue%20state%3Aclosed%20label%3AI-ICE%20%22mir_const_qualif%3A%20MIR%20had%20errors%22
cushionbadak commented
cargo-bisect-rustc --start=2022-01-01 --end=2025-11-07 --regress ice --preserve --script rustc -- 148614.rs
********************************************************************************
Regression in nightly-2022-10-19
********************************************************************************
fetching https://static.rust-lang.org/dist/2022-10-18/channel-rust-nightly-git-commit-hash.txt
nightly manifest 2022-10-18: 40 B / 40 B [================================================================================================================================================] 100.00 % 751.55 KB/s converted 2022-10-18 to 06f049a35535d26d5c8426d4f782f78277b41aa1
fetching https://static.rust-lang.org/dist/2022-10-19/channel-rust-nightly-git-commit-hash.txt
nightly manifest 2022-10-19: 40 B / 40 B [================================================================================================================================================] 100.00 % 723.69 KB/s converted 2022-10-19 to a24a020e6d926dffe6b472fc647978f92269504e
looking for regression commit between 2022-10-18 and 2022-10-19
fetching (via remote github) commits from max(06f049a35535d26d5c8426d4f782f78277b41aa1, 2022-10-16) to a24a020e6d926dffe6b472fc647978f92269504e
ending github query because we found starting sha: 06f049a35535d26d5c8426d4f782f78277b41aa1
get_commits_between returning commits, len: 8
commit[0] 2022-10-17: Auto merge of #101837 - scottmcm:box-array-from-vec, r=m-ou-se
commit[1] 2022-10-17: Auto merge of #103165 - matthiaskrgr:rollup-guw8oh6, r=matthiaskrgr
commit[2] 2022-10-18: Auto merge of #102543 - daym:patch-1, r=joshtriplett
commit[3] 2022-10-18: Auto merge of #102992 - nnethercote:rm-RunCompiler-emitter, r=bjorn3
commit[4] 2022-10-18: Auto merge of #103177 - lnicola:rust-analyzer-2022-10-18, r=lnicola
commit[5] 2022-10-18: Auto merge of #103075 - SUPERCILEX:miri-metadata, r=thomcc
commit[6] 2022-10-18: Auto merge of #103188 - JohnTitor:rollup-pwilam1, r=JohnTitor
commit[7] 2022-10-18: Auto merge of #102418 - citrus-it:illumos-strip-debug, r=nagisa
ERROR: no CI builds available between 06f049a35535d26d5c8426d4f782f78277b41aa1 and a24a020e6d926dffe6b472fc647978f92269504e within last 167 days