Skip to content

ICE: primitive read not possible for type #127676

Closed
@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

#![feature(dyn_star,const_async_blocks)]

static S: dyn* Send + Sync = async { 42 };

pub fn main() {}

original:

//@ check-pass

#![feature(dyn_star)]
//~^ WARN the feature `dyn_star` is incomplete

const C: dyn* Send + Sync = &();

static S: dyn* Send + Sync = async { //~ NOTE `async` blocks are only allowed in Rust 2018 or later
        42
        //~^ ERROR expected identifier, found `42`
        //~| NOTE expected identifier
        //~| HELP pass `--edition 2021` to `rustc`
        //~| NOTE for more on editions, read https://doc.rust-lang.org/edition-guide
    };

fn main(ref mut a @ ref b: U) {}

Version information

rustc 1.81.0-nightly (006538460 2024-07-13)
binary: rustc
commit-hash: 0065384608dfb27695f50e709d9689a7f4d0cdbc
commit-date: 2024-07-13
host: x86_64-unknown-linux-gnu
release: 1.81.0-nightly
LLVM version: 18.1.7

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zcrate-attr=feature(const_async_blocks) --edition=2018

Program output

warning: the feature `dyn_star` is incomplete and may not be safe to use and/or cause compiler crashes
 --> /tmp/icemaker_global_tempdir.qOpX44w7LzSk/rustc_testrunner_tmpdir_reporting.KYrBxxJksDU9/mvce.rs:1:12
  |
1 | #![feature(dyn_star)]
  |            ^^^^^^^^
  |
  = note: see issue #102425 <https://github.com/rust-lang/rust/issues/102425> for more information
  = note: `#[warn(incomplete_features)]` on by default

error[E0601]: `main` function not found in crate `mvce`
 --> /tmp/icemaker_global_tempdir.qOpX44w7LzSk/rustc_testrunner_tmpdir_reporting.KYrBxxJksDU9/mvce.rs:3:43
  |
3 | static S: dyn* Send + Sync = async { 42 };
  |                                           ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.qOpX44w7LzSk/rustc_testrunner_tmpdir_reporting.KYrBxxJksDU9/mvce.rs`

error: internal compiler error: compiler/rustc_const_eval/src/interpret/operand.rs:610:13: primitive read not possible for type: {async block@/tmp/icemaker_global_tempdir.qOpX44w7LzSk/rustc_testrunner_tmpdir_reporting.KYrBxxJksDU9/mvce.rs:3:30: 3:35}
 --> /tmp/icemaker_global_tempdir.qOpX44w7LzSk/rustc_testrunner_tmpdir_reporting.KYrBxxJksDU9/mvce.rs:3:30
  |
3 | static S: dyn* Send + Sync = async { 42 };
  |                              ^^^^^^^^^^^^

thread 'rustc' panicked at compiler/rustc_const_eval/src/interpret/operand.rs:610:13:
Box<dyn Any>
stack backtrace:
   0:     0x77115e2ef9c5 - std::backtrace_rs::backtrace::libunwind::trace::h7d0a52425298c889
                               at /rustc/0065384608dfb27695f50e709d9689a7f4d0cdbc/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
   1:     0x77115e2ef9c5 - std::backtrace_rs::backtrace::trace_unsynchronized::h099de2d232b5beea
                               at /rustc/0065384608dfb27695f50e709d9689a7f4d0cdbc/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x77115e2ef9c5 - std::sys::backtrace::_print_fmt::hf4fcf8db2f38d5cf
                               at /rustc/0065384608dfb27695f50e709d9689a7f4d0cdbc/library/std/src/sys/backtrace.rs:65:5
   3:     0x77115e2ef9c5 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h98f29425034928f9
                               at /rustc/0065384608dfb27695f50e709d9689a7f4d0cdbc/library/std/src/sys/backtrace.rs:40:26
   4:     0x77115e33f74b - core::fmt::rt::Argument::fmt::h59a179093c95dedc
                               at /rustc/0065384608dfb27695f50e709d9689a7f4d0cdbc/library/core/src/fmt/rt.rs:173:76
   5:     0x77115e33f74b - core::fmt::write::h94c903a80b5e82f2
                               at /rustc/0065384608dfb27695f50e709d9689a7f4d0cdbc/library/core/src/fmt/mod.rs:1182:21
   6:     0x77115e2e451f - std::io::Write::write_fmt::h8ceccaaf9a49b4c2
                               at /rustc/0065384608dfb27695f50e709d9689a7f4d0cdbc/library/std/src/io/mod.rs:1835:15
   7:     0x77115e2f21b1 - std::sys::backtrace::BacktraceLock::print::h3ffa7253c89f61f4
                               at /rustc/0065384608dfb27695f50e709d9689a7f4d0cdbc/library/std/src/sys/backtrace.rs:43:9
   8:     0x77115e2f21b1 - std::panicking::default_hook::{{closure}}::h9a94880802ac1774
                               at /rustc/0065384608dfb27695f50e709d9689a7f4d0cdbc/library/std/src/panicking.rs:269:22
   9:     0x77115e2f1e8c - std::panicking::default_hook::h9e65aa61001e801a
                               at /rustc/0065384608dfb27695f50e709d9689a7f4d0cdbc/library/std/src/panicking.rs:296:9
  10:     0x77115a8285ba - std[3fe90023072b89de]::panicking::update_hook::<alloc[915790aa0a363f0a]::boxed::Box<rustc_driver_impl[8a2c7e0acf9e67d]::install_ice_hook::{closure#0}>>::{closure#0}
  11:     0x77115e2f2b7f - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h645cf6680e970534
                               at /rustc/0065384608dfb27695f50e709d9689a7f4d0cdbc/library/alloc/src/boxed.rs:2078:9
  12:     0x77115e2f2b7f - std::panicking::rust_panic_with_hook::hb60500a0d79156f4
                               at /rustc/0065384608dfb27695f50e709d9689a7f4d0cdbc/library/std/src/panicking.rs:808:13
  13:     0x77115a863571 - std[3fe90023072b89de]::panicking::begin_panic::<rustc_errors[385b685cdf4cc31e]::ExplicitBug>::{closure#0}
  14:     0x77115a856526 - std[3fe90023072b89de]::sys::backtrace::__rust_end_short_backtrace::<std[3fe90023072b89de]::panicking::begin_panic<rustc_errors[385b685cdf4cc31e]::ExplicitBug>::{closure#0}, !>
  15:     0x77115a8564d6 - std[3fe90023072b89de]::panicking::begin_panic::<rustc_errors[385b685cdf4cc31e]::ExplicitBug>
  16:     0x77115a86c7b1 - <rustc_errors[385b685cdf4cc31e]::diagnostic::BugAbort as rustc_errors[385b685cdf4cc31e]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  17:     0x77115a77faad - <rustc_errors[385b685cdf4cc31e]::DiagCtxtHandle>::span_bug::<rustc_span[bbc2399b22ff849d]::span_encoding::Span, alloc[915790aa0a363f0a]::string::String>
  18:     0x77115a7a0ca8 - rustc_middle[eec5333731a86dc0]::util::bug::opt_span_bug_fmt::<rustc_span[bbc2399b22ff849d]::span_encoding::Span>::{closure#0}
  19:     0x77115a7a0e4a - rustc_middle[eec5333731a86dc0]::ty::context::tls::with_opt::<rustc_middle[eec5333731a86dc0]::util::bug::opt_span_bug_fmt<rustc_span[bbc2399b22ff849d]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  20:     0x77115a79449b - rustc_middle[eec5333731a86dc0]::ty::context::tls::with_context_opt::<rustc_middle[eec5333731a86dc0]::ty::context::tls::with_opt<rustc_middle[eec5333731a86dc0]::util::bug::opt_span_bug_fmt<rustc_span[bbc2399b22ff849d]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  21:     0x77115983ee07 - rustc_middle[eec5333731a86dc0]::util::bug::span_bug_fmt::<rustc_span[bbc2399b22ff849d]::span_encoding::Span>
  22:     0x77115be7518d - rustc_const_eval[fcfaf257159e2083]::const_eval::eval_queries::eval_body_using_ecx::<rustc_middle[eec5333731a86dc0]::mir::interpret::allocation::ConstAllocation>
  23:     0x77115cd024f1 - rustc_const_eval[fcfaf257159e2083]::const_eval::eval_queries::eval_static_initializer_provider
  24:     0x77115cd02267 - rustc_query_impl[91782128a8ee728d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[91782128a8ee728d]::query_impl::eval_static_initializer::dynamic_query::{closure#2}::{closure#0}, rustc_middle[eec5333731a86dc0]::query::erase::Erased<[u8; 16usize]>>
  25:     0x77115cd02249 - <rustc_query_impl[91782128a8ee728d]::query_impl::eval_static_initializer::dynamic_query::{closure#2} as core[319e6f75c3953897]::ops::function::FnOnce<(rustc_middle[eec5333731a86dc0]::ty::context::TyCtxt, rustc_span[bbc2399b22ff849d]::def_id::DefId)>>::call_once
  26:     0x77115c23813a - rustc_query_system[371af816df43a4de]::query::plumbing::try_execute_query::<rustc_query_impl[91782128a8ee728d]::DynamicConfig<rustc_query_system[371af816df43a4de]::query::caches::DefIdCache<rustc_middle[eec5333731a86dc0]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[91782128a8ee728d]::plumbing::QueryCtxt, false>
  27:     0x77115cd29e39 - rustc_query_impl[91782128a8ee728d]::query_impl::eval_static_initializer::get_query_non_incr::__rust_end_short_backtrace
  28:     0x77115c17ed81 - <rustc_middle[eec5333731a86dc0]::hir::map::Map>::par_body_owners::<rustc_hir_analysis[858e500c8dae0eb2]::check_crate::{closure#3}>::{closure#0}
  29:     0x77115c17c414 - rustc_hir_analysis[858e500c8dae0eb2]::check_crate
  30:     0x77115c172ad5 - rustc_interface[d6698aabb02b4562]::passes::analysis
  31:     0x77115c172691 - rustc_query_impl[91782128a8ee728d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[91782128a8ee728d]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[eec5333731a86dc0]::query::erase::Erased<[u8; 1usize]>>
  32:     0x77115cd16965 - rustc_query_system[371af816df43a4de]::query::plumbing::try_execute_query::<rustc_query_impl[91782128a8ee728d]::DynamicConfig<rustc_query_system[371af816df43a4de]::query::caches::SingleCache<rustc_middle[eec5333731a86dc0]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[91782128a8ee728d]::plumbing::QueryCtxt, false>
  33:     0x77115cd166cf - rustc_query_impl[91782128a8ee728d]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  34:     0x77115cbfa445 - rustc_interface[d6698aabb02b4562]::interface::run_compiler::<core[319e6f75c3953897]::result::Result<(), rustc_span[bbc2399b22ff849d]::ErrorGuaranteed>, rustc_driver_impl[8a2c7e0acf9e67d]::run_compiler::{closure#0}>::{closure#1}
  35:     0x77115cbd7e89 - std[3fe90023072b89de]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[d6698aabb02b4562]::util::run_in_thread_with_globals<rustc_interface[d6698aabb02b4562]::util::run_in_thread_pool_with_globals<rustc_interface[d6698aabb02b4562]::interface::run_compiler<core[319e6f75c3953897]::result::Result<(), rustc_span[bbc2399b22ff849d]::ErrorGuaranteed>, rustc_driver_impl[8a2c7e0acf9e67d]::run_compiler::{closure#0}>::{closure#1}, core[319e6f75c3953897]::result::Result<(), rustc_span[bbc2399b22ff849d]::ErrorGuaranteed>>::{closure#0}, core[319e6f75c3953897]::result::Result<(), rustc_span[bbc2399b22ff849d]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[319e6f75c3953897]::result::Result<(), rustc_span[bbc2399b22ff849d]::ErrorGuaranteed>>
  36:     0x77115cbd7c3a - <<std[3fe90023072b89de]::thread::Builder>::spawn_unchecked_<rustc_interface[d6698aabb02b4562]::util::run_in_thread_with_globals<rustc_interface[d6698aabb02b4562]::util::run_in_thread_pool_with_globals<rustc_interface[d6698aabb02b4562]::interface::run_compiler<core[319e6f75c3953897]::result::Result<(), rustc_span[bbc2399b22ff849d]::ErrorGuaranteed>, rustc_driver_impl[8a2c7e0acf9e67d]::run_compiler::{closure#0}>::{closure#1}, core[319e6f75c3953897]::result::Result<(), rustc_span[bbc2399b22ff849d]::ErrorGuaranteed>>::{closure#0}, core[319e6f75c3953897]::result::Result<(), rustc_span[bbc2399b22ff849d]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[319e6f75c3953897]::result::Result<(), rustc_span[bbc2399b22ff849d]::ErrorGuaranteed>>::{closure#2} as core[319e6f75c3953897]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  37:     0x77115e2fc9eb - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h967f6673253f3c49
                               at /rustc/0065384608dfb27695f50e709d9689a7f4d0cdbc/library/alloc/src/boxed.rs:2064:9
  38:     0x77115e2fc9eb - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hb3dfca655dd3866c
                               at /rustc/0065384608dfb27695f50e709d9689a7f4d0cdbc/library/alloc/src/boxed.rs:2064:9
  39:     0x77115e2fc9eb - std::sys::pal::unix::thread::Thread::new::thread_start::h0b7a83376a05c6db
                               at /rustc/0065384608dfb27695f50e709d9689a7f4d0cdbc/library/std/src/sys/pal/unix/thread.rs:108:17
  40:     0x7711572a6ded - <unknown>
  41:     0x77115732a0dc - <unknown>
  42:                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.81.0-nightly (006538460 2024-07-13) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z crate-attr=feature(const_async_blocks) -Z dump-mir-dir=dir

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

For more information about this error, try `rustc --explain E0601`.

@rustbot label +F-dyn_star +F-const_async_blocks

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-const_async_blocks`#![feature(const_async_blocks)]`F-dyn_star`#![feature(dyn_star)]`I-ICEIssue: 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.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions