Skip to content

ICE with #![feature(non_lifetime_binders)] #121467

@ChayimFriedman2

Description

@ChayimFriedman2

Code

#![feature(non_lifetime_binders)]

fn generic<T>(_v: T) {}

fn take_generic_closure<F>(_f: F)
where
    for<T> F: Fn(T),
{
}

fn main() {
    take_generic_closure(generic);
}

Error output:

error: internal compiler error: /rustc/3406ada96f8e16e49e947a91db3eba0db45245fa/compiler/rustc_middle/src/ty/fold.rs:283:33: unexpected bound ty in binder: "T"

Playground.

Backtrace

thread 'rustc' panicked at compiler/rustc_middle/src/util/bug.rs:35:44:
Box<dyn Any>
stack backtrace:
   0:     0x7fc8b018aaf6 - std::backtrace_rs::backtrace::libunwind::trace::hf298c77755f5b12e
                               at /rustc/3406ada96f8e16e49e947a91db3eba0db45245fa/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7fc8b018aaf6 - std::backtrace_rs::backtrace::trace_unsynchronized::h4da6a489ce2db74e
                               at /rustc/3406ada96f8e16e49e947a91db3eba0db45245fa/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fc8b018aaf6 - std::sys_common::backtrace::_print_fmt::h051beca4a6f5cb98
                               at /rustc/3406ada96f8e16e49e947a91db3eba0db45245fa/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7fc8b018aaf6 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hcb86488900881a45
                               at /rustc/3406ada96f8e16e49e947a91db3eba0db45245fa/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fc8b01dba7c - core::fmt::rt::Argument::fmt::haf43875fa4a971bb
                               at /rustc/3406ada96f8e16e49e947a91db3eba0db45245fa/library/core/src/fmt/rt.rs:142:9
   5:     0x7fc8b01dba7c - core::fmt::write::h44c7f32ae3be5535
                               at /rustc/3406ada96f8e16e49e947a91db3eba0db45245fa/library/core/src/fmt/mod.rs:1120:17
   6:     0x7fc8b017f4bf - std::io::Write::write_fmt::hc3fec0223f64c010
                               at /rustc/3406ada96f8e16e49e947a91db3eba0db45245fa/library/std/src/io/mod.rs:1846:15
   7:     0x7fc8b018a8a4 - std::sys_common::backtrace::_print::h7c03376d42fd745a
                               at /rustc/3406ada96f8e16e49e947a91db3eba0db45245fa/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7fc8b018a8a4 - std::sys_common::backtrace::print::h9ff10455f68b06c1
                               at /rustc/3406ada96f8e16e49e947a91db3eba0db45245fa/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7fc8b018d5eb - std::panicking::default_hook::{{closure}}::he4f9865f1b72b2d5
  10:     0x7fc8b018d339 - std::panicking::default_hook::h3d59f13a05d49fe6
                               at /rustc/3406ada96f8e16e49e947a91db3eba0db45245fa/library/std/src/panicking.rs:292:9
  11:     0x7fc8b30711ec - std[19d33715048712a6]::panicking::update_hook::<alloc[6fc58ab69ba746fe]::boxed::Box<rustc_driver_impl[4c01069949ad96dd]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7fc8b018dd50 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hf41c577e6ac4b0df
                               at /rustc/3406ada96f8e16e49e947a91db3eba0db45245fa/library/alloc/src/boxed.rs:2030:9
  13:     0x7fc8b018dd50 - std::panicking::rust_panic_with_hook::h70f59ab226ae2c5c
                               at /rustc/3406ada96f8e16e49e947a91db3eba0db45245fa/library/std/src/panicking.rs:786:13
  14:     0x7fc8b309ddc4 - std[19d33715048712a6]::panicking::begin_panic::<rustc_errors[59443abce0bd3010]::ExplicitBug>::{closure#0}
  15:     0x7fc8b309aa16 - std[19d33715048712a6]::sys_common::backtrace::__rust_end_short_backtrace::<std[19d33715048712a6]::panicking::begin_panic<rustc_errors[59443abce0bd3010]::ExplicitBug>::{closure#0}, !>
  16:     0x7fc8b30961d6 - std[19d33715048712a6]::panicking::begin_panic::<rustc_errors[59443abce0bd3010]::ExplicitBug>
  17:     0x7fc8b1a09281 - <rustc_errors[59443abce0bd3010]::diagnostic::BugAbort as rustc_errors[59443abce0bd3010]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  18:     0x7fc8b3478dac - <rustc_errors[59443abce0bd3010]::DiagCtxt>::bug::<alloc[6fc58ab69ba746fe]::string::String>
  19:     0x7fc8b351da5b - rustc_middle[3375709bf24a03bb]::util::bug::opt_span_bug_fmt::<rustc_span[a2e62ba9c1d34a9a]::span_encoding::Span>::{closure#0}
  20:     0x7fc8b3501a1a - rustc_middle[3375709bf24a03bb]::ty::context::tls::with_opt::<rustc_middle[3375709bf24a03bb]::util::bug::opt_span_bug_fmt<rustc_span[a2e62ba9c1d34a9a]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7fc8b3501898 - rustc_middle[3375709bf24a03bb]::ty::context::tls::with_context_opt::<rustc_middle[3375709bf24a03bb]::ty::context::tls::with_opt<rustc_middle[3375709bf24a03bb]::util::bug::opt_span_bug_fmt<rustc_span[a2e62ba9c1d34a9a]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7fc8b198b5f0 - rustc_middle[3375709bf24a03bb]::util::bug::bug_fmt
  23:     0x7fc8b3ad016c - <rustc_middle[3375709bf24a03bb]::ty::context::TyCtxt>::instantiate_bound_regions_uncached::<rustc_middle[3375709bf24a03bb]::ty::Ty, <rustc_middle[3375709bf24a03bb]::ty::context::TyCtxt>::instantiate_bound_regions<rustc_middle[3375709bf24a03bb]::ty::Ty, <rustc_middle[3375709bf24a03bb]::ty::context::TyCtxt>::instantiate_bound_regions_with_erased<rustc_middle[3375709bf24a03bb]::ty::Ty>::{closure#0}>::{closure#0}>::{closure#0}
  24:     0x7fc8b34ec0fc - <rustc_middle[3375709bf24a03bb]::ty::fold::FnMutDelegate as rustc_middle[3375709bf24a03bb]::ty::fold::BoundVarReplacerDelegate>::replace_ty
  25:     0x7fc8b4a7b24c - <rustc_middle[3375709bf24a03bb]::ty::fold::BoundVarReplacer<rustc_middle[3375709bf24a03bb]::ty::fold::FnMutDelegate> as rustc_type_ir[4a7bd4ac40d43ce3]::fold::TypeFolder<rustc_middle[3375709bf24a03bb]::ty::context::TyCtxt>>::fold_ty
  26:     0x7fc8b4a7a86d - <&rustc_middle[3375709bf24a03bb]::ty::list::List<rustc_middle[3375709bf24a03bb]::ty::Ty> as rustc_type_ir[4a7bd4ac40d43ce3]::fold::TypeFoldable<rustc_middle[3375709bf24a03bb]::ty::context::TyCtxt>>::try_fold_with::<rustc_middle[3375709bf24a03bb]::ty::fold::BoundVarReplacer<rustc_middle[3375709bf24a03bb]::ty::fold::FnMutDelegate>>
  27:     0x7fc8b3a8f911 - <rustc_middle[3375709bf24a03bb]::ty::context::TyCtxt>::instantiate_bound_regions_with_erased::<rustc_middle[3375709bf24a03bb]::ty::sty::FnSig>
  28:     0x7fc8b3b6993a - <rustc_infer[65b241f8538939a5]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[efd6c1898b99ba52]::traits::error_reporting::suggestions::TypeErrCtxtExt>::note_conflicting_fn_args
  29:     0x7fc8b3b68b97 - <rustc_infer[65b241f8538939a5]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[efd6c1898b99ba52]::traits::error_reporting::suggestions::TypeErrCtxtExt>::report_closure_arg_mismatch
  30:     0x7fc8b3b94b28 - <rustc_infer[65b241f8538939a5]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[efd6c1898b99ba52]::traits::error_reporting::type_err_ctxt_ext::InferCtxtPrivExt>::report_signature_mismatch_error
  31:     0x7fc8b3b81cf0 - <rustc_infer[65b241f8538939a5]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[efd6c1898b99ba52]::traits::error_reporting::type_err_ctxt_ext::TypeErrCtxtExt>::report_selection_error
  32:     0x7fc8b3b955c1 - <rustc_infer[65b241f8538939a5]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[efd6c1898b99ba52]::traits::error_reporting::type_err_ctxt_ext::InferCtxtPrivExt>::report_fulfillment_error
  33:     0x7fc8b3b7f23a - <rustc_infer[65b241f8538939a5]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[efd6c1898b99ba52]::traits::error_reporting::type_err_ctxt_ext::TypeErrCtxtExt>::report_fulfillment_errors
  34:     0x7fc8b4f2d90e - <rustc_hir_typeck[709182f2acdb1baf]::fn_ctxt::FnCtxt>::check_argument_types
  35:     0x7fc8b4d553af - <rustc_hir_typeck[709182f2acdb1baf]::fn_ctxt::FnCtxt>::check_call
  36:     0x7fc8b4e8416d - <rustc_hir_typeck[709182f2acdb1baf]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  37:     0x7fc8b49907a5 - <rustc_hir_typeck[709182f2acdb1baf]::fn_ctxt::FnCtxt>::check_block_with_expected
  38:     0x7fc8b4e846c3 - <rustc_hir_typeck[709182f2acdb1baf]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  39:     0x7fc8b4e716c8 - rustc_hir_typeck[709182f2acdb1baf]::check::check_fn
  40:     0x7fc8b465a7ae - rustc_hir_typeck[709182f2acdb1baf]::typeck
  41:     0x7fc8b4659a57 - rustc_query_impl[80d5b36ddf5440ab]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[80d5b36ddf5440ab]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[3375709bf24a03bb]::query::erase::Erased<[u8; 8usize]>>
  42:     0x7fc8b450a530 - rustc_query_system[3c4b6c562f3523cb]::query::plumbing::try_execute_query::<rustc_query_impl[80d5b36ddf5440ab]::DynamicConfig<rustc_query_system[3c4b6c562f3523cb]::query::caches::VecCache<rustc_span[a2e62ba9c1d34a9a]::def_id::LocalDefId, rustc_middle[3375709bf24a03bb]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[80d5b36ddf5440ab]::plumbing::QueryCtxt, false>
  43:     0x7fc8b450a04c - rustc_query_impl[80d5b36ddf5440ab]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  44:     0x7fc8b4db5012 - <rustc_middle[3375709bf24a03bb]::hir::map::Map>::par_body_owners::<rustc_hir_analysis[111fc78e3bc47c48]::check_crate::{closure#6}>::{closure#0}
  45:     0x7fc8b4db38dd - rustc_hir_analysis[111fc78e3bc47c48]::check_crate
  46:     0x7fc8b4ea0a13 - rustc_interface[3868b2f10de3354]::passes::analysis
  47:     0x7fc8b4ea0669 - rustc_query_impl[80d5b36ddf5440ab]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[80d5b36ddf5440ab]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[3375709bf24a03bb]::query::erase::Erased<[u8; 1usize]>>
  48:     0x7fc8b5131ce5 - rustc_query_system[3c4b6c562f3523cb]::query::plumbing::try_execute_query::<rustc_query_impl[80d5b36ddf5440ab]::DynamicConfig<rustc_query_system[3c4b6c562f3523cb]::query::caches::SingleCache<rustc_middle[3375709bf24a03bb]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[80d5b36ddf5440ab]::plumbing::QueryCtxt, false>
  49:     0x7fc8b5131a49 - rustc_query_impl[80d5b36ddf5440ab]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  50:     0x7fc8b5140f59 - rustc_interface[3868b2f10de3354]::interface::run_compiler::<core[a9f526eb09c6e7cd]::result::Result<(), rustc_span[a2e62ba9c1d34a9a]::ErrorGuaranteed>, rustc_driver_impl[4c01069949ad96dd]::run_compiler::{closure#0}>::{closure#0}
  51:     0x7fc8b53bbc45 - std[19d33715048712a6]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[3868b2f10de3354]::util::run_in_thread_with_globals<rustc_interface[3868b2f10de3354]::util::run_in_thread_pool_with_globals<rustc_interface[3868b2f10de3354]::interface::run_compiler<core[a9f526eb09c6e7cd]::result::Result<(), rustc_span[a2e62ba9c1d34a9a]::ErrorGuaranteed>, rustc_driver_impl[4c01069949ad96dd]::run_compiler::{closure#0}>::{closure#0}, core[a9f526eb09c6e7cd]::result::Result<(), rustc_span[a2e62ba9c1d34a9a]::ErrorGuaranteed>>::{closure#0}, core[a9f526eb09c6e7cd]::result::Result<(), rustc_span[a2e62ba9c1d34a9a]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[a9f526eb09c6e7cd]::result::Result<(), rustc_span[a2e62ba9c1d34a9a]::ErrorGuaranteed>>
  52:     0x7fc8b53bba72 - <<std[19d33715048712a6]::thread::Builder>::spawn_unchecked_<rustc_interface[3868b2f10de3354]::util::run_in_thread_with_globals<rustc_interface[3868b2f10de3354]::util::run_in_thread_pool_with_globals<rustc_interface[3868b2f10de3354]::interface::run_compiler<core[a9f526eb09c6e7cd]::result::Result<(), rustc_span[a2e62ba9c1d34a9a]::ErrorGuaranteed>, rustc_driver_impl[4c01069949ad96dd]::run_compiler::{closure#0}>::{closure#0}, core[a9f526eb09c6e7cd]::result::Result<(), rustc_span[a2e62ba9c1d34a9a]::ErrorGuaranteed>>::{closure#0}, core[a9f526eb09c6e7cd]::result::Result<(), rustc_span[a2e62ba9c1d34a9a]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[a9f526eb09c6e7cd]::result::Result<(), rustc_span[a2e62ba9c1d34a9a]::ErrorGuaranteed>>::{closure#1} as core[a9f526eb09c6e7cd]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  53:     0x7fc8b0197725 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h79a9e4aa91d71737
                               at /rustc/3406ada96f8e16e49e947a91db3eba0db45245fa/library/alloc/src/boxed.rs:2016:9
  54:     0x7fc8b0197725 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h6eabe626cfdc74a5
                               at /rustc/3406ada96f8e16e49e947a91db3eba0db45245fa/library/alloc/src/boxed.rs:2016:9
  55:     0x7fc8b0197725 - std::sys::pal::unix::thread::Thread::new::thread_start::h8428b71c070d7cf2
                               at /rustc/3406ada96f8e16e49e947a91db3eba0db45245fa/library/std/src/sys/pal/unix/thread.rs:108:17
  56:     0x7fc8b00a6609 - start_thread
  57:     0x7fc8affc9353 - clone
  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

note: please attach the file at `/playground/rustc-ice-2024-02-22T16_54_54-108.txt` to your bug report

note: compiler flags: --crate-type bin -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [typeck] type-checking `main`
#1 [analysis] running analysis passes on this crate
end of query stack

@rustbot label requires-nightly F-non_lifetime_binders

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-non_lifetime_binders`#![feature(non_lifetime_binders)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions