Skip to content

ICE: has escaping bound vars, so it cannot be wrapped in a dummy binder #111418

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 May 10, 2023 · 1 comment
Closed
Labels
C-bug Category: This is a bug. F-generic_const_exprs `#![feature(generic_const_exprs)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-incomplete-features This issue requires the use of incomplete features. requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

Code

#![feature(generic_const_exprs)]
fn bug<'a>()
where
    for<'b> [(); {
        let x: &'b ();
        0
    }]:
{}

Meta

rustc --version --verbose:

rustc 1.71.0-nightly (2f6bc5d25 2023-05-09)
binary: rustc
commit-hash: 2f6bc5d259e7ab25ddfdd33de53b892770218918
commit-date: 2023-05-09
host: x86_64-unknown-linux-gnu
release: 1.71.0-nightly
LLVM version: 16.0.2

Error output

<output>
Backtrace

warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes
 --> treereduce.out:1:12
  |
1 | #![feature(generic_const_exprs)]
  |            ^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information
  = note: `#[warn(incomplete_features)]` on by default

error[E0601]: `main` function not found in crate `treereduce`
 --> treereduce.out:8:3
  |
8 | {}
  |   ^ consider adding a `main` function to `treereduce.out`

thread 'rustc' panicked at '`WellFormed(&'b ())` has escaping bound vars, so it cannot be wrapped in a dummy binder.', compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs:483:13
stack backtrace:
   0:     0x7faad236a481 - std::backtrace_rs::backtrace::libunwind::trace::h28494931c73179b2
                               at /rustc/2f6bc5d259e7ab25ddfdd33de53b892770218918/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7faad236a481 - std::backtrace_rs::backtrace::trace_unsynchronized::h9032c52edccf7bd1
                               at /rustc/2f6bc5d259e7ab25ddfdd33de53b892770218918/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7faad236a481 - std::sys_common::backtrace::_print_fmt::hd90562e967f4e4e1
                               at /rustc/2f6bc5d259e7ab25ddfdd33de53b892770218918/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7faad236a481 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h113657117676131e
                               at /rustc/2f6bc5d259e7ab25ddfdd33de53b892770218918/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7faad23ca84f - core::fmt::rt::Argument::fmt::hd56cdfa11c364505
                               at /rustc/2f6bc5d259e7ab25ddfdd33de53b892770218918/library/core/src/fmt/rt.rs:138:9
   5:     0x7faad23ca84f - core::fmt::write::h24c20284e5d6be9e
                               at /rustc/2f6bc5d259e7ab25ddfdd33de53b892770218918/library/core/src/fmt/mod.rs:1094:21
   6:     0x7faad235d6e1 - std::io::Write::write_fmt::hbf02c94f0e7342d1
                               at /rustc/2f6bc5d259e7ab25ddfdd33de53b892770218918/library/std/src/io/mod.rs:1712:15
   7:     0x7faad236a295 - std::sys_common::backtrace::_print::he85212e2c716c859
                               at /rustc/2f6bc5d259e7ab25ddfdd33de53b892770218918/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7faad236a295 - std::sys_common::backtrace::print::h888aaf3ad10f084e
                               at /rustc/2f6bc5d259e7ab25ddfdd33de53b892770218918/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7faad236cf17 - std::panicking::default_hook::{{closure}}::hba0edb58dc223add
  10:     0x7faad236cd04 - std::panicking::default_hook::h1555b8bada2010d7
                               at /rustc/2f6bc5d259e7ab25ddfdd33de53b892770218918/library/std/src/panicking.rs:288:9
  11:     0x7faad55d593b - <rustc_driver_impl[c1e8e7e9cc0f0224]::install_ice_hook::{closure#0} as core[75e04f0db769f8d6]::ops::function::FnOnce<(&core[75e04f0db769f8d6]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  12:     0x7faad236d637 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h07438796673f3d04
                               at /rustc/2f6bc5d259e7ab25ddfdd33de53b892770218918/library/alloc/src/boxed.rs:1999:9
  13:     0x7faad236d637 - std::panicking::rust_panic_with_hook::h72a06453beb2cbcb
                               at /rustc/2f6bc5d259e7ab25ddfdd33de53b892770218918/library/std/src/panicking.rs:695:13
  14:     0x7faad236d3b7 - std::panicking::begin_panic_handler::{{closure}}::h0281d6cc05cfd2a4
                               at /rustc/2f6bc5d259e7ab25ddfdd33de53b892770218918/library/std/src/panicking.rs:582:13
  15:     0x7faad236a8c6 - std::sys_common::backtrace::__rust_end_short_backtrace::h1c79565770be27d9
                               at /rustc/2f6bc5d259e7ab25ddfdd33de53b892770218918/library/std/src/sys_common/backtrace.rs:150:18
  16:     0x7faad236d122 - rust_begin_unwind
                               at /rustc/2f6bc5d259e7ab25ddfdd33de53b892770218918/library/std/src/panicking.rs:578:5
  17:     0x7faad23c6ad3 - core::panicking::panic_fmt::he6a2fe7a1b635de3
                               at /rustc/2f6bc5d259e7ab25ddfdd33de53b892770218918/library/core/src/panicking.rs:67:14
  18:     0x7faad3b101ac - <rustc_hir_typeck[7fb44c8b93f9310b]::fn_ctxt::FnCtxt>::register_wf_obligation
  19:     0x7faad3b0ff35 - <rustc_hir_typeck[7fb44c8b93f9310b]::fn_ctxt::FnCtxt>::to_ty
  20:     0x7faad368eba5 - <rustc_hir_typeck[7fb44c8b93f9310b]::gather_locals::GatherLocalsVisitor as rustc_hir[98be715f7d0986d7]::intravisit::Visitor>::visit_local
  21:     0x7faad368d3f9 - <rustc_hir_typeck[7fb44c8b93f9310b]::gather_locals::GatherLocalsVisitor as rustc_hir[98be715f7d0986d7]::intravisit::Visitor>::visit_expr
  22:     0x7faad3c11411 - rustc_hir_typeck[7fb44c8b93f9310b]::typeck
  23:     0x7faad3c06d32 - rustc_query_system[ffc3e6874545e2cc]::query::plumbing::try_execute_query::<rustc_query_impl[677774657eb92e7b]::queries::typeck, rustc_query_impl[677774657eb92e7b]::plumbing::QueryCtxt>
  24:     0x7faad3c069c5 - rustc_query_impl[677774657eb92e7b]::get_query::typeck
  25:     0x7faad3f45e8b - rustc_mir_build[9b43786a7326c032]::thir::cx::thir_body
  26:     0x7faad3f43fcc - rustc_query_system[ffc3e6874545e2cc]::query::plumbing::try_execute_query::<rustc_query_impl[677774657eb92e7b]::queries::thir_body, rustc_query_impl[677774657eb92e7b]::plumbing::QueryCtxt>
  27:     0x7faad3f43c65 - rustc_query_impl[677774657eb92e7b]::get_query::thir_body
  28:     0x7faad46598b6 - rustc_query_system[ffc3e6874545e2cc]::query::plumbing::try_execute_query::<rustc_query_impl[677774657eb92e7b]::queries::thir_abstract_const, rustc_query_impl[677774657eb92e7b]::plumbing::QueryCtxt>
  29:     0x7faad465846a - rustc_query_impl[677774657eb92e7b]::get_query::thir_abstract_const
  30:     0x7faad4a5f212 - rustc_middle[8c6563ccb890ccc7]::ty::query::query_get_at::<rustc_query_system[ffc3e6874545e2cc]::query::caches::DefaultCache<rustc_span[f344ead202b2f728]::def_id::DefId, rustc_middle[8c6563ccb890ccc7]::query::erase::Erased<[u8; 16usize]>>>
  31:     0x7faad3662a38 - <<rustc_middle[8c6563ccb890ccc7]::ty::context::TyCtxt>::expand_abstract_consts::Expander as rustc_type_ir[a2a3eb09eb372e2d]::fold::TypeFolder<rustc_middle[8c6563ccb890ccc7]::ty::context::TyCtxt>>::fold_const
  32:     0x7faad3829887 - rustc_trait_selection[430f5fa6108926ed]::traits::const_evaluatable::is_const_evaluatable
  33:     0x7faad37bc0d2 - <rustc_trait_selection[430f5fa6108926ed]::traits::fulfill::FulfillProcessor as rustc_data_structures[78003e5995acb4f0]::obligation_forest::ObligationProcessor>::process_obligation
  34:     0x7faad37b17c4 - <rustc_data_structures[78003e5995acb4f0]::obligation_forest::ObligationForest<rustc_trait_selection[430f5fa6108926ed]::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection[430f5fa6108926ed]::traits::fulfill::FulfillProcessor>
  35:     0x7faad393f62b - <rustc_trait_selection[430f5fa6108926ed]::traits::engine::ObligationCtxt>::select_all_or_error
  36:     0x7faad40e11c7 - rustc_hir_analysis[22ad3c510546d4fc]::check::wfcheck::check_item_fn
  37:     0x7faad40dd6ea - rustc_hir_analysis[22ad3c510546d4fc]::check::wfcheck::check_well_formed
  38:     0x7faad3970403 - rustc_query_system[ffc3e6874545e2cc]::query::plumbing::try_execute_query::<rustc_query_impl[677774657eb92e7b]::queries::check_well_formed, rustc_query_impl[677774657eb92e7b]::plumbing::QueryCtxt>
  39:     0x7faad49b15e7 - rustc_data_structures[78003e5995acb4f0]::sync::par_for_each_in::<&[rustc_hir[98be715f7d0986d7]::hir::ItemId], <rustc_middle[8c6563ccb890ccc7]::hir::ModuleItems>::par_items<rustc_hir_analysis[22ad3c510546d4fc]::check::wfcheck::check_mod_type_wf::{closure#0}>::{closure#0}>
  40:     0x7faad49b11fa - rustc_hir_analysis[22ad3c510546d4fc]::check::wfcheck::check_mod_type_wf
  41:     0x7faad4c33dc1 - rustc_query_system[ffc3e6874545e2cc]::query::plumbing::try_execute_query::<rustc_query_impl[677774657eb92e7b]::queries::check_mod_type_wf, rustc_query_impl[677774657eb92e7b]::plumbing::QueryCtxt>
  42:     0x7faad4c33a01 - rustc_query_impl[677774657eb92e7b]::get_query::check_mod_type_wf
  43:     0x7faad4a03b97 - rustc_data_structures[78003e5995acb4f0]::sync::par_for_each_in::<&[rustc_hir[98be715f7d0986d7]::hir_id::OwnerId], <rustc_middle[8c6563ccb890ccc7]::hir::map::Map>::par_for_each_module<rustc_hir_analysis[22ad3c510546d4fc]::check_crate::{closure#5}::{closure#0}::{closure#0}>::{closure#0}>
  44:     0x7faad4a00b17 - rustc_hir_analysis[22ad3c510546d4fc]::check_crate
  45:     0x7faad49f43c0 - rustc_interface[e0c448f9df8a7367]::passes::analysis
  46:     0x7faad4d421f7 - rustc_query_system[ffc3e6874545e2cc]::query::plumbing::try_execute_query::<rustc_query_impl[677774657eb92e7b]::queries::analysis, rustc_query_impl[677774657eb92e7b]::plumbing::QueryCtxt>
  47:     0x7faad4d41f13 - rustc_query_impl[677774657eb92e7b]::get_query::analysis
  48:     0x7faad47c4d8f - <rustc_middle[8c6563ccb890ccc7]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[c1e8e7e9cc0f0224]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[75e04f0db769f8d6]::result::Result<(), rustc_span[f344ead202b2f728]::ErrorGuaranteed>>
  49:     0x7faad47c3e6f - <rustc_interface[e0c448f9df8a7367]::interface::Compiler>::enter::<rustc_driver_impl[c1e8e7e9cc0f0224]::run_compiler::{closure#1}::{closure#2}, core[75e04f0db769f8d6]::result::Result<core[75e04f0db769f8d6]::option::Option<rustc_interface[e0c448f9df8a7367]::queries::Linker>, rustc_span[f344ead202b2f728]::ErrorGuaranteed>>
  50:     0x7faad47c150b - std[9a33fd118bee7e76]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[e0c448f9df8a7367]::util::run_in_thread_pool_with_globals<rustc_interface[e0c448f9df8a7367]::interface::run_compiler<core[75e04f0db769f8d6]::result::Result<(), rustc_span[f344ead202b2f728]::ErrorGuaranteed>, rustc_driver_impl[c1e8e7e9cc0f0224]::run_compiler::{closure#1}>::{closure#0}, core[75e04f0db769f8d6]::result::Result<(), rustc_span[f344ead202b2f728]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[75e04f0db769f8d6]::result::Result<(), rustc_span[f344ead202b2f728]::ErrorGuaranteed>>
  51:     0x7faad4eab7c5 - <<std[9a33fd118bee7e76]::thread::Builder>::spawn_unchecked_<rustc_interface[e0c448f9df8a7367]::util::run_in_thread_pool_with_globals<rustc_interface[e0c448f9df8a7367]::interface::run_compiler<core[75e04f0db769f8d6]::result::Result<(), rustc_span[f344ead202b2f728]::ErrorGuaranteed>, rustc_driver_impl[c1e8e7e9cc0f0224]::run_compiler::{closure#1}>::{closure#0}, core[75e04f0db769f8d6]::result::Result<(), rustc_span[f344ead202b2f728]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[75e04f0db769f8d6]::result::Result<(), rustc_span[f344ead202b2f728]::ErrorGuaranteed>>::{closure#1} as core[75e04f0db769f8d6]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  52:     0x7faad2377ae5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h71c821b130855373
                               at /rustc/2f6bc5d259e7ab25ddfdd33de53b892770218918/library/alloc/src/boxed.rs:1985:9
  53:     0x7faad2377ae5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h1701cec9acb1061c
                               at /rustc/2f6bc5d259e7ab25ddfdd33de53b892770218918/library/alloc/src/boxed.rs:1985:9
  54:     0x7faad2377ae5 - std::sys::unix::thread::Thread::new::thread_start::h6dd5ef62dde103f1
                               at /rustc/2f6bc5d259e7ab25ddfdd33de53b892770218918/library/std/src/sys/unix/thread.rs:108:17
  55:     0x7faad2114bb5 - <unknown>
  56:     0x7faad2196d90 - <unknown>
  57:                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: rustc 1.71.0-nightly (2f6bc5d25 2023-05-09) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [typeck] type-checking `bug::{constant#0}`
#1 [thir_body] building THIR for `bug::{constant#0}`
#2 [thir_abstract_const] building an abstract representation for `bug::{constant#0}`
#3 [check_well_formed] checking that `bug` is well-formed
#4 [check_mod_type_wf] checking that types are well-formed in top-level module
#5 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error; 1 warning emitted

For more information about this error, try `rustc --explain E0601`.

@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 May 10, 2023
@Noratrieb Noratrieb added requires-nightly This issue requires a nightly compiler in some way. F-generic_const_exprs `#![feature(generic_const_exprs)]` requires-incomplete-features This issue requires the use of incomplete features. labels May 10, 2023
@BoxyUwU
Copy link
Member

BoxyUwU commented May 10, 2023

dupe of #83993

@BoxyUwU BoxyUwU closed this as completed May 10, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-bug Category: This is a bug. F-generic_const_exprs `#![feature(generic_const_exprs)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-incomplete-features This issue requires the use of incomplete features. requires-nightly This issue requires a nightly compiler in some way. 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

3 participants