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 when using closure_lifetime_binder lifetime inside closure body #103736

Closed
Jules-Bertholet opened this issue Oct 29, 2022 · 1 comment · Fixed by #103780
Closed

ICE when using closure_lifetime_binder lifetime inside closure body #103736

Jules-Bertholet opened this issue Oct 29, 2022 · 1 comment · Fixed by #103780
Assignees
Labels
C-bug Category: This is a bug. F-closure_lifetime_binder `#![feature(closure_lifetime_binder)]` 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

@Jules-Bertholet
Copy link
Contributor

Code

#![feature(closure_lifetime_binder)]

fn main() {
    let _ = for<'a> || -> () {
        let _: &'a bool = &true;
    };
}

Meta

rustc --version --verbose:

rustc 1.66.0-nightly (9565dfeb4 2022-10-28)
binary: rustc
commit-hash: 9565dfeb4e6225177bbe78f18cd48a7982f34401
commit-date: 2022-10-28
host: x86_64-unknown-linux-gnu
release: 1.66.0-nightly
LLVM version: 15.0.2

Error output

thread '<unnamed>' panicked at 'assertion failed: !value.has_escaping_bound_vars()', /rustc/9565dfeb4e6225177bbe78f18cd48a7982f34401/compiler/rustc_middle/src/ty/sty.rs:982:9
Backtrace

stack backtrace:
   0:     0x7facd5781850 - std::backtrace_rs::backtrace::libunwind::trace::hcb08f530cff40cca
                               at /rustc/9565dfeb4e6225177bbe78f18cd48a7982f34401/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7facd5781850 - std::backtrace_rs::backtrace::trace_unsynchronized::hddb2a2d491e7ca18
                               at /rustc/9565dfeb4e6225177bbe78f18cd48a7982f34401/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7facd5781850 - std::sys_common::backtrace::_print_fmt::h7bfa3f787e3397d9
                               at /rustc/9565dfeb4e6225177bbe78f18cd48a7982f34401/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7facd5781850 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hb44d7c7e3209d54f
                               at /rustc/9565dfeb4e6225177bbe78f18cd48a7982f34401/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7facd57dd7ae - core::fmt::write::heff7f33d40f68a07
                               at /rustc/9565dfeb4e6225177bbe78f18cd48a7982f34401/library/core/src/fmt/mod.rs:1209:17
   5:     0x7facd57719c5 - std::io::Write::write_fmt::h481263232c739287
                               at /rustc/9565dfeb4e6225177bbe78f18cd48a7982f34401/library/std/src/io/mod.rs:1682:15
   6:     0x7facd5781615 - std::sys_common::backtrace::_print::hbb3318f3b9d95c27
                               at /rustc/9565dfeb4e6225177bbe78f18cd48a7982f34401/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7facd5781615 - std::sys_common::backtrace::print::h09b2314a2aa0e962
                               at /rustc/9565dfeb4e6225177bbe78f18cd48a7982f34401/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7facd578441f - std::panicking::default_hook::{{closure}}::ha4a56aab942e9c60
                               at /rustc/9565dfeb4e6225177bbe78f18cd48a7982f34401/library/std/src/panicking.rs:267:22
   9:     0x7facd578415a - std::panicking::default_hook::h100359da3e3d3584
                               at /rustc/9565dfeb4e6225177bbe78f18cd48a7982f34401/library/std/src/panicking.rs:286:9
  10:     0x7facd5784c28 - std::panicking::rust_panic_with_hook::h25048bbf4fde4742
                               at /rustc/9565dfeb4e6225177bbe78f18cd48a7982f34401/library/std/src/panicking.rs:688:13
  11:     0x7facd5784981 - std::panicking::begin_panic_handler::{{closure}}::h41565a90d0d6688d
                               at /rustc/9565dfeb4e6225177bbe78f18cd48a7982f34401/library/std/src/panicking.rs:577:13
  12:     0x7facd5781cfc - std::sys_common::backtrace::__rust_end_short_backtrace::h8f85f375182a95c1
                               at /rustc/9565dfeb4e6225177bbe78f18cd48a7982f34401/library/std/src/sys_common/backtrace.rs:137:18
  13:     0x7facd57846e2 - rust_begin_unwind
                               at /rustc/9565dfeb4e6225177bbe78f18cd48a7982f34401/library/std/src/panicking.rs:575:5
  14:     0x7facd57da193 - core::panicking::panic_fmt::h68463fb299862f1f
                               at /rustc/9565dfeb4e6225177bbe78f18cd48a7982f34401/library/core/src/panicking.rs:65:14
  15:     0x7facd57da26d - core::panicking::panic::hf3ad889fdb69a756
                               at /rustc/9565dfeb4e6225177bbe78f18cd48a7982f34401/library/core/src/panicking.rs:115:5
  16:     0x7facd6e6c7f5 - <rustc_hir_typeck[5921ba7e3d7ef2c]::fn_ctxt::FnCtxt>::register_wf_obligation
  17:     0x7facd6a8b570 - <rustc_hir_typeck[5921ba7e3d7ef2c]::gather_locals::GatherLocalsVisitor>::declare
  18:     0x7facd6a8af67 - <rustc_hir_typeck[5921ba7e3d7ef2c]::gather_locals::GatherLocalsVisitor as rustc_hir[4c69b9408057528b]::intravisit::Visitor>::visit_expr
  19:     0x7facd787b5eb - rustc_hir_typeck[5921ba7e3d7ef2c]::check::check_fn
  20:     0x7facd6eee226 - <rustc_hir_typeck[5921ba7e3d7ef2c]::fn_ctxt::FnCtxt>::check_expr_closure
  21:     0x7facd6e536f1 - <rustc_hir_typeck[5921ba7e3d7ef2c]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  22:     0x7facd6e92a62 - <rustc_hir_typeck[5921ba7e3d7ef2c]::fn_ctxt::FnCtxt>::check_decl
  23:     0x7facd6e8fada - <rustc_hir_typeck[5921ba7e3d7ef2c]::fn_ctxt::FnCtxt>::check_block_with_expected
  24:     0x7facd6e4fac0 - <rustc_hir_typeck[5921ba7e3d7ef2c]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  25:     0x7facd787e246 - <rustc_hir_typeck[5921ba7e3d7ef2c]::fn_ctxt::FnCtxt>::check_return_expr
  26:     0x7facd787bb4a - rustc_hir_typeck[5921ba7e3d7ef2c]::check::check_fn
  27:     0x7facd786726d - rustc_hir_typeck[5921ba7e3d7ef2c]::typeck
  28:     0x7facd6e198d3 - <rustc_query_system[6a6350e27c5a6f25]::dep_graph::graph::DepGraph<rustc_middle[f64f4db409ba5abd]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[f64f4db409ba5abd]::ty::context::TyCtxt, rustc_span[4a20dfc976afaa8c]::def_id::LocalDefId, &rustc_middle[f64f4db409ba5abd]::ty::context::TypeckResults>
  29:     0x7facd6e11f61 - rustc_query_system[6a6350e27c5a6f25]::query::plumbing::try_execute_query::<rustc_query_impl[1405fd9b45468ea]::plumbing::QueryCtxt, rustc_query_system[6a6350e27c5a6f25]::query::caches::DefaultCache<rustc_span[4a20dfc976afaa8c]::def_id::LocalDefId, &rustc_middle[f64f4db409ba5abd]::ty::context::TypeckResults>>
  30:     0x7facd8106ec8 - rustc_data_structures[e5a688f0adb11ef5]::sync::par_for_each_in::<&[rustc_span[4a20dfc976afaa8c]::def_id::LocalDefId], <rustc_middle[f64f4db409ba5abd]::hir::map::Map>::par_body_owners<rustc_hir_typeck[5921ba7e3d7ef2c]::typeck_item_bodies::{closure#0}>::{closure#0}>
  31:     0x7facd8106ba3 - rustc_hir_typeck[5921ba7e3d7ef2c]::typeck_item_bodies
  32:     0x7facd80018a9 - <rustc_query_system[6a6350e27c5a6f25]::dep_graph::graph::DepGraph<rustc_middle[f64f4db409ba5abd]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[f64f4db409ba5abd]::ty::context::TyCtxt, (), ()>
  33:     0x7facd800084d - rustc_query_system[6a6350e27c5a6f25]::query::plumbing::try_execute_query::<rustc_query_impl[1405fd9b45468ea]::plumbing::QueryCtxt, rustc_query_system[6a6350e27c5a6f25]::query::caches::DefaultCache<(), ()>>
  34:     0x7facd80001d7 - rustc_query_system[6a6350e27c5a6f25]::query::plumbing::get_query::<rustc_query_impl[1405fd9b45468ea]::queries::typeck_item_bodies, rustc_query_impl[1405fd9b45468ea]::plumbing::QueryCtxt>
  35:     0x7facd6d13c8a - <rustc_session[86f59dd04d0dca5e]::session::Session>::time::<(), rustc_hir_analysis[2c96763b7984a461]::check_crate::{closure#7}>
  36:     0x7facd6d12e3b - rustc_hir_analysis[2c96763b7984a461]::check_crate
  37:     0x7facd6d12a6b - rustc_interface[1b8cc14ea0a1d58e]::passes::analysis
  38:     0x7facd815ce4e - <rustc_query_system[6a6350e27c5a6f25]::dep_graph::graph::DepGraph<rustc_middle[f64f4db409ba5abd]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[f64f4db409ba5abd]::ty::context::TyCtxt, (), core[a97f803d89ea326c]::result::Result<(), rustc_errors[ab181c9b86d7e982]::ErrorGuaranteed>>
  39:     0x7facd815c1c4 - rustc_query_system[6a6350e27c5a6f25]::query::plumbing::try_execute_query::<rustc_query_impl[1405fd9b45468ea]::plumbing::QueryCtxt, rustc_query_system[6a6350e27c5a6f25]::query::caches::DefaultCache<(), core[a97f803d89ea326c]::result::Result<(), rustc_errors[ab181c9b86d7e982]::ErrorGuaranteed>>>
  40:     0x7facd815bc47 - rustc_query_system[6a6350e27c5a6f25]::query::plumbing::get_query::<rustc_query_impl[1405fd9b45468ea]::queries::analysis, rustc_query_impl[1405fd9b45468ea]::plumbing::QueryCtxt>
  41:     0x7facd7c9e22d - <rustc_interface[1b8cc14ea0a1d58e]::passes::QueryContext>::enter::<rustc_driver[ac8a6fe4a2afd1b]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[a97f803d89ea326c]::result::Result<(), rustc_errors[ab181c9b86d7e982]::ErrorGuaranteed>>
  42:     0x7facd7c9a6df - <rustc_interface[1b8cc14ea0a1d58e]::interface::Compiler>::enter::<rustc_driver[ac8a6fe4a2afd1b]::run_compiler::{closure#1}::{closure#2}, core[a97f803d89ea326c]::result::Result<core[a97f803d89ea326c]::option::Option<rustc_interface[1b8cc14ea0a1d58e]::queries::Linker>, rustc_errors[ab181c9b86d7e982]::ErrorGuaranteed>>
  43:     0x7facd7c92222 - rustc_span[4a20dfc976afaa8c]::with_source_map::<core[a97f803d89ea326c]::result::Result<(), rustc_errors[ab181c9b86d7e982]::ErrorGuaranteed>, rustc_interface[1b8cc14ea0a1d58e]::interface::run_compiler<core[a97f803d89ea326c]::result::Result<(), rustc_errors[ab181c9b86d7e982]::ErrorGuaranteed>, rustc_driver[ac8a6fe4a2afd1b]::run_compiler::{closure#1}>::{closure#0}::{closure#1}>
  44:     0x7facd7c91d19 - <scoped_tls[ce0abc247ca248a0]::ScopedKey<rustc_span[4a20dfc976afaa8c]::SessionGlobals>>::set::<rustc_interface[1b8cc14ea0a1d58e]::interface::run_compiler<core[a97f803d89ea326c]::result::Result<(), rustc_errors[ab181c9b86d7e982]::ErrorGuaranteed>, rustc_driver[ac8a6fe4a2afd1b]::run_compiler::{closure#1}>::{closure#0}, core[a97f803d89ea326c]::result::Result<(), rustc_errors[ab181c9b86d7e982]::ErrorGuaranteed>>
  45:     0x7facd7c91328 - std[e720b13db21e6030]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[1b8cc14ea0a1d58e]::util::run_in_thread_pool_with_globals<rustc_interface[1b8cc14ea0a1d58e]::interface::run_compiler<core[a97f803d89ea326c]::result::Result<(), rustc_errors[ab181c9b86d7e982]::ErrorGuaranteed>, rustc_driver[ac8a6fe4a2afd1b]::run_compiler::{closure#1}>::{closure#0}, core[a97f803d89ea326c]::result::Result<(), rustc_errors[ab181c9b86d7e982]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[a97f803d89ea326c]::result::Result<(), rustc_errors[ab181c9b86d7e982]::ErrorGuaranteed>>
  46:     0x7facd7c9104c - <<std[e720b13db21e6030]::thread::Builder>::spawn_unchecked_<rustc_interface[1b8cc14ea0a1d58e]::util::run_in_thread_pool_with_globals<rustc_interface[1b8cc14ea0a1d58e]::interface::run_compiler<core[a97f803d89ea326c]::result::Result<(), rustc_errors[ab181c9b86d7e982]::ErrorGuaranteed>, rustc_driver[ac8a6fe4a2afd1b]::run_compiler::{closure#1}>::{closure#0}, core[a97f803d89ea326c]::result::Result<(), rustc_errors[ab181c9b86d7e982]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[a97f803d89ea326c]::result::Result<(), rustc_errors[ab181c9b86d7e982]::ErrorGuaranteed>>::{closure#1} as core[a97f803d89ea326c]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  47:     0x7facd96444f3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h777accc1e1ec51f4
                               at /rustc/9565dfeb4e6225177bbe78f18cd48a7982f34401/library/alloc/src/boxed.rs:1987:9
  48:     0x7facd96444f3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h95dfcec2e5bf9e0f
                               at /rustc/9565dfeb4e6225177bbe78f18cd48a7982f34401/library/alloc/src/boxed.rs:1987:9
  49:     0x7facd96444f3 - std::sys::unix::thread::Thread::new::thread_start::hb399bf19376dd98b
                               at /rustc/9565dfeb4e6225177bbe78f18cd48a7982f34401/library/std/src/sys/unix/thread.rs:108:17
  50:     0x7facd54dde2d - start_thread
  51:     0x7facd55631b0 - __clone3
  52:                0x0 - <unknown>

@Jules-Bertholet Jules-Bertholet 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 Oct 29, 2022
@Jules-Bertholet
Copy link
Contributor Author

@rustbot label requires-nightly

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-closure_lifetime_binder `#![feature(closure_lifetime_binder)]` 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