Repository navigation
ICE: sty: None #138361
Copy link
Copy link
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.Status: This bug is tracked inside the repo by a `known-bug` test.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
snippet:
const fn x() {
let array = [(); { loop {} }];
let nan1: f64 = unsafe { std::mem::transmute([4]) };
}
fn main() {}Version information
rustc 1.87.0-nightly (ebf0cf75d 2025-03-11)
binary: rustc
commit-hash: ebf0cf75d368c035f4c7e7246d203bd469ee4a51
commit-date: 2025-03-11
host: x86_64-unknown-linux-gnu
release: 1.87.0-nightly
LLVM version: 20.1.0
Possibly related line of code:
rust/compiler/rustc_middle/src/ty/sty.rs
Lines 2072 to 2084 in ebf0cf7
| } | |
| } | |
| } | |
| impl<'tcx> rustc_type_ir::inherent::Tys<TyCtxt<'tcx>> for &'tcx ty::List<Ty<'tcx>> { | |
| fn inputs(self) -> &'tcx [Ty<'tcx>] { | |
| self.split_last().unwrap().1 | |
| } | |
| fn output(self) -> Ty<'tcx> { | |
| *self.split_last().unwrap().0 | |
| } | |
| } |
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc
Program output
error: constant evaluation is taking a long time
--> /tmp/icemaker_global_tempdir.OFXddYdTsfsI/rustc_testrunner_tmpdir_reporting.6eWFtohymixh/mvce.rs:2:24
|
2 | let array = [(); { loop {} }];
| ^^^^^^^
|
= note: this lint makes sure the compiler doesn't get stuck due to infinite loops in const eval.
If your compilation actually takes a long time, you can safely allow the lint.
help: the constant being evaluated
--> /tmp/icemaker_global_tempdir.OFXddYdTsfsI/rustc_testrunner_tmpdir_reporting.6eWFtohymixh/mvce.rs:2:22
|
2 | let array = [(); { loop {} }];
| ^^^^^^^^^^^
= note: `#[deny(long_running_const_eval)]` on by default
warning: function `x` is never used
--> /tmp/icemaker_global_tempdir.OFXddYdTsfsI/rustc_testrunner_tmpdir_reporting.6eWFtohymixh/mvce.rs:1:10
|
1 | const fn x() {
| ^
|
= note: `#[warn(dead_code)]` on by default
thread 'rustc' panicked at compiler/rustc_middle/src/ty/sty.rs:2078:27:
called `Option::unwrap()` on a `None` value
stack backtrace:
0: 0x7e3346625b33 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h7fb80f6afbe41a33
1: 0x7e3346e059d8 - core::fmt::write::h000527be0eea6fe8
2: 0x7e334824ffd1 - std::io::Write::write_fmt::h4991a22851475fb5
3: 0x7e3346625992 - std::sys::backtrace::BacktraceLock::print::hffad87dde00cbe3e
4: 0x7e33466282b8 - std::panicking::default_hook::{{closure}}::ha46397973bec1239
5: 0x7e3346627dd7 - std::panicking::default_hook::h706de72a1550eed4
6: 0x7e3345693abf - std[ea0914bf68e3efbf]::panicking::update_hook::<alloc[3dfe61f71ba45cfe]::boxed::Box<rustc_driver_impl[23cd132fe59c5dfc]::install_ice_hook::{closure#1}>>::{closure#0}
7: 0x7e3346628b23 - std::panicking::rust_panic_with_hook::h6666776865bd21f5
8: 0x7e33466287e6 - std::panicking::begin_panic_handler::{{closure}}::hb8595612365d24db
9: 0x7e3346625ff9 - std::sys::backtrace::__rust_end_short_backtrace::h7037f177c7ae4ed3
10: 0x7e33466284dd - rust_begin_unwind
11: 0x7e3343070ea0 - core::panicking::panic_fmt::hd26142fa9828e2a3
12: 0x7e3343ca041c - core::panicking::panic::h59ce24d70b84159e
13: 0x7e3344576a39 - core::option::unwrap_failed::h48c0f1454ecd4af7
14: 0x7e33473e27a6 - <rustc_lint[3f5ee35a34c41153]::BuiltinCombinedModuleLateLintPass as rustc_lint[3f5ee35a34c41153]::passes::LateLintPass>::check_expr
15: 0x7e33476f2ee4 - <rustc_lint[3f5ee35a34c41153]::late::LateContextAndPass<rustc_lint[3f5ee35a34c41153]::BuiltinCombinedModuleLateLintPass> as rustc_hir[9c8f1de648b82ae]::intravisit::Visitor>::visit_expr
16: 0x7e33476f31ab - <rustc_lint[3f5ee35a34c41153]::late::LateContextAndPass<rustc_lint[3f5ee35a34c41153]::BuiltinCombinedModuleLateLintPass> as rustc_hir[9c8f1de648b82ae]::intravisit::Visitor>::visit_expr
17: 0x7e33476f1e6e - <rustc_lint[3f5ee35a34c41153]::late::LateContextAndPass<rustc_lint[3f5ee35a34c41153]::BuiltinCombinedModuleLateLintPass> as rustc_hir[9c8f1de648b82ae]::intravisit::Visitor>::visit_block
18: 0x7e33476f3245 - <rustc_lint[3f5ee35a34c41153]::late::LateContextAndPass<rustc_lint[3f5ee35a34c41153]::BuiltinCombinedModuleLateLintPass> as rustc_hir[9c8f1de648b82ae]::intravisit::Visitor>::visit_expr
19: 0x7e33476f203f - <rustc_lint[3f5ee35a34c41153]::late::LateContextAndPass<rustc_lint[3f5ee35a34c41153]::BuiltinCombinedModuleLateLintPass> as rustc_hir[9c8f1de648b82ae]::intravisit::Visitor>::visit_block
20: 0x7e334727ccf5 - <rustc_lint[3f5ee35a34c41153]::late::LateContextAndPass<rustc_lint[3f5ee35a34c41153]::BuiltinCombinedModuleLateLintPass> as rustc_hir[9c8f1de648b82ae]::intravisit::Visitor>::visit_nested_body
21: 0x7e334727718d - <rustc_lint[3f5ee35a34c41153]::late::LateContextAndPass<rustc_lint[3f5ee35a34c41153]::BuiltinCombinedModuleLateLintPass> as rustc_hir[9c8f1de648b82ae]::intravisit::Visitor>::visit_nested_item
22: 0x7e3347275d3a - rustc_lint[3f5ee35a34c41153]::lint_mod
23: 0x7e3347275a3d - rustc_query_impl[977456df771add7]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[977456df771add7]::query_impl::lint_mod::dynamic_query::{closure#2}::{closure#0}, rustc_middle[8b56cfa39295cc9e]::query::erase::Erased<[u8; 0usize]>>
24: 0x7e3347df874f - rustc_query_system[f942f53a11d60297]::query::plumbing::try_execute_query::<rustc_query_impl[977456df771add7]::DynamicConfig<rustc_query_system[f942f53a11d60297]::query::caches::DefaultCache<rustc_span[ef11c3aadf555ab3]::def_id::LocalModDefId, rustc_middle[8b56cfa39295cc9e]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[977456df771add7]::plumbing::QueryCtxt, false>
25: 0x7e3347df783e - rustc_query_impl[977456df771add7]::query_impl::lint_mod::get_query_non_incr::__rust_end_short_backtrace
26: 0x7e3347df73fd - rustc_lint[3f5ee35a34c41153]::late::check_crate::{closure#1}
27: 0x7e3347df6f78 - rustc_lint[3f5ee35a34c41153]::late::check_crate
28: 0x7e3347dfa8f2 - rustc_interface[15b2602f89c3a5c0]::passes::analysis
29: 0x7e3347dfa6d7 - rustc_query_impl[977456df771add7]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[977456df771add7]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[8b56cfa39295cc9e]::query::erase::Erased<[u8; 0usize]>>
30: 0x7e3347f1c981 - rustc_query_system[f942f53a11d60297]::query::plumbing::try_execute_query::<rustc_query_impl[977456df771add7]::DynamicConfig<rustc_query_system[f942f53a11d60297]::query::caches::SingleCache<rustc_middle[8b56cfa39295cc9e]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[977456df771add7]::plumbing::QueryCtxt, false>
31: 0x7e3347f1c674 - rustc_query_impl[977456df771add7]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
32: 0x7e334815bfbc - rustc_interface[15b2602f89c3a5c0]::passes::create_and_enter_global_ctxt::<core[72d9f83855d8cc5b]::option::Option<rustc_interface[15b2602f89c3a5c0]::queries::Linker>, rustc_driver_impl[23cd132fe59c5dfc]::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}
33: 0x7e3347f74c97 - rustc_interface[15b2602f89c3a5c0]::interface::run_compiler::<(), rustc_driver_impl[23cd132fe59c5dfc]::run_compiler::{closure#0}>::{closure#1}
34: 0x7e3347dd97c8 - std[ea0914bf68e3efbf]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[15b2602f89c3a5c0]::util::run_in_thread_with_globals<rustc_interface[15b2602f89c3a5c0]::util::run_in_thread_pool_with_globals<rustc_interface[15b2602f89c3a5c0]::interface::run_compiler<(), rustc_driver_impl[23cd132fe59c5dfc]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
35: 0x7e3347dda0b4 - <<std[ea0914bf68e3efbf]::thread::Builder>::spawn_unchecked_<rustc_interface[15b2602f89c3a5c0]::util::run_in_thread_with_globals<rustc_interface[15b2602f89c3a5c0]::util::run_in_thread_pool_with_globals<rustc_interface[15b2602f89c3a5c0]::interface::run_compiler<(), rustc_driver_impl[23cd132fe59c5dfc]::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[72d9f83855d8cc5b]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
36: 0x7e3347ddb4b7 - std::sys::pal::unix::thread::Thread::new::thread_start::ha1530b93ff336c49
37: 0x7e3341ca370a - <unknown>
38: 0x7e3341d27aac - <unknown>
39: 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.87.0-nightly (ebf0cf75d 2025-03-11) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [lint_mod] linting top-level module
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 1 previous error; 1 warning emitted
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.Status: This bug is tracked inside the repo by a `known-bug` test.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Activity
matthiaskrgr commentedon Mar 11, 2025
mvce probably
matthiaskrgr commentedon Mar 11, 2025
bisects to nightly-2024-02-23
meithecatte commentedon Mar 27, 2025
bisecting between nightly-2024-02-22 and nightly-2024-02-23
meithecatte commentedon Mar 27, 2025
bisection reports: 46f4983 is the first bad commit
cc @nnethercote
meithecatte commentedon Mar 27, 2025
Interestingly the panic I'm getting is different:
meithecatte commentedon Mar 27, 2025
It seems that in both cases, what happens is that an
FnSig/Tyswith zero length gets created and then accessed,meithecatte commentedon Mar 27, 2025
I think what's going on here is that the "constant evaluation is taking a long time" lint is getting triggered, aborts the typechecking of the function, and then the transmute lint trips over that – and because the former is a lint, it isn't enough for the lint passes to decide "this thing is broken enough that we shouldn't try to lint it"?
Not sure where is the code that actually implements this, though, and no idea why @nnethercote's commit would change this behavior.
meithecatte commentedon Mar 27, 2025
Okay, before the offending commit, an actual typechecking error gets emitted in addition to the
long_running_const_evallint.meithecatte commentedon Mar 27, 2025
@rustbot claim
meithecatte commentedon Mar 28, 2025
It seems that this has the same root cause as #125323, and will likely get fixed with #138679.
meithecatte commentedon Mar 28, 2025
@rustbot unclaim
meithecatte commentedon Apr 2, 2025
cough
@rustbot release-assignment
Shunpoco commentedon Oct 19, 2025
@rustbot claim
Rollup merge of rust-lang#147876 - Shunpoco:lint-check-tainted-error,…
Rollup merge of rust-lang#147876 - Shunpoco:lint-check-tainted-error,…
Rollup merge of rust-lang#147876 - Shunpoco:lint-check-tainted-error,…
Rollup merge of rust-lang#147876 - Shunpoco:lint-check-tainted-error,…
Rollup merge of rust-lang#147876 - Shunpoco:lint-check-tainted-error,…
Unrolled build for #147876 in rollup 163157