rust-lang/rust

ICE: `item_name: no name for DefPath`, `stmt_expr_attributes`

matthiaskrgr opened this issue · 0 comments

Code

#![crate_type = "lib"]
#![feature(stmt_expr_attributes)]

pub struct S([usize; 8]);

pub fn outer_function(x: S, y: S) -> usize {
    (#[no_mangle]
    || y.0[0])()
}

Meta

rustc --version --verbose:

rustc 1.70.0-nightly (13afbdaa0 2023-03-17)
binary: rustc
commit-hash: 13afbdaa0655dda23d7129e59ac48f1ec88b2084
commit-date: 2023-03-17
host: x86_64-unknown-linux-gnu
release: 1.70.0-nightly
LLVM version: 15.0.7

Error output

warning: attribute should be applied to a free function, impl method or static
 --> treereduce.out:7:6
  |
7 |       (#[no_mangle]
  |  _____-^^^^^^^^^^^^
8 | |     || y.0[0])()
  | |______________- not a free function, impl method or static
  |
  = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
  = note: `#[warn(unused_attributes)]` on by default

warning: unused variable: `x`
 --> treereduce.out:6:23
  |
6 | pub fn outer_function(x: S, y: S) -> usize {
  |                       ^ help: if this is intentional, prefix it with an underscore: `_x`
  |
  = note: `#[warn(unused_variables)]` on by default
Backtrace

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

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/compiler/rustc_errors/src/lib.rs:1644:9
stack backtrace:
   0:     0x7f74dc76739a - std::backtrace_rs::backtrace::libunwind::trace::h84d2711f38e4d049
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f74dc76739a - std::backtrace_rs::backtrace::trace_unsynchronized::h07f6ebc5344709db
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f74dc76739a - std::sys_common::backtrace::_print_fmt::h05a29271ab24b307
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f74dc76739a - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h2badcaa62266c6d2
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f74dc7ca9be - core::fmt::write::h029bd029dcf67de1
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/core/src/fmt/mod.rs:1254:17
   5:     0x7f74dc75a225 - std::io::Write::write_fmt::h80e1934b9bd451b8
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/io/mod.rs:1684:15
   6:     0x7f74dc767165 - std::sys_common::backtrace::_print::hd15e10f9274c89b0
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f74dc767165 - std::sys_common::backtrace::print::h170965e4e66b5ee4
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f74dc769edf - std::panicking::default_hook::{{closure}}::h0164004bb09e0366
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/panicking.rs:271:22
   9:     0x7f74dc769c1b - std::panicking::default_hook::h5e2940911ec5582f
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/panicking.rs:290:9
  10:     0x7f74df9f2415 - rustc_driver_impl[bad2ed848d64dbdc]::DEFAULT_HOOK::{closure#0}::{closure#0}
  11:     0x7f74dc76a71d - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h0f3cc38fa49d6ba4
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/alloc/src/boxed.rs:2002:9
  12:     0x7f74dc76a71d - std::panicking::rust_panic_with_hook::h591d1df500c4db69
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/panicking.rs:696:13
  13:     0x7f74dff2aef1 - std[b4247acdb72724ff]::panicking::begin_panic::<rustc_errors[48bb1377a0478866]::ExplicitBug>::{closure#0}
  14:     0x7f74dff28996 - std[b4247acdb72724ff]::sys_common::backtrace::__rust_end_short_backtrace::<std[b4247acdb72724ff]::panicking::begin_panic<rustc_errors[48bb1377a0478866]::ExplicitBug>::{closure#0}, !>
  15:     0x7f74dff3ec96 - std[b4247acdb72724ff]::panicking::begin_panic::<rustc_errors[48bb1377a0478866]::ExplicitBug>
  16:     0x7f74dffa10d6 - std[b4247acdb72724ff]::panic::panic_any::<rustc_errors[48bb1377a0478866]::ExplicitBug>
  17:     0x7f74dff9e896 - <rustc_errors[48bb1377a0478866]::HandlerInner>::bug::<&alloc[c5857ad37805d36e]::string::String>
  18:     0x7f74dff9e560 - <rustc_errors[48bb1377a0478866]::Handler>::bug::<&alloc[c5857ad37805d36e]::string::String>
  19:     0x7f74dff9684b - rustc_middle[eaf6378de1cdbfa8]::util::bug::opt_span_bug_fmt::<rustc_span[4d522547309d7b79]::span_encoding::Span>::{closure#0}
  20:     0x7f74dff9529a - rustc_middle[eaf6378de1cdbfa8]::ty::context::tls::with_opt::<rustc_middle[eaf6378de1cdbfa8]::util::bug::opt_span_bug_fmt<rustc_span[4d522547309d7b79]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7f74dff95266 - rustc_middle[eaf6378de1cdbfa8]::ty::context::tls::with_context_opt::<rustc_middle[eaf6378de1cdbfa8]::ty::context::tls::with_opt<rustc_middle[eaf6378de1cdbfa8]::util::bug::opt_span_bug_fmt<rustc_span[4d522547309d7b79]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7f74dff96796 - rustc_middle[eaf6378de1cdbfa8]::util::bug::opt_span_bug_fmt::<rustc_span[4d522547309d7b79]::span_encoding::Span>
  23:     0x7f74de0874e3 - rustc_middle[eaf6378de1cdbfa8]::util::bug::bug_fmt
  24:     0x7f74de11f4c8 - <rustc_middle[eaf6378de1cdbfa8]::ty::context::TyCtxt>::item_name
  25:     0x7f74de5ced57 - rustc_symbol_mangling[fb7e6a15e9045b51]::symbol_name_provider
  26:     0x7f74de5c847d - rustc_query_system[3b264ab6e948b942]::query::plumbing::try_execute_query::<rustc_query_impl[1cc93b35ef872c79]::queries::symbol_name, rustc_query_impl[1cc93b35ef872c79]::plumbing::QueryCtxt>
  27:     0x7f74ddebd4fe - <rustc_middle[eaf6378de1cdbfa8]::mir::mono::MonoItem>::symbol_name
  28:     0x7f74dee959b9 - <alloc[c5857ad37805d36e]::vec::Vec<(&rustc_middle[eaf6378de1cdbfa8]::mir::mono::MonoItem, rustc_middle[eaf6378de1cdbfa8]::ty::SymbolName)> as alloc[c5857ad37805d36e]::vec::spec_from_iter::SpecFromIter<(&rustc_middle[eaf6378de1cdbfa8]::mir::mono::MonoItem, rustc_middle[eaf6378de1cdbfa8]::ty::SymbolName), core[9847d4a2e8a02df2]::iter::adapters::map::Map<std[b4247acdb72724ff]::collections::hash::set::Iter<rustc_middle[eaf6378de1cdbfa8]::mir::mono::MonoItem>, rustc_monomorphize[589fc27a96a813aa]::partitioning::assert_symbols_are_distinct<std[b4247acdb72724ff]::collections::hash::set::Iter<rustc_middle[eaf6378de1cdbfa8]::mir::mono::MonoItem>>::{closure#0}>>>::from_iter
  29:     0x7f74dee95561 - rustc_monomorphize[589fc27a96a813aa]::partitioning::assert_symbols_are_distinct::<std[b4247acdb72724ff]::collections::hash::set::Iter<rustc_middle[eaf6378de1cdbfa8]::mir::mono::MonoItem>>
  30:     0x7f74dee947c0 - rustc_data_structures[8426954b093953dd]::sync::join::<rustc_monomorphize[589fc27a96a813aa]::partitioning::collect_and_partition_mono_items::{closure#0}::{closure#0}, rustc_monomorphize[589fc27a96a813aa]::partitioning::collect_and_partition_mono_items::{closure#0}::{closure#1}, &[rustc_middle[eaf6378de1cdbfa8]::mir::mono::CodegenUnit], ()>
  31:     0x7f74dee93206 - rustc_monomorphize[589fc27a96a813aa]::partitioning::collect_and_partition_mono_items
  32:     0x7f74debe98b2 - rustc_query_system[3b264ab6e948b942]::query::plumbing::try_execute_query::<rustc_query_impl[1cc93b35ef872c79]::queries::collect_and_partition_mono_items, rustc_query_impl[1cc93b35ef872c79]::plumbing::QueryCtxt>
  33:     0x7f74debe956d - <rustc_query_impl[1cc93b35ef872c79]::Queries as rustc_middle[eaf6378de1cdbfa8]::ty::query::QueryEngine>::collect_and_partition_mono_items
  34:     0x7f74df1b3e17 - rustc_codegen_ssa[4bc24aeebcd9fcf0]::back::symbol_export::exported_symbols_provider_local
  35:     0x7f74df15449a - rustc_query_system[3b264ab6e948b942]::query::plumbing::try_execute_query::<rustc_query_impl[1cc93b35ef872c79]::queries::exported_symbols, rustc_query_impl[1cc93b35ef872c79]::plumbing::QueryCtxt>
  36:     0x7f74df1540f1 - <rustc_query_impl[1cc93b35ef872c79]::Queries as rustc_middle[eaf6378de1cdbfa8]::ty::query::QueryEngine>::exported_symbols
  37:     0x7f74dec7eb41 - <rustc_metadata[e926187d3f7f9ccf]::rmeta::encoder::EncodeContext>::encode_crate_root
  38:     0x7f74dec11c53 - rustc_metadata[e926187d3f7f9ccf]::rmeta::encoder::encode_metadata_impl
  39:     0x7f74dec072ac - rustc_data_structures[8426954b093953dd]::sync::join::<rustc_metadata[e926187d3f7f9ccf]::rmeta::encoder::encode_metadata::{closure#0}, rustc_metadata[e926187d3f7f9ccf]::rmeta::encoder::encode_metadata::{closure#1}, (), ()>
  40:     0x7f74dec06fc1 - rustc_metadata[e926187d3f7f9ccf]::rmeta::encoder::encode_metadata
  41:     0x7f74dec0632a - rustc_metadata[e926187d3f7f9ccf]::fs::encode_and_write_metadata
  42:     0x7f74debfdc9e - rustc_interface[dde792dfc5bb5edd]::passes::start_codegen
  43:     0x7f74debfaa38 - <rustc_middle[eaf6378de1cdbfa8]::ty::context::GlobalCtxt>::enter::<<rustc_interface[dde792dfc5bb5edd]::queries::Queries>::ongoing_codegen::{closure#0}::{closure#0}, core[9847d4a2e8a02df2]::result::Result<alloc[c5857ad37805d36e]::boxed::Box<dyn core[9847d4a2e8a02df2]::any::Any>, rustc_span[4d522547309d7b79]::ErrorGuaranteed>>
  44:     0x7f74debf8f94 - <rustc_interface[dde792dfc5bb5edd]::queries::Queries>::ongoing_codegen
  45:     0x7f74debf8561 - <rustc_interface[dde792dfc5bb5edd]::interface::Compiler>::enter::<rustc_driver_impl[bad2ed848d64dbdc]::run_compiler::{closure#1}::{closure#2}, core[9847d4a2e8a02df2]::result::Result<core[9847d4a2e8a02df2]::option::Option<rustc_interface[dde792dfc5bb5edd]::queries::Linker>, rustc_span[4d522547309d7b79]::ErrorGuaranteed>>
  46:     0x7f74debf6630 - rustc_span[4d522547309d7b79]::with_source_map::<core[9847d4a2e8a02df2]::result::Result<(), rustc_span[4d522547309d7b79]::ErrorGuaranteed>, rustc_interface[dde792dfc5bb5edd]::interface::run_compiler<core[9847d4a2e8a02df2]::result::Result<(), rustc_span[4d522547309d7b79]::ErrorGuaranteed>, rustc_driver_impl[bad2ed848d64dbdc]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  47:     0x7f74debf5bd9 - std[b4247acdb72724ff]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[dde792dfc5bb5edd]::util::run_in_thread_pool_with_globals<rustc_interface[dde792dfc5bb5edd]::interface::run_compiler<core[9847d4a2e8a02df2]::result::Result<(), rustc_span[4d522547309d7b79]::ErrorGuaranteed>, rustc_driver_impl[bad2ed848d64dbdc]::run_compiler::{closure#1}>::{closure#0}, core[9847d4a2e8a02df2]::result::Result<(), rustc_span[4d522547309d7b79]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[9847d4a2e8a02df2]::result::Result<(), rustc_span[4d522547309d7b79]::ErrorGuaranteed>>
  48:     0x7f74df2e6afa - <<std[b4247acdb72724ff]::thread::Builder>::spawn_unchecked_<rustc_interface[dde792dfc5bb5edd]::util::run_in_thread_pool_with_globals<rustc_interface[dde792dfc5bb5edd]::interface::run_compiler<core[9847d4a2e8a02df2]::result::Result<(), rustc_span[4d522547309d7b79]::ErrorGuaranteed>, rustc_driver_impl[bad2ed848d64dbdc]::run_compiler::{closure#1}>::{closure#0}, core[9847d4a2e8a02df2]::result::Result<(), rustc_span[4d522547309d7b79]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[9847d4a2e8a02df2]::result::Result<(), rustc_span[4d522547309d7b79]::ErrorGuaranteed>>::{closure#1} as core[9847d4a2e8a02df2]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  49:     0x7f74dc7745f3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h51bca2043facf7d3
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/alloc/src/boxed.rs:1988:9
  50:     0x7f74dc7745f3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h365da710d54db7ab
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/alloc/src/boxed.rs:1988:9
  51:     0x7f74dc7745f3 - std::sys::unix::thread::Thread::new::thread_start::hb322f3a535acf0fe
                               at /rustc/13afbdaa0655dda23d7129e59ac48f1ec88b2084/library/std/src/sys/unix/thread.rs:108:17
  52:     0x7f74dc4c0bb5 - <unknown>
  53:     0x7f74dc542d90 - <unknown>
  54:                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.70.0-nightly (13afbdaa0 2023-03-17) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [symbol_name] computing the symbol for `outer_function::{closure#0}`
#1 [collect_and_partition_mono_items] collect_and_partition_mono_items
#2 [exported_symbols] collecting exported symbols for crate `0`
end of query stack
error: aborting due to previous error; 2 warnings emitted