Skip to content

dyn* ICE primitive read not possible for type: [i32; 4] #102173

Closed

Description

@DutchGhost

Code

#![feature(dyn_star)]
#![allow(incomplete_features)]

use core::fmt::Debug;

fn main() {
    let i = [1, 2, 3, 4] as dyn* Debug;
    
    dbg!(i);
}

Meta

rustc --version --verbose:

rustc 1.66.0-nightly (e7119a030 2022-09-22)

Error output

[<output>](error: internal compiler error: /rustc/e7119a0300b87a3d670408ee8e847c6821b3ae80/compiler/rustc_const_eval/src/interpret/operand.rs:390:13: primitive read not possible for type: [i32; 4])
Backtrace

error: internal compiler error: /rustc/e7119a0300b87a3d670408ee8e847c6821b3ae80/compiler/rustc_const_eval/src/interpret/operand.rs:390:13: primitive read not possible for type: [i32; 4]
 --> src/main.rs:7:13
  |
7 |     let i = [1, 2, 3, 4] as dyn* Debug;
  |             ^^^^^^^^^^^^^^^^^^^^^^^^^^

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/e7119a0300b87a3d670408ee8e847c6821b3ae80/compiler/rustc_errors/src/lib.rs:1434:9
stack backtrace:
   0:     0x7f024ef53ff0 - std::backtrace_rs::backtrace::libunwind::trace::hf4e04b2e4313927b
                               at /rustc/e7119a0300b87a3d670408ee8e847c6821b3ae80/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   1:     0x7f024ef53ff0 - std::backtrace_rs::backtrace::trace_unsynchronized::h2771cf061d4680d1
                               at /rustc/e7119a0300b87a3d670408ee8e847c6821b3ae80/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f024ef53ff0 - std::sys_common::backtrace::_print_fmt::h2e413508900ead1c
                               at /rustc/e7119a0300b87a3d670408ee8e847c6821b3ae80/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7f024ef53ff0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hb886319318f6b897
                               at /rustc/e7119a0300b87a3d670408ee8e847c6821b3ae80/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7f024efaee1e - core::fmt::write::hd7350cb51945e18c
                               at /rustc/e7119a0300b87a3d670408ee8e847c6821b3ae80/library/core/src/fmt/mod.rs:1202:17
   5:     0x7f024ef44af5 - std::io::Write::write_fmt::ha7bc763f922fc662
                               at /rustc/e7119a0300b87a3d670408ee8e847c6821b3ae80/library/std/src/io/mod.rs:1679:15
   6:     0x7f024ef56d73 - std::sys_common::backtrace::_print::h7ad0003e1b032609
                               at /rustc/e7119a0300b87a3d670408ee8e847c6821b3ae80/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7f024ef56d73 - std::sys_common::backtrace::print::h6f247b59322d4826
                               at /rustc/e7119a0300b87a3d670408ee8e847c6821b3ae80/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7f024ef56d73 - std::panicking::default_hook::{{closure}}::h71a394bfa368bc38
                               at /rustc/e7119a0300b87a3d670408ee8e847c6821b3ae80/library/std/src/panicking.rs:267:22
   9:     0x7f024ef56a5f - std::panicking::default_hook::h353829743ca9a29f
                               at /rustc/e7119a0300b87a3d670408ee8e847c6821b3ae80/library/std/src/panicking.rs:286:9
  10:     0x7f025176cef1 - <rustc_driver[7857f239df018eab]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[cde1ce9e21f08391]::ops::function::FnOnce<(&core[cde1ce9e21f08391]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  11:     0x7f024ef575ab - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h5c7ac9f6a4be07e2
                               at /rustc/e7119a0300b87a3d670408ee8e847c6821b3ae80/library/alloc/src/boxed.rs:1954:9
  12:     0x7f024ef575ab - std::panicking::rust_panic_with_hook::h6ad4960c15699d95
                               at /rustc/e7119a0300b87a3d670408ee8e847c6821b3ae80/library/std/src/panicking.rs:673:13
  13:     0x7f02519f5b21 - std[35bb8192b5670ad2]::panicking::begin_panic::<rustc_errors[354c2d440e1385ac]::ExplicitBug>::{closure#0}
  14:     0x7f02519f41c6 - std[35bb8192b5670ad2]::sys_common::backtrace::__rust_end_short_backtrace::<std[35bb8192b5670ad2]::panicking::begin_panic<rustc_errors[354c2d440e1385ac]::ExplicitBug>::{closure#0}, !>
  15:     0x7f0251976536 - std[35bb8192b5670ad2]::panicking::begin_panic::<rustc_errors[354c2d440e1385ac]::ExplicitBug>
  16:     0x7f0251a1f4a6 - std[35bb8192b5670ad2]::panic::panic_any::<rustc_errors[354c2d440e1385ac]::ExplicitBug>
  17:     0x7f0251a1eedf - <rustc_errors[354c2d440e1385ac]::HandlerInner>::span_bug::<rustc_span[4a0a9e8ceb64f0f4]::span_encoding::Span, &alloc[70f1755a93720895]::string::String>
  18:     0x7f0251a1ec60 - <rustc_errors[354c2d440e1385ac]::Handler>::span_bug::<rustc_span[4a0a9e8ceb64f0f4]::span_encoding::Span, &alloc[70f1755a93720895]::string::String>
  19:     0x7f0251a4c3e8 - rustc_middle[33a3dc3ec8228005]::ty::context::tls::with_context_opt::<rustc_middle[33a3dc3ec8228005]::ty::context::tls::with_opt<rustc_middle[33a3dc3ec8228005]::util::bug::opt_span_bug_fmt<rustc_span[4a0a9e8ceb64f0f4]::span_encoding::Span>::{closure#0}, ()>::{closure#0}, ()>
  20:     0x7f0251a4b906 - rustc_middle[33a3dc3ec8228005]::util::bug::opt_span_bug_fmt::<rustc_span[4a0a9e8ceb64f0f4]::span_encoding::Span>
  21:     0x7f0251a4b8c4 - rustc_middle[33a3dc3ec8228005]::util::bug::span_bug_fmt::<rustc_span[4a0a9e8ceb64f0f4]::span_encoding::Span>
  22:     0x7f0250e15e82 - <rustc_const_eval[4d5bd7e7607305c4]::interpret::eval_context::InterpCx<rustc_mir_transform[38a49b1d59d53461]::const_prop::ConstPropMachine>>::eval_rvalue_into_place
  23:     0x7f0250bb10c2 - <rustc_mir_transform[38a49b1d59d53461]::const_prop_lint::ConstPropagator as rustc_middle[33a3dc3ec8228005]::mir::visit::Visitor>::visit_body
  24:     0x7f0250ba8c03 - <rustc_mir_transform[38a49b1d59d53461]::const_prop_lint::ConstProp as rustc_mir_transform[38a49b1d59d53461]::pass_manager::MirLint>::run_lint
  25:     0x7f02503013e5 - rustc_mir_transform[38a49b1d59d53461]::pass_manager::run_passes_no_validate
  26:     0x7f02502fe684 - rustc_mir_transform[38a49b1d59d53461]::run_analysis_to_runtime_passes
  27:     0x7f02502fd692 - rustc_mir_transform[38a49b1d59d53461]::mir_drops_elaborated_and_const_checked
  28:     0x7f0250d526a3 - rustc_query_system[d3b2657d85679091]::query::plumbing::try_execute_query::<rustc_query_impl[542bbd4b66bfb449]::plumbing::QueryCtxt, rustc_query_system[d3b2657d85679091]::query::caches::DefaultCache<rustc_middle[33a3dc3ec8228005]::ty::WithOptConstParam<rustc_span[4a0a9e8ceb64f0f4]::def_id::LocalDefId>, &rustc_data_structures[bf19c7e493ef6519]::steal::Steal<rustc_middle[33a3dc3ec8228005]::mir::Body>>>
  29:     0x7f02516ad28e - <rustc_query_impl[542bbd4b66bfb449]::Queries as rustc_middle[33a3dc3ec8228005]::ty::query::QueryEngine>::mir_drops_elaborated_and_const_checked
  30:     0x7f025035b3cb - rustc_mir_transform[38a49b1d59d53461]::optimized_mir
  31:     0x7f0250b744eb - rustc_query_system[d3b2657d85679091]::query::plumbing::try_execute_query::<rustc_query_impl[542bbd4b66bfb449]::plumbing::QueryCtxt, rustc_query_system[d3b2657d85679091]::query::caches::DefaultCache<rustc_span[4a0a9e8ceb64f0f4]::def_id::DefId, &rustc_middle[33a3dc3ec8228005]::mir::Body>>
  32:     0x7f02516ad67f - <rustc_query_impl[542bbd4b66bfb449]::Queries as rustc_middle[33a3dc3ec8228005]::ty::query::QueryEngine>::optimized_mir
  33:     0x7f02503a5735 - <rustc_middle[33a3dc3ec8228005]::ty::context::TyCtxt>::instance_mir
  34:     0x7f025039ab3c - rustc_monomorphize[807358ae657c971c]::collector::collect_neighbours
  35:     0x7f02503986d2 - rustc_monomorphize[807358ae657c971c]::collector::collect_items_rec
  36:     0x7f0250ee534d - <rustc_session[fa757ff4c2b8954a]::session::Session>::time::<(), rustc_monomorphize[807358ae657c971c]::collector::collect_crate_mono_items::{closure#1}>
  37:     0x7f0250ee4ed9 - rustc_monomorphize[807358ae657c971c]::collector::collect_crate_mono_items
  38:     0x7f0250ee3dc6 - rustc_monomorphize[807358ae657c971c]::partitioning::collect_and_partition_mono_items
  39:     0x7f025151c4a9 - rustc_query_system[d3b2657d85679091]::query::plumbing::try_execute_query::<rustc_query_impl[542bbd4b66bfb449]::plumbing::QueryCtxt, rustc_query_system[d3b2657d85679091]::query::caches::DefaultCache<(), (&std[35bb8192b5670ad2]::collections::hash::set::HashSet<rustc_span[4a0a9e8ceb64f0f4]::def_id::DefId, core[cde1ce9e21f08391]::hash::BuildHasherDefault<rustc_hash[56467a0a1e3e166e]::FxHasher>>, &[rustc_middle[33a3dc3ec8228005]::mir::mono::CodegenUnit])>>
  40:     0x7f025151c19b - rustc_query_system[d3b2657d85679091]::query::plumbing::get_query::<rustc_query_impl[542bbd4b66bfb449]::queries::collect_and_partition_mono_items, rustc_query_impl[542bbd4b66bfb449]::plumbing::QueryCtxt>
  41:     0x7f025151c0de - <rustc_query_impl[542bbd4b66bfb449]::Queries as rustc_middle[33a3dc3ec8228005]::ty::query::QueryEngine>::collect_and_partition_mono_items
  42:     0x7f0251263712 - rustc_codegen_ssa[2a18cf2abb0e25f]::base::codegen_crate::<rustc_codegen_llvm[1c20db9e7afb2165]::LlvmCodegenBackend>
  43:     0x7f02512634e2 - <rustc_codegen_llvm[1c20db9e7afb2165]::LlvmCodegenBackend as rustc_codegen_ssa[2a18cf2abb0e25f]::traits::backend::CodegenBackend>::codegen_crate
  44:     0x7f025053f7dc - <rustc_session[fa757ff4c2b8954a]::session::Session>::time::<alloc[70f1755a93720895]::boxed::Box<dyn core[cde1ce9e21f08391]::any::Any>, rustc_interface[f2560d97934cc6f6]::passes::start_codegen::{closure#0}>
  45:     0x7f025053f1ae - <rustc_interface[f2560d97934cc6f6]::passes::QueryContext>::enter::<<rustc_interface[f2560d97934cc6f6]::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core[cde1ce9e21f08391]::result::Result<alloc[70f1755a93720895]::boxed::Box<dyn core[cde1ce9e21f08391]::any::Any>, rustc_errors[354c2d440e1385ac]::ErrorGuaranteed>>
  46:     0x7f02504ff6d3 - <rustc_interface[f2560d97934cc6f6]::queries::Queries>::ongoing_codegen
  47:     0x7f02504fda4a - rustc_interface[f2560d97934cc6f6]::interface::create_compiler_and_run::<core[cde1ce9e21f08391]::result::Result<(), rustc_errors[354c2d440e1385ac]::ErrorGuaranteed>, rustc_driver[7857f239df018eab]::run_compiler::{closure#1}>
  48:     0x7f02504fc342 - <scoped_tls[8ee1aa185b4607e2]::ScopedKey<rustc_span[4a0a9e8ceb64f0f4]::SessionGlobals>>::set::<rustc_interface[f2560d97934cc6f6]::interface::run_compiler<core[cde1ce9e21f08391]::result::Result<(), rustc_errors[354c2d440e1385ac]::ErrorGuaranteed>, rustc_driver[7857f239df018eab]::run_compiler::{closure#1}>::{closure#0}, core[cde1ce9e21f08391]::result::Result<(), rustc_errors[354c2d440e1385ac]::ErrorGuaranteed>>
  49:     0x7f02504fc02f - std[35bb8192b5670ad2]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[f2560d97934cc6f6]::util::run_in_thread_pool_with_globals<rustc_interface[f2560d97934cc6f6]::interface::run_compiler<core[cde1ce9e21f08391]::result::Result<(), rustc_errors[354c2d440e1385ac]::ErrorGuaranteed>, rustc_driver[7857f239df018eab]::run_compiler::{closure#1}>::{closure#0}, core[cde1ce9e21f08391]::result::Result<(), rustc_errors[354c2d440e1385ac]::ErrorGuaranteed>>::{closure#0}, core[cde1ce9e21f08391]::result::Result<(), rustc_errors[354c2d440e1385ac]::ErrorGuaranteed>>
  50:     0x7f02515d1980 - <<std[35bb8192b5670ad2]::thread::Builder>::spawn_unchecked_<rustc_interface[f2560d97934cc6f6]::util::run_in_thread_pool_with_globals<rustc_interface[f2560d97934cc6f6]::interface::run_compiler<core[cde1ce9e21f08391]::result::Result<(), rustc_errors[354c2d440e1385ac]::ErrorGuaranteed>, rustc_driver[7857f239df018eab]::run_compiler::{closure#1}>::{closure#0}, core[cde1ce9e21f08391]::result::Result<(), rustc_errors[354c2d440e1385ac]::ErrorGuaranteed>>::{closure#0}, core[cde1ce9e21f08391]::result::Result<(), rustc_errors[354c2d440e1385ac]::ErrorGuaranteed>>::{closure#1} as core[cde1ce9e21f08391]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  51:     0x7f024ef61393 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hbe492c93bea3125c
                               at /rustc/e7119a0300b87a3d670408ee8e847c6821b3ae80/library/alloc/src/boxed.rs:1940:9
  52:     0x7f024ef61393 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h1c6cb812ee67c431
                               at /rustc/e7119a0300b87a3d670408ee8e847c6821b3ae80/library/alloc/src/boxed.rs:1940:9
  53:     0x7f024ef61393 - std::sys::unix::thread::Thread::new::thread_start::hcd53b5f11cecf106
                               at /rustc/e7119a0300b87a3d670408ee8e847c6821b3ae80/library/std/src/sys/unix/thread.rs:108:17
  54:     0x7f024ee34609 - start_thread
  55:     0x7f024ed57133 - clone
  56:                0x0 - <unknown>

note: 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: rustc 1.66.0-nightly (e7119a030 2022-09-22) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type bin -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [mir_drops_elaborated_and_const_checked] elaborating drops for `main`
#1 [optimized_mir] optimizing MIR for `main`
#2 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
error: could not compile `playground`

Activity

  1. added
    C-bugCategory: This is a bug.
    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Sep 23, 2022
  2. changed the title [-]dyn* ICE[/-] [+]dyn* ICE primitive read not possible for type: [i32; 4][/+] on Sep 23, 2022
  3. added a commit that references this issue on Sep 23, 2022
  4. added
    requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.
    on Sep 24, 2022
  5. eholk commented on Sep 28, 2022

    @eholk
    Contributor

    Thanks for the report!

    This test case should not compile because only things that are pointer sized can be converted to dyn*. But, we definitely need a proper error message rather than an ICE.

  6. self-assigned this
    on Oct 2, 2022
  7. added a commit that references this issue on Nov 16, 2022
    9cd06e6
  8. added 3 commits that reference this issue on Nov 18, 2022
    6520fdc
    171b519
    24ee599
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.F-dyn_star`#![feature(dyn_star)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions