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

Const parameter inside for<> closure parameter list (feature closure_lifetime_binder) crashes the compiler #99566

Closed
fmease opened this issue Jul 21, 2022 · 0 comments · Fixed by #99582
Assignees
Labels
A-const-generics Area: const generics (parameters and arguments) C-bug Category: This is a bug. F-closure_lifetime_binder `#![feature(closure_lifetime_binder)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ 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

@fmease
Copy link
Member

fmease commented Jul 21, 2022

Code

#![feature(closure_lifetime_binder)]

fn main() {
    for<const N: i32> || -> () {};    
}

Meta

rustc --version --verbose:

rustc 1.64.0-nightly (f8588549c 2022-07-18)
binary: rustc
commit-hash: f8588549c3c3d45c32b404210cada01e2a45def3
commit-date: 2022-07-18
host: x86_64-unknown-linux-gnu
release: 1.64.0-nightly
LLVM version: 14.0.6

Error output

error: only lifetime parameters can be used in this context
 --> main.rs:4:15
  |
4 |     for<const N: i32> || -> () {};
  |               ^

error: internal compiler error: compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs:548:17: no type for node HirId { owner: DefId(0:3 ~ main[2056]::main), local_id: 3 }: type i32 (hir_id=HirId { owner: DefId(0:3 ~ main[2056]::main), local_id: 3 }) in fcx 0x7fb2c47f0fd0
Backtrace

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/f8588549c3c3d45c32b404210cada01e2a45def3/compiler/rustc_errors/src/lib.rs:1391:9
stack backtrace:
   0:     0x7fb2ca76ced0 - std::backtrace_rs::backtrace::libunwind::trace::h6b3f9f41ee650c4f
                               at /rustc/f8588549c3c3d45c32b404210cada01e2a45def3/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   1:     0x7fb2ca76ced0 - std::backtrace_rs::backtrace::trace_unsynchronized::he56cb04310aea81a
                               at /rustc/f8588549c3c3d45c32b404210cada01e2a45def3/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fb2ca76ced0 - std::sys_common::backtrace::_print_fmt::h6d4ec34d6cd34171
                               at /rustc/f8588549c3c3d45c32b404210cada01e2a45def3/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7fb2ca76ced0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h01911f0526d8b05c
                               at /rustc/f8588549c3c3d45c32b404210cada01e2a45def3/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7fb2ca7c82ac - core::fmt::write::h49f323f7091ea1c8
                               at /rustc/f8588549c3c3d45c32b404210cada01e2a45def3/library/core/src/fmt/mod.rs:1198:17
   5:     0x7fb2ca75dd85 - std::io::Write::write_fmt::hbf1f476d48d43edd
                               at /rustc/f8588549c3c3d45c32b404210cada01e2a45def3/library/std/src/io/mod.rs:1672:15
   6:     0x7fb2ca76fba1 - std::sys_common::backtrace::_print::h2bbdb393c4180f57
                               at /rustc/f8588549c3c3d45c32b404210cada01e2a45def3/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7fb2ca76fba1 - std::sys_common::backtrace::print::h4200c2a0dbbbc055
                               at /rustc/f8588549c3c3d45c32b404210cada01e2a45def3/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7fb2ca76fba1 - std::panicking::default_hook::{{closure}}::h393b25bd4d38364f
                               at /rustc/f8588549c3c3d45c32b404210cada01e2a45def3/library/std/src/panicking.rs:295:22
   9:     0x7fb2ca76f873 - std::panicking::default_hook::h70f1f206e4c542c6
                               at /rustc/f8588549c3c3d45c32b404210cada01e2a45def3/library/std/src/panicking.rs:314:9
  10:     0x7fb2ccfc75f1 - <rustc_driver[72308b4096139644]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[cd150e9e29982b29]::ops::function::FnOnce<(&core[cd150e9e29982b29]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  11:     0x7fb2ca7703d6 - std::panicking::rust_panic_with_hook::hdfebab2861adaf27
                               at /rustc/f8588549c3c3d45c32b404210cada01e2a45def3/library/std/src/panicking.rs:702:17
  12:     0x7fb2cdea22a1 - std[778605c8b9d7d939]::panicking::begin_panic::<rustc_errors[5ec552083a70b038]::ExplicitBug>::{closure#0}
  13:     0x7fb2cde9f4d6 - std[778605c8b9d7d939]::sys_common::backtrace::__rust_end_short_backtrace::<std[778605c8b9d7d939]::panicking::begin_panic<rustc_errors[5ec552083a70b038]::ExplicitBug>::{closure#0}, !>
  14:     0x7fb2cdee57e6 - std[778605c8b9d7d939]::panicking::begin_panic::<rustc_errors[5ec552083a70b038]::ExplicitBug>
  15:     0x7fb2cde9e0f6 - std[778605c8b9d7d939]::panic::panic_any::<rustc_errors[5ec552083a70b038]::ExplicitBug>
  16:     0x7fb2cde9cf45 - <rustc_errors[5ec552083a70b038]::HandlerInner>::bug::<&alloc[110eb368cf5d93ca]::string::String>
  17:     0x7fb2cde9cca0 - <rustc_errors[5ec552083a70b038]::Handler>::bug::<&alloc[110eb368cf5d93ca]::string::String>
  18:     0x7fb2cdf4b39d - rustc_middle[c6afec08b0d1be81]::ty::context::tls::with_context_opt::<rustc_middle[c6afec08b0d1be81]::ty::context::tls::with_opt<rustc_middle[c6afec08b0d1be81]::util::bug::opt_span_bug_fmt<rustc_span[7c9df871791ece55]::span_encoding::Span>::{closure#0}, ()>::{closure#0}, ()>
  19:     0x7fb2cdf50d06 - rustc_middle[c6afec08b0d1be81]::util::bug::opt_span_bug_fmt::<rustc_span[7c9df871791ece55]::span_encoding::Span>
  20:     0x7fb2cbabfdf3 - rustc_middle[c6afec08b0d1be81]::util::bug::bug_fmt
  21:     0x7fb2cb98f873 - <rustc_typeck[13b33a7e4358dbf3]::check::writeback::WritebackCx as rustc_hir[a82dbec78fd9e7a2]::intravisit::Visitor>::visit_ty
  22:     0x7fb2cb98c7f7 - <rustc_typeck[13b33a7e4358dbf3]::check::writeback::WritebackCx as rustc_hir[a82dbec78fd9e7a2]::intravisit::Visitor>::visit_expr
  23:     0x7fb2cb9894c6 - <rustc_typeck[13b33a7e4358dbf3]::check::writeback::WritebackCx as rustc_hir[a82dbec78fd9e7a2]::intravisit::Visitor>::visit_expr
  24:     0x7fb2cc008f49 - <rustc_typeck[13b33a7e4358dbf3]::check::fn_ctxt::FnCtxt>::resolve_type_vars_in_body
  25:     0x7fb2cbffe0c9 - <rustc_infer[b83d0fd35fa563b9]::infer::InferCtxtBuilder>::enter::<&rustc_middle[c6afec08b0d1be81]::ty::context::TypeckResults, <rustc_typeck[13b33a7e4358dbf3]::check::inherited::InheritedBuilder>::enter<rustc_typeck[13b33a7e4358dbf3]::check::typeck_with_fallback<rustc_typeck[13b33a7e4358dbf3]::check::typeck::{closure#0}>::{closure#1}, &rustc_middle[c6afec08b0d1be81]::ty::context::TypeckResults>::{closure#0}>
  26:     0x7fb2cc9bd0ef - rustc_typeck[13b33a7e4358dbf3]::check::typeck
  27:     0x7fb2cc5fda5f - rustc_query_system[2682b511cc84fabe]::query::plumbing::try_execute_query::<rustc_query_impl[5e8382c68d202a33]::plumbing::QueryCtxt, rustc_query_system[2682b511cc84fabe]::query::caches::DefaultCache<rustc_span[7c9df871791ece55]::def_id::LocalDefId, &rustc_middle[c6afec08b0d1be81]::ty::context::TypeckResults>>
  28:     0x7fb2ccebd708 - <rustc_query_impl[5e8382c68d202a33]::Queries as rustc_middle[c6afec08b0d1be81]::ty::query::QueryEngine>::typeck
  29:     0x7fb2cccf7d6d - <rustc_middle[c6afec08b0d1be81]::hir::map::Map>::par_body_owners::<rustc_typeck[13b33a7e4358dbf3]::check::typeck_item_bodies::{closure#0}>
  30:     0x7fb2cccf7bac - rustc_typeck[13b33a7e4358dbf3]::check::typeck_item_bodies
  31:     0x7fb2ccc990b5 - rustc_query_system[2682b511cc84fabe]::query::plumbing::try_execute_query::<rustc_query_impl[5e8382c68d202a33]::plumbing::QueryCtxt, rustc_query_system[2682b511cc84fabe]::query::caches::DefaultCache<(), ()>>
  32:     0x7fb2ccc98e41 - rustc_query_system[2682b511cc84fabe]::query::plumbing::get_query::<rustc_query_impl[5e8382c68d202a33]::queries::typeck_item_bodies, rustc_query_impl[5e8382c68d202a33]::plumbing::QueryCtxt>
  33:     0x7fb2cc982e3f - <rustc_session[b6be1dcf14d2202f]::session::Session>::time::<(), rustc_typeck[13b33a7e4358dbf3]::check_crate::{closure#7}>
  34:     0x7fb2cc982877 - rustc_typeck[13b33a7e4358dbf3]::check_crate
  35:     0x7fb2cc982057 - rustc_interface[8ca32d3d634051a7]::passes::analysis
  36:     0x7fb2ccd617b5 - rustc_query_system[2682b511cc84fabe]::query::plumbing::try_execute_query::<rustc_query_impl[5e8382c68d202a33]::plumbing::QueryCtxt, rustc_query_system[2682b511cc84fabe]::query::caches::DefaultCache<(), core[cd150e9e29982b29]::result::Result<(), rustc_errors[5ec552083a70b038]::ErrorGuaranteed>>>
  37:     0x7fb2ccd6153e - rustc_query_system[2682b511cc84fabe]::query::plumbing::get_query::<rustc_query_impl[5e8382c68d202a33]::queries::analysis, rustc_query_impl[5e8382c68d202a33]::plumbing::QueryCtxt>
  38:     0x7fb2cc6b25ee - <rustc_interface[8ca32d3d634051a7]::passes::QueryContext>::enter::<rustc_driver[72308b4096139644]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[cd150e9e29982b29]::result::Result<(), rustc_errors[5ec552083a70b038]::ErrorGuaranteed>>
  39:     0x7fb2cc6ae25e - <rustc_interface[8ca32d3d634051a7]::interface::Compiler>::enter::<rustc_driver[72308b4096139644]::run_compiler::{closure#1}::{closure#2}, core[cd150e9e29982b29]::result::Result<core[cd150e9e29982b29]::option::Option<rustc_interface[8ca32d3d634051a7]::queries::Linker>, rustc_errors[5ec552083a70b038]::ErrorGuaranteed>>
  40:     0x7fb2cc6a929f - rustc_span[7c9df871791ece55]::with_source_map::<core[cd150e9e29982b29]::result::Result<(), rustc_errors[5ec552083a70b038]::ErrorGuaranteed>, rustc_interface[8ca32d3d634051a7]::interface::create_compiler_and_run<core[cd150e9e29982b29]::result::Result<(), rustc_errors[5ec552083a70b038]::ErrorGuaranteed>, rustc_driver[72308b4096139644]::run_compiler::{closure#1}>::{closure#1}>
  41:     0x7fb2cc6a8c90 - rustc_interface[8ca32d3d634051a7]::interface::create_compiler_and_run::<core[cd150e9e29982b29]::result::Result<(), rustc_errors[5ec552083a70b038]::ErrorGuaranteed>, rustc_driver[72308b4096139644]::run_compiler::{closure#1}>
  42:     0x7fb2cc6a7722 - <scoped_tls[3f6da10b6a2c80a0]::ScopedKey<rustc_span[7c9df871791ece55]::SessionGlobals>>::set::<rustc_interface[8ca32d3d634051a7]::interface::run_compiler<core[cd150e9e29982b29]::result::Result<(), rustc_errors[5ec552083a70b038]::ErrorGuaranteed>, rustc_driver[72308b4096139644]::run_compiler::{closure#1}>::{closure#0}, core[cd150e9e29982b29]::result::Result<(), rustc_errors[5ec552083a70b038]::ErrorGuaranteed>>
  43:     0x7fb2cc6a6bdf - std[778605c8b9d7d939]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[8ca32d3d634051a7]::util::run_in_thread_pool_with_globals<rustc_interface[8ca32d3d634051a7]::interface::run_compiler<core[cd150e9e29982b29]::result::Result<(), rustc_errors[5ec552083a70b038]::ErrorGuaranteed>, rustc_driver[72308b4096139644]::run_compiler::{closure#1}>::{closure#0}, core[cd150e9e29982b29]::result::Result<(), rustc_errors[5ec552083a70b038]::ErrorGuaranteed>>::{closure#0}, core[cd150e9e29982b29]::result::Result<(), rustc_errors[5ec552083a70b038]::ErrorGuaranteed>>
  44:     0x7fb2ccde53e9 - <<std[778605c8b9d7d939]::thread::Builder>::spawn_unchecked_<rustc_interface[8ca32d3d634051a7]::util::run_in_thread_pool_with_globals<rustc_interface[8ca32d3d634051a7]::interface::run_compiler<core[cd150e9e29982b29]::result::Result<(), rustc_errors[5ec552083a70b038]::ErrorGuaranteed>, rustc_driver[72308b4096139644]::run_compiler::{closure#1}>::{closure#0}, core[cd150e9e29982b29]::result::Result<(), rustc_errors[5ec552083a70b038]::ErrorGuaranteed>>::{closure#0}, core[cd150e9e29982b29]::result::Result<(), rustc_errors[5ec552083a70b038]::ErrorGuaranteed>>::{closure#1} as core[cd150e9e29982b29]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  45:     0x7fb2ca77a193 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h1a098e41f44eb0a6
                               at /rustc/f8588549c3c3d45c32b404210cada01e2a45def3/library/alloc/src/boxed.rs:1935:9
  46:     0x7fb2ca77a193 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hc5709f2569386b76
                               at /rustc/f8588549c3c3d45c32b404210cada01e2a45def3/library/alloc/src/boxed.rs:1935:9
  47:     0x7fb2ca77a193 - std::sys::unix::thread::Thread::new::thread_start::h0444ab80c205eb75
                               at /rustc/f8588549c3c3d45c32b404210cada01e2a45def3/library/std/src/sys/unix/thread.rs:108:17
  48:     0x7fb2ca48c54d - <unknown>
  49:     0x7fb2ca511874 - clone
  50:                0x0 - <unknown>

note: 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.64.0-nightly (f8588549c 2022-07-18) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [typeck] type-checking `main`
#1 [typeck_item_bodies] type-checking all item bodies
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 2 previous errors

@rustbot label requires-nightly A-const-generics

@fmease fmease 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 Jul 21, 2022
@rustbot rustbot added requires-nightly This issue requires a nightly compiler in some way. A-const-generics Area: const generics (parameters and arguments) labels Jul 21, 2022
matthiaskrgr added a commit to matthiaskrgr/glacier that referenced this issue Jul 21, 2022
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Jul 21, 2022
@compiler-errors compiler-errors self-assigned this Jul 22, 2022
@bors bors closed this as completed in a9f3e03 Aug 14, 2022
@fmease fmease added the F-closure_lifetime_binder `#![feature(closure_lifetime_binder)]` label Jul 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-generics Area: const generics (parameters and arguments) C-bug Category: This is a bug. F-closure_lifetime_binder `#![feature(closure_lifetime_binder)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ 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

Successfully merging a pull request may close this issue.

4 participants