Skip to content

ICE compiler/rustc_ast_lowering/src/expr.rs None #121108

Closed

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

#![derive(Clone, Copy)]

use std::ptr::addr_of;

const UNINHABITED_VARIANT: () = unsafe {
    let v = *addr_of!(data).cast();
};

original:

#![feature(never_type)]
#![derive(Clone, Copy)]

use std::ptr::addr_of;

const UNINHABITED_VARIANT: () = unsafe {
    let v = *addr_of!(data).cast();
};

Version information

rustc 1.78.0-nightly (502ce8287 2024-02-14)
binary: rustc
commit-hash: 502ce8287bc3c86dca07acc38c5ff9431a6097be
commit-date: 2024-02-14
host: x86_64-unknown-linux-gnu
release: 1.78.0-nightly
LLVM version: 18.1.0

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

Program output

thread 'rustc' panicked at compiler/rustc_ast_lowering/src/expr.rs:326:77:
called `Option::unwrap()` on a `None` value
stack backtrace:
   0:     0x7f1058d8ce46 - std::backtrace_rs::backtrace::libunwind::trace::hef6ca8c9ff05aa0a
                               at /rustc/502ce8287bc3c86dca07acc38c5ff9431a6097be/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7f1058d8ce46 - std::backtrace_rs::backtrace::trace_unsynchronized::hb30822e6b7919c47
                               at /rustc/502ce8287bc3c86dca07acc38c5ff9431a6097be/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f1058d8ce46 - std::sys_common::backtrace::_print_fmt::h1f703c2afd9c4e56
                               at /rustc/502ce8287bc3c86dca07acc38c5ff9431a6097be/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7f1058d8ce46 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::ha2e21b66a3385ce5
                               at /rustc/502ce8287bc3c86dca07acc38c5ff9431a6097be/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f1058ddd46c - core::fmt::rt::Argument::fmt::hcd1e8c7041e5ed14
                               at /rustc/502ce8287bc3c86dca07acc38c5ff9431a6097be/library/core/src/fmt/rt.rs:142:9
   5:     0x7f1058ddd46c - core::fmt::write::h77a4d210f458f9fc
                               at /rustc/502ce8287bc3c86dca07acc38c5ff9431a6097be/library/core/src/fmt/mod.rs:1120:17
   6:     0x7f1058d807ef - std::io::Write::write_fmt::h15bb809fa04e147c
                               at /rustc/502ce8287bc3c86dca07acc38c5ff9431a6097be/library/std/src/io/mod.rs:1854:15
   7:     0x7f1058d8cbf4 - std::sys_common::backtrace::_print::h87585e724113690e
                               at /rustc/502ce8287bc3c86dca07acc38c5ff9431a6097be/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f1058d8cbf4 - std::sys_common::backtrace::print::haf0d2d33f1864f49
                               at /rustc/502ce8287bc3c86dca07acc38c5ff9431a6097be/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f1058d8f93b - std::panicking::default_hook::{{closure}}::h2b5712d85f6a0901
  10:     0x7f1058d8f689 - std::panicking::default_hook::h4ad63ec10ddd483d
                               at /rustc/502ce8287bc3c86dca07acc38c5ff9431a6097be/library/std/src/panicking.rs:292:9
  11:     0x7f105bbf315c - std[7cf124c558fcb2bf]::panicking::update_hook::<alloc[ea5cddfe48f16fea]::boxed::Box<rustc_driver_impl[82aae3524ab0b7f8]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f1058d900a0 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hed07387d774f1dce
                               at /rustc/502ce8287bc3c86dca07acc38c5ff9431a6097be/library/alloc/src/boxed.rs:2030:9
  13:     0x7f1058d900a0 - std::panicking::rust_panic_with_hook::hbd81dbb6d407ad32
                               at /rustc/502ce8287bc3c86dca07acc38c5ff9431a6097be/library/std/src/panicking.rs:785:13
  14:     0x7f1058d8fda9 - std::panicking::begin_panic_handler::{{closure}}::h59cb51a91c6c9c7d
                               at /rustc/502ce8287bc3c86dca07acc38c5ff9431a6097be/library/std/src/panicking.rs:651:13
  15:     0x7f1058d8d326 - std::sys_common::backtrace::__rust_end_short_backtrace::h08442929fe104458
                               at /rustc/502ce8287bc3c86dca07acc38c5ff9431a6097be/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x7f1058d8fb14 - rust_begin_unwind
                               at /rustc/502ce8287bc3c86dca07acc38c5ff9431a6097be/library/std/src/panicking.rs:647:5
  17:     0x7f1058dd9975 - core::panicking::panic_fmt::h0107ebfcc222a38a
                               at /rustc/502ce8287bc3c86dca07acc38c5ff9431a6097be/library/core/src/panicking.rs:72:14
  18:     0x7f1058dd9a33 - core::panicking::panic::h2128ec897528fc3c
                               at /rustc/502ce8287bc3c86dca07acc38c5ff9431a6097be/library/core/src/panicking.rs:144:5
  19:     0x7f1058dd9706 - core::option::unwrap_failed::hd1de7e3a153d73ce
                               at /rustc/502ce8287bc3c86dca07acc38c5ff9431a6097be/library/core/src/option.rs:1983:5
  20:     0x7f105d057f49 - <rustc_ast_lowering[393f0e0731473f24]::LoweringContext>::lower_expr_mut
  21:     0x7f105d052c94 - <rustc_ast_lowering[393f0e0731473f24]::LoweringContext>::lower_expr_mut
  22:     0x7f105d053e3f - <rustc_ast_lowering[393f0e0731473f24]::LoweringContext>::lower_expr_mut
  23:     0x7f105d8614f5 - <rustc_ast_lowering[393f0e0731473f24]::LoweringContext>::lower_block_noalloc
  24:     0x7f105d85cf9e - <rustc_ast_lowering[393f0e0731473f24]::LoweringContext>::lower_expr_mut::{closure#0}
  25:     0x7f105d85c35a - <rustc_ast_lowering[393f0e0731473f24]::LoweringContext>::lower_const_body
  26:     0x7f105daec196 - <rustc_ast_lowering[393f0e0731473f24]::LoweringContext>::lower_item_kind
  27:     0x7f105d061a64 - <rustc_ast_lowering[393f0e0731473f24]::item::ItemLowerer>::lower_node
  28:     0x7f105de39148 - rustc_ast_lowering[393f0e0731473f24]::lower_to_hir
  29:     0x7f105de388bc - rustc_query_impl[c1f81d4ed970b77f]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c1f81d4ed970b77f]::query_impl::hir_crate::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f5b3ce8587b47ad6]::query::erase::Erased<[u8; 8usize]>>
  30:     0x7f105dc1e58e - rustc_query_system[d1b725211d241e33]::query::plumbing::try_execute_query::<rustc_query_impl[c1f81d4ed970b77f]::DynamicConfig<rustc_query_system[d1b725211d241e33]::query::caches::SingleCache<rustc_middle[f5b3ce8587b47ad6]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[c1f81d4ed970b77f]::plumbing::QueryCtxt, false>
  31:     0x7f105dc1e0e0 - rustc_query_impl[c1f81d4ed970b77f]::query_impl::hir_crate::get_query_non_incr::__rust_end_short_backtrace
  32:     0x7f105d1c98c3 - rustc_query_impl[c1f81d4ed970b77f]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c1f81d4ed970b77f]::query_impl::hir_attrs::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f5b3ce8587b47ad6]::query::erase::Erased<[u8; 8usize]>>
  33:     0x7f105d1c8e23 - rustc_query_system[d1b725211d241e33]::query::plumbing::try_execute_query::<rustc_query_impl[c1f81d4ed970b77f]::DynamicConfig<rustc_query_system[d1b725211d241e33]::query::caches::VecCache<rustc_hir[6fa992176e24209c]::hir_id::OwnerId, rustc_middle[f5b3ce8587b47ad6]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[c1f81d4ed970b77f]::plumbing::QueryCtxt, false>
  34:     0x7f105d1c8b89 - rustc_query_impl[c1f81d4ed970b77f]::query_impl::hir_attrs::get_query_non_incr::__rust_end_short_backtrace
  35:     0x7f105ce1c6aa - <rustc_middle[f5b3ce8587b47ad6]::hir::map::Map>::attrs
  36:     0x7f105d81d382 - rustc_passes[9fd052a3157f7746]::entry::entry_fn
  37:     0x7f105d81d318 - rustc_query_impl[c1f81d4ed970b77f]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c1f81d4ed970b77f]::query_impl::entry_fn::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f5b3ce8587b47ad6]::query::erase::Erased<[u8; 12usize]>>
  38:     0x7f105d81d2f3 - <rustc_query_impl[c1f81d4ed970b77f]::query_impl::entry_fn::dynamic_query::{closure#2} as core[e53a522e144fbf44]::ops::function::FnOnce<(rustc_middle[f5b3ce8587b47ad6]::ty::context::TyCtxt, ())>>::call_once
  39:     0x7f105d81cc0a - rustc_query_system[d1b725211d241e33]::query::plumbing::try_execute_query::<rustc_query_impl[c1f81d4ed970b77f]::DynamicConfig<rustc_query_system[d1b725211d241e33]::query::caches::SingleCache<rustc_middle[f5b3ce8587b47ad6]::query::erase::Erased<[u8; 12usize]>>, false, false, false>, rustc_query_impl[c1f81d4ed970b77f]::plumbing::QueryCtxt, false>
  40:     0x7f105d81c9c5 - rustc_query_impl[c1f81d4ed970b77f]::query_impl::entry_fn::get_query_non_incr::__rust_end_short_backtrace
  41:     0x7f105d823bd8 - rustc_interface[f1e0aa0964ecdd2d]::passes::analysis
  42:     0x7f105d823ae9 - rustc_query_impl[c1f81d4ed970b77f]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c1f81d4ed970b77f]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[f5b3ce8587b47ad6]::query::erase::Erased<[u8; 1usize]>>
  43:     0x7f105ddb9125 - rustc_query_system[d1b725211d241e33]::query::plumbing::try_execute_query::<rustc_query_impl[c1f81d4ed970b77f]::DynamicConfig<rustc_query_system[d1b725211d241e33]::query::caches::SingleCache<rustc_middle[f5b3ce8587b47ad6]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[c1f81d4ed970b77f]::plumbing::QueryCtxt, false>
  44:     0x7f105ddb8e89 - rustc_query_impl[c1f81d4ed970b77f]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  45:     0x7f105dc327d5 - rustc_interface[f1e0aa0964ecdd2d]::interface::run_compiler::<core[e53a522e144fbf44]::result::Result<(), rustc_span[19fea007627efb2]::ErrorGuaranteed>, rustc_driver_impl[82aae3524ab0b7f8]::run_compiler::{closure#0}>::{closure#0}
  46:     0x7f105ddd0f98 - std[7cf124c558fcb2bf]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[f1e0aa0964ecdd2d]::util::run_in_thread_with_globals<rustc_interface[f1e0aa0964ecdd2d]::util::run_in_thread_pool_with_globals<rustc_interface[f1e0aa0964ecdd2d]::interface::run_compiler<core[e53a522e144fbf44]::result::Result<(), rustc_span[19fea007627efb2]::ErrorGuaranteed>, rustc_driver_impl[82aae3524ab0b7f8]::run_compiler::{closure#0}>::{closure#0}, core[e53a522e144fbf44]::result::Result<(), rustc_span[19fea007627efb2]::ErrorGuaranteed>>::{closure#0}, core[e53a522e144fbf44]::result::Result<(), rustc_span[19fea007627efb2]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[e53a522e144fbf44]::result::Result<(), rustc_span[19fea007627efb2]::ErrorGuaranteed>>
  47:     0x7f105ddd0dc4 - <<std[7cf124c558fcb2bf]::thread::Builder>::spawn_unchecked_<rustc_interface[f1e0aa0964ecdd2d]::util::run_in_thread_with_globals<rustc_interface[f1e0aa0964ecdd2d]::util::run_in_thread_pool_with_globals<rustc_interface[f1e0aa0964ecdd2d]::interface::run_compiler<core[e53a522e144fbf44]::result::Result<(), rustc_span[19fea007627efb2]::ErrorGuaranteed>, rustc_driver_impl[82aae3524ab0b7f8]::run_compiler::{closure#0}>::{closure#0}, core[e53a522e144fbf44]::result::Result<(), rustc_span[19fea007627efb2]::ErrorGuaranteed>>::{closure#0}, core[e53a522e144fbf44]::result::Result<(), rustc_span[19fea007627efb2]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[e53a522e144fbf44]::result::Result<(), rustc_span[19fea007627efb2]::ErrorGuaranteed>>::{closure#1} as core[e53a522e144fbf44]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  48:     0x7f1058d991e5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h5b233556e8a86423
                               at /rustc/502ce8287bc3c86dca07acc38c5ff9431a6097be/library/alloc/src/boxed.rs:2016:9
  49:     0x7f1058d991e5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h9f9dc4d80a9c44c9
                               at /rustc/502ce8287bc3c86dca07acc38c5ff9431a6097be/library/alloc/src/boxed.rs:2016:9
  50:     0x7f1058d991e5 - std::sys::pal::unix::thread::Thread::new::thread_start::hdbff39a3a9a3c450
                               at /rustc/502ce8287bc3c86dca07acc38c5ff9431a6097be/library/std/src/sys/pal/unix/thread.rs:108:17
  51:     0x7f1058b4a9eb - <unknown>
  52:     0x7f1058bce7cc - <unknown>
  53:                0x0 - <unknown>

error: 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.78.0-nightly (502ce8287 2024-02-14) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [hir_crate] getting the crate HIR
#1 [hir_attrs] getting HIR owner attributes in ``
#2 [entry_fn] looking up the entry function of a crate
#3 [analysis] running analysis passes on this crate
end of query stack
error: cannot determine resolution for the attribute macro `derive`
 --> /tmp/icemaker_global_tempdir.a2iOjzPWxH9q/rustc_testrunner_tmpdir_reporting.z3u82pkTiRc4/mvce.rs:1:4
  |
1 | #![derive(Clone, Copy)]
  |    ^^^^^^
  |
  = note: import resolution is stuck, try simplifying macro imports

error: cannot determine resolution for the macro `addr_of`
 --> /tmp/icemaker_global_tempdir.a2iOjzPWxH9q/rustc_testrunner_tmpdir_reporting.z3u82pkTiRc4/mvce.rs:6:14
  |
6 |     let v = *addr_of!(data).cast();
  |              ^^^^^^^
  |
  = note: import resolution is stuck, try simplifying macro imports

error: aborting due to 2 previous errors


Activity

  1. added
    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.
    C-bugCategory: This is a bug.
    on Feb 14, 2024
  2. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Feb 14, 2024
  3. matthiaskrgr commented on Feb 14, 2024

    @matthiaskrgr
    MemberAuthor
  4. jieyouxu commented on Feb 14, 2024

    @jieyouxu
    Member

    @rustbot label +D-diagnostic-infra +S-has-mcve -needs-triage

  5. added
    D-diagnostic-infraDiagnostics: Issues that affect all diagnostics, or relate to the diagnostic machinery itself.
    S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issue
    and removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Feb 14, 2024
  6. self-assigned this
    on Feb 14, 2024
  7. added a commit that references this issue on Feb 14, 2024
    64a9c9c
  8. added a commit that references this issue on Feb 15, 2024
    4899108
  9. added a commit that references this issue on Feb 15, 2024
    40402cd
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.D-diagnostic-infraDiagnostics: Issues that affect all diagnostics, or relate to the diagnostic machinery itself.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-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