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

ICE: no non-'#[track_caller]' frame found #131787

Open
matthiaskrgr opened this issue Oct 16, 2024 · 4 comments
Open

ICE: no non-'#[track_caller]' frame found #131787

matthiaskrgr opened this issue Oct 16, 2024 · 4 comments
Assignees
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) A-const-eval Area: Constant evaluation, covers all const contexts (static, const fn, ...) C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Oct 16, 2024

snippet:

#[track_caller]
static no_mangle: u32 = {
    unimplemented!();
};

Version information

rustc 1.84.0-nightly (0037048da 2024-10-16)
binary: rustc
commit-hash: 0037048da8ed19feef7ee1437f123a88a7342b33
commit-date: 2024-10-16
host: x86_64-unknown-linux-gnu
release: 1.84.0-nightly
LLVM version: 19.1.1

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

error[E0601]: `main` function not found in crate `mvce`
 --> /tmp/icemaker_global_tempdir.9mWKQYhpKcQf/rustc_testrunner_tmpdir_reporting.ZvoUyb86p9Bh/mvce.rs:4:3
  |
4 | };
  |   ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.9mWKQYhpKcQf/rustc_testrunner_tmpdir_reporting.ZvoUyb86p9Bh/mvce.rs`

error[E0739]: attribute should be applied to a function definition
 --> /tmp/icemaker_global_tempdir.9mWKQYhpKcQf/rustc_testrunner_tmpdir_reporting.ZvoUyb86p9Bh/mvce.rs:1:1
  |
1 |   #[track_caller]
  |   ^^^^^^^^^^^^^^^
2 | / static no_mangle: u32 = {
3 | |     unimplemented!();
4 | | };
  | |__- not a function definition

error: internal compiler error: compiler/rustc_const_eval/src/interpret/eval_context.rs:387:9: no non-`#[track_caller]` frame found
   --> /home/matthias/.rustup/toolchains/master/lib/rustlib/src/rust/library/core/src/panicking.rs:335:9
    |
335 |         panic_display(&msg);
    |         ^^^^^^^^^^^^^^^^^^^

thread 'rustc' panicked at compiler/rustc_const_eval/src/interpret/eval_context.rs:387:9:
Box<dyn Any>
stack backtrace:
   0:     0x794bd267a1da - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h9bfc3dcaa7dcd19f
   1:     0x794bd2e03e4a - core::fmt::write::hbfae06088092e203
   2:     0x794bd41aab11 - std::io::Write::write_fmt::h02af9c7f9f7cbb2b
   3:     0x794bd267a032 - std::sys::backtrace::BacktraceLock::print::h891ae704043eaf13
   4:     0x794bd267c516 - std::panicking::default_hook::{{closure}}::h70877a3c3126a3d1
   5:     0x794bd267c360 - std::panicking::default_hook::h1b6dbfbbf2c8fa69
   6:     0x794bd16fba8f - std[50dae06ecd9b895e]::panicking::update_hook::<alloc[419218e354315928]::boxed::Box<rustc_driver_impl[5c793412a60745d2]::install_ice_hook::{closure#0}>>::{closure#0}
   7:     0x794bd267cc28 - std::panicking::rust_panic_with_hook::h84e267ff56671c55
   8:     0x794bd1736101 - std[50dae06ecd9b895e]::panicking::begin_panic::<rustc_errors[6c0f546568541fc3]::ExplicitBug>::{closure#0}
   9:     0x794bd1729136 - std[50dae06ecd9b895e]::sys::backtrace::__rust_end_short_backtrace::<std[50dae06ecd9b895e]::panicking::begin_panic<rustc_errors[6c0f546568541fc3]::ExplicitBug>::{closure#0}, !>
  10:     0x794bd1724970 - std[50dae06ecd9b895e]::panicking::begin_panic::<rustc_errors[6c0f546568541fc3]::ExplicitBug>
  11:     0x794bd173fbb1 - <rustc_errors[6c0f546568541fc3]::diagnostic::BugAbort as rustc_errors[6c0f546568541fc3]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  12:     0x794bd163d86d - <rustc_errors[6c0f546568541fc3]::DiagCtxtHandle>::span_bug::<rustc_span[8cbfb0bc2691013e]::span_encoding::Span, alloc[419218e354315928]::string::String>
  13:     0x794bd1664dd8 - rustc_middle[4e1d5dc5f38e5925]::util::bug::opt_span_bug_fmt::<rustc_span[8cbfb0bc2691013e]::span_encoding::Span>::{closure#0}
  14:     0x794bd1664e2a - rustc_middle[4e1d5dc5f38e5925]::ty::context::tls::with_opt::<rustc_middle[4e1d5dc5f38e5925]::util::bug::opt_span_bug_fmt<rustc_span[8cbfb0bc2691013e]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  15:     0x794bd16500db - rustc_middle[4e1d5dc5f38e5925]::ty::context::tls::with_context_opt::<rustc_middle[4e1d5dc5f38e5925]::ty::context::tls::with_opt<rustc_middle[4e1d5dc5f38e5925]::util::bug::opt_span_bug_fmt<rustc_span[8cbfb0bc2691013e]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  16:     0x794bd05df367 - rustc_middle[4e1d5dc5f38e5925]::util::bug::span_bug_fmt::<rustc_span[8cbfb0bc2691013e]::span_encoding::Span>
  17:     0x794bd16b525c - <rustc_const_eval[b5702e0782daf67b]::interpret::eval_context::InterpCx<rustc_const_eval[b5702e0782daf67b]::const_eval::machine::CompileTimeMachine>>::find_closest_untracked_caller_location
  18:     0x794bd3893ad5 - <rustc_const_eval[b5702e0782daf67b]::const_eval::machine::CompileTimeMachine as rustc_const_eval[b5702e0782daf67b]::interpret::machine::Machine>::find_mir_or_eval_fn
  19:     0x794bd3894c09 - <rustc_const_eval[b5702e0782daf67b]::interpret::eval_context::InterpCx<rustc_const_eval[b5702e0782daf67b]::const_eval::machine::CompileTimeMachine>>::init_fn_call
  20:     0x794bd3ff5e02 - rustc_const_eval[b5702e0782daf67b]::const_eval::eval_queries::eval_body_using_ecx::<rustc_middle[4e1d5dc5f38e5925]::mir::interpret::allocation::ConstAllocation>
  21:     0x794bd3fe8101 - rustc_const_eval[b5702e0782daf67b]::const_eval::eval_queries::eval_static_initializer_provider
  22:     0x794bd3fe7ea7 - rustc_query_impl[e6053411f8f7b0cc]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e6053411f8f7b0cc]::query_impl::eval_static_initializer::dynamic_query::{closure#2}::{closure#0}, rustc_middle[4e1d5dc5f38e5925]::query::erase::Erased<[u8; 16usize]>>
  23:     0x794bd3fe7e89 - <rustc_query_impl[e6053411f8f7b0cc]::query_impl::eval_static_initializer::dynamic_query::{closure#2} as core[b55cee407c7ca3a1]::ops::function::FnOnce<(rustc_middle[4e1d5dc5f38e5925]::ty::context::TyCtxt, rustc_span[8cbfb0bc2691013e]::def_id::DefId)>>::call_once
  24:     0x794bd32a7a04 - rustc_query_system[c2531f464b8ca71c]::query::plumbing::try_execute_query::<rustc_query_impl[e6053411f8f7b0cc]::DynamicConfig<rustc_query_system[c2531f464b8ca71c]::query::caches::DefIdCache<rustc_middle[4e1d5dc5f38e5925]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[e6053411f8f7b0cc]::plumbing::QueryCtxt, false>
  25:     0x794bd3d19579 - rustc_query_impl[e6053411f8f7b0cc]::query_impl::eval_static_initializer::get_query_non_incr::__rust_end_short_backtrace
  26:     0x794bd3274f88 - <rustc_middle[4e1d5dc5f38e5925]::hir::map::Map>::par_body_owners::<rustc_hir_analysis[74f006b5970f8749]::check_crate::{closure#3}>::{closure#0}
  27:     0x794bd3272773 - rustc_hir_analysis[74f006b5970f8749]::check_crate
  28:     0x794bd38184d7 - rustc_interface[7bf09400196ba76b]::passes::run_required_analyses
  29:     0x794bd3c33cde - rustc_interface[7bf09400196ba76b]::passes::analysis
  30:     0x794bd3c33cb1 - rustc_query_impl[e6053411f8f7b0cc]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[e6053411f8f7b0cc]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[4e1d5dc5f38e5925]::query::erase::Erased<[u8; 1usize]>>
  31:     0x794bd3d0302e - rustc_query_system[c2531f464b8ca71c]::query::plumbing::try_execute_query::<rustc_query_impl[e6053411f8f7b0cc]::DynamicConfig<rustc_query_system[c2531f464b8ca71c]::query::caches::SingleCache<rustc_middle[4e1d5dc5f38e5925]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[e6053411f8f7b0cc]::plumbing::QueryCtxt, false>
  32:     0x794bd3d02d0f - rustc_query_impl[e6053411f8f7b0cc]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  33:     0x794bd3b849ac - rustc_interface[7bf09400196ba76b]::interface::run_compiler::<core[b55cee407c7ca3a1]::result::Result<(), rustc_span[8cbfb0bc2691013e]::ErrorGuaranteed>, rustc_driver_impl[5c793412a60745d2]::run_compiler::{closure#0}>::{closure#1}
  34:     0x794bd3c24754 - std[50dae06ecd9b895e]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[7bf09400196ba76b]::util::run_in_thread_with_globals<rustc_interface[7bf09400196ba76b]::util::run_in_thread_pool_with_globals<rustc_interface[7bf09400196ba76b]::interface::run_compiler<core[b55cee407c7ca3a1]::result::Result<(), rustc_span[8cbfb0bc2691013e]::ErrorGuaranteed>, rustc_driver_impl[5c793412a60745d2]::run_compiler::{closure#0}>::{closure#1}, core[b55cee407c7ca3a1]::result::Result<(), rustc_span[8cbfb0bc2691013e]::ErrorGuaranteed>>::{closure#0}, core[b55cee407c7ca3a1]::result::Result<(), rustc_span[8cbfb0bc2691013e]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[b55cee407c7ca3a1]::result::Result<(), rustc_span[8cbfb0bc2691013e]::ErrorGuaranteed>>
  35:     0x794bd3c24b68 - <<std[50dae06ecd9b895e]::thread::Builder>::spawn_unchecked_<rustc_interface[7bf09400196ba76b]::util::run_in_thread_with_globals<rustc_interface[7bf09400196ba76b]::util::run_in_thread_pool_with_globals<rustc_interface[7bf09400196ba76b]::interface::run_compiler<core[b55cee407c7ca3a1]::result::Result<(), rustc_span[8cbfb0bc2691013e]::ErrorGuaranteed>, rustc_driver_impl[5c793412a60745d2]::run_compiler::{closure#0}>::{closure#1}, core[b55cee407c7ca3a1]::result::Result<(), rustc_span[8cbfb0bc2691013e]::ErrorGuaranteed>>::{closure#0}, core[b55cee407c7ca3a1]::result::Result<(), rustc_span[8cbfb0bc2691013e]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[b55cee407c7ca3a1]::result::Result<(), rustc_span[8cbfb0bc2691013e]::ErrorGuaranteed>>::{closure#1} as core[b55cee407c7ca3a1]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  36:     0x794bd3c2562b - std::sys::pal::unix::thread::Thread::new::thread_start::hd84f0cccf574faa7
  37:     0x794bd541939d - <unknown>
  38:     0x794bd549e49c - <unknown>
  39:                0x0 - <unknown>

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.84.0-nightly (0037048da 2024-10-16) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [eval_static_initializer] evaluating initializer of static `no_mangle`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 3 previous errors

Some errors have detailed explanations: E0601, E0739.
For more information about an error, try `rustc --explain E0601`.

@matthiaskrgr matthiaskrgr 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 Oct 16, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Oct 16, 2024
@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Oct 20, 2024
@workingjubilee workingjubilee added the A-const-eval Area: Constant evaluation, covers all const contexts (static, const fn, ...) label Oct 21, 2024
@RalfJung
Copy link
Member

RalfJung commented Nov 9, 2024

Uh, we allow that attribute on a static? That makes no sense, that should be an error... right?^^

Cc @rust-lang/wg-const-eval
Cc @jdonszelmann (seems related to rust-lang/compiler-team#796)

@jdonszelmann
Copy link
Contributor

Lmao, yes I'm working on making it easier to set target limitations on attributes

@Noratrieb Noratrieb removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Nov 9, 2024
@jdonszelmann
Copy link
Contributor

@rustbot claim

@jdonszelmann
Copy link
Contributor

@rustbot label +A-attributes

@rustbot rustbot added the A-attributes Area: Attributes (`#[…]`, `#![…]`) label Nov 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) A-const-eval Area: Constant evaluation, covers all const contexts (static, const fn, ...) C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

6 participants