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) #124262

Closed
matthiaskrgr opened this issue Apr 22, 2024 · 1 comment · Fixed by #127311
Closed
Labels
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

snippet:

struct Foo(<&[fn()] as ::core::ops::Deref>::Target);
const _: *const Foo = 0 as _;

Version information

rustc 1.79.0-nightly (290d79241 2024-04-22)
binary: rustc
commit-hash: 290d792411566c94273e5d1a980a1ab91f1d950b
commit-date: 2024-04-22
host: x86_64-unknown-linux-gnu
release: 1.79.0-nightly
LLVM version: 18.1.4

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc --edition=2021

Program output

error[E0106]: missing lifetime specifier
 --> /tmp/icemaker_global_tempdir.1nBNEtZmd8hU/rustc_testrunner_tmpdir_reporting.YScR49rloxcZ/mvce.rs:1:13
  |
1 | struct Foo(<&[fn()] as ::core::ops::Deref>::Target);
  |             ^ expected named lifetime parameter
  |
help: consider introducing a named lifetime parameter
  |
1 | struct Foo<'a>(<&'a [fn()] as ::core::ops::Deref>::Target);
  |           ++++   ++

error[E0601]: `main` function not found in crate `mvce`
 --> /tmp/icemaker_global_tempdir.1nBNEtZmd8hU/rustc_testrunner_tmpdir_reporting.YScR49rloxcZ/mvce.rs:2:30
  |
2 | const _: *const Foo = 0 as _;
  |                              ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.1nBNEtZmd8hU/rustc_testrunner_tmpdir_reporting.YScR49rloxcZ/mvce.rs`

error: internal compiler error: compiler/rustc_const_eval/src/interpret/place.rs:37: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:37:17:
Box<dyn Any>
stack backtrace:
   0:     0x7d2e63191935 - std::backtrace_rs::backtrace::libunwind::trace::h26e1fa40e8cb8736
                               at /rustc/290d792411566c94273e5d1a980a1ab91f1d950b/library/std/src/../../backtrace/src/backtrace/libunwind.rs:105:5
   1:     0x7d2e63191935 - std::backtrace_rs::backtrace::trace_unsynchronized::h859af531c2f619a1
                               at /rustc/290d792411566c94273e5d1a980a1ab91f1d950b/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7d2e63191935 - std::sys_common::backtrace::_print_fmt::h770ada6f33df9a23
                               at /rustc/290d792411566c94273e5d1a980a1ab91f1d950b/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7d2e63191935 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h1202620471ff2013
                               at /rustc/290d792411566c94273e5d1a980a1ab91f1d950b/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7d2e631e0a6b - core::fmt::rt::Argument::fmt::h1d7f69a8f0bb037c
                               at /rustc/290d792411566c94273e5d1a980a1ab91f1d950b/library/core/src/fmt/rt.rs:165:63
   5:     0x7d2e631e0a6b - core::fmt::write::h2cfd50c1c61a678b
                               at /rustc/290d792411566c94273e5d1a980a1ab91f1d950b/library/core/src/fmt/mod.rs:1157:21
   6:     0x7d2e631864bf - std::io::Write::write_fmt::h68244818dfe9446a
                               at /rustc/290d792411566c94273e5d1a980a1ab91f1d950b/library/std/src/io/mod.rs:1832:15
   7:     0x7d2e6319170e - std::sys_common::backtrace::_print::hb0df927864ffa3c4
                               at /rustc/290d792411566c94273e5d1a980a1ab91f1d950b/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7d2e6319170e - std::sys_common::backtrace::print::hb29ea7496634044b
                               at /rustc/290d792411566c94273e5d1a980a1ab91f1d950b/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7d2e63194079 - std::panicking::default_hook::{{closure}}::hcfcc8ff96a30a9c7
  10:     0x7d2e63193dbd - std::panicking::default_hook::h8bb790ee0d607409
                               at /rustc/290d792411566c94273e5d1a980a1ab91f1d950b/library/std/src/panicking.rs:298:9
  11:     0x7d2e5fa3227c - std[37c8ccdab8a3c0d8]::panicking::update_hook::<alloc[34ed19a5ff888b12]::boxed::Box<rustc_driver_impl[480b09937bfb0708]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7d2e63194776 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h11842aeeeb09579f
                               at /rustc/290d792411566c94273e5d1a980a1ab91f1d950b/library/alloc/src/boxed.rs:2036:9
  13:     0x7d2e63194776 - std::panicking::rust_panic_with_hook::h2039ccc53629d416
                               at /rustc/290d792411566c94273e5d1a980a1ab91f1d950b/library/std/src/panicking.rs:799:13
  14:     0x7d2e5fa62584 - std[37c8ccdab8a3c0d8]::panicking::begin_panic::<rustc_errors[6444c462ca5918aa]::ExplicitBug>::{closure#0}
  15:     0x7d2e5fa5ef36 - std[37c8ccdab8a3c0d8]::sys_common::backtrace::__rust_end_short_backtrace::<std[37c8ccdab8a3c0d8]::panicking::begin_panic<rustc_errors[6444c462ca5918aa]::ExplicitBug>::{closure#0}, !>
  16:     0x7d2e5fa5a506 - std[37c8ccdab8a3c0d8]::panicking::begin_panic::<rustc_errors[6444c462ca5918aa]::ExplicitBug>
  17:     0x7d2e5fa6b801 - <rustc_errors[6444c462ca5918aa]::diagnostic::BugAbort as rustc_errors[6444c462ca5918aa]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  18:     0x7d2e5ff1155c - rustc_middle[d30f97e255128713]::util::bug::opt_span_bug_fmt::<rustc_span[128fa906eb8a1c67]::span_encoding::Span>::{closure#0}
  19:     0x7d2e5fef982a - rustc_middle[d30f97e255128713]::ty::context::tls::with_opt::<rustc_middle[d30f97e255128713]::util::bug::opt_span_bug_fmt<rustc_span[128fa906eb8a1c67]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  20:     0x7d2e5fef96cb - rustc_middle[d30f97e255128713]::ty::context::tls::with_context_opt::<rustc_middle[d30f97e255128713]::ty::context::tls::with_opt<rustc_middle[d30f97e255128713]::util::bug::opt_span_bug_fmt<rustc_span[128fa906eb8a1c67]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  21:     0x7d2e5e28fe70 - rustc_middle[d30f97e255128713]::util::bug::bug_fmt
  22:     0x7d2e5f9ef2ec - <rustc_const_eval[6d96b92d4bade795]::interpret::validity::ValidityVisitor<rustc_const_eval[6d96b92d4bade795]::const_eval::machine::CompileTimeInterpreter>>::check_wide_ptr_meta
  23:     0x7d2e60e6ecdd - <rustc_const_eval[6d96b92d4bade795]::interpret::validity::ValidityVisitor<rustc_const_eval[6d96b92d4bade795]::const_eval::machine::CompileTimeInterpreter> as rustc_const_eval[6d96b92d4bade795]::interpret::visitor::ValueVisitor<rustc_const_eval[6d96b92d4bade795]::const_eval::machine::CompileTimeInterpreter>>::visit_value
  24:     0x7d2e5ef85621 - rustc_const_eval[6d96b92d4bade795]::const_eval::eval_queries::eval_to_allocation_raw_provider
  25:     0x7d2e616b56b6 - rustc_query_impl[4316bc259f8ef16e]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[4316bc259f8ef16e]::query_impl::eval_to_allocation_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[d30f97e255128713]::query::erase::Erased<[u8; 24usize]>>
  26:     0x7d2e616b4ed6 - rustc_query_system[8cff448a052401bd]::query::plumbing::try_execute_query::<rustc_query_impl[4316bc259f8ef16e]::DynamicConfig<rustc_query_system[8cff448a052401bd]::query::caches::DefaultCache<rustc_middle[d30f97e255128713]::ty::ParamEnvAnd<rustc_middle[d30f97e255128713]::mir::interpret::GlobalId>, rustc_middle[d30f97e255128713]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[4316bc259f8ef16e]::plumbing::QueryCtxt, false>
  27:     0x7d2e616b4aac - rustc_query_impl[4316bc259f8ef16e]::query_impl::eval_to_allocation_raw::get_query_non_incr::__rust_end_short_backtrace
  28:     0x7d2e616b460c - rustc_middle[d30f97e255128713]::query::plumbing::query_get_at::<rustc_query_system[8cff448a052401bd]::query::caches::DefaultCache<rustc_middle[d30f97e255128713]::ty::ParamEnvAnd<rustc_middle[d30f97e255128713]::mir::interpret::GlobalId>, rustc_middle[d30f97e255128713]::query::erase::Erased<[u8; 24usize]>>>
  29:     0x7d2e616b2afc - rustc_const_eval[6d96b92d4bade795]::const_eval::eval_queries::eval_to_const_value_raw_provider
  30:     0x7d2e616b2a76 - rustc_query_impl[4316bc259f8ef16e]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[4316bc259f8ef16e]::query_impl::eval_to_const_value_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[d30f97e255128713]::query::erase::Erased<[u8; 24usize]>>
  31:     0x7d2e616b4e99 - rustc_query_system[8cff448a052401bd]::query::plumbing::try_execute_query::<rustc_query_impl[4316bc259f8ef16e]::DynamicConfig<rustc_query_system[8cff448a052401bd]::query::caches::DefaultCache<rustc_middle[d30f97e255128713]::ty::ParamEnvAnd<rustc_middle[d30f97e255128713]::mir::interpret::GlobalId>, rustc_middle[d30f97e255128713]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[4316bc259f8ef16e]::plumbing::QueryCtxt, false>
  32:     0x7d2e616b49ac - rustc_query_impl[4316bc259f8ef16e]::query_impl::eval_to_const_value_raw::get_query_non_incr::__rust_end_short_backtrace
  33:     0x7d2e61043e10 - <rustc_middle[d30f97e255128713]::hir::map::Map>::par_body_owners::<rustc_hir_analysis[6f20a5ebf44cea1c]::check_crate::{closure#3}>::{closure#0}
  34:     0x7d2e6104243c - rustc_hir_analysis[6f20a5ebf44cea1c]::check_crate
  35:     0x7d2e613163ba - rustc_interface[ffee9ea60ef965c3]::passes::analysis
  36:     0x7d2e61315f15 - rustc_query_impl[4316bc259f8ef16e]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[4316bc259f8ef16e]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[d30f97e255128713]::query::erase::Erased<[u8; 1usize]>>
  37:     0x7d2e61b8dca5 - rustc_query_system[8cff448a052401bd]::query::plumbing::try_execute_query::<rustc_query_impl[4316bc259f8ef16e]::DynamicConfig<rustc_query_system[8cff448a052401bd]::query::caches::SingleCache<rustc_middle[d30f97e255128713]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[4316bc259f8ef16e]::plumbing::QueryCtxt, false>
  38:     0x7d2e61b8da09 - rustc_query_impl[4316bc259f8ef16e]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  39:     0x7d2e619ea753 - rustc_interface[ffee9ea60ef965c3]::interface::run_compiler::<core[d851a872a27282f9]::result::Result<(), rustc_span[128fa906eb8a1c67]::ErrorGuaranteed>, rustc_driver_impl[480b09937bfb0708]::run_compiler::{closure#0}>::{closure#1}
  40:     0x7d2e619d8627 - std[37c8ccdab8a3c0d8]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[ffee9ea60ef965c3]::util::run_in_thread_with_globals<rustc_interface[ffee9ea60ef965c3]::util::run_in_thread_pool_with_globals<rustc_interface[ffee9ea60ef965c3]::interface::run_compiler<core[d851a872a27282f9]::result::Result<(), rustc_span[128fa906eb8a1c67]::ErrorGuaranteed>, rustc_driver_impl[480b09937bfb0708]::run_compiler::{closure#0}>::{closure#1}, core[d851a872a27282f9]::result::Result<(), rustc_span[128fa906eb8a1c67]::ErrorGuaranteed>>::{closure#0}, core[d851a872a27282f9]::result::Result<(), rustc_span[128fa906eb8a1c67]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d851a872a27282f9]::result::Result<(), rustc_span[128fa906eb8a1c67]::ErrorGuaranteed>>
  41:     0x7d2e619d83ea - <<std[37c8ccdab8a3c0d8]::thread::Builder>::spawn_unchecked_<rustc_interface[ffee9ea60ef965c3]::util::run_in_thread_with_globals<rustc_interface[ffee9ea60ef965c3]::util::run_in_thread_pool_with_globals<rustc_interface[ffee9ea60ef965c3]::interface::run_compiler<core[d851a872a27282f9]::result::Result<(), rustc_span[128fa906eb8a1c67]::ErrorGuaranteed>, rustc_driver_impl[480b09937bfb0708]::run_compiler::{closure#0}>::{closure#1}, core[d851a872a27282f9]::result::Result<(), rustc_span[128fa906eb8a1c67]::ErrorGuaranteed>>::{closure#0}, core[d851a872a27282f9]::result::Result<(), rustc_span[128fa906eb8a1c67]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d851a872a27282f9]::result::Result<(), rustc_span[128fa906eb8a1c67]::ErrorGuaranteed>>::{closure#2} as core[d851a872a27282f9]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  42:     0x7d2e6319e60b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h8fcfbedcc7bc1020
                               at /rustc/290d792411566c94273e5d1a980a1ab91f1d950b/library/alloc/src/boxed.rs:2022:9
  43:     0x7d2e6319e60b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hb725f441e1474916
                               at /rustc/290d792411566c94273e5d1a980a1ab91f1d950b/library/alloc/src/boxed.rs:2022:9
  44:     0x7d2e6319e60b - std::sys::pal::unix::thread::Thread::new::thread_start::h34c8a550ac2bc24c
                               at /rustc/290d792411566c94273e5d1a980a1ab91f1d950b/library/std/src/sys/pal/unix/thread.rs:108:17
  45:     0x7d2e62f3c55a - <unknown>
  46:     0x7d2e62fb9a3c - <unknown>
  47:                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.79.0-nightly (290d79241 2024-04-22) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z dump-mir-dir=dir

query stack during panic:
#0 [eval_to_allocation_raw] const-evaluating + checking `_`
#1 [eval_to_const_value_raw] simplifying constant for the type system `_`
#2 [analysis] running analysis passes on this crate
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 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. C-bug Category: This is a bug. labels Apr 22, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Apr 22, 2024
@matthiaskrgr
Copy link
Member Author

bisects to #122749

@fmease fmease removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Apr 22, 2024
@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Apr 27, 2024
bors added a commit to rust-lang-ci/rust that referenced this issue Jul 4, 2024
Avoid follow-up errors and ICEs after missing lifetime errors on data structures

Tuple struct constructors are functions, so when we call them typeck will use the signature tuple struct constructor function to provide type hints. Since typeck mostly ignores and erases lifetimes, we end up never seeing the error lifetime in writeback, thus not tainting the typeck result.

Now, we eagerly taint typeck results by tainting from `resolve_vars_if_possible`, which is called all over the place.

I did not carry over all the `crashes` test suite tests, as they are really all the same cause (missing or unknown lifetime names in tuple struct definitions or generic arg lists).

fixes rust-lang#124262
fixes rust-lang#124083
fixes rust-lang#125155
fixes rust-lang#125888
fixes rust-lang#125992
fixes rust-lang#126666
fixes rust-lang#126648
fixes rust-lang#127268
bors added a commit to rust-lang-ci/rust that referenced this issue Jul 9, 2024
…ler-errors

Avoid follow-up errors and ICEs after missing lifetime errors on data structures

Tuple struct constructors are functions, so when we call them typeck will use the signature tuple struct constructor function to provide type hints. Since typeck mostly ignores and erases lifetimes, we end up never seeing the error lifetime in writeback, thus not tainting the typeck result.

Now, we eagerly taint typeck results by tainting from `resolve_vars_if_possible`, which is called all over the place.

I did not carry over all the `crashes` test suite tests, as they are really all the same cause (missing or unknown lifetime names in tuple struct definitions or generic arg lists).

fixes rust-lang#124262
fixes rust-lang#124083
fixes rust-lang#125155
fixes rust-lang#125888
fixes rust-lang#125992
fixes rust-lang#126666
fixes rust-lang#126648
fixes rust-lang#127268
@bors bors closed this as completed in c92a8e4 Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

Successfully merging a pull request may close this issue.

3 participants