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: does not have a "fn_arg_names"' #130015

Closed
matthiaskrgr opened this issue Sep 6, 2024 · 1 comment · Fixed by #130033
Closed

ICE: does not have a "fn_arg_names"' #130015

matthiaskrgr opened this issue Sep 6, 2024 · 1 comment · Fixed by #130033
Assignees
Labels
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

auto-reduced (treereduce-rust):

use std::ops::Index;

impl<T, F, Idx> Index<Idx> for Map<T, Output> {}

original:

// Test against ICE in #118111

use std::ops::Index;

struct Map<T, F> {
    f: F,
    inner: T,
}

impl<T, F, Idx> Index<Idx> for Map<T, Output>
where
    T: FnOnce(&T, Idx) -> Idx,
    F: FnOnce(&T, Idx) -> Idx
{
    type Output = T::Output;

    fn index(&self, index: Idx) -> &T {
    Map { inner: [0_usize], f: |_, i: usize| 1_usize }[0];
    //~^ ERROR cannot index into a value of type
    // Problem here is that
    //   `f: |_, i: usize| ...`
    // should be
    //   `f: |_: &_, i: usize| ...`
}
}

fn main() {
    Map { 0, f: |_, i: usize| 1_usize }[0];
    //~^ ERROR cannot index into a value of type
    // Problem here is that
    f: |_, i: usize| 1_usize~^ ERROR cannot index into a value of type
    // should be
    //   `f: |_: &_, i: usize| ...`
}

Version information

rustc 1.83.0-nightly (54fdef779 2024-09-06)
binary: rustc
commit-hash: 54fdef7799d9ff9470bb5cabd29fde9471a99eaa
commit-date: 2024-09-06
host: x86_64-unknown-linux-gnu
release: 1.83.0-nightly
LLVM version: 19.1.0

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

Program output

thread 'rustc' panicked at compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs:244:1:
DefId(2:43557 ~ core[ef64]::ops::index::Index::Output) does not have a "fn_arg_names"
stack backtrace:
   0:     0x72aa5404caea - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::ha06606287bbc0d40
   1:     0x72aa548032d7 - core::fmt::write::h900168b8d6b18d0e
   2:     0x72aa55a98b11 - std::io::Write::write_fmt::h37096a98cee6aecc
   3:     0x72aa5404c942 - std::sys::backtrace::BacktraceLock::print::ha41d7d8ec1d7827c
   4:     0x72aa5404ee61 - std::panicking::default_hook::{{closure}}::hca14ab024825d53f
   5:     0x72aa5404ec94 - std::panicking::default_hook::h4858525b39283b35
   6:     0x72aa531646df - std[6d8313e6711de5ec]::panicking::update_hook::<alloc[69e5093c240c6a93]::boxed::Box<rustc_driver_impl[bb97483d227938cc]::install_ice_hook::{closure#0}>>::{closure#0}
   7:     0x72aa5404f588 - std::panicking::rust_panic_with_hook::h018e63ac98cfb250
   8:     0x72aa5404f357 - std::panicking::begin_panic_handler::{{closure}}::h47a7576b8040d795
   9:     0x72aa5404cf99 - std::sys::backtrace::__rust_end_short_backtrace::hb0b79a031dbb259b
  10:     0x72aa5404f024 - rust_begin_unwind
  11:     0x72aa50e8e103 - core::panicking::panic_fmt::hbbbf440be8216850
  12:     0x72aa53717f22 - rustc_metadata[5ce0ef877c353d66]::rmeta::decoder::cstore_impl::provide_extern::fn_arg_names::{closure#2}
  13:     0x72aa53717dae - rustc_metadata[5ce0ef877c353d66]::rmeta::decoder::cstore_impl::provide_extern::fn_arg_names
  14:     0x72aa55d43269 - rustc_query_impl[627e742369ef9b00]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[627e742369ef9b00]::query_impl::fn_arg_names::dynamic_query::{closure#2}::{closure#0}, rustc_middle[7c194d2c51ee7d6b]::query::erase::Erased<[u8; 16usize]>>.cold
  15:     0x72aa54a924d5 - <rustc_query_impl[627e742369ef9b00]::query_impl::fn_arg_names::dynamic_query::{closure#2} as core[ef64e34f4f685035]::ops::function::FnOnce<(rustc_middle[7c194d2c51ee7d6b]::ty::context::TyCtxt, rustc_span[554534721cb6ceca]::def_id::DefId)>>::call_once
  16:     0x72aa54d76a01 - rustc_query_system[989e049842c55218]::query::plumbing::try_execute_query::<rustc_query_impl[627e742369ef9b00]::DynamicConfig<rustc_query_system[989e049842c55218]::query::caches::DefIdCache<rustc_middle[7c194d2c51ee7d6b]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[627e742369ef9b00]::plumbing::QueryCtxt, false>
  17:     0x72aa54d762ee - rustc_query_impl[627e742369ef9b00]::query_impl::fn_arg_names::get_query_non_incr::__rust_end_short_backtrace
  18:     0x72aa54d75163 - rustc_middle[7c194d2c51ee7d6b]::query::plumbing::query_get_at::<rustc_query_system[989e049842c55218]::query::caches::DefIdCache<rustc_middle[7c194d2c51ee7d6b]::query::erase::Erased<[u8; 16usize]>>>
  19:     0x72aa53c56760 - <rustc_resolve[8f914cbac3712a73]::late::LateResolutionVisitor>::try_lookup_name_relaxed
  20:     0x72aa53c4ef91 - <rustc_resolve[8f914cbac3712a73]::late::LateResolutionVisitor>::smart_resolve_report_errors
  21:     0x72aa516b798c - <rustc_resolve[8f914cbac3712a73]::late::LateResolutionVisitor>::smart_resolve_path_fragment::{closure#0}
  22:     0x72aa553564d6 - <rustc_resolve[8f914cbac3712a73]::late::LateResolutionVisitor>::smart_resolve_path_fragment
  23:     0x72aa516af194 - <rustc_resolve[8f914cbac3712a73]::late::LateResolutionVisitor as rustc_ast[4a29b632a72979d1]::visit::Visitor>::visit_ty
  24:     0x72aa5534e4c6 - <rustc_resolve[8f914cbac3712a73]::late::LateResolutionVisitor as rustc_ast[4a29b632a72979d1]::visit::Visitor>::visit_generic_arg
  25:     0x72aa516af7f7 - <rustc_resolve[8f914cbac3712a73]::late::LateResolutionVisitor as rustc_ast[4a29b632a72979d1]::visit::Visitor>::visit_ty
  26:     0x72aa517aecae - <rustc_resolve[8f914cbac3712a73]::late::LateResolutionVisitor as rustc_ast[4a29b632a72979d1]::visit::Visitor>::visit_item
  27:     0x72aa55a19960 - <rustc_resolve[8f914cbac3712a73]::Resolver>::resolve_crate::{closure#0}
  28:     0x72aa55a13dc0 - <rustc_resolve[8f914cbac3712a73]::Resolver>::resolve_crate
  29:     0x72aa54c2443e - rustc_interface[5a709bf0abf5983c]::passes::resolver_for_lowering_raw
  30:     0x72aa54c2365b - rustc_query_impl[627e742369ef9b00]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[627e742369ef9b00]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2}::{closure#0}, rustc_middle[7c194d2c51ee7d6b]::query::erase::Erased<[u8; 16usize]>>
  31:     0x72aa54c23649 - <rustc_query_impl[627e742369ef9b00]::query_impl::resolver_for_lowering_raw::dynamic_query::{closure#2} as core[ef64e34f4f685035]::ops::function::FnOnce<(rustc_middle[7c194d2c51ee7d6b]::ty::context::TyCtxt, ())>>::call_once
  32:     0x72aa5575ca92 - rustc_query_system[989e049842c55218]::query::plumbing::try_execute_query::<rustc_query_impl[627e742369ef9b00]::DynamicConfig<rustc_query_system[989e049842c55218]::query::caches::SingleCache<rustc_middle[7c194d2c51ee7d6b]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[627e742369ef9b00]::plumbing::QueryCtxt, false>
  33:     0x72aa5575c72d - rustc_query_impl[627e742369ef9b00]::query_impl::resolver_for_lowering_raw::get_query_non_incr::__rust_end_short_backtrace
  34:     0x72aa555911ee - rustc_interface[5a709bf0abf5983c]::interface::run_compiler::<core[ef64e34f4f685035]::result::Result<(), rustc_span[554534721cb6ceca]::ErrorGuaranteed>, rustc_driver_impl[bb97483d227938cc]::run_compiler::{closure#0}>::{closure#1}
  35:     0x72aa55642490 - std[6d8313e6711de5ec]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[5a709bf0abf5983c]::util::run_in_thread_with_globals<rustc_interface[5a709bf0abf5983c]::util::run_in_thread_pool_with_globals<rustc_interface[5a709bf0abf5983c]::interface::run_compiler<core[ef64e34f4f685035]::result::Result<(), rustc_span[554534721cb6ceca]::ErrorGuaranteed>, rustc_driver_impl[bb97483d227938cc]::run_compiler::{closure#0}>::{closure#1}, core[ef64e34f4f685035]::result::Result<(), rustc_span[554534721cb6ceca]::ErrorGuaranteed>>::{closure#0}, core[ef64e34f4f685035]::result::Result<(), rustc_span[554534721cb6ceca]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[ef64e34f4f685035]::result::Result<(), rustc_span[554534721cb6ceca]::ErrorGuaranteed>>
  36:     0x72aa55642afa - <<std[6d8313e6711de5ec]::thread::Builder>::spawn_unchecked_<rustc_interface[5a709bf0abf5983c]::util::run_in_thread_with_globals<rustc_interface[5a709bf0abf5983c]::util::run_in_thread_pool_with_globals<rustc_interface[5a709bf0abf5983c]::interface::run_compiler<core[ef64e34f4f685035]::result::Result<(), rustc_span[554534721cb6ceca]::ErrorGuaranteed>, rustc_driver_impl[bb97483d227938cc]::run_compiler::{closure#0}>::{closure#1}, core[ef64e34f4f685035]::result::Result<(), rustc_span[554534721cb6ceca]::ErrorGuaranteed>>::{closure#0}, core[ef64e34f4f685035]::result::Result<(), rustc_span[554534721cb6ceca]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[ef64e34f4f685035]::result::Result<(), rustc_span[554534721cb6ceca]::ErrorGuaranteed>>::{closure#1} as core[ef64e34f4f685035]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  37:     0x72aa55642eeb - std::sys::pal::unix::thread::Thread::new::thread_start::h8a408131a034eba4
  38:     0x72aa56cd739d - <unknown>
  39:     0x72aa56d5c49c - <unknown>
  40:                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: please make sure that you have updated to the latest nightly

note: rustc 1.83.0-nightly (54fdef779 2024-09-06) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [fn_arg_names] looking up function parameter names for `core::ops::index::Index::Output`
#1 [resolver_for_lowering_raw] getting the resolver for lowering
end of query stack

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

#129829 cc @compiler-errors

@compiler-errors compiler-errors self-assigned this Sep 6, 2024
@saethlin saethlin removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Sep 7, 2024
@bors bors closed this as completed in 7be15b8 Sep 16, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Sep 16, 2024
Rollup merge of rust-lang#130033 - compiler-errors:foreign-fn-types, r=BoxyUwU

Don't call `fn_arg_names` query for non-`fn` foreign items in resolver

Fixes rust-lang#130015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

4 participants