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

unexpected bound var resolution for HirId(DefId(0:8 ~ test_3[ea46]::kind::{opaque#0}::{opaque#0}).1): None #119716

Open
Doremisolatido opened this issue Jan 7, 2024 · 1 comment · May be fixed by #129244
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) ❄️ requires-incomplete-features 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

@Doremisolatido
Copy link

Code

#![feature(non_lifetime_binders)]
trait v0<v1> {}
fn kind  :(v3main impl for<v4> v0<'_, v2 = impl v0<v4> + '_>) {}

Meta

rustc --version --verbose:

rustc 1.77.0-nightly (d8b44d280 2024-01-07)
binary: rustc
commit-hash: d8b44d2802ab665b183dce06d527bf09175dd8cf
commit-date: 2024-01-07
host: x86_64-unknown-linux-gnu
release: 1.77.0-nightly
LLVM version: 17.0.6

Error output

error: internal compiler error: compiler/rustc_hir_analysis/src/astconv/mod.rs:2296:20: unexpected bound var resolution for HirId(DefId(0:8 ~ test_3[ea46]::kind::{opaque#0}::{opaque#0}).1): None
Box<dyn Any>
stack backtrace:
   0:     0x7f7399548477 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h9b88b6f3ca46a608
   1:     0x7f73995a6470 - core::fmt::write::h006931418f3178a6
   2:     0x7f7399534f1f - std::io::Write::write_fmt::hef1b13539c871113
   3:     0x7f7399548244 - std::sys_common::backtrace::print::hdf04dd1e52b85090
   4:     0x7f739954914a - std::panicking::default_hook::{{closure}}::h38e3ca5d3417a132
   5:     0x7f7399548e73 - std::panicking::default_hook::h7c8bd090cc5c8cb1
   6:     0x7f7390ca0c37 - <alloc[ab03fe8b414083ab]::boxed::Box<rustc_driver_impl[2320baa211b147c5]::install_ice_hook::{closure#0}> as core[da5ff848ab5b9634]::ops::function::Fn<(&dyn for<'a, 'b> core[da5ff848ab5b9634]::ops::function::Fn<(&'a core[da5ff848ab5b9634]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[da5ff848ab5b9634]::marker::Sync + core[da5ff848ab5b9634]::marker::Send, &core[da5ff848ab5b9634]::panic::panic_info::PanicInfo)>>::call
   7:     0x7f7399549898 - std::panicking::rust_panic_with_hook::h39552955130d1e24
   8:     0x7f7395ee8786 - std[9295f5ecf1531c2a]::panicking::begin_panic::<rustc_errors[aa2fa569483a35a2]::ExplicitBug>::{closure#0}
   9:     0x7f7395ee3576 - std[9295f5ecf1531c2a]::sys_common::backtrace::__rust_end_short_backtrace::<std[9295f5ecf1531c2a]::panicking::begin_panic<rustc_errors[aa2fa569483a35a2]::ExplicitBug>::{closure#0}, !>
  10:     0x7f7390c10fd6 - std[9295f5ecf1531c2a]::panicking::begin_panic::<rustc_errors[aa2fa569483a35a2]::ExplicitBug>
  11:     0x7f7395edaf21 - <rustc_errors[aa2fa569483a35a2]::diagnostic_builder::BugAbort as rustc_errors[aa2fa569483a35a2]::diagnostic_builder::EmissionGuarantee>::emit_producing_guarantee
  12:     0x7f7395d532dd - <rustc_errors[aa2fa569483a35a2]::DiagCtxt>::bug::<alloc[ab03fe8b414083ab]::string::String>
  13:     0x7f7395d36115 - rustc_middle[712429aa67461ada]::util::bug::opt_span_bug_fmt::<rustc_span[7e71af783b1896b5]::span_encoding::Span>::{closure#0}
  14:     0x7f7395d2e59a - rustc_middle[712429aa67461ada]::ty::context::tls::with_opt::<rustc_middle[712429aa67461ada]::util::bug::opt_span_bug_fmt<rustc_span[7e71af783b1896b5]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  15:     0x7f7395d2e548 - rustc_middle[712429aa67461ada]::ty::context::tls::with_context_opt::<rustc_middle[712429aa67461ada]::ty::context::tls::with_opt<rustc_middle[712429aa67461ada]::util::bug::opt_span_bug_fmt<rustc_span[7e71af783b1896b5]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  16:     0x7f7390be1422 - rustc_middle[712429aa67461ada]::util::bug::bug_fmt
  17:     0x7f7393cd8727 - <dyn rustc_hir_analysis[70120cffb8a4fd07]::astconv::AstConv>::hir_id_to_bound_ty
  18:     0x7f7393cd4bcf - <dyn rustc_hir_analysis[70120cffb8a4fd07]::astconv::AstConv>::res_to_ty
  19:     0x7f7393ce859b - <dyn rustc_hir_analysis[70120cffb8a4fd07]::astconv::AstConv>::ast_ty_to_ty_inner
  20:     0x7f7393cda267 - <<dyn rustc_hir_analysis[70120cffb8a4fd07]::astconv::AstConv>::create_args_for_ast_path::{closure#0}::SubstsForAstPathCtxt as rustc_hir_analysis[70120cffb8a4fd07]::astconv::CreateSubstsForGenericArgsCtxt>::provided_kind::{closure#0}
  21:     0x7f7393cd9f67 - <<dyn rustc_hir_analysis[70120cffb8a4fd07]::astconv::AstConv>::create_args_for_ast_path::{closure#0}::SubstsForAstPathCtxt as rustc_hir_analysis[70120cffb8a4fd07]::astconv::CreateSubstsForGenericArgsCtxt>::provided_kind
  22:     0x7f7393e1bb58 - rustc_hir_analysis[70120cffb8a4fd07]::astconv::generics::create_args_for_parent_generic_args::<<dyn rustc_hir_analysis[70120cffb8a4fd07]::astconv::AstConv>::create_args_for_ast_path::{closure#0}::SubstsForAstPathCtxt>
  23:     0x7f7393cd9cd3 - <dyn rustc_hir_analysis[70120cffb8a4fd07]::astconv::AstConv>::create_args_for_ast_path
  24:     0x7f7393cdb43a - <dyn rustc_hir_analysis[70120cffb8a4fd07]::astconv::AstConv>::instantiate_poly_trait_ref
  25:     0x7f7393cc34c3 - <dyn rustc_hir_analysis[70120cffb8a4fd07]::astconv::AstConv>::compute_bounds
  26:     0x7f7393d70713 - rustc_hir_analysis[70120cffb8a4fd07]::collect::item_bounds::opaque_type_bounds
  27:     0x7f7393d600b6 - rustc_hir_analysis[70120cffb8a4fd07]::collect::item_bounds::explicit_item_bounds
  28:     0x7f7394ba107e - rustc_query_impl[c09cc8fff495313c]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c09cc8fff495313c]::query_impl::explicit_item_bounds::dynamic_query::{closure#2}::{closure#0}, rustc_middle[712429aa67461ada]::query::erase::Erased<[u8; 16usize]>>
  29:     0x7f7394c19a21 - <rustc_query_impl[c09cc8fff495313c]::query_impl::explicit_item_bounds::dynamic_query::{closure#2} as core[da5ff848ab5b9634]::ops::function::FnOnce<(rustc_middle[712429aa67461ada]::ty::context::TyCtxt, rustc_span[7e71af783b1896b5]::def_id::DefId)>>::call_once
  30:     0x7f7394e620ca - rustc_query_system[3a5b469aacd7ee53]::query::plumbing::try_execute_query::<rustc_query_impl[c09cc8fff495313c]::DynamicConfig<rustc_query_system[3a5b469aacd7ee53]::query::caches::DefaultCache<rustc_span[7e71af783b1896b5]::def_id::DefId, rustc_middle[712429aa67461ada]::query::erase::Erased<[u8; 16usize]>>, false, false, false>, rustc_query_impl[c09cc8fff495313c]::plumbing::QueryCtxt, false>
  31:     0x7f7394c3800c - rustc_query_impl[c09cc8fff495313c]::query_impl::explicit_item_bounds::get_query_non_incr::__rust_end_short_backtrace
  32:     0x7f7393d6974f - rustc_hir_analysis[70120cffb8a4fd07]::collect::convert_item
  33:     0x7f7393d616f2 - <rustc_hir_analysis[70120cffb8a4fd07]::collect::CollectItemTypesVisitor as rustc_hir[c5f0d571a76e7881]::intravisit::Visitor>::visit_item
  34:     0x7f7393dcf457 - <rustc_middle[712429aa67461ada]::hir::map::Map>::visit_item_likes_in_module::<rustc_hir_analysis[70120cffb8a4fd07]::collect::CollectItemTypesVisitor>
  35:     0x7f7393d60e7d - rustc_hir_analysis[70120cffb8a4fd07]::collect::collect_mod_item_types
  36:     0x7f7394ba147c - rustc_query_impl[c09cc8fff495313c]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c09cc8fff495313c]::query_impl::collect_mod_item_types::dynamic_query::{closure#2}::{closure#0}, rustc_middle[712429aa67461ada]::query::erase::Erased<[u8; 0usize]>>
  37:     0x7f7394c08a3c - <rustc_query_impl[c09cc8fff495313c]::query_impl::collect_mod_item_types::dynamic_query::{closure#2} as core[da5ff848ab5b9634]::ops::function::FnOnce<(rustc_middle[712429aa67461ada]::ty::context::TyCtxt, rustc_span[7e71af783b1896b5]::def_id::LocalModDefId)>>::call_once
  38:     0x7f7394e5936b - rustc_query_system[3a5b469aacd7ee53]::query::plumbing::try_execute_query::<rustc_query_impl[c09cc8fff495313c]::DynamicConfig<rustc_query_system[3a5b469aacd7ee53]::query::caches::DefaultCache<rustc_span[7e71af783b1896b5]::def_id::LocalModDefId, rustc_middle[712429aa67461ada]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[c09cc8fff495313c]::plumbing::QueryCtxt, false>
  39:     0x7f7394c4712d - rustc_query_impl[c09cc8fff495313c]::query_impl::collect_mod_item_types::get_query_non_incr::__rust_end_short_backtrace
  40:     0x7f7393dceddd - <rustc_middle[712429aa67461ada]::hir::map::Map>::for_each_module::<rustc_hir_analysis[70120cffb8a4fd07]::check_crate::{closure#0}::{closure#0}::{closure#0}>
  41:     0x7f7393e68015 - <rustc_session[9285c94e3a71432f]::session::Session>::track_errors::<rustc_hir_analysis[70120cffb8a4fd07]::check_crate::{closure#0}, ()>
  42:     0x7f7393dce266 - rustc_hir_analysis[70120cffb8a4fd07]::check_crate
  43:     0x7f7390e6ccc0 - rustc_interface[b5ea119f6d9fba02]::passes::analysis
  44:     0x7f7394ba318a - rustc_query_impl[c09cc8fff495313c]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[c09cc8fff495313c]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[712429aa67461ada]::query::erase::Erased<[u8; 1usize]>>
  45:     0x7f7394d54708 - <rustc_query_impl[c09cc8fff495313c]::query_impl::analysis::dynamic_query::{closure#2} as core[da5ff848ab5b9634]::ops::function::FnOnce<(rustc_middle[712429aa67461ada]::ty::context::TyCtxt, ())>>::call_once
  46:     0x7f7394e11fac - rustc_query_system[3a5b469aacd7ee53]::query::plumbing::try_execute_query::<rustc_query_impl[c09cc8fff495313c]::DynamicConfig<rustc_query_system[3a5b469aacd7ee53]::query::caches::SingleCache<rustc_middle[712429aa67461ada]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[c09cc8fff495313c]::plumbing::QueryCtxt, false>
  47:     0x7f7394c37043 - rustc_query_impl[c09cc8fff495313c]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  48:     0x7f7390c7f04b - <rustc_middle[712429aa67461ada]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[2320baa211b147c5]::run_compiler::{closure#0}::{closure#0}::{closure#3}, core[da5ff848ab5b9634]::result::Result<(), rustc_span[7e71af783b1896b5]::ErrorGuaranteed>>
  49:     0x7f7390d06869 - <rustc_interface[b5ea119f6d9fba02]::interface::Compiler>::enter::<rustc_driver_impl[2320baa211b147c5]::run_compiler::{closure#0}::{closure#0}, core[da5ff848ab5b9634]::result::Result<core[da5ff848ab5b9634]::option::Option<rustc_interface[b5ea119f6d9fba02]::queries::Linker>, rustc_span[7e71af783b1896b5]::ErrorGuaranteed>>
  50:     0x7f7390cc8469 - rustc_span[7e71af783b1896b5]::set_source_map::<core[da5ff848ab5b9634]::result::Result<(), rustc_span[7e71af783b1896b5]::ErrorGuaranteed>, rustc_interface[b5ea119f6d9fba02]::interface::run_compiler<core[da5ff848ab5b9634]::result::Result<(), rustc_span[7e71af783b1896b5]::ErrorGuaranteed>, rustc_driver_impl[2320baa211b147c5]::run_compiler::{closure#0}>::{closure#0}::{closure#0}>
  51:     0x7f7390cae7d3 - <scoped_tls[8787e17a3822f26a]::ScopedKey<rustc_span[7e71af783b1896b5]::SessionGlobals>>::set::<rustc_interface[b5ea119f6d9fba02]::util::run_in_thread_pool_with_globals<rustc_interface[b5ea119f6d9fba02]::interface::run_compiler<core[da5ff848ab5b9634]::result::Result<(), rustc_span[7e71af783b1896b5]::ErrorGuaranteed>, rustc_driver_impl[2320baa211b147c5]::run_compiler::{closure#0}>::{closure#0}, core[da5ff848ab5b9634]::result::Result<(), rustc_span[7e71af783b1896b5]::ErrorGuaranteed>>::{closure#0}, core[da5ff848ab5b9634]::result::Result<(), rustc_span[7e71af783b1896b5]::ErrorGuaranteed>>
  52:     0x7f7390cc8959 - rustc_span[7e71af783b1896b5]::create_session_globals_then::<core[da5ff848ab5b9634]::result::Result<(), rustc_span[7e71af783b1896b5]::ErrorGuaranteed>, rustc_interface[b5ea119f6d9fba02]::util::run_in_thread_pool_with_globals<rustc_interface[b5ea119f6d9fba02]::interface::run_compiler<core[da5ff848ab5b9634]::result::Result<(), rustc_span[7e71af783b1896b5]::ErrorGuaranteed>, rustc_driver_impl[2320baa211b147c5]::run_compiler::{closure#0}>::{closure#0}, core[da5ff848ab5b9634]::result::Result<(), rustc_span[7e71af783b1896b5]::ErrorGuaranteed>>::{closure#0}>
  53:     0x7f7390cb7cae - std[9295f5ecf1531c2a]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[b5ea119f6d9fba02]::util::run_in_thread_with_globals<rustc_interface[b5ea119f6d9fba02]::util::run_in_thread_pool_with_globals<rustc_interface[b5ea119f6d9fba02]::interface::run_compiler<core[da5ff848ab5b9634]::result::Result<(), rustc_span[7e71af783b1896b5]::ErrorGuaranteed>, rustc_driver_impl[2320baa211b147c5]::run_compiler::{closure#0}>::{closure#0}, core[da5ff848ab5b9634]::result::Result<(), rustc_span[7e71af783b1896b5]::ErrorGuaranteed>>::{closure#0}, core[da5ff848ab5b9634]::result::Result<(), rustc_span[7e71af783b1896b5]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[da5ff848ab5b9634]::result::Result<(), rustc_span[7e71af783b1896b5]::ErrorGuaranteed>>
  54:     0x7f7390cb8ad1 - <<std[9295f5ecf1531c2a]::thread::Builder>::spawn_unchecked_<rustc_interface[b5ea119f6d9fba02]::util::run_in_thread_with_globals<rustc_interface[b5ea119f6d9fba02]::util::run_in_thread_pool_with_globals<rustc_interface[b5ea119f6d9fba02]::interface::run_compiler<core[da5ff848ab5b9634]::result::Result<(), rustc_span[7e71af783b1896b5]::ErrorGuaranteed>, rustc_driver_impl[2320baa211b147c5]::run_compiler::{closure#0}>::{closure#0}, core[da5ff848ab5b9634]::result::Result<(), rustc_span[7e71af783b1896b5]::ErrorGuaranteed>>::{closure#0}, core[da5ff848ab5b9634]::result::Result<(), rustc_span[7e71af783b1896b5]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[da5ff848ab5b9634]::result::Result<(), rustc_span[7e71af783b1896b5]::ErrorGuaranteed>>::{closure#1} as core[da5ff848ab5b9634]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  55:     0x7f7399577685 - std::sys::unix::thread::Thread::new::thread_start::h0316d03ce42d35a5
  56:     0x7f738fe94ac3 - start_thread
                               at ./nptl/pthread_create.c:442:8
  57:     0x7f738ff26660 - clone3
                               at ./misc/../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
  58:                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

@Doremisolatido Doremisolatido added 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. labels Jan 7, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 7, 2024
@fmease fmease added the F-non_lifetime_binders `#![feature(non_lifetime_binders)]` label Jan 7, 2024
@fmease
Copy link
Member

fmease commented Jan 7, 2024

Minimized and cleaned up:

#![feature(non_lifetime_binders)]
trait Trait<T> {}
fn f<T>() -> impl for<T> Trait<impl Trait<T>> {}

@fmease fmease added requires-incomplete-features and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Jan 7, 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
@cjgillot cjgillot linked a pull request Aug 18, 2024 that will close this issue
bors added a commit to rust-lang-ci/rust that referenced this issue Aug 22, 2024
Make opaque types regular HIR nodes

Having opaque types as HIR owner introduces all sorts of complications. This PR proposes to make them regular HIR nodes instead.

I haven't gone through all the test changes yet, so there may be a few surprises.

Many thanks to `@camelid` for the first draft.
Fixes rust-lang#129023

Fixes rust-lang#129099
Fixes rust-lang#125843
Fixes rust-lang#119716
Fixes rust-lang#121422
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) ❄️ requires-incomplete-features 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

Successfully merging a pull request may close this issue.

4 participants