Skip to content

ICE: fn_arg_names: unexpected item #105896

Closed
@matthiaskrgr

Description

@matthiaskrgr

Code

// run-pass
#![feature(intrinsics)]

mod dst {
    extern "rust-intrinsic" {
        pub fn dst<dst>(dst: *mut dst, dst: dst, dst: dst) -> dst;
    }
}

pub fn dst() {
    unsafe {
        let mut dst: dst<_> = dst::dst(1);
    }
}

pub fn main() {}

This crashes with rustc 1.68.0-nightly (107233789 2022-12-19) while rustc 1.68.0-nightly (d0dc9efff 2022-12-18) just gives an error.

Error output

error[E0573]: expected type, found module `dst`
  --> 659b4bf9cb28826af248db582fdd0c70e77d41f3.rs:12:22
   |
12 |         let mut dst: dst<_> = dst::dst(1);
   |                      ^^^^^^ not a type

warning: type parameter `dst` should have an upper camel case name
 --> 659b4bf9cb28826af248db582fdd0c70e77d41f3.rs:6:20
  |
6 |         pub fn dst<dst>(dst: *mut dst, dst: dst, dst: dst) -> dst;
  |                    ^^^ help: convert the identifier to upper camel case: `Dst`
  |
  = note: `#[warn(non_camel_case_types)]` on by default

error[E0093]: unrecognized intrinsic function: `dst`
 --> 659b4bf9cb28826af248db582fdd0c70e77d41f3.rs:6:9
  |
6 |         pub fn dst<dst>(dst: *mut dst, dst: dst, dst: dst) -> dst;
  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unrecognized intrinsic

error: internal compiler error: compiler/rustc_middle/src/hir/mod.rs:167:13: fn_arg_names: unexpected item DefId(0:5 ~ 659b4bf9cb28826af248db582fdd0c70e77d41f3[89ee]::dst::{extern#0}::dst)
 --> 659b4bf9cb28826af248db582fdd0c70e77d41f3.rs:6:9
  |
6 |         pub fn dst<dst>(dst: *mut dst, dst: dst, dst: dst) -> dst;
  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Backtrace


thread 'rustc' panicked at 'Box<dyn Any>', /rustc/10723378900ba2d25fc5d8baf785e1082f385832/compiler/rustc_errors/src/lib.rs:973:33
stack backtrace:
   0:     0x7f6c4a565a7a - std::backtrace_rs::backtrace::libunwind::trace::hbe817c0efe02d8ea
                               at /rustc/10723378900ba2d25fc5d8baf785e1082f385832/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f6c4a565a7a - std::backtrace_rs::backtrace::trace_unsynchronized::hf5eded12f70281f8
                               at /rustc/10723378900ba2d25fc5d8baf785e1082f385832/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f6c4a565a7a - std::sys_common::backtrace::_print_fmt::ha3eed1152d9ea99d
                               at /rustc/10723378900ba2d25fc5d8baf785e1082f385832/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f6c4a565a7a - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hcef547eb2d855e86
                               at /rustc/10723378900ba2d25fc5d8baf785e1082f385832/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f6c4a5c87ae - core::fmt::write::h8175b61341c45c99
                               at /rustc/10723378900ba2d25fc5d8baf785e1082f385832/library/core/src/fmt/mod.rs:1208:17
   5:     0x7f6c4a555e45 - std::io::Write::write_fmt::h40465d26406ea225
                               at /rustc/10723378900ba2d25fc5d8baf785e1082f385832/library/std/src/io/mod.rs:1682:15
   6:     0x7f6c4a565845 - std::sys_common::backtrace::_print::hbf0611de7b190873
                               at /rustc/10723378900ba2d25fc5d8baf785e1082f385832/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f6c4a565845 - std::sys_common::backtrace::print::h5f205ab6e7a3eaea
                               at /rustc/10723378900ba2d25fc5d8baf785e1082f385832/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f6c4a56858f - std::panicking::default_hook::{{closure}}::ha03d9b8e4a7bfeb3
                               at /rustc/10723378900ba2d25fc5d8baf785e1082f385832/library/std/src/panicking.rs:267:22
   9:     0x7f6c4a5682cb - std::panicking::default_hook::h7ce0af83af8235e2
                               at /rustc/10723378900ba2d25fc5d8baf785e1082f385832/library/std/src/panicking.rs:286:9
  10:     0x7f6c4d846dc1 - <rustc_driver[873c8147108e0c52]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[91b364b36d0cd5d9]::ops::function::FnOnce<(&core[91b364b36d0cd5d9]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  11:     0x7f6c4a568dcd - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h48d7f1a978d95664
                               at /rustc/10723378900ba2d25fc5d8baf785e1082f385832/library/alloc/src/boxed.rs:2032:9
  12:     0x7f6c4a568dcd - std::panicking::rust_panic_with_hook::he6c587b4a8d065dd
                               at /rustc/10723378900ba2d25fc5d8baf785e1082f385832/library/std/src/panicking.rs:692:13
  13:     0x7f6c4dceecd1 - std[b07903e9660f04f8]::panicking::begin_panic::<rustc_errors[4968f042fa50c46c]::ExplicitBug>::{closure#0}
  14:     0x7f6c4dcee546 - std[b07903e9660f04f8]::sys_common::backtrace::__rust_end_short_backtrace::<std[b07903e9660f04f8]::panicking::begin_panic<rustc_errors[4968f042fa50c46c]::ExplicitBug>::{closure#0}, !>
  15:     0x7f6c4dd493b6 - std[b07903e9660f04f8]::panicking::begin_panic::<rustc_errors[4968f042fa50c46c]::ExplicitBug>
  16:     0x7f6c4dcee386 - std[b07903e9660f04f8]::panic::panic_any::<rustc_errors[4968f042fa50c46c]::ExplicitBug>
  17:     0x7f6c4dceba82 - <rustc_errors[4968f042fa50c46c]::HandlerInner>::span_bug::<rustc_span[27e1a4b63f059171]::span_encoding::Span, &alloc[5ce7202016aa7b09]::string::String>
  18:     0x7f6c4dceb8a7 - <rustc_errors[4968f042fa50c46c]::Handler>::span_bug::<rustc_span[27e1a4b63f059171]::span_encoding::Span, &alloc[5ce7202016aa7b09]::string::String>
  19:     0x7f6c4ddb1099 - rustc_middle[3410431a177fd057]::ty::context::tls::with_context_opt::<rustc_middle[3410431a177fd057]::ty::context::tls::with_opt<rustc_middle[3410431a177fd057]::util::bug::opt_span_bug_fmt<rustc_span[27e1a4b63f059171]::span_encoding::Span>::{closure#0}, ()>::{closure#0}, ()>
  20:     0x7f6c4ddb1346 - rustc_middle[3410431a177fd057]::util::bug::opt_span_bug_fmt::<rustc_span[27e1a4b63f059171]::span_encoding::Span>
  21:     0x7f6c4c28d404 - rustc_middle[3410431a177fd057]::util::bug::span_bug_fmt::<rustc_span[27e1a4b63f059171]::span_encoding::Span>
  22:     0x7f6c4cd802e2 - <rustc_middle[3410431a177fd057]::hir::provide::{closure#8} as core[91b364b36d0cd5d9]::ops::function::FnOnce<(rustc_middle[3410431a177fd057]::ty::context::TyCtxt, rustc_span[27e1a4b63f059171]::def_id::DefId)>>::call_once
  23:     0x7f6c4ce3172f - rustc_query_system[19c1f136687b648f]::query::plumbing::try_execute_query::<rustc_query_impl[5090600b3e7be830]::plumbing::QueryCtxt, rustc_query_system[19c1f136687b648f]::query::caches::DefaultCache<rustc_span[27e1a4b63f059171]::def_id::DefId, &[rustc_span[27e1a4b63f059171]::symbol::Ident]>>
  24:     0x7f6c4ce3136d - rustc_query_system[19c1f136687b648f]::query::plumbing::get_query::<rustc_query_impl[5090600b3e7be830]::queries::fn_arg_names, rustc_query_impl[5090600b3e7be830]::plumbing::QueryCtxt>
  25:     0x7f6c4d9c0363 - <rustc_hir_typeck[e02b40bb426e936a]::fn_ctxt::FnCtxt>::report_arg_errors
  26:     0x7f6c4bac92b5 - <rustc_hir_typeck[e02b40bb426e936a]::fn_ctxt::FnCtxt>::check_argument_types
  27:     0x7f6c4bc77141 - <rustc_hir_typeck[e02b40bb426e936a]::fn_ctxt::FnCtxt>::check_call
  28:     0x7f6c4bbf6bfe - <rustc_hir_typeck[e02b40bb426e936a]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  29:     0x7f6c4bc47fea - <rustc_hir_typeck[e02b40bb426e936a]::fn_ctxt::FnCtxt>::check_decl
  30:     0x7f6c4bc450aa - <rustc_hir_typeck[e02b40bb426e936a]::fn_ctxt::FnCtxt>::check_block_with_expected
  31:     0x7f6c4bbf6ffa - <rustc_hir_typeck[e02b40bb426e936a]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  32:     0x7f6c4bc45217 - <rustc_hir_typeck[e02b40bb426e936a]::fn_ctxt::FnCtxt>::check_block_with_expected
  33:     0x7f6c4bbf6ffa - <rustc_hir_typeck[e02b40bb426e936a]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  34:     0x7f6c4bdb99b3 - <rustc_hir_typeck[e02b40bb426e936a]::fn_ctxt::FnCtxt>::check_return_expr
  35:     0x7f6c4bdb1717 - rustc_hir_typeck[e02b40bb426e936a]::check::check_fn
  36:     0x7f6c4bd9cadd - <rustc_hir_typeck[e02b40bb426e936a]::inherited::InheritedBuilder>::enter::<rustc_hir_typeck[e02b40bb426e936a]::typeck_with_fallback<rustc_hir_typeck[e02b40bb426e936a]::typeck::{closure#0}>::{closure#0}::{closure#1}, &rustc_middle[3410431a177fd057]::ty::typeck_results::TypeckResults>
  37:     0x7f6c4bd8fa61 - rustc_hir_typeck[e02b40bb426e936a]::typeck
  38:     0x7f6c4bd8dd44 - rustc_query_system[19c1f136687b648f]::query::plumbing::try_execute_query::<rustc_query_impl[5090600b3e7be830]::plumbing::QueryCtxt, rustc_query_system[19c1f136687b648f]::query::caches::VecCache<rustc_span[27e1a4b63f059171]::def_id::LocalDefId, &rustc_middle[3410431a177fd057]::ty::typeck_results::TypeckResults>>
  39:     0x7f6c4cfb0b85 - rustc_data_structures[bb3d73c199fb3f04]::sync::par_for_each_in::<&[rustc_span[27e1a4b63f059171]::def_id::LocalDefId], <rustc_middle[3410431a177fd057]::hir::map::Map>::par_body_owners<rustc_hir_typeck[e02b40bb426e936a]::typeck_item_bodies::{closure#0}>::{closure#0}>
  40:     0x7f6c4cfb08c3 - rustc_hir_typeck[e02b40bb426e936a]::typeck_item_bodies
  41:     0x7f6c4ce9d527 - rustc_query_system[19c1f136687b648f]::query::plumbing::try_execute_query::<rustc_query_impl[5090600b3e7be830]::plumbing::QueryCtxt, rustc_query_system[19c1f136687b648f]::query::caches::DefaultCache<(), ()>>
  42:     0x7f6c4ce9d230 - rustc_query_system[19c1f136687b648f]::query::plumbing::get_query::<rustc_query_impl[5090600b3e7be830]::queries::typeck_item_bodies, rustc_query_impl[5090600b3e7be830]::plumbing::QueryCtxt>
  43:     0x7f6c4bd79942 - <rustc_session[9e5269c5111e2834]::session::Session>::time::<(), rustc_hir_analysis[3468f65b6d968f91]::check_crate::{closure#7}>
  44:     0x7f6c4bd7883c - rustc_hir_analysis[3468f65b6d968f91]::check_crate
  45:     0x7f6c4bd7845b - rustc_interface[900f5b0893c40cbb]::passes::analysis
  46:     0x7f6c4d00aef7 - rustc_query_system[19c1f136687b648f]::query::plumbing::try_execute_query::<rustc_query_impl[5090600b3e7be830]::plumbing::QueryCtxt, rustc_query_system[19c1f136687b648f]::query::caches::DefaultCache<(), core[91b364b36d0cd5d9]::result::Result<(), rustc_errors[4968f042fa50c46c]::ErrorGuaranteed>>>
  47:     0x7f6c4d00abf0 - rustc_query_system[19c1f136687b648f]::query::plumbing::get_query::<rustc_query_impl[5090600b3e7be830]::queries::analysis, rustc_query_impl[5090600b3e7be830]::plumbing::QueryCtxt>
  48:     0x7f6c4cacf7e3 - <rustc_interface[900f5b0893c40cbb]::passes::QueryContext>::enter::<rustc_driver[873c8147108e0c52]::run_compiler::{closure#1}::{closure#2}::{closure#2}, core[91b364b36d0cd5d9]::result::Result<(), rustc_errors[4968f042fa50c46c]::ErrorGuaranteed>>
  49:     0x7f6c4cacbb93 - <rustc_interface[900f5b0893c40cbb]::interface::Compiler>::enter::<rustc_driver[873c8147108e0c52]::run_compiler::{closure#1}::{closure#2}, core[91b364b36d0cd5d9]::result::Result<core[91b364b36d0cd5d9]::option::Option<rustc_interface[900f5b0893c40cbb]::queries::Linker>, rustc_errors[4968f042fa50c46c]::ErrorGuaranteed>>
  50:     0x7f6c4cac6ba8 - rustc_span[27e1a4b63f059171]::with_source_map::<core[91b364b36d0cd5d9]::result::Result<(), rustc_errors[4968f042fa50c46c]::ErrorGuaranteed>, rustc_interface[900f5b0893c40cbb]::interface::run_compiler<core[91b364b36d0cd5d9]::result::Result<(), rustc_errors[4968f042fa50c46c]::ErrorGuaranteed>, rustc_driver[873c8147108e0c52]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  51:     0x7f6c4cac6695 - <scoped_tls[d12b376b8b570f08]::ScopedKey<rustc_span[27e1a4b63f059171]::SessionGlobals>>::set::<rustc_interface[900f5b0893c40cbb]::interface::run_compiler<core[91b364b36d0cd5d9]::result::Result<(), rustc_errors[4968f042fa50c46c]::ErrorGuaranteed>, rustc_driver[873c8147108e0c52]::run_compiler::{closure#1}>::{closure#0}, core[91b364b36d0cd5d9]::result::Result<(), rustc_errors[4968f042fa50c46c]::ErrorGuaranteed>>
  52:     0x7f6c4cac5c82 - std[b07903e9660f04f8]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[900f5b0893c40cbb]::util::run_in_thread_pool_with_globals<rustc_interface[900f5b0893c40cbb]::interface::run_compiler<core[91b364b36d0cd5d9]::result::Result<(), rustc_errors[4968f042fa50c46c]::ErrorGuaranteed>, rustc_driver[873c8147108e0c52]::run_compiler::{closure#1}>::{closure#0}, core[91b364b36d0cd5d9]::result::Result<(), rustc_errors[4968f042fa50c46c]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[91b364b36d0cd5d9]::result::Result<(), rustc_errors[4968f042fa50c46c]::ErrorGuaranteed>>
  53:     0x7f6c4d104e7a - <<std[b07903e9660f04f8]::thread::Builder>::spawn_unchecked_<rustc_interface[900f5b0893c40cbb]::util::run_in_thread_pool_with_globals<rustc_interface[900f5b0893c40cbb]::interface::run_compiler<core[91b364b36d0cd5d9]::result::Result<(), rustc_errors[4968f042fa50c46c]::ErrorGuaranteed>, rustc_driver[873c8147108e0c52]::run_compiler::{closure#1}>::{closure#0}, core[91b364b36d0cd5d9]::result::Result<(), rustc_errors[4968f042fa50c46c]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[91b364b36d0cd5d9]::result::Result<(), rustc_errors[4968f042fa50c46c]::ErrorGuaranteed>>::{closure#1} as core[91b364b36d0cd5d9]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  54:     0x7f6c4a572dc3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hd7b74f246c12bbb4
                               at /rustc/10723378900ba2d25fc5d8baf785e1082f385832/library/alloc/src/boxed.rs:2000:9
  55:     0x7f6c4a572dc3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h6cf02d6df8e8f9e1
                               at /rustc/10723378900ba2d25fc5d8baf785e1082f385832/library/alloc/src/boxed.rs:2000:9
  56:     0x7f6c4a572dc3 - std::sys::unix::thread::Thread::new::thread_start::h2eff8ab7597635da
                               at /rustc/10723378900ba2d25fc5d8baf785e1082f385832/library/std/src/sys/unix/thread.rs:108:17
  57:     0x7f6c4a3058fd - <unknown>
  58:     0x7f6c4a387a60 - <unknown>
  59:                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.68.0-nightly (107233789 2022-12-19) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [fn_arg_names] looking up function parameter names for `dst::dst`
#1 [typeck] type-checking `dst`
#2 [typeck_item_bodies] type-checking all item bodies
#3 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 3 previous errors; 1 warning emitted

Some errors have detailed explanations: E0093, E0573.
For more information about an error, try `rustc --explain E0093`.

Metadata

Metadata

Labels

C-bugCategory: This is a bug.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.requires-nightlyThis issue requires a nightly compiler in some way.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions