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: expected wide pointer extra data (e.g. slice length or trait object vtable) #133966

Open
matthiaskrgr opened this issue Dec 6, 2024 · 4 comments
Labels
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. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

snippet:

pub struct Data([[&str]; 5_i32]);
const _: &'static Data = unsafe { &*(&[] as *const Data) };

Version information

rustc 1.85.0-nightly (acf48426b 2024-12-06)
binary: rustc
commit-hash: acf48426b64d24f372d534f634072de1f4c7e588
commit-date: 2024-12-06
host: x86_64-unknown-linux-gnu
release: 1.85.0-nightly
LLVM version: 19.1.5

Possibly related line of code:

impl<Prov: Provenance> MemPlaceMeta<Prov> {
#[cfg_attr(debug_assertions, track_caller)] // only in debug builds due to perf (see #98980)
pub fn unwrap_meta(self) -> Scalar<Prov> {
match self {
Self::Meta(s) => s,
Self::None => {
bug!("expected wide pointer extra data (e.g. slice length or trait object vtable)")
}
}
}
#[inline(always)]
pub fn has_meta(self) -> bool {

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

Program output

error[E0106]: missing lifetime specifier
 --> /tmp/icemaker_global_tempdir.aSYe5Is2GJl3/rustc_testrunner_tmpdir_reporting.gKjFHYgJOJDL/mvce.rs:1:19
  |
1 | pub struct Data([[&str]; 5_i32]);
  |                   ^ expected named lifetime parameter
  |
help: consider introducing a named lifetime parameter
  |
1 | pub struct Data<'a>([[&'a str]; 5_i32]);
  |                ++++    ++

error[E0601]: `main` function not found in crate `mvce`
 --> /tmp/icemaker_global_tempdir.aSYe5Is2GJl3/rustc_testrunner_tmpdir_reporting.gKjFHYgJOJDL/mvce.rs:2:60
  |
2 | const _: &'static Data = unsafe { &*(&[] as *const Data) };
  |                                                            ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.aSYe5Is2GJl3/rustc_testrunner_tmpdir_reporting.gKjFHYgJOJDL/mvce.rs`

error: internal compiler error: compiler/rustc_const_eval/src/interpret/place.rs:36:17: expected wide pointer extra data (e.g. slice length or trait object vtable)

thread 'rustc' panicked at compiler/rustc_const_eval/src/interpret/place.rs:36:17:
Box<dyn Any>
stack backtrace:
   0:     0x7ad09f54895a - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h69edfa39ad21a03a
   1:     0x7ad09fc13e26 - core::fmt::write::h54afaacea6c2c9e2
   2:     0x7ad0a0bf3ad1 - std::io::Write::write_fmt::h00e73f8f3070368c
   3:     0x7ad09f5487b2 - std::sys::backtrace::BacktraceLock::print::h2b0900033e71643f
   4:     0x7ad09f54acca - std::panicking::default_hook::{{closure}}::h325b3b03f2ea7a39
   5:     0x7ad09f54ab13 - std::panicking::default_hook::haaf25a6e7afde799
   6:     0x7ad09e6c1238 - std[85c61899f894cf29]::panicking::update_hook::<alloc[98b3c20953f4fbe5]::boxed::Box<rustc_driver_impl[45224e78b6d2fe59]::install_ice_hook::{closure#0}>>::{closure#0}
   7:     0x7ad09f54b488 - std::panicking::rust_panic_with_hook::hdc045113cf0fafba
   8:     0x7ad09e6f6771 - std[85c61899f894cf29]::panicking::begin_panic::<rustc_errors[2297728cd06420b6]::ExplicitBug>::{closure#0}
   9:     0x7ad09e6eb916 - std[85c61899f894cf29]::sys::backtrace::__rust_end_short_backtrace::<std[85c61899f894cf29]::panicking::begin_panic<rustc_errors[2297728cd06420b6]::ExplicitBug>::{closure#0}, !>
  10:     0x7ad09e6eb6d3 - std[85c61899f894cf29]::panicking::begin_panic::<rustc_errors[2297728cd06420b6]::ExplicitBug>
  11:     0x7ad09e700711 - <rustc_errors[2297728cd06420b6]::diagnostic::BugAbort as rustc_errors[2297728cd06420b6]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  12:     0x7ad09ece86d3 - rustc_middle[2b65deb07cad4442]::util::bug::opt_span_bug_fmt::<rustc_span[267b34eb586afd37]::span_encoding::Span>::{closure#0}
  13:     0x7ad09ecd0c0a - rustc_middle[2b65deb07cad4442]::ty::context::tls::with_opt::<rustc_middle[2b65deb07cad4442]::util::bug::opt_span_bug_fmt<rustc_span[267b34eb586afd37]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  14:     0x7ad09ecd0a9b - rustc_middle[2b65deb07cad4442]::ty::context::tls::with_context_opt::<rustc_middle[2b65deb07cad4442]::ty::context::tls::with_opt<rustc_middle[2b65deb07cad4442]::util::bug::opt_span_bug_fmt<rustc_span[267b34eb586afd37]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  15:     0x7ad09ce2a8d0 - rustc_middle[2b65deb07cad4442]::util::bug::bug_fmt
  16:     0x7ad0a07da666 - <rustc_const_eval[c1d2b202d9973a02]::interpret::validity::ValidityVisitor<rustc_const_eval[c1d2b202d9973a02]::const_eval::machine::CompileTimeMachine> as rustc_const_eval[c1d2b202d9973a02]::interpret::visitor::ValueVisitor<rustc_const_eval[c1d2b202d9973a02]::const_eval::machine::CompileTimeMachine>>::visit_value
  17:     0x7ad0a07d8eeb - <rustc_const_eval[c1d2b202d9973a02]::interpret::validity::ValidityVisitor<rustc_const_eval[c1d2b202d9973a02]::const_eval::machine::CompileTimeMachine> as rustc_const_eval[c1d2b202d9973a02]::interpret::visitor::ValueVisitor<rustc_const_eval[c1d2b202d9973a02]::const_eval::machine::CompileTimeMachine>>::visit_value
  18:     0x7ad0a07d86fe - <rustc_const_eval[c1d2b202d9973a02]::interpret::validity::ValidityVisitor<rustc_const_eval[c1d2b202d9973a02]::const_eval::machine::CompileTimeMachine> as rustc_const_eval[c1d2b202d9973a02]::interpret::visitor::ValueVisitor<rustc_const_eval[c1d2b202d9973a02]::const_eval::machine::CompileTimeMachine>>::visit_value
  19:     0x7ad0a0808a9c - rustc_const_eval[c1d2b202d9973a02]::const_eval::eval_queries::eval_to_allocation_raw_provider
  20:     0x7ad0a08079be - rustc_query_impl[31526c927efa8eec]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[31526c927efa8eec]::query_impl::eval_to_allocation_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[2b65deb07cad4442]::query::erase::Erased<[u8; 24usize]>>
  21:     0x7ad0a07efc22 - rustc_query_system[8b7296974754ceb3]::query::plumbing::try_execute_query::<rustc_query_impl[31526c927efa8eec]::DynamicConfig<rustc_query_system[8b7296974754ceb3]::query::caches::DefaultCache<rustc_middle[2b65deb07cad4442]::ty::PseudoCanonicalInput<rustc_middle[2b65deb07cad4442]::mir::interpret::GlobalId>, rustc_middle[2b65deb07cad4442]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[31526c927efa8eec]::plumbing::QueryCtxt, false>
  22:     0x7ad0a07ef781 - rustc_query_impl[31526c927efa8eec]::query_impl::eval_to_allocation_raw::get_query_non_incr::__rust_end_short_backtrace
  23:     0x7ad0a07f18f9 - rustc_const_eval[c1d2b202d9973a02]::const_eval::eval_queries::eval_to_const_value_raw_provider
  24:     0x7ad0a07f1702 - rustc_query_impl[31526c927efa8eec]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[31526c927efa8eec]::query_impl::eval_to_const_value_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[2b65deb07cad4442]::query::erase::Erased<[u8; 24usize]>>
  25:     0x7ad0a07efbd9 - rustc_query_system[8b7296974754ceb3]::query::plumbing::try_execute_query::<rustc_query_impl[31526c927efa8eec]::DynamicConfig<rustc_query_system[8b7296974754ceb3]::query::caches::DefaultCache<rustc_middle[2b65deb07cad4442]::ty::PseudoCanonicalInput<rustc_middle[2b65deb07cad4442]::mir::interpret::GlobalId>, rustc_middle[2b65deb07cad4442]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[31526c927efa8eec]::plumbing::QueryCtxt, false>
  26:     0x7ad0a07ef689 - rustc_query_impl[31526c927efa8eec]::query_impl::eval_to_const_value_raw::get_query_non_incr::__rust_end_short_backtrace
  27:     0x7ad0a003a154 - <rustc_middle[2b65deb07cad4442]::hir::map::Map>::par_body_owners::<rustc_hir_analysis[4e6fa7c2cad24599]::check_crate::{closure#3}>::{closure#0}
  28:     0x7ad0a0037b37 - rustc_hir_analysis[4e6fa7c2cad24599]::check_crate
  29:     0x7ad0a0042584 - rustc_interface[51c1904b6ef58290]::passes::run_required_analyses
  30:     0x7ad0a0bd88de - rustc_interface[51c1904b6ef58290]::passes::analysis
  31:     0x7ad0a0bd88af - rustc_query_impl[31526c927efa8eec]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[31526c927efa8eec]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[2b65deb07cad4442]::query::erase::Erased<[u8; 1usize]>>
  32:     0x7ad0a0baf7ba - rustc_query_system[8b7296974754ceb3]::query::plumbing::try_execute_query::<rustc_query_impl[31526c927efa8eec]::DynamicConfig<rustc_query_system[8b7296974754ceb3]::query::caches::SingleCache<rustc_middle[2b65deb07cad4442]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[31526c927efa8eec]::plumbing::QueryCtxt, false>
  33:     0x7ad0a0baf48e - rustc_query_impl[31526c927efa8eec]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  34:     0x7ad0a0c503eb - rustc_interface[51c1904b6ef58290]::interface::run_compiler::<core[ce4f568dace374e]::result::Result<(), rustc_span[267b34eb586afd37]::ErrorGuaranteed>, rustc_driver_impl[45224e78b6d2fe59]::run_compiler::{closure#0}>::{closure#1}
  35:     0x7ad0a0b41ca1 - std[85c61899f894cf29]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[51c1904b6ef58290]::util::run_in_thread_with_globals<rustc_interface[51c1904b6ef58290]::util::run_in_thread_pool_with_globals<rustc_interface[51c1904b6ef58290]::interface::run_compiler<core[ce4f568dace374e]::result::Result<(), rustc_span[267b34eb586afd37]::ErrorGuaranteed>, rustc_driver_impl[45224e78b6d2fe59]::run_compiler::{closure#0}>::{closure#1}, core[ce4f568dace374e]::result::Result<(), rustc_span[267b34eb586afd37]::ErrorGuaranteed>>::{closure#0}, core[ce4f568dace374e]::result::Result<(), rustc_span[267b34eb586afd37]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[ce4f568dace374e]::result::Result<(), rustc_span[267b34eb586afd37]::ErrorGuaranteed>>
  36:     0x7ad0a0b41948 - <<std[85c61899f894cf29]::thread::Builder>::spawn_unchecked_<rustc_interface[51c1904b6ef58290]::util::run_in_thread_with_globals<rustc_interface[51c1904b6ef58290]::util::run_in_thread_pool_with_globals<rustc_interface[51c1904b6ef58290]::interface::run_compiler<core[ce4f568dace374e]::result::Result<(), rustc_span[267b34eb586afd37]::ErrorGuaranteed>, rustc_driver_impl[45224e78b6d2fe59]::run_compiler::{closure#0}>::{closure#1}, core[ce4f568dace374e]::result::Result<(), rustc_span[267b34eb586afd37]::ErrorGuaranteed>>::{closure#0}, core[ce4f568dace374e]::result::Result<(), rustc_span[267b34eb586afd37]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[ce4f568dace374e]::result::Result<(), rustc_span[267b34eb586afd37]::ErrorGuaranteed>>::{closure#1} as core[ce4f568dace374e]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  37:     0x7ad0a0b4107b - std::sys::pal::unix::thread::Thread::new::thread_start::h6f16c939ae6ab66d
  38:     0x7ad09aea339d - <unknown>
  39:     0x7ad09af2849c - <unknown>
  40:                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.85.0-nightly (acf48426b 2024-12-06) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [eval_to_allocation_raw] const-evaluating + checking `_`
#1 [eval_to_const_value_raw] simplifying constant for the type system `_`
end of query stack
error: aborting due to 3 previous errors

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

@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 Dec 6, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Dec 6, 2024
@matthiaskrgr
Copy link
Member Author

Regression in nightly-2024-02-21

commit[0] 2024-02-19: Auto merge of #121185 - GuillaumeGomez:update-stdarch, r=Amanieu
commit[1] 2024-02-19: Auto merge of #121211 - lcnr:nll-relate-handle-infer, r=BoxyUwU
commit[2] 2024-02-20: Auto merge of #121296 - madsmtm:fix-mac-catalyst-deployment-target, r=shepmaster
commit[3] 2024-02-20: Auto merge of #120628 - workingjubilee:reimpl-meaningful-test-name-lint, r=compiler-errors
commit[4] 2024-02-20: Auto merge of #120692 - Nadrieril:move-column-analysis-to-placeinfo, r=compiler-errors
commit[5] 2024-02-20: Auto merge of #121327 - Nilstrieb:rollup-zxcwwwy, r=Nilstrieb
commit[6] 2024-02-20: Auto merge of #121087 - oli-obk:eager_const_failures, r=lcnr
commit[7] 2024-02-20: Auto merge of #120576 - nnethercote:merge-Diagnostic-DiagnosticBuilder, r=davidtwco
commit[8] 2024-02-20: Auto merge of #120863 - saethlin:slice-get-checked, r=the8472
commit[9] 2024-02-20: Auto merge of #121345 - Nilstrieb:rollup-reb0xge, r=Nilstrieb

could be #121087

@matthiaskrgr
Copy link
Member Author

similar to #115998 which is why this felt so familiar

@jieyouxu jieyouxu added A-const-eval Area: Constant evaluation, covers all const contexts (static, const fn, ...) S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Dec 8, 2024
@jieyouxu
Copy link
Member

jieyouxu commented Dec 8, 2024

#121087 might have exposed const-eval to invalid types that const-eval was not prepared to handle, seems likely.

@oli-obk
Copy link
Contributor

oli-obk commented Dec 9, 2024

Avoiding a bogus error, to make sure it's not related:

pub struct Data([[&'static str]; 5_i32]);
const _: &'static Data = unsafe { &*(&[] as *const Data) };

@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue 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

5 participants
@oli-obk @matthiaskrgr @jieyouxu @rustbot and others