Skip to content

cannot get associated-item of DefKey #119847

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
matthiaskrgr opened this issue Jan 11, 2024 · 2 comments · Fixed by #120056
Closed

cannot get associated-item of DefKey #119847

matthiaskrgr opened this issue Jan 11, 2024 · 2 comments · Fixed by #120056
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

another one caused by #117449

auto-reduced (treereduce-rust):

fn frob() -> impl Fn<P, Output = T> + '_ {}

fn open_parent<'path>() {
    todo!()
}

fn main() {
    let old_path = frob("hello");

    open_parent(&old_path)
}

original:

// revisions: current next
//[next] compile-flags: -Znext-solver
// check-pass

use std::path::Path;
use std::ffi::OsStr
use std::ops::Deref;

fn frob(path: &str) -> impl Fn<P, Output = T> + '_ {
    OsStr::new(path).as_ref()
}

fn open_parent<'path>(_path: &'path Path) {
    todo!()
}

fn main() {
    let old_path = frob("hello");

    open_parent(&old_path)
}

Version information

rustc 1.77.0-nightly (0a8923361 2024-01-11)
binary: rustc
commit-hash: 0a8923361ec2a37fa341292c029ef7c6d0405d4b
commit-date: 2024-01-11
host: x86_64-unknown-linux-gnu
release: 1.77.0-nightly
LLVM version: 17.0.6

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

Program output

error[E0106]: missing lifetime specifier
 --> /tmp/icemaker_global_tempdir.nW43QDl0tZ3m/rustc_testrunner_tmpdir_reporting.xWv2jkVNFcR0/mvce.rs:1:39
  |
1 | fn frob() -> impl Fn<P, Output = T> + '_ {}
  |                                       ^^ expected named lifetime parameter
  |
  = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`, or if you will only have owned values
  |
1 | fn frob() -> impl Fn<P, Output = T> + 'static {}
  |                                       ~~~~~~~

error[E0412]: cannot find type `P` in this scope
 --> /tmp/icemaker_global_tempdir.nW43QDl0tZ3m/rustc_testrunner_tmpdir_reporting.xWv2jkVNFcR0/mvce.rs:1:22
  |
1 | fn frob() -> impl Fn<P, Output = T> + '_ {}
  |                      ^ not found in this scope
  |
help: you might be missing a type parameter
  |
1 | fn frob<P>() -> impl Fn<P, Output = T> + '_ {}
  |        +++

error[E0412]: cannot find type `T` in this scope
 --> /tmp/icemaker_global_tempdir.nW43QDl0tZ3m/rustc_testrunner_tmpdir_reporting.xWv2jkVNFcR0/mvce.rs:1:34
  |
1 | fn frob() -> impl Fn<P, Output = T> + '_ {}
  |                                  ^ not found in this scope
  |
help: you might be missing a type parameter
  |
1 | fn frob<T>() -> impl Fn<P, Output = T> + '_ {}
  |        +++

error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change
 --> /tmp/icemaker_global_tempdir.nW43QDl0tZ3m/rustc_testrunner_tmpdir_reporting.xWv2jkVNFcR0/mvce.rs:1:19
  |
1 | fn frob() -> impl Fn<P, Output = T> + '_ {}
  |                   ^^^^^^^^^^^^^^^^^ help: use parenthetical notation instead: `Fn(P) -> T`
  |
  = note: see issue #29625 <https://github.com/rust-lang/rust/issues/29625> for more information
  = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable

error[E0061]: this function takes 0 arguments but 1 argument was supplied
 --> /tmp/icemaker_global_tempdir.nW43QDl0tZ3m/rustc_testrunner_tmpdir_reporting.xWv2jkVNFcR0/mvce.rs:8:20
  |
8 |     let old_path = frob("hello");
  |                    ^^^^ -------
  |                         |
  |                         unexpected argument of type `&'static str`
  |                         help: remove the extra argument
  |
note: function defined here
 --> /tmp/icemaker_global_tempdir.nW43QDl0tZ3m/rustc_testrunner_tmpdir_reporting.xWv2jkVNFcR0/mvce.rs:1:4
  |
1 | fn frob() -> impl Fn<P, Output = T> + '_ {}
  |    ^^^^

error: internal compiler error: compiler/rustc_metadata/src/rmeta/decoder.rs:1299:18: cannot get associated-item of `DefKey { parent: Some(DefIndex(3125)), disambiguated_data: DisambiguatedDefPathData { data: TypeNs("FnOnce"), disambiguator: 0 } }`

thread 'rustc' panicked at /rustc/0a8923361ec2a37fa341292c029ef7c6d0405d4b/compiler/rustc_errors/src/lib.rs:941:30:
Box<dyn Any>
stack backtrace:
   0:     0x7f00fab8c7e6 - std::backtrace_rs::backtrace::libunwind::trace::h94bb5959755b86f2
                               at /rustc/0a8923361ec2a37fa341292c029ef7c6d0405d4b/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7f00fab8c7e6 - std::backtrace_rs::backtrace::trace_unsynchronized::h0ffc134be1aaf930
                               at /rustc/0a8923361ec2a37fa341292c029ef7c6d0405d4b/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f00fab8c7e6 - std::sys_common::backtrace::_print_fmt::h26081e0c608a0b7f
                               at /rustc/0a8923361ec2a37fa341292c029ef7c6d0405d4b/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7f00fab8c7e6 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h5c8038800e6fb5f7
                               at /rustc/0a8923361ec2a37fa341292c029ef7c6d0405d4b/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f00fabdeec0 - core::fmt::rt::Argument::fmt::h3f1be51c7343ffea
                               at /rustc/0a8923361ec2a37fa341292c029ef7c6d0405d4b/library/core/src/fmt/rt.rs:142:9
   5:     0x7f00fabdeec0 - core::fmt::write::h1488c259b4acf9ab
                               at /rustc/0a8923361ec2a37fa341292c029ef7c6d0405d4b/library/core/src/fmt/mod.rs:1120:17
   6:     0x7f00fab8014f - std::io::Write::write_fmt::h24f4cd0dcf44bd3f
                               at /rustc/0a8923361ec2a37fa341292c029ef7c6d0405d4b/library/std/src/io/mod.rs:1810:15
   7:     0x7f00fab8c5c4 - std::sys_common::backtrace::_print::h5ba325da6734b016
                               at /rustc/0a8923361ec2a37fa341292c029ef7c6d0405d4b/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f00fab8c5c4 - std::sys_common::backtrace::print::hf30744c1471ec929
                               at /rustc/0a8923361ec2a37fa341292c029ef7c6d0405d4b/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f00fab8f357 - std::panicking::default_hook::{{closure}}::h2280b259aae7d3fe
  10:     0x7f00fab8f0b9 - std::panicking::default_hook::he7df247e2295c328
                               at /rustc/0a8923361ec2a37fa341292c029ef7c6d0405d4b/library/std/src/panicking.rs:292:9
  11:     0x7f00fd95ee2c - std[df2bb02ebe81061e]::panicking::update_hook::<alloc[688fff2a09b379cd]::boxed::Box<rustc_driver_impl[3af87016ec32f132]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f00fab8faa6 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hf4a63bd7a4561991
                               at /rustc/0a8923361ec2a37fa341292c029ef7c6d0405d4b/library/alloc/src/boxed.rs:2030:9
  13:     0x7f00fab8faa6 - std::panicking::rust_panic_with_hook::h4cc138991ddaa8e1
                               at /rustc/0a8923361ec2a37fa341292c029ef7c6d0405d4b/library/std/src/panicking.rs:785:13
  14:     0x7f00fd990e84 - std[df2bb02ebe81061e]::panicking::begin_panic::<rustc_errors[935076ffe56fbaa3]::ExplicitBug>::{closure#0}
  15:     0x7f00fd98d776 - std[df2bb02ebe81061e]::sys_common::backtrace::__rust_end_short_backtrace::<std[df2bb02ebe81061e]::panicking::begin_panic<rustc_errors[935076ffe56fbaa3]::ExplicitBug>::{closure#0}, !>
  16:     0x7f00fd98d3e6 - std[df2bb02ebe81061e]::panicking::begin_panic::<rustc_errors[935076ffe56fbaa3]::ExplicitBug>
  17:     0x7f00fd99bdd1 - <rustc_errors[935076ffe56fbaa3]::diagnostic_builder::BugAbort as rustc_errors[935076ffe56fbaa3]::diagnostic_builder::EmissionGuarantee>::emit_producing_guarantee
  18:     0x7f00fdd6310e - <rustc_errors[935076ffe56fbaa3]::DiagCtxt>::bug::<alloc[688fff2a09b379cd]::string::String>
  19:     0x7f00fddfbb0b - rustc_middle[aa34c5a2c4702fe8]::util::bug::opt_span_bug_fmt::<rustc_span[4b4e540b8f3141bc]::span_encoding::Span>::{closure#0}
  20:     0x7f00fdde46fa - rustc_middle[aa34c5a2c4702fe8]::ty::context::tls::with_opt::<rustc_middle[aa34c5a2c4702fe8]::util::bug::opt_span_bug_fmt<rustc_span[4b4e540b8f3141bc]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7f00fdde4598 - rustc_middle[aa34c5a2c4702fe8]::ty::context::tls::with_context_opt::<rustc_middle[aa34c5a2c4702fe8]::ty::context::tls::with_opt<rustc_middle[aa34c5a2c4702fe8]::util::bug::opt_span_bug_fmt<rustc_span[4b4e540b8f3141bc]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7f00fbd8f3b0 - rustc_middle[aa34c5a2c4702fe8]::util::bug::bug_fmt
  23:     0x7f00ff2eaaeb - rustc_metadata[971df77c2ee648c4]::rmeta::decoder::cstore_impl::provide_extern::associated_item
  24:     0x7f00ff2e9b33 - rustc_query_impl[b792d1ca797334ee]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b792d1ca797334ee]::query_impl::associated_item::dynamic_query::{closure#2}::{closure#0}, rustc_middle[aa34c5a2c4702fe8]::query::erase::Erased<[u8; 40usize]>>
  25:     0x7f00ff2e90ff - rustc_query_system[3ece82405c4406ab]::query::plumbing::try_execute_query::<rustc_query_impl[b792d1ca797334ee]::DynamicConfig<rustc_query_system[3ece82405c4406ab]::query::caches::DefaultCache<rustc_span[4b4e540b8f3141bc]::def_id::DefId, rustc_middle[aa34c5a2c4702fe8]::query::erase::Erased<[u8; 40usize]>>, false, false, false>, rustc_query_impl[b792d1ca797334ee]::plumbing::QueryCtxt, false>
  26:     0x7f00ff2e8df4 - rustc_query_impl[b792d1ca797334ee]::query_impl::associated_item::get_query_non_incr::__rust_end_short_backtrace
  27:     0x7f00fddd542c - <rustc_middle[aa34c5a2c4702fe8]::ty::print::pretty::FmtPrinter as rustc_middle[aa34c5a2c4702fe8]::ty::print::pretty::PrettyPrinter>::pretty_print_opaque_impl_type
  28:     0x7f00ffb8f498 - <rustc_middle[aa34c5a2c4702fe8]::ty::print::pretty::FmtPrinter as rustc_middle[aa34c5a2c4702fe8]::ty::print::pretty::PrettyPrinter>::pretty_print_type
  29:     0x7f00ffb8e1dc - <rustc_middle[aa34c5a2c4702fe8]::ty::print::pretty::FmtPrinter as rustc_middle[aa34c5a2c4702fe8]::ty::print::pretty::PrettyPrinter>::pretty_print_type
  30:     0x7f00ffb8fac1 - <rustc_middle[aa34c5a2c4702fe8]::ty::Ty as core[6902f9af1f3facd9]::fmt::Display>::fmt
  31:     0x7f00fabdeec0 - core::fmt::rt::Argument::fmt::h3f1be51c7343ffea
                               at /rustc/0a8923361ec2a37fa341292c029ef7c6d0405d4b/library/core/src/fmt/rt.rs:142:9
  32:     0x7f00fabdeec0 - core::fmt::write::h1488c259b4acf9ab
                               at /rustc/0a8923361ec2a37fa341292c029ef7c6d0405d4b/library/core/src/fmt/mod.rs:1120:17
  33:     0x7f00fabcddd8 - <&mut W as core::fmt::Write::write_fmt::SpecWriteFmt>::spec_write_fmt::hec3144203de7114a
                               at /rustc/0a8923361ec2a37fa341292c029ef7c6d0405d4b/library/core/src/fmt/mod.rs:211:17
  34:     0x7f00fabcddd8 - core::fmt::Write::write_fmt::hed68ab8549809521
                               at /rustc/0a8923361ec2a37fa341292c029ef7c6d0405d4b/library/core/src/fmt/mod.rs:215:14
  35:     0x7f00fabcddd8 - alloc::fmt::format::format_inner::hb2933aa08576c345
                               at /rustc/0a8923361ec2a37fa341292c029ef7c6d0405d4b/library/alloc/src/fmt.rs:612:16
  36:     0x7f00fdb31009 - <rustc_hir_typeck[d224dc29d1d831a9]::fn_ctxt::FnCtxt>::report_arg_errors
  37:     0x7f00ff763802 - <rustc_hir_typeck[d224dc29d1d831a9]::fn_ctxt::FnCtxt>::check_argument_types
  38:     0x7f00ff596fb5 - <rustc_hir_typeck[d224dc29d1d831a9]::fn_ctxt::FnCtxt>::check_call
  39:     0x7f00ff6db579 - <rustc_hir_typeck[d224dc29d1d831a9]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  40:     0x7f00ff5780e5 - <rustc_hir_typeck[d224dc29d1d831a9]::fn_ctxt::FnCtxt>::check_block_with_expected
  41:     0x7f00ff6db989 - <rustc_hir_typeck[d224dc29d1d831a9]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  42:     0x7f00ff2a7ec8 - rustc_hir_typeck[d224dc29d1d831a9]::check::check_fn
  43:     0x7f00fef006c1 - rustc_hir_typeck[d224dc29d1d831a9]::typeck
  44:     0x7f00feeffa49 - rustc_query_impl[b792d1ca797334ee]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b792d1ca797334ee]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[aa34c5a2c4702fe8]::query::erase::Erased<[u8; 8usize]>>
  45:     0x7f00ff0f9039 - rustc_query_system[3ece82405c4406ab]::query::plumbing::try_execute_query::<rustc_query_impl[b792d1ca797334ee]::DynamicConfig<rustc_query_system[3ece82405c4406ab]::query::caches::VecCache<rustc_span[4b4e540b8f3141bc]::def_id::LocalDefId, rustc_middle[aa34c5a2c4702fe8]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[b792d1ca797334ee]::plumbing::QueryCtxt, false>
  46:     0x7f00ff0f8cd0 - rustc_query_impl[b792d1ca797334ee]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  47:     0x7f00ff0f854c - <rustc_middle[aa34c5a2c4702fe8]::hir::map::Map>::par_body_owners::<rustc_hir_analysis[546a31c598987e4a]::check_crate::{closure#6}>::{closure#0}
  48:     0x7f00ff0f6e44 - rustc_hir_analysis[546a31c598987e4a]::check_crate
  49:     0x7f00ff65bb99 - rustc_interface[43fdae4d36f71f42]::passes::analysis
  50:     0x7f00ff65b7df - rustc_query_impl[b792d1ca797334ee]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[b792d1ca797334ee]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[aa34c5a2c4702fe8]::query::erase::Erased<[u8; 1usize]>>
  51:     0x7f00ffbca2c0 - rustc_query_system[3ece82405c4406ab]::query::plumbing::try_execute_query::<rustc_query_impl[b792d1ca797334ee]::DynamicConfig<rustc_query_system[3ece82405c4406ab]::query::caches::SingleCache<rustc_middle[aa34c5a2c4702fe8]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[b792d1ca797334ee]::plumbing::QueryCtxt, false>
  52:     0x7f00ffbca0c7 - rustc_query_impl[b792d1ca797334ee]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  53:     0x7f00ff93f588 - rustc_interface[43fdae4d36f71f42]::interface::run_compiler::<core[6902f9af1f3facd9]::result::Result<(), rustc_span[4b4e540b8f3141bc]::ErrorGuaranteed>, rustc_driver_impl[3af87016ec32f132]::run_compiler::{closure#0}>::{closure#0}
  54:     0x7f00ffbecd86 - std[df2bb02ebe81061e]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[43fdae4d36f71f42]::util::run_in_thread_with_globals<rustc_interface[43fdae4d36f71f42]::util::run_in_thread_pool_with_globals<rustc_interface[43fdae4d36f71f42]::interface::run_compiler<core[6902f9af1f3facd9]::result::Result<(), rustc_span[4b4e540b8f3141bc]::ErrorGuaranteed>, rustc_driver_impl[3af87016ec32f132]::run_compiler::{closure#0}>::{closure#0}, core[6902f9af1f3facd9]::result::Result<(), rustc_span[4b4e540b8f3141bc]::ErrorGuaranteed>>::{closure#0}, core[6902f9af1f3facd9]::result::Result<(), rustc_span[4b4e540b8f3141bc]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[6902f9af1f3facd9]::result::Result<(), rustc_span[4b4e540b8f3141bc]::ErrorGuaranteed>>
  55:     0x7f00ffbecbb3 - <<std[df2bb02ebe81061e]::thread::Builder>::spawn_unchecked_<rustc_interface[43fdae4d36f71f42]::util::run_in_thread_with_globals<rustc_interface[43fdae4d36f71f42]::util::run_in_thread_pool_with_globals<rustc_interface[43fdae4d36f71f42]::interface::run_compiler<core[6902f9af1f3facd9]::result::Result<(), rustc_span[4b4e540b8f3141bc]::ErrorGuaranteed>, rustc_driver_impl[3af87016ec32f132]::run_compiler::{closure#0}>::{closure#0}, core[6902f9af1f3facd9]::result::Result<(), rustc_span[4b4e540b8f3141bc]::ErrorGuaranteed>>::{closure#0}, core[6902f9af1f3facd9]::result::Result<(), rustc_span[4b4e540b8f3141bc]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[6902f9af1f3facd9]::result::Result<(), rustc_span[4b4e540b8f3141bc]::ErrorGuaranteed>>::{closure#1} as core[6902f9af1f3facd9]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  56:     0x7f00fab999d5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hfa068cbc4d1f0631
                               at /rustc/0a8923361ec2a37fa341292c029ef7c6d0405d4b/library/alloc/src/boxed.rs:2016:9
  57:     0x7f00fab999d5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h63f146f44326f9ec
                               at /rustc/0a8923361ec2a37fa341292c029ef7c6d0405d4b/library/alloc/src/boxed.rs:2016:9
  58:     0x7f00fab999d5 - std::sys::unix::thread::Thread::new::thread_start::h920a03d727fced69
                               at /rustc/0a8923361ec2a37fa341292c029ef7c6d0405d4b/library/std/src/sys/unix/thread.rs:108:17
  59:     0x7f00fa9859eb - <unknown>
  60:     0x7f00faa097cc - <unknown>
  61:                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.77.0-nightly (0a8923361 2024-01-11) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [associated_item] computing associated item data for `core::ops::function::FnOnce`
#1 [typeck] type-checking `main`
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 6 previous errors

Some errors have detailed explanations: E0061, E0106, E0412, E0658.
For more information about an error, try `rustc --explain E0061`.

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

@oli-obk fyi

@oli-obk oli-obk self-assigned this Jan 16, 2024
@oli-obk
Copy link
Contributor

oli-obk commented Jan 17, 2024

another one caused by #117449

not caused by that, only exposed by it. The issue is a typo using FnOnce instead of FnOnceOutput in diagnostic code, getting the wrong DefId and then attempting to treat FnOnce as an associated item

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jan 17, 2024
…er-errors

Use FnOnceOutput instead of FnOnce where expected

fixes rust-lang#119847
compiler-errors added a commit to compiler-errors/rust that referenced this issue Jan 17, 2024
…er-errors

Use FnOnceOutput instead of FnOnce where expected

fixes rust-lang#119847
@bors bors closed this as completed in 99a8b6a Jan 18, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jan 18, 2024
Rollup merge of rust-lang#120056 - oli-obk:arg_mismatch_ice, r=compiler-errors

Use FnOnceOutput instead of FnOnce where expected

fixes rust-lang#119847
# for free to join this conversation on GitHub. Already have an account? # 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