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: could not resolve DefId #121422

Open
matthiaskrgr opened this issue Feb 22, 2024 · 1 comment
Open

ICE: could not resolve DefId #121422

matthiaskrgr opened this issue Feb 22, 2024 · 1 comment
Assignees
Labels
C-bug Category: This is a bug. F-non_lifetime_binders `#![feature(non_lifetime_binders)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. 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):

#![feature(non_lifetime_binders)]

trait Trait<T: ?Sized> {}

fn produce() -> impl for<T> Trait<(), Assoc = impl Trait<T>> {
    16
}

original:

// check-pass

#![feature(non_lifetime_binders)]
//~^ WARN the feature `non_lifetime_binders` is incomplete

trait Trait<T: ?Sized> {}

impl<T: ?Sized> Trait<T> for i32 {}

fn produce() -> impl for<T> Trait<(), Assoc = impl Trait<T>> {
    16
}

fn main() {
    let _ = produce();
}

Version information

rustc 1.78.0-nightly (f8131a48a 2024-02-21)
binary: rustc
commit-hash: f8131a48a46ac3bc8a3d0fe0477055b132cffdc3
commit-date: 2024-02-21
host: x86_64-unknown-linux-gnu
release: 1.78.0-nightly
LLVM version: 18.1.0

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

Program output

warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
 --> /tmp/icemaker_global_tempdir.0emJgmZ88e4H/rustc_testrunner_tmpdir_reporting.nzVpYvTIjOr1/mvce.rs:1:12
  |
1 | #![feature(non_lifetime_binders)]
  |            ^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
  = note: `#[warn(incomplete_features)]` on by default

error[E0601]: `main` function not found in crate `mvce`
 --> /tmp/icemaker_global_tempdir.0emJgmZ88e4H/rustc_testrunner_tmpdir_reporting.nzVpYvTIjOr1/mvce.rs:7:2
  |
7 | }
  |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.0emJgmZ88e4H/rustc_testrunner_tmpdir_reporting.nzVpYvTIjOr1/mvce.rs`

error[E0220]: associated type `Assoc` not found for `Trait`
 --> /tmp/icemaker_global_tempdir.0emJgmZ88e4H/rustc_testrunner_tmpdir_reporting.nzVpYvTIjOr1/mvce.rs:5:39
  |
5 | fn produce() -> impl for<T> Trait<(), Assoc = impl Trait<T>> {
  |                                       ^^^^^ associated type `Assoc` not found

error: internal compiler error: could not resolve DefId(0:6 ~ mvce[8c01]::produce::T)
 --> /tmp/icemaker_global_tempdir.0emJgmZ88e4H/rustc_testrunner_tmpdir_reporting.nzVpYvTIjOr1/mvce.rs:5:58
  |
5 | fn produce() -> impl for<T> Trait<(), Assoc = impl Trait<T>> {
  |                                                          ^

thread 'rustc' panicked at compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs:1470:14:
Box<dyn Any>
stack backtrace:
   0:     0x7ffba3b8caf6 - std::backtrace_rs::backtrace::libunwind::trace::hbec2edc838b433e2
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7ffba3b8caf6 - std::backtrace_rs::backtrace::trace_unsynchronized::h88c30257ee0dd166
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7ffba3b8caf6 - std::sys_common::backtrace::_print_fmt::h9176654d509e3088
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7ffba3b8caf6 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h671feaee1776bf19
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7ffba3bdda7c - core::fmt::rt::Argument::fmt::h59605c83ae32d935
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/core/src/fmt/rt.rs:142:9
   5:     0x7ffba3bdda7c - core::fmt::write::hf7af8dfcfd20db5b
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/core/src/fmt/mod.rs:1120:17
   6:     0x7ffba3b814bf - std::io::Write::write_fmt::h92a5dbf489025e71
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/std/src/io/mod.rs:1846:15
   7:     0x7ffba3b8c8a4 - std::sys_common::backtrace::_print::h00080302d23998ae
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7ffba3b8c8a4 - std::sys_common::backtrace::print::h6b23124445400245
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7ffba3b8f5eb - std::panicking::default_hook::{{closure}}::hd67b2f9d36675a28
  10:     0x7ffba3b8f339 - std::panicking::default_hook::h10a39ef11c714e42
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/std/src/panicking.rs:292:9
  11:     0x7ffba6a7a94c - std[5a8e7f94216a9138]::panicking::update_hook::<alloc[e14ab1f516d287ab]::boxed::Box<rustc_driver_impl[e279e4f1fedd9109]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7ffba3b8fd50 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h37ba37dc48823c1d
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/alloc/src/boxed.rs:2030:9
  13:     0x7ffba3b8fd50 - std::panicking::rust_panic_with_hook::he3e3bc7c345bf54b
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/std/src/panicking.rs:786:13
  14:     0x7ffba6aa7524 - std[5a8e7f94216a9138]::panicking::begin_panic::<rustc_errors[34364e5c712fab73]::ExplicitBug>::{closure#0}
  15:     0x7ffba6aa4176 - std[5a8e7f94216a9138]::sys_common::backtrace::__rust_end_short_backtrace::<std[5a8e7f94216a9138]::panicking::begin_panic<rustc_errors[34364e5c712fab73]::ExplicitBug>::{closure#0}, !>
  16:     0x7ffba6a9f936 - std[5a8e7f94216a9138]::panicking::begin_panic::<rustc_errors[34364e5c712fab73]::ExplicitBug>
  17:     0x7ffba5417631 - <rustc_errors[34364e5c712fab73]::diagnostic::BugAbort as rustc_errors[34364e5c712fab73]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  18:     0x7ffba871e027 - <rustc_hir_analysis[71d4294717f7f2b7]::collect::resolve_bound_vars::BoundVarContext>::resolve_type_ref
  19:     0x7ffba51b7b52 - rustc_hir[170b9793d794ea06]::intravisit::walk_qpath::<rustc_hir_analysis[71d4294717f7f2b7]::collect::resolve_bound_vars::BoundVarContext>
  20:     0x7ffba51bea74 - <rustc_hir_analysis[71d4294717f7f2b7]::collect::resolve_bound_vars::BoundVarContext as rustc_hir[170b9793d794ea06]::intravisit::Visitor>::visit_path
  21:     0x7ffba858faef - <rustc_hir_analysis[71d4294717f7f2b7]::collect::resolve_bound_vars::BoundVarContext>::visit_poly_trait_ref_inner
  22:     0x7ffba871c4ae - rustc_hir[170b9793d794ea06]::intravisit::walk_item::<rustc_hir_analysis[71d4294717f7f2b7]::collect::resolve_bound_vars::BoundVarContext>
  23:     0x7ffba871b5b8 - <rustc_hir_analysis[71d4294717f7f2b7]::collect::resolve_bound_vars::BoundVarContext as rustc_hir[170b9793d794ea06]::intravisit::Visitor>::visit_item
  24:     0x7ffba858cb8a - rustc_hir_analysis[71d4294717f7f2b7]::collect::resolve_bound_vars::resolve_bound_vars
  25:     0x7ffba858c731 - rustc_query_impl[9d4c51777e2bb749]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[9d4c51777e2bb749]::query_impl::resolve_bound_vars::dynamic_query::{closure#2}::{closure#0}, rustc_middle[446dd094ad85939e]::query::erase::Erased<[u8; 8usize]>>
  26:     0x7ffba80f6be3 - rustc_query_system[9b2ccfe41ae3bb1b]::query::plumbing::try_execute_query::<rustc_query_impl[9d4c51777e2bb749]::DynamicConfig<rustc_query_system[9b2ccfe41ae3bb1b]::query::caches::VecCache<rustc_hir[170b9793d794ea06]::hir_id::OwnerId, rustc_middle[446dd094ad85939e]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[9d4c51777e2bb749]::plumbing::QueryCtxt, false>
  27:     0x7ffba80f670c - rustc_query_impl[9d4c51777e2bb749]::query_impl::resolve_bound_vars::get_query_non_incr::__rust_end_short_backtrace
  28:     0x7ffba80f62a6 - rustc_query_impl[9d4c51777e2bb749]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[9d4c51777e2bb749]::query_impl::named_variable_map::dynamic_query::{closure#2}::{closure#0}, rustc_middle[446dd094ad85939e]::query::erase::Erased<[u8; 8usize]>>
  29:     0x7ffba80f6be3 - rustc_query_system[9b2ccfe41ae3bb1b]::query::plumbing::try_execute_query::<rustc_query_impl[9d4c51777e2bb749]::DynamicConfig<rustc_query_system[9b2ccfe41ae3bb1b]::query::caches::VecCache<rustc_hir[170b9793d794ea06]::hir_id::OwnerId, rustc_middle[446dd094ad85939e]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[9d4c51777e2bb749]::plumbing::QueryCtxt, false>
  30:     0x7ffba80f664c - rustc_query_impl[9d4c51777e2bb749]::query_impl::named_variable_map::get_query_non_incr::__rust_end_short_backtrace
  31:     0x7ffba5e39cd2 - <dyn rustc_hir_analysis[71d4294717f7f2b7]::astconv::AstConv>::res_to_ty
  32:     0x7ffba801b7c0 - <dyn rustc_hir_analysis[71d4294717f7f2b7]::astconv::AstConv>::ast_ty_to_ty_inner
  33:     0x7ffba8944b44 - <dyn rustc_hir_analysis[71d4294717f7f2b7]::astconv::AstConv>::create_args_for_ast_path
  34:     0x7ffba8a71b10 - <dyn rustc_hir_analysis[71d4294717f7f2b7]::astconv::AstConv>::instantiate_poly_trait_ref
  35:     0x7ffba8a6eafc - <dyn rustc_hir_analysis[71d4294717f7f2b7]::astconv::AstConv>::compute_bounds
  36:     0x7ffba8940fa2 - rustc_hir_analysis[71d4294717f7f2b7]::collect::item_bounds::opaque_type_bounds
  37:     0x7ffba893f8f1 - rustc_hir_analysis[71d4294717f7f2b7]::collect::item_bounds::explicit_item_bounds
  38:     0x7ffba893ea67 - rustc_query_impl[9d4c51777e2bb749]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[9d4c51777e2bb749]::query_impl::explicit_item_bounds::dynamic_query::{closure#2}::{closure#0}, rustc_middle[446dd094ad85939e]::query::erase::Erased<[u8; 16usize]>>
  39:     0x7ffba893ea31 - <rustc_query_impl[9d4c51777e2bb749]::query_impl::explicit_item_bounds::dynamic_query::{closure#2} as core[85b4fd477ce5bb21]::ops::function::FnOnce<(rustc_middle[446dd094ad85939e]::ty::context::TyCtxt, rustc_span[adb133ac03280fc1]::def_id::DefId)>>::call_once
  40:     0x7ffba8158a40 - rustc_query_system[9b2ccfe41ae3bb1b]::query::plumbing::try_execute_query::<rustc_query_impl[9d4c51777e2bb749]::DynamicConfig<rustc_query_system[9b2ccfe41ae3bb1b]::query::caches::DefIdCache<rustc_middle[446dd094ad85939e]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[9d4c51777e2bb749]::plumbing::QueryCtxt, false>
  41:     0x7ffba8157121 - rustc_query_impl[9d4c51777e2bb749]::query_impl::explicit_item_bounds::get_query_non_incr::__rust_end_short_backtrace
  42:     0x7ffba81f4c6a - <rustc_hir_analysis[71d4294717f7f2b7]::collect::CollectItemTypesVisitor as rustc_hir[170b9793d794ea06]::intravisit::Visitor>::visit_item
  43:     0x7ffba81f3176 - rustc_hir_analysis[71d4294717f7f2b7]::collect::collect_mod_item_types
  44:     0x7ffba81f3109 - rustc_query_impl[9d4c51777e2bb749]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[9d4c51777e2bb749]::query_impl::collect_mod_item_types::dynamic_query::{closure#2}::{closure#0}, rustc_middle[446dd094ad85939e]::query::erase::Erased<[u8; 0usize]>>
  45:     0x7ffba8a2b2ed - rustc_query_system[9b2ccfe41ae3bb1b]::query::plumbing::try_execute_query::<rustc_query_impl[9d4c51777e2bb749]::DynamicConfig<rustc_query_system[9b2ccfe41ae3bb1b]::query::caches::DefaultCache<rustc_span[adb133ac03280fc1]::def_id::LocalModDefId, rustc_middle[446dd094ad85939e]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[9d4c51777e2bb749]::plumbing::QueryCtxt, false>
  46:     0x7ffba8a2ae17 - rustc_query_impl[9d4c51777e2bb749]::query_impl::collect_mod_item_types::get_query_non_incr::__rust_end_short_backtrace
  47:     0x7ffba87ad4e8 - rustc_hir_analysis[71d4294717f7f2b7]::check_crate
  48:     0x7ffba88a2dd3 - rustc_interface[7ca501d7f8f3a34f]::passes::analysis
  49:     0x7ffba88a2a29 - rustc_query_impl[9d4c51777e2bb749]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[9d4c51777e2bb749]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[446dd094ad85939e]::query::erase::Erased<[u8; 1usize]>>
  50:     0x7ffba8b3d4a5 - rustc_query_system[9b2ccfe41ae3bb1b]::query::plumbing::try_execute_query::<rustc_query_impl[9d4c51777e2bb749]::DynamicConfig<rustc_query_system[9b2ccfe41ae3bb1b]::query::caches::SingleCache<rustc_middle[446dd094ad85939e]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[9d4c51777e2bb749]::plumbing::QueryCtxt, false>
  51:     0x7ffba8b3d209 - rustc_query_impl[9d4c51777e2bb749]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  52:     0x7ffba8b4c719 - rustc_interface[7ca501d7f8f3a34f]::interface::run_compiler::<core[85b4fd477ce5bb21]::result::Result<(), rustc_span[adb133ac03280fc1]::ErrorGuaranteed>, rustc_driver_impl[e279e4f1fedd9109]::run_compiler::{closure#0}>::{closure#0}
  53:     0x7ffba8dbe705 - std[5a8e7f94216a9138]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[7ca501d7f8f3a34f]::util::run_in_thread_with_globals<rustc_interface[7ca501d7f8f3a34f]::util::run_in_thread_pool_with_globals<rustc_interface[7ca501d7f8f3a34f]::interface::run_compiler<core[85b4fd477ce5bb21]::result::Result<(), rustc_span[adb133ac03280fc1]::ErrorGuaranteed>, rustc_driver_impl[e279e4f1fedd9109]::run_compiler::{closure#0}>::{closure#0}, core[85b4fd477ce5bb21]::result::Result<(), rustc_span[adb133ac03280fc1]::ErrorGuaranteed>>::{closure#0}, core[85b4fd477ce5bb21]::result::Result<(), rustc_span[adb133ac03280fc1]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[85b4fd477ce5bb21]::result::Result<(), rustc_span[adb133ac03280fc1]::ErrorGuaranteed>>
  54:     0x7ffba8dbe532 - <<std[5a8e7f94216a9138]::thread::Builder>::spawn_unchecked_<rustc_interface[7ca501d7f8f3a34f]::util::run_in_thread_with_globals<rustc_interface[7ca501d7f8f3a34f]::util::run_in_thread_pool_with_globals<rustc_interface[7ca501d7f8f3a34f]::interface::run_compiler<core[85b4fd477ce5bb21]::result::Result<(), rustc_span[adb133ac03280fc1]::ErrorGuaranteed>, rustc_driver_impl[e279e4f1fedd9109]::run_compiler::{closure#0}>::{closure#0}, core[85b4fd477ce5bb21]::result::Result<(), rustc_span[adb133ac03280fc1]::ErrorGuaranteed>>::{closure#0}, core[85b4fd477ce5bb21]::result::Result<(), rustc_span[adb133ac03280fc1]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[85b4fd477ce5bb21]::result::Result<(), rustc_span[adb133ac03280fc1]::ErrorGuaranteed>>::{closure#1} as core[85b4fd477ce5bb21]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  55:     0x7ffba3b99725 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h1bff3efb61c3fa6b
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/alloc/src/boxed.rs:2016:9
  56:     0x7ffba3b99725 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h83141cf549dced8a
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/alloc/src/boxed.rs:2016:9
  57:     0x7ffba3b99725 - std::sys::pal::unix::thread::Thread::new::thread_start::hbe9287fdd7c325bc
                               at /rustc/f8131a48a46ac3bc8a3d0fe0477055b132cffdc3/library/std/src/sys/pal/unix/thread.rs:108:17
  58:     0x7ffba39819eb - <unknown>
  59:     0x7ffba3a057cc - <unknown>
  60:                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.78.0-nightly (f8131a48a 2024-02-21) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [resolve_bound_vars] resolving lifetimes
#1 [named_variable_map] looking up a named region
#2 [explicit_item_bounds] finding item bounds for `produce::{opaque#0}::{opaque#0}`
#3 [collect_mod_item_types] collecting item types in top-level module
#4 [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: E0220, E0601.
For more information about an error, try `rustc --explain E0220`.

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

Regression in nightly-2023-02-18

fetching (via remote github) commits from max(9a7cc6c, 2023-02-15) to 9aa5c24
ending github query because we found starting sha: 9a7cc6c
get_commits_between returning commits, len: 8
commit[0] 2023-02-16: Auto merge of #108127 - matthiaskrgr:rollup-kpzfc6j, r=matthiaskrgr
commit[1] 2023-02-16: Auto merge of #107833 - Zoxc:arena-query-clean, r=cjgillot
commit[2] 2023-02-17: Auto merge of #108145 - matthiaskrgr:rollup-bgadak1, r=matthiaskrgr
commit[3] 2023-02-17: Auto merge of #107753 - kylematsuda:type-of, r=BoxyUwU
commit[4] 2023-02-17: Auto merge of #108058 - Zoxc:query-ctxtx-byval, r=cjgillot
commit[5] 2023-02-17: Auto merge of #107965 - BoxyUwU:add_const_arg_has_type_predicate, r=compiler-errors
commit[6] 2023-02-17: Auto merge of #108159 - matthiaskrgr:rollup-5k2j7cx, r=matthiaskrgr
commit[7] 2023-02-17: Auto merge of #108075 - WaffleLapkin:de-arena-allocates-you-OwO, r=Nilstrieb
ERROR: no CI builds available between 9a7cc6c and 9aa5c24 within last 167 days

@matthiaskrgr matthiaskrgr added the F-non_lifetime_binders `#![feature(non_lifetime_binders)]` label Feb 22, 2024
@compiler-errors compiler-errors self-assigned this Feb 22, 2024
@fmease fmease removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Mar 1, 2024
@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Apr 15, 2024
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. F-non_lifetime_binders `#![feature(non_lifetime_binders)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants