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: non_lifetime_binders: unexpected bound ty in binder #110627

Closed
matthiaskrgr opened this issue Apr 20, 2023 · 1 comment
Closed

ICE: non_lifetime_binders: unexpected bound ty in binder #110627

matthiaskrgr opened this issue Apr 20, 2023 · 1 comment
Labels
C-bug Category: This is a bug. F-non_lifetime_binders `#![feature(non_lifetime_binders)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

Code

#![feature(non_lifetime_binders)]

fn take(id: impl for<T> Fn(T) -> T) {}

fn main() {
    take(|x| x)
}

Meta

rustc --version --verbose:

rustc 1.71.0-nightly (39c6804b9 2023-04-19)
binary: rustc
commit-hash: 39c6804b92aa202369e402525cee329556bc1db0
commit-date: 2023-04-19
host: x86_64-unknown-linux-gnu
release: 1.71.0-nightly
LLVM version: 16.0.2

Error output

<output>
Backtrace

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

error: internal compiler error: /rustc/39c6804b92aa202369e402525cee329556bc1db0/compiler/rustc_middle/src/ty/fold.rs:285:33: unexpected bound ty in binder: BoundTy { var: 0, kind: Anon }

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/39c6804b92aa202369e402525cee329556bc1db0/compiler/rustc_errors/src/lib.rs:1643:9
stack backtrace:
   0:     0x7f866c661d43 - std::backtrace_rs::backtrace::libunwind::trace::h2a7e49770a0c8eb3
                               at /rustc/39c6804b92aa202369e402525cee329556bc1db0/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7f866c661d43 - std::backtrace_rs::backtrace::trace_unsynchronized::h6a543332a97578fa
                               at /rustc/39c6804b92aa202369e402525cee329556bc1db0/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f866c661d43 - std::sys_common::backtrace::_print_fmt::heb3e5fffa7940917
                               at /rustc/39c6804b92aa202369e402525cee329556bc1db0/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7f866c661d43 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h810a6e7cce2ac2e2
                               at /rustc/39c6804b92aa202369e402525cee329556bc1db0/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f866c6c2daf - core::fmt::write::h9ad46b7c2a3eb976
                               at /rustc/39c6804b92aa202369e402525cee329556bc1db0/library/core/src/fmt/mod.rs:1254:17
   5:     0x7f866c654d01 - std::io::Write::write_fmt::h1c9baacb87e6b9c9
                               at /rustc/39c6804b92aa202369e402525cee329556bc1db0/library/std/src/io/mod.rs:1698:15
   6:     0x7f866c661b55 - std::sys_common::backtrace::_print::hca33eaa945a8a7ce
                               at /rustc/39c6804b92aa202369e402525cee329556bc1db0/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7f866c661b55 - std::sys_common::backtrace::print::h00199beaff62c71c
                               at /rustc/39c6804b92aa202369e402525cee329556bc1db0/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7f866c664807 - std::panicking::default_hook::{{closure}}::hd62eb02492041726
   9:     0x7f866c6645f5 - std::panicking::default_hook::hb077d6100095f68a
                               at /rustc/39c6804b92aa202369e402525cee329556bc1db0/library/std/src/panicking.rs:288:9
  10:     0x7f866b4416e5 - <rustc_driver_impl[fc06c256dc1cd1a9]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[87dac7cd678aec56]::ops::function::FnOnce<(&core[87dac7cd678aec56]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  11:     0x7f866c664f45 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h616a4bdc344416e6
                               at /rustc/39c6804b92aa202369e402525cee329556bc1db0/library/alloc/src/boxed.rs:1976:9
  12:     0x7f866c664f45 - std::panicking::rust_panic_with_hook::hd2d604a080396eb9
                               at /rustc/39c6804b92aa202369e402525cee329556bc1db0/library/std/src/panicking.rs:695:13
  13:     0x7f866b9111a1 - std[ca44723e5ea5c648]::panicking::begin_panic::<rustc_errors[340b75cb71735eab]::ExplicitBug>::{closure#0}
  14:     0x7f866b90f4f6 - std[ca44723e5ea5c648]::sys_common::backtrace::__rust_end_short_backtrace::<std[ca44723e5ea5c648]::panicking::begin_panic<rustc_errors[340b75cb71735eab]::ExplicitBug>::{closure#0}, !>
  15:     0x7f866b96b2b6 - std[ca44723e5ea5c648]::panicking::begin_panic::<rustc_errors[340b75cb71735eab]::ExplicitBug>
  16:     0x7f866b995cb6 - <rustc_errors[340b75cb71735eab]::HandlerInner>::bug::<&alloc[27ecb065d74dda4e]::string::String>
  17:     0x7f866b995980 - <rustc_errors[340b75cb71735eab]::Handler>::bug::<&alloc[27ecb065d74dda4e]::string::String>
  18:     0x7f866b9688db - rustc_middle[6b53c1a405df2db5]::util::bug::opt_span_bug_fmt::<rustc_span[35742d543528875]::span_encoding::Span>::{closure#0}
  19:     0x7f866b9680da - rustc_middle[6b53c1a405df2db5]::ty::context::tls::with_opt::<rustc_middle[6b53c1a405df2db5]::util::bug::opt_span_bug_fmt<rustc_span[35742d543528875]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  20:     0x7f866b9680a6 - rustc_middle[6b53c1a405df2db5]::ty::context::tls::with_context_opt::<rustc_middle[6b53c1a405df2db5]::ty::context::tls::with_opt<rustc_middle[6b53c1a405df2db5]::util::bug::opt_span_bug_fmt<rustc_span[35742d543528875]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  21:     0x7f86695d42dd - rustc_middle[6b53c1a405df2db5]::util::bug::bug_fmt
  22:     0x7f866b6504dc - <rustc_middle[6b53c1a405df2db5]::ty::context::TyCtxt>::replace_late_bound_regions_uncached::<rustc_middle[6b53c1a405df2db5]::ty::sty::TraitRef, <rustc_middle[6b53c1a405df2db5]::ty::context::TyCtxt>::replace_late_bound_regions<rustc_middle[6b53c1a405df2db5]::ty::sty::TraitRef, <rustc_middle[6b53c1a405df2db5]::ty::context::TyCtxt>::erase_late_bound_regions<rustc_middle[6b53c1a405df2db5]::ty::sty::TraitRef>::{closure#0}>::{closure#0}>::{closure#0}
  23:     0x7f8669625611 - <rustc_middle[6b53c1a405df2db5]::ty::fold::BoundVarReplacer<rustc_middle[6b53c1a405df2db5]::ty::fold::FnMutDelegate> as rustc_type_ir[7988ade75723acf4]::fold::FallibleTypeFolder<rustc_middle[6b53c1a405df2db5]::ty::context::TyCtxt>>::try_fold_ty
  24:     0x7f86696248a0 - <&rustc_middle[6b53c1a405df2db5]::ty::list::List<rustc_middle[6b53c1a405df2db5]::ty::Ty> as rustc_type_ir[7988ade75723acf4]::fold::TypeFoldable<rustc_middle[6b53c1a405df2db5]::ty::context::TyCtxt>>::try_fold_with::<rustc_middle[6b53c1a405df2db5]::ty::fold::BoundVarReplacer<rustc_middle[6b53c1a405df2db5]::ty::fold::FnMutDelegate>>
  25:     0x7f8669a07187 - <rustc_hir_typeck[5d0bc6618fe00cd3]::fn_ctxt::FnCtxt>::check_expr_closure
  26:     0x7f866997e525 - <rustc_hir_typeck[5d0bc6618fe00cd3]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  27:     0x7f8669584c3e - <rustc_hir_typeck[5d0bc6618fe00cd3]::fn_ctxt::FnCtxt>::check_argument_types
  28:     0x7f8669561c3b - <rustc_hir_typeck[5d0bc6618fe00cd3]::fn_ctxt::FnCtxt>::check_call
  29:     0x7f866997a639 - <rustc_hir_typeck[5d0bc6618fe00cd3]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  30:     0x7f86699c1519 - <rustc_hir_typeck[5d0bc6618fe00cd3]::fn_ctxt::FnCtxt>::check_block_with_expected
  31:     0x7f866997ae64 - <rustc_hir_typeck[5d0bc6618fe00cd3]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  32:     0x7f8669b857dd - <rustc_hir_typeck[5d0bc6618fe00cd3]::fn_ctxt::FnCtxt>::check_return_expr
  33:     0x7f8669b7d96a - rustc_hir_typeck[5d0bc6618fe00cd3]::check::check_fn
  34:     0x7f8669b65b23 - rustc_hir_typeck[5d0bc6618fe00cd3]::typeck
  35:     0x7f86694dd309 - rustc_query_system[cc3f2816497b0dda]::query::plumbing::try_execute_query::<rustc_query_impl[d5b511e0af106fac]::queries::typeck, rustc_query_impl[d5b511e0af106fac]::plumbing::QueryCtxt>
  36:     0x7f866abb7570 - rustc_data_structures[a36227c7e9b5ca0d]::sync::par_for_each_in::<&[rustc_span[35742d543528875]::def_id::LocalDefId], <rustc_middle[6b53c1a405df2db5]::hir::map::Map>::par_body_owners<rustc_hir_typeck[5d0bc6618fe00cd3]::typeck_item_bodies::{closure#0}>::{closure#0}>
  37:     0x7f866abb731e - rustc_hir_typeck[5d0bc6618fe00cd3]::typeck_item_bodies
  38:     0x7f866ac3b717 - rustc_query_system[cc3f2816497b0dda]::query::plumbing::try_execute_query::<rustc_query_impl[d5b511e0af106fac]::queries::typeck_item_bodies, rustc_query_impl[d5b511e0af106fac]::plumbing::QueryCtxt>
  39:     0x7f866ac3b42c - <rustc_query_impl[d5b511e0af106fac]::Queries as rustc_middle[6b53c1a405df2db5]::ty::query::QueryEngine>::typeck_item_bodies
  40:     0x7f866a809dbc - rustc_hir_analysis[b76cf653628f06f0]::check_crate
  41:     0x7f866a803bad - rustc_interface[582898756836a6b1]::passes::analysis
  42:     0x7f866aba3702 - rustc_query_system[cc3f2816497b0dda]::query::plumbing::try_execute_query::<rustc_query_impl[d5b511e0af106fac]::queries::analysis, rustc_query_impl[d5b511e0af106fac]::plumbing::QueryCtxt>
  43:     0x7f866aba3410 - <rustc_query_impl[d5b511e0af106fac]::Queries as rustc_middle[6b53c1a405df2db5]::ty::query::QueryEngine>::analysis
  44:     0x7f866aa640e6 - <std[ca44723e5ea5c648]::thread::local::LocalKey<core[87dac7cd678aec56]::cell::Cell<*const ()>>>::with::<rustc_middle[6b53c1a405df2db5]::ty::context::tls::enter_context<<rustc_middle[6b53c1a405df2db5]::ty::context::GlobalCtxt>::enter<rustc_driver_impl[fc06c256dc1cd1a9]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[87dac7cd678aec56]::result::Result<(), rustc_span[35742d543528875]::ErrorGuaranteed>>::{closure#0}, core[87dac7cd678aec56]::result::Result<(), rustc_span[35742d543528875]::ErrorGuaranteed>>::{closure#0}, core[87dac7cd678aec56]::result::Result<(), rustc_span[35742d543528875]::ErrorGuaranteed>>
  45:     0x7f866a63dca8 - <rustc_interface[582898756836a6b1]::interface::Compiler>::enter::<rustc_driver_impl[fc06c256dc1cd1a9]::run_compiler::{closure#1}::{closure#2}, core[87dac7cd678aec56]::result::Result<core[87dac7cd678aec56]::option::Option<rustc_interface[582898756836a6b1]::queries::Linker>, rustc_span[35742d543528875]::ErrorGuaranteed>>
  46:     0x7f866a637caf - rustc_span[35742d543528875]::set_source_map::<core[87dac7cd678aec56]::result::Result<(), rustc_span[35742d543528875]::ErrorGuaranteed>, rustc_interface[582898756836a6b1]::interface::run_compiler<core[87dac7cd678aec56]::result::Result<(), rustc_span[35742d543528875]::ErrorGuaranteed>, rustc_driver_impl[fc06c256dc1cd1a9]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  47:     0x7f866a6378c8 - <scoped_tls[73fb7a08bc8a4c85]::ScopedKey<rustc_span[35742d543528875]::SessionGlobals>>::set::<rustc_interface[582898756836a6b1]::interface::run_compiler<core[87dac7cd678aec56]::result::Result<(), rustc_span[35742d543528875]::ErrorGuaranteed>, rustc_driver_impl[fc06c256dc1cd1a9]::run_compiler::{closure#1}>::{closure#0}, core[87dac7cd678aec56]::result::Result<(), rustc_span[35742d543528875]::ErrorGuaranteed>>
  48:     0x7f866a636edb - std[ca44723e5ea5c648]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[582898756836a6b1]::util::run_in_thread_pool_with_globals<rustc_interface[582898756836a6b1]::interface::run_compiler<core[87dac7cd678aec56]::result::Result<(), rustc_span[35742d543528875]::ErrorGuaranteed>, rustc_driver_impl[fc06c256dc1cd1a9]::run_compiler::{closure#1}>::{closure#0}, core[87dac7cd678aec56]::result::Result<(), rustc_span[35742d543528875]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[87dac7cd678aec56]::result::Result<(), rustc_span[35742d543528875]::ErrorGuaranteed>>
  49:     0x7f866ad09431 - <<std[ca44723e5ea5c648]::thread::Builder>::spawn_unchecked_<rustc_interface[582898756836a6b1]::util::run_in_thread_pool_with_globals<rustc_interface[582898756836a6b1]::interface::run_compiler<core[87dac7cd678aec56]::result::Result<(), rustc_span[35742d543528875]::ErrorGuaranteed>, rustc_driver_impl[fc06c256dc1cd1a9]::run_compiler::{closure#1}>::{closure#0}, core[87dac7cd678aec56]::result::Result<(), rustc_span[35742d543528875]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[87dac7cd678aec56]::result::Result<(), rustc_span[35742d543528875]::ErrorGuaranteed>>::{closure#1} as core[87dac7cd678aec56]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  50:     0x7f866c66f3d5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::haab69effe0fa19e3
                               at /rustc/39c6804b92aa202369e402525cee329556bc1db0/library/alloc/src/boxed.rs:1962:9
  51:     0x7f866c66f3d5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hb0775fd74e9e7829
                               at /rustc/39c6804b92aa202369e402525cee329556bc1db0/library/alloc/src/boxed.rs:1962:9
  52:     0x7f866c66f3d5 - std::sys::unix::thread::Thread::new::thread_start::h0e7436fc32c0c985
                               at /rustc/39c6804b92aa202369e402525cee329556bc1db0/library/std/src/sys/unix/thread.rs:108:17
  53:     0x7f8668094bb5 - <unknown>
  54:     0x7f8668116d90 - <unknown>
  55:                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.71.0-nightly (39c6804b9 2023-04-19) 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 previous error; 1 warning emitted

@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. requires-nightly This issue requires a nightly compiler in some way. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue F-non_lifetime_binders `#![feature(non_lifetime_binders)]` labels Apr 20, 2023
@fmease
Copy link
Member

fmease commented Apr 20, 2023

Duplicate of #108814.

@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Apr 15, 2024
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)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue 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

2 participants