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: item_name: no name for DefPath #123243

Closed
matthiaskrgr opened this issue Mar 30, 2024 · 1 comment · Fixed by #123310
Closed

ICE: item_name: no name for DefPath #123243

matthiaskrgr opened this issue Mar 30, 2024 · 1 comment · Fixed by #123310
Labels
A-codegen Area: Code generation 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.

Comments

@matthiaskrgr
Copy link
Member

Guess this is the ticket that was never created for #71212 (comment)

auto-reduced (treereduce-rust):

pub mod a {
    #[no_mangle]
    pub static mut FOO: &mut [i32] = &mut [42];
}

fn main() {}

original:

#![feature(const_mut_refs)]
pub mod a {
    #[no_mangle]
    pub static mut FOO: &mut [i32] = &mut [42];
}

pub mod b {
    #[no_mangle]
    pub static mut BAR: &mut [i32] = unsafe { &mut *crate::a::FOO };
}

fn main() {
    unsafe {
        assert_eq!(a::FOO.as_ptr(), b::BAR.as_ptr());
    }
}

Version information

rustc 1.79.0-nightly (ef4936510 2024-03-30)
binary: rustc
commit-hash: ef493651025db2d5c38225c12ef97fd832c00c4a
commit-date: 2024-03-30
host: x86_64-unknown-linux-gnu
release: 1.79.0-nightly
LLVM version: 18.1.2

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

Program output

error: internal compiler error: compiler/rustc_middle/src/ty/mod.rs:1631:13: item_name: no name for DefPath { data: [DisambiguatedDefPathData { data: TypeNs("a"), disambiguator: 0 }, DisambiguatedDefPathData { data: ValueNs("FOO"), disambiguator: 0 }, DisambiguatedDefPathData { data: AnonConst, disambiguator: 0 }], krate: crate0 }

thread 'rustc' panicked at compiler/rustc_middle/src/ty/mod.rs:1631:13:
Box<dyn Any>
stack backtrace:
   0:     0x7a7c6b5196c5 - std::backtrace_rs::backtrace::libunwind::trace::hc28d290282a0116e
                               at /rustc/ef493651025db2d5c38225c12ef97fd832c00c4a/library/std/src/../../backtrace/src/backtrace/libunwind.rs:105:5
   1:     0x7a7c6b5196c5 - std::backtrace_rs::backtrace::trace_unsynchronized::hea8c781e268ac866
                               at /rustc/ef493651025db2d5c38225c12ef97fd832c00c4a/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7a7c6b5196c5 - std::sys_common::backtrace::_print_fmt::h5968ef18c21ec464
                               at /rustc/ef493651025db2d5c38225c12ef97fd832c00c4a/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7a7c6b5196c5 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h0e18bed46c2684f7
                               at /rustc/ef493651025db2d5c38225c12ef97fd832c00c4a/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7a7c6b56a74b - core::fmt::rt::Argument::fmt::hbc4e85c7a1c65cbb
                               at /rustc/ef493651025db2d5c38225c12ef97fd832c00c4a/library/core/src/fmt/rt.rs:142:9
   5:     0x7a7c6b56a74b - core::fmt::write::h854a694ad7e22c0c
                               at /rustc/ef493651025db2d5c38225c12ef97fd832c00c4a/library/core/src/fmt/mod.rs:1153:17
   6:     0x7a7c6b50e2af - std::io::Write::write_fmt::h4349e03f9303ee09
                               at /rustc/ef493651025db2d5c38225c12ef97fd832c00c4a/library/std/src/io/mod.rs:1843:15
   7:     0x7a7c6b51949e - std::sys_common::backtrace::_print::h243c83ace43ed33a
                               at /rustc/ef493651025db2d5c38225c12ef97fd832c00c4a/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7a7c6b51949e - std::sys_common::backtrace::print::h2d55f69703150a7b
                               at /rustc/ef493651025db2d5c38225c12ef97fd832c00c4a/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7a7c6b51c149 - std::panicking::default_hook::{{closure}}::h8dc6034aee29decb
  10:     0x7a7c6b51beb3 - std::panicking::default_hook::h56520e57fc8269f5
                               at /rustc/ef493651025db2d5c38225c12ef97fd832c00c4a/library/std/src/panicking.rs:292:9
  11:     0x7a7c67e001de - std[f64e62e47cc83539]::panicking::update_hook::<alloc[bb78173f19f05b74]::boxed::Box<rustc_driver_impl[a4188e147e7947d]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7a7c6b51c84c - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hea7201e35d9c3ad4
                               at /rustc/ef493651025db2d5c38225c12ef97fd832c00c4a/library/alloc/src/boxed.rs:2032:9
  13:     0x7a7c6b51c84c - std::panicking::rust_panic_with_hook::h2c9c8efc2d7819e0
                               at /rustc/ef493651025db2d5c38225c12ef97fd832c00c4a/library/std/src/panicking.rs:793:13
  14:     0x7a7c67e301a4 - std[f64e62e47cc83539]::panicking::begin_panic::<rustc_errors[7507ac2b93ad6780]::ExplicitBug>::{closure#0}
  15:     0x7a7c67e2cf16 - std[f64e62e47cc83539]::sys_common::backtrace::__rust_end_short_backtrace::<std[f64e62e47cc83539]::panicking::begin_panic<rustc_errors[7507ac2b93ad6780]::ExplicitBug>::{closure#0}, !>
  16:     0x7a7c67e2cbf6 - std[f64e62e47cc83539]::panicking::begin_panic::<rustc_errors[7507ac2b93ad6780]::ExplicitBug>
  17:     0x7a7c67e39401 - <rustc_errors[7507ac2b93ad6780]::diagnostic::BugAbort as rustc_errors[7507ac2b93ad6780]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  18:     0x7a7c682cdacc - rustc_middle[9869adca887e2ba2]::util::bug::opt_span_bug_fmt::<rustc_span[943c03d33bb8b9a7]::span_encoding::Span>::{closure#0}
  19:     0x7a7c682b0f8a - rustc_middle[9869adca887e2ba2]::ty::context::tls::with_opt::<rustc_middle[9869adca887e2ba2]::util::bug::opt_span_bug_fmt<rustc_span[943c03d33bb8b9a7]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  20:     0x7a7c682b0e2b - rustc_middle[9869adca887e2ba2]::ty::context::tls::with_context_opt::<rustc_middle[9869adca887e2ba2]::ty::context::tls::with_opt<rustc_middle[9869adca887e2ba2]::util::bug::opt_span_bug_fmt<rustc_span[943c03d33bb8b9a7]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  21:     0x7a7c65efea00 - rustc_middle[9869adca887e2ba2]::util::bug::bug_fmt
  22:     0x7a7c6a2ab5a0 - <rustc_middle[9869adca887e2ba2]::ty::context::TyCtxt>::item_name
  23:     0x7a7c6956c9e6 - rustc_symbol_mangling[98f33ffdb70809d3]::symbol_name_provider
  24:     0x7a7c6956acc8 - rustc_query_impl[74fb6ca467066e1c]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[74fb6ca467066e1c]::query_impl::symbol_name::dynamic_query::{closure#2}::{closure#0}, rustc_middle[9869adca887e2ba2]::query::erase::Erased<[u8; 16usize]>>
  25:     0x7a7c69569c64 - rustc_query_system[119b49fc53e45c67]::query::plumbing::try_execute_query::<rustc_query_impl[74fb6ca467066e1c]::DynamicConfig<rustc_query_system[119b49fc53e45c67]::query::caches::DefaultCache<rustc_middle[9869adca887e2ba2]::ty::instance::Instance, rustc_middle[9869adca887e2ba2]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[74fb6ca467066e1c]::plumbing::QueryCtxt, false>
  26:     0x7a7c695698e8 - rustc_query_impl[74fb6ca467066e1c]::query_impl::symbol_name::get_query_non_incr::__rust_end_short_backtrace
  27:     0x7a7c69c87a66 - rustc_middle[9869adca887e2ba2]::query::plumbing::query_get_at::<rustc_query_system[119b49fc53e45c67]::query::caches::DefaultCache<rustc_middle[9869adca887e2ba2]::ty::instance::Instance, rustc_middle[9869adca887e2ba2]::query::erase::Erased<[u8; 16usize]>>>
  28:     0x7a7c69339ba7 - rustc_monomorphize[ad57543fff614c09]::partitioning::assert_symbols_are_distinct::<std[f64e62e47cc83539]::collections::hash::set::Iter<rustc_middle[9869adca887e2ba2]::mir::mono::MonoItem>>
  29:     0x7a7c6a0151ea - rustc_monomorphize[ad57543fff614c09]::partitioning::collect_and_partition_mono_items
  30:     0x7a7c6a0145b0 - rustc_query_impl[74fb6ca467066e1c]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[74fb6ca467066e1c]::query_impl::collect_and_partition_mono_items::dynamic_query::{closure#2}::{closure#0}, rustc_middle[9869adca887e2ba2]::query::erase::Erased<[u8; 24usize]>>
  31:     0x7a7c6a014595 - <rustc_query_impl[74fb6ca467066e1c]::query_impl::collect_and_partition_mono_items::dynamic_query::{closure#2} as core[14e3cd74f4fa99b5]::ops::function::FnOnce<(rustc_middle[9869adca887e2ba2]::ty::context::TyCtxt, ())>>::call_once
  32:     0x7a7c6a013014 - rustc_query_system[119b49fc53e45c67]::query::plumbing::try_execute_query::<rustc_query_impl[74fb6ca467066e1c]::DynamicConfig<rustc_query_system[119b49fc53e45c67]::query::caches::SingleCache<rustc_middle[9869adca887e2ba2]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[74fb6ca467066e1c]::plumbing::QueryCtxt, false>
  33:     0x7a7c6a012d0b - rustc_query_impl[74fb6ca467066e1c]::query_impl::collect_and_partition_mono_items::get_query_non_incr::__rust_end_short_backtrace
  34:     0x7a7c6a0f246a - rustc_codegen_ssa[31ac75f9d021ea0a]::base::codegen_crate::<rustc_codegen_llvm[cf65e4b907d49d9e]::LlvmCodegenBackend>
  35:     0x7a7c6a0e5782 - <rustc_codegen_llvm[cf65e4b907d49d9e]::LlvmCodegenBackend as rustc_codegen_ssa[31ac75f9d021ea0a]::traits::backend::CodegenBackend>::codegen_crate
  36:     0x7a7c6a0e5105 - rustc_interface[dc383db41dd6a1d7]::passes::start_codegen
  37:     0x7a7c6a0e4774 - <rustc_interface[dc383db41dd6a1d7]::queries::Queries>::codegen_and_build_linker
  38:     0x7a7c69e515c4 - rustc_interface[dc383db41dd6a1d7]::interface::run_compiler::<core[14e3cd74f4fa99b5]::result::Result<(), rustc_span[943c03d33bb8b9a7]::ErrorGuaranteed>, rustc_driver_impl[a4188e147e7947d]::run_compiler::{closure#0}>::{closure#0}
  39:     0x7a7c69f7797f - std[f64e62e47cc83539]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[dc383db41dd6a1d7]::util::run_in_thread_with_globals<rustc_interface[dc383db41dd6a1d7]::util::run_in_thread_pool_with_globals<rustc_interface[dc383db41dd6a1d7]::interface::run_compiler<core[14e3cd74f4fa99b5]::result::Result<(), rustc_span[943c03d33bb8b9a7]::ErrorGuaranteed>, rustc_driver_impl[a4188e147e7947d]::run_compiler::{closure#0}>::{closure#0}, core[14e3cd74f4fa99b5]::result::Result<(), rustc_span[943c03d33bb8b9a7]::ErrorGuaranteed>>::{closure#0}, core[14e3cd74f4fa99b5]::result::Result<(), rustc_span[943c03d33bb8b9a7]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[14e3cd74f4fa99b5]::result::Result<(), rustc_span[943c03d33bb8b9a7]::ErrorGuaranteed>>
  40:     0x7a7c69f77772 - <<std[f64e62e47cc83539]::thread::Builder>::spawn_unchecked_<rustc_interface[dc383db41dd6a1d7]::util::run_in_thread_with_globals<rustc_interface[dc383db41dd6a1d7]::util::run_in_thread_pool_with_globals<rustc_interface[dc383db41dd6a1d7]::interface::run_compiler<core[14e3cd74f4fa99b5]::result::Result<(), rustc_span[943c03d33bb8b9a7]::ErrorGuaranteed>, rustc_driver_impl[a4188e147e7947d]::run_compiler::{closure#0}>::{closure#0}, core[14e3cd74f4fa99b5]::result::Result<(), rustc_span[943c03d33bb8b9a7]::ErrorGuaranteed>>::{closure#0}, core[14e3cd74f4fa99b5]::result::Result<(), rustc_span[943c03d33bb8b9a7]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[14e3cd74f4fa99b5]::result::Result<(), rustc_span[943c03d33bb8b9a7]::ErrorGuaranteed>>::{closure#1} as core[14e3cd74f4fa99b5]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  41:     0x7a7c6b5261a9 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h0776fb0ce93ed35e
                               at /rustc/ef493651025db2d5c38225c12ef97fd832c00c4a/library/alloc/src/boxed.rs:2018:9
  42:     0x7a7c6b5261a9 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h0210ee959262dd00
                               at /rustc/ef493651025db2d5c38225c12ef97fd832c00c4a/library/alloc/src/boxed.rs:2018:9
  43:     0x7a7c6b5261a9 - std::sys::pal::unix::thread::Thread::new::thread_start::h3824f8b11b1eb421
                               at /rustc/ef493651025db2d5c38225c12ef97fd832c00c4a/library/std/src/sys/pal/unix/thread.rs:108:17
  44:     0x7a7c64ca955a - <unknown>
  45:     0x7a7c64d26a3c - <unknown>
  46:                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: rustc 1.79.0-nightly (ef4936510 2024-03-30) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [symbol_name] computing the symbol for `a::FOO::{constant#0}`
#1 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
error: aborting due to 1 previous error


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

matthiaskrgr commented Mar 30, 2024

Interestingly the original bisects to #121644 which is way younger than the snippet 🤔

@bors bors closed this as completed in 3d5528c Apr 1, 2024
@jieyouxu jieyouxu added A-codegen Area: Code generation and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation 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.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants