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: No bound vars found for HirId #112574

Closed
matthiaskrgr opened this issue Jun 13, 2023 · 1 comment · Fixed by #113396
Closed

ICE: No bound vars found for HirId #112574

matthiaskrgr opened this issue Jun 13, 2023 · 1 comment · Fixed by #113396
Assignees
Labels
C-bug Category: This is a bug. F-non_lifetime_binders `#![feature(non_lifetime_binders)]` glacier ICE tracked in rust-lang/glacier. 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

matthiaskrgr commented Jun 13, 2023

Code

#![feature(non_lifetime_binders)]

pub fn bar()
where
    for<const N: usize = {
    (||1usize)()
}> V: IntoIterator
{
}

fn main() {
    bar();
}

Meta

rustc --version --verbose:

rustc 1.72.0-dev
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.72.0-dev
LLVM version: 16.0.5

Error output

error[E0412]: cannot find type `V` in this scope
 --> 5C8E6DFB90049D1ED2C38FC6320AD5DA73701B5AFC252FFE8FE74BB826CA50CE.rs:6:4
  |
6 | }> V: IntoIterator
  |    ^ not found in this scope
  |
help: you might be missing a type parameter
  |
2 | pub fn bar<V>()
  |           +++


Backtrace


error: internal compiler error: compiler/rustc_middle/src/ty/context.rs:2289:21: No bound vars found for HirId(DefId(0:3 ~ 5C8E6DFB90049D1ED2C38FC6320AD5DA73701B5AFC252FFE8FE74BB826CA50CE[127a]::bar).9) (expr `||`)

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/37998ab508d5d9fa0d465d7b535dc673087dda8f/compiler/rustc_errors/src/lib.rs:1650:9
stack backtrace:
   0:     0x7f10e616cc41 - std::backtrace_rs::backtrace::libunwind::trace::h35f134416a413def
                               at /rustc/37998ab508d5d9fa0d465d7b535dc673087dda8f/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f10e616cc41 - std::backtrace_rs::backtrace::trace_unsynchronized::h97d72e5ccb361250
                               at /rustc/37998ab508d5d9fa0d465d7b535dc673087dda8f/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f10e616cc41 - std::sys_common::backtrace::_print_fmt::h41dee555152bfe03
                               at /rustc/37998ab508d5d9fa0d465d7b535dc673087dda8f/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f10e616cc41 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hc1e304ec519467a0
                               at /rustc/37998ab508d5d9fa0d465d7b535dc673087dda8f/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f10e61cd5ff - core::fmt::rt::Argument::fmt::h18748c956c86f6df
                               at /rustc/37998ab508d5d9fa0d465d7b535dc673087dda8f/library/core/src/fmt/rt.rs:138:9
   5:     0x7f10e61cd5ff - core::fmt::write::h1ed511e09c7a8383
                               at /rustc/37998ab508d5d9fa0d465d7b535dc673087dda8f/library/core/src/fmt/mod.rs:1094:21
   6:     0x7f10e615fee1 - std::io::Write::write_fmt::h8733931b2a82a2eb
                               at /rustc/37998ab508d5d9fa0d465d7b535dc673087dda8f/library/std/src/io/mod.rs:1713:15
   7:     0x7f10e616ca55 - std::sys_common::backtrace::_print::hb465b5b4b7eb2936
                               at /rustc/37998ab508d5d9fa0d465d7b535dc673087dda8f/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f10e616ca55 - std::sys_common::backtrace::print::h8bcb164fa5fc7be2
                               at /rustc/37998ab508d5d9fa0d465d7b535dc673087dda8f/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f10e616f737 - std::panicking::default_hook::{{closure}}::h01283762a96218bc
  10:     0x7f10e616f524 - std::panicking::default_hook::hfd21c0cfcb272d16
                               at /rustc/37998ab508d5d9fa0d465d7b535dc673087dda8f/library/std/src/panicking.rs:288:9
  11:     0x7f10e4fdc13b - <rustc_driver_impl[fba1e33438a44d68]::install_ice_hook::{closure#0} as core[1db632d38b63a018]::ops::function::FnOnce<(&core[1db632d38b63a018]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  12:     0x7f10e616fe7d - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h3a1de70d32a99b50
                               at /rustc/37998ab508d5d9fa0d465d7b535dc673087dda8f/library/alloc/src/boxed.rs:1999:9
  13:     0x7f10e616fe7d - std::panicking::rust_panic_with_hook::h9d8ee017c8a85eb4
                               at /rustc/37998ab508d5d9fa0d465d7b535dc673087dda8f/library/std/src/panicking.rs:709:13
  14:     0x7f10e54f3441 - std[cba8be935e4691e6]::panicking::begin_panic::<rustc_errors[728f9932e0aceb2e]::ExplicitBug>::{closure#0}
  15:     0x7f10e54ef166 - std[cba8be935e4691e6]::sys_common::backtrace::__rust_end_short_backtrace::<std[cba8be935e4691e6]::panicking::begin_panic<rustc_errors[728f9932e0aceb2e]::ExplicitBug>::{closure#0}, !>
  16:     0x7f10e556a826 - std[cba8be935e4691e6]::panicking::begin_panic::<rustc_errors[728f9932e0aceb2e]::ExplicitBug>
  17:     0x7f10e54e96e4 - <rustc_errors[728f9932e0aceb2e]::HandlerInner>::bug::<alloc[cca000f3ce8c2124]::string::String>
  18:     0x7f10e54e9486 - <rustc_errors[728f9932e0aceb2e]::Handler>::bug::<alloc[cca000f3ce8c2124]::string::String>
  19:     0x7f10e5578605 - rustc_middle[59a3416cac023631]::util::bug::opt_span_bug_fmt::<rustc_span[6d789dedfce3844e]::span_encoding::Span>::{closure#0}
  20:     0x7f10e557521a - rustc_middle[59a3416cac023631]::ty::context::tls::with_opt::<rustc_middle[59a3416cac023631]::util::bug::opt_span_bug_fmt<rustc_span[6d789dedfce3844e]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7f10e55751ea - rustc_middle[59a3416cac023631]::ty::context::tls::with_context_opt::<rustc_middle[59a3416cac023631]::ty::context::tls::with_opt<rustc_middle[59a3416cac023631]::util::bug::opt_span_bug_fmt<rustc_span[6d789dedfce3844e]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7f10e3252d2d - rustc_middle[59a3416cac023631]::util::bug::bug_fmt
  23:     0x7f10e3f4046f - <rustc_middle[59a3416cac023631]::ty::context::TyCtxt>::late_bound_vars
  24:     0x7f10e3632a95 - <rustc_hir_typeck[1da36ff38e28e3e5]::fn_ctxt::FnCtxt>::supplied_sig_of_closure
  25:     0x7f10e362e730 - <rustc_hir_typeck[1da36ff38e28e3e5]::fn_ctxt::FnCtxt>::check_expr_closure
  26:     0x7f10e35a9af5 - <rustc_hir_typeck[1da36ff38e28e3e5]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  27:     0x7f10e31f0bde - <rustc_hir_typeck[1da36ff38e28e3e5]::fn_ctxt::FnCtxt>::check_call
  28:     0x7f10e35a5b80 - <rustc_hir_typeck[1da36ff38e28e3e5]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  29:     0x7f10e35eab8f - <rustc_hir_typeck[1da36ff38e28e3e5]::fn_ctxt::FnCtxt>::check_block_with_expected
  30:     0x7f10e35a64f2 - <rustc_hir_typeck[1da36ff38e28e3e5]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  31:     0x7f10e35a1459 - <rustc_hir_typeck[1da36ff38e28e3e5]::fn_ctxt::FnCtxt>::check_expr_coercible_to_type
  32:     0x7f10e3a7faf1 - rustc_hir_typeck[1da36ff38e28e3e5]::typeck
  33:     0x7f10e302240e - rustc_query_impl[df3b21b9339ef56f]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[df3b21b9339ef56f]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[59a3416cac023631]::query::erase::Erased<[u8; 8usize]>>
  34:     0x7f10e30223de - <rustc_query_impl[df3b21b9339ef56f]::query_impl::typeck::dynamic_query::{closure#2} as core[1db632d38b63a018]::ops::function::FnOnce<(rustc_middle[59a3416cac023631]::ty::context::TyCtxt, rustc_span[6d789dedfce3844e]::def_id::LocalDefId)>>::call_once
  35:     0x7f10e30f30fd - rustc_query_system[a4db672a9fb1a0c2]::query::plumbing::try_execute_query::<rustc_query_impl[df3b21b9339ef56f]::DynamicConfig<rustc_query_system[a4db672a9fb1a0c2]::query::caches::VecCache<rustc_span[6d789dedfce3844e]::def_id::LocalDefId, rustc_middle[59a3416cac023631]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[df3b21b9339ef56f]::plumbing::QueryCtxt, false>
  36:     0x7f10e495b621 - rustc_query_impl[df3b21b9339ef56f]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  37:     0x7f10e313b91d - rustc_query_impl[df3b21b9339ef56f]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[df3b21b9339ef56f]::query_impl::used_trait_imports::dynamic_query::{closure#2}::{closure#0}, rustc_middle[59a3416cac023631]::query::erase::Erased<[u8; 8usize]>>
  38:     0x7f10e313b87e - <rustc_query_impl[df3b21b9339ef56f]::query_impl::used_trait_imports::dynamic_query::{closure#2} as core[1db632d38b63a018]::ops::function::FnOnce<(rustc_middle[59a3416cac023631]::ty::context::TyCtxt, rustc_span[6d789dedfce3844e]::def_id::LocalDefId)>>::call_once
  39:     0x7f10e30f30fd - rustc_query_system[a4db672a9fb1a0c2]::query::plumbing::try_execute_query::<rustc_query_impl[df3b21b9339ef56f]::DynamicConfig<rustc_query_system[a4db672a9fb1a0c2]::query::caches::VecCache<rustc_span[6d789dedfce3844e]::def_id::LocalDefId, rustc_middle[59a3416cac023631]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[df3b21b9339ef56f]::plumbing::QueryCtxt, false>
  40:     0x7f10e495b721 - rustc_query_impl[df3b21b9339ef56f]::query_impl::used_trait_imports::get_query_non_incr::__rust_end_short_backtrace
  41:     0x7f10e446ec5d - rustc_hir_analysis[612599f064808e12]::check_crate
  42:     0x7f10e4469a3d - rustc_interface[3e335cb30b0230d7]::passes::analysis
  43:     0x7f10e44ebfca - rustc_query_impl[df3b21b9339ef56f]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[df3b21b9339ef56f]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[59a3416cac023631]::query::erase::Erased<[u8; 1usize]>>
  44:     0x7f10e44ebfb9 - <rustc_query_impl[df3b21b9339ef56f]::query_impl::analysis::dynamic_query::{closure#2} as core[1db632d38b63a018]::ops::function::FnOnce<(rustc_middle[59a3416cac023631]::ty::context::TyCtxt, ())>>::call_once
  45:     0x7f10e46750f8 - rustc_query_system[a4db672a9fb1a0c2]::query::plumbing::try_execute_query::<rustc_query_impl[df3b21b9339ef56f]::DynamicConfig<rustc_query_system[a4db672a9fb1a0c2]::query::caches::SingleCache<rustc_middle[59a3416cac023631]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[df3b21b9339ef56f]::plumbing::QueryCtxt, false>
  46:     0x7f10e4674ec9 - rustc_query_impl[df3b21b9339ef56f]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  47:     0x7f10e464b2f5 - <rustc_middle[59a3416cac023631]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[fba1e33438a44d68]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[1db632d38b63a018]::result::Result<(), rustc_span[6d789dedfce3844e]::ErrorGuaranteed>>
  48:     0x7f10e429e33f - <rustc_interface[3e335cb30b0230d7]::interface::Compiler>::enter::<rustc_driver_impl[fba1e33438a44d68]::run_compiler::{closure#1}::{closure#2}, core[1db632d38b63a018]::result::Result<core[1db632d38b63a018]::option::Option<rustc_interface[3e335cb30b0230d7]::queries::Linker>, rustc_span[6d789dedfce3844e]::ErrorGuaranteed>>
  49:     0x7f10e429bed9 - <scoped_tls[1ae1ce8af73abd96]::ScopedKey<rustc_span[6d789dedfce3844e]::SessionGlobals>>::set::<rustc_interface[3e335cb30b0230d7]::interface::run_compiler<core[1db632d38b63a018]::result::Result<(), rustc_span[6d789dedfce3844e]::ErrorGuaranteed>, rustc_driver_impl[fba1e33438a44d68]::run_compiler::{closure#1}>::{closure#0}, core[1db632d38b63a018]::result::Result<(), rustc_span[6d789dedfce3844e]::ErrorGuaranteed>>
  50:     0x7f10e429b346 - std[cba8be935e4691e6]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[3e335cb30b0230d7]::util::run_in_thread_pool_with_globals<rustc_interface[3e335cb30b0230d7]::interface::run_compiler<core[1db632d38b63a018]::result::Result<(), rustc_span[6d789dedfce3844e]::ErrorGuaranteed>, rustc_driver_impl[fba1e33438a44d68]::run_compiler::{closure#1}>::{closure#0}, core[1db632d38b63a018]::result::Result<(), rustc_span[6d789dedfce3844e]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[1db632d38b63a018]::result::Result<(), rustc_span[6d789dedfce3844e]::ErrorGuaranteed>>
  51:     0x7f10e429b0f5 - <<std[cba8be935e4691e6]::thread::Builder>::spawn_unchecked_<rustc_interface[3e335cb30b0230d7]::util::run_in_thread_pool_with_globals<rustc_interface[3e335cb30b0230d7]::interface::run_compiler<core[1db632d38b63a018]::result::Result<(), rustc_span[6d789dedfce3844e]::ErrorGuaranteed>, rustc_driver_impl[fba1e33438a44d68]::run_compiler::{closure#1}>::{closure#0}, core[1db632d38b63a018]::result::Result<(), rustc_span[6d789dedfce3844e]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[1db632d38b63a018]::result::Result<(), rustc_span[6d789dedfce3844e]::ErrorGuaranteed>>::{closure#1} as core[1db632d38b63a018]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  52:     0x7f10e617a3a5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h4e8c3fc074112d3c
                               at /rustc/37998ab508d5d9fa0d465d7b535dc673087dda8f/library/alloc/src/boxed.rs:1985:9
  53:     0x7f10e617a3a5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hdc315b6a2477d325
                               at /rustc/37998ab508d5d9fa0d465d7b535dc673087dda8f/library/alloc/src/boxed.rs:1985:9
  54:     0x7f10e617a3a5 - std::sys::unix::thread::Thread::new::thread_start::h5f49ef29460f0a9b
                               at /rustc/37998ab508d5d9fa0d465d7b535dc673087dda8f/library/std/src/sys/unix/thread.rs:108:17
  55:     0x7f10e1c6444b - <unknown>
  56:     0x7f10e1ce7e40 - <unknown>
  57:                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.72.0-nightly (37998ab50 2023-06-11) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [typeck] type-checking `bar::{constant#0}`
#1 [used_trait_imports] finding used_trait_imports `bar::{constant#0}`
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 3 previous errors

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

@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. F-non_lifetime_binders `#![feature(non_lifetime_binders)]` labels Jun 13, 2023
@lenko-d
Copy link
Contributor

lenko-d commented Jun 17, 2023

@rustbot claim

@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Jul 14, 2023
bors added a commit to rust-lang-ci/rust that referenced this issue Sep 25, 2023
…for_lifetime_binders, r=compiler-errors

Don't ICE when no bound vars found while doing closure hir type check

The problem was that we were not visiting the const generic default argument in a bound where predicate when the HIR gets traversed in hir_analysis -> collect -> resolve_bound_vars.

Fixes [112574](rust-lang#112574)
bors added a commit to rust-lang-ci/rust that referenced this issue Sep 25, 2023
…for_lifetime_binders, r=compiler-errors

Don't ICE when no bound vars found while doing closure hir type check

The problem was that we were not visiting the const generic default argument in a bound where predicate when the HIR gets traversed in hir_analysis -> collect -> resolve_bound_vars.

Fixes [112574](rust-lang#112574)
github-actions bot pushed a commit to rust-lang/miri that referenced this issue Sep 27, 2023
…ime_binders, r=compiler-errors

Don't ICE when no bound vars found while doing closure hir type check

The problem was that we were not visiting the const generic default argument in a bound where predicate when the HIR gets traversed in hir_analysis -> collect -> resolve_bound_vars.

Fixes [112574](rust-lang/rust#112574)
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)]` glacier ICE tracked in rust-lang/glacier. 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.

3 participants