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

non_lifetime_binders: unexpected bound ty in binder #117061

Closed
benluelo opened this issue Oct 22, 2023 · 2 comments
Closed

non_lifetime_binders: unexpected bound ty in binder #117061

benluelo opened this issue Oct 22, 2023 · 2 comments
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) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@benluelo
Copy link
Contributor

Code

https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=9722116b41bf05e9c9d57900eb41a95d

Meta

rustc --version --verbose:

rustc 1.74.0-nightly (734a0d0aa 2023-08-25)
binary: rustc
commit-hash: 734a0d0aa0d5cab60f94f6d0c6a014dae12915f1
commit-date: 2023-08-25
host: x86_64-unknown-linux-gnu
release: 1.74.0-nightly
LLVM version: 17.0.0

Error output

thread 'rustc' panicked at /rustc/734a0d0aa0d5cab60f94f6d0c6a014dae12915f1/compiler/rustc_errors/src/lib.rs:1649:9:
Box<dyn Any>
stack backtrace:
   0:     0x7ffff391330c - std::backtrace_rs::backtrace::libunwind::trace::hd9f7ac08238d25ac
                               at /rustc/734a0d0aa0d5cab60f94f6d0c6a014dae12915f1/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7ffff391330c - std::backtrace_rs::backtrace::trace_unsynchronized::h1af01762a2621c85
                               at /rustc/734a0d0aa0d5cab60f94f6d0c6a014dae12915f1/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7ffff391330c - std::sys_common::backtrace::_print_fmt::h5f3b8dbcedc37939
                               at /rustc/734a0d0aa0d5cab60f94f6d0c6a014dae12915f1/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7ffff391330c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::he6380ff20810e388
                               at /rustc/734a0d0aa0d5cab60f94f6d0c6a014dae12915f1/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7ffff39794bc - core::fmt::rt::Argument::fmt::h6efc876ec995b0df
                               at /rustc/734a0d0aa0d5cab60f94f6d0c6a014dae12915f1/library/core/src/fmt/rt.rs:138:9
   5:     0x7ffff39794bc - core::fmt::write::hbfff067b75f69c18
                               at /rustc/734a0d0aa0d5cab60f94f6d0c6a014dae12915f1/library/core/src/fmt/mod.rs:1094:21
   6:     0x7ffff3905d3e - std::io::Write::write_fmt::h28ddc294557b6a5d
                               at /rustc/734a0d0aa0d5cab60f94f6d0c6a014dae12915f1/library/std/src/io/mod.rs:1714:15
   7:     0x7ffff39130f4 - std::sys_common::backtrace::_print::h58b8061724e09bea
                               at /rustc/734a0d0aa0d5cab60f94f6d0c6a014dae12915f1/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7ffff39130f4 - std::sys_common::backtrace::print::hf2c5a771029da8c3
                               at /rustc/734a0d0aa0d5cab60f94f6d0c6a014dae12915f1/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7ffff39161ea - std::panicking::panic_hook_with_disk_dump::{{closure}}::h3dfc347c2ae051bf
                               at /rustc/734a0d0aa0d5cab60f94f6d0c6a014dae12915f1/library/std/src/panicking.rs:278:22
  10:     0x7ffff3915e9a - std::panicking::panic_hook_with_disk_dump::h15cbef431cdd8a7c
                               at /rustc/734a0d0aa0d5cab60f94f6d0c6a014dae12915f1/library/std/src/panicking.rs:305:9
  11:     0x7ffff6b52029 - rustc_driver_impl[ef6a0d9a5572f1d2]::install_ice_hook::{closure#0}
  12:     0x7ffff3916a91 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hefa73e6727dbd05e
                               at /rustc/734a0d0aa0d5cab60f94f6d0c6a014dae12915f1/library/alloc/src/boxed.rs:2021:9
  13:     0x7ffff3916a91 - std::panicking::rust_panic_with_hook::ha11958324ac326da
                               at /rustc/734a0d0aa0d5cab60f94f6d0c6a014dae12915f1/library/std/src/panicking.rs:733:13
  14:     0x7ffff712e561 - std[f6dab3b182b9be26]::panicking::begin_panic::<rustc_errors[26748c07646421e8]::ExplicitBug>::{closure#0}
  15:     0x7ffff712e336 - std[f6dab3b182b9be26]::sys_common::backtrace::__rust_end_short_backtrace::<std[f6dab3b182b9be26]::panicking::begin_panic<rustc_errors[26748c07646421e8]::ExplicitBug>::{closure#0}, !>
  16:     0x7ffff70ed5b6 - std[f6dab3b182b9be26]::panicking::begin_panic::<rustc_errors[26748c07646421e8]::ExplicitBug>
  17:     0x7ffff707fe54 - <rustc_errors[26748c07646421e8]::HandlerInner>::bug::<alloc[42873f85a7c7bc20]::string::String>
  18:     0x7ffff707fce6 - <rustc_errors[26748c07646421e8]::Handler>::bug::<alloc[42873f85a7c7bc20]::string::String>
  19:     0x7ffff70b9bec - rustc_middle[99297203a9599a56]::util::bug::opt_span_bug_fmt::<rustc_span[bbf7b08c8648562e]::span_encoding::Span>::{closure#0}
  20:     0x7ffff70b822a - rustc_middle[99297203a9599a56]::ty::context::tls::with_opt::<rustc_middle[99297203a9599a56]::util::bug::opt_span_bug_fmt<rustc_span[bbf7b08c8648562e]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7ffff70b81f8 - rustc_middle[99297203a9599a56]::ty::context::tls::with_context_opt::<rustc_middle[99297203a9599a56]::ty::context::tls::with_opt<rustc_middle[99297203a9599a56]::util::bug::opt_span_bug_fmt<rustc_span[bbf7b08c8648562e]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7ffff52ecea0 - rustc_middle[99297203a9599a56]::util::bug::bug_fmt
  23:     0x7ffff5fed4d5 - <rustc_middle[99297203a9599a56]::ty::context::TyCtxt>::replace_late_bound_regions_uncached::<rustc_middle[99297203a9599a56]::ty::sty::FnSig, <rustc_middle[99297203a9599a56]::ty::context::TyCtxt>::liberate_late_bound_regions<rustc_middle[99297203a9599a56]::ty::sty::FnSig>::{closure#0}>::{closure#0}
  24:     0x7ffff50777bc - <&rustc_middle[99297203a9599a56]::ty::list::List<rustc_middle[99297203a9599a56]::ty::generic_args::GenericArg> as rustc_type_ir[82b34392f0e6bd47]::fold::TypeFoldable<rustc_middle[99297203a9599a56]::ty::context::TyCtxt>>::try_fold_with::<rustc_middle[99297203a9599a56]::ty::fold::BoundVarReplacer<rustc_middle[99297203a9599a56]::ty::fold::FnMutDelegate>>
  25:     0x7ffff5076bc7 - <rustc_middle[99297203a9599a56]::ty::Ty as rustc_type_ir[82b34392f0e6bd47]::fold::TypeSuperFoldable<rustc_middle[99297203a9599a56]::ty::context::TyCtxt>>::try_super_fold_with::<rustc_middle[99297203a9599a56]::ty::fold::BoundVarReplacer<rustc_middle[99297203a9599a56]::ty::fold::FnMutDelegate>>
  26:     0x7ffff541ef03 - <rustc_middle[99297203a9599a56]::ty::sty::FnSig as rustc_type_ir[82b34392f0e6bd47]::fold::TypeFoldable<rustc_middle[99297203a9599a56]::ty::context::TyCtxt>>::fold_with::<rustc_middle[99297203a9599a56]::ty::fold::BoundVarReplacer<rustc_middle[99297203a9599a56]::ty::fold::FnMutDelegate>>
  27:     0x7ffff4f1dd93 - <rustc_hir_typeck[7e40077950def15e]::fn_ctxt::FnCtxt>::check_expr_closure
  28:     0x7ffff4e35438 - <rustc_hir_typeck[7e40077950def15e]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  29:     0x7ffff4e83bed - <rustc_hir_typeck[7e40077950def15e]::fn_ctxt::FnCtxt>::check_argument_types
  30:     0x7ffff4e33cfc - <rustc_hir_typeck[7e40077950def15e]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  31:     0x7ffff4e5ff0d - <rustc_hir_typeck[7e40077950def15e]::fn_ctxt::FnCtxt>::check_block_with_expected
  32:     0x7ffff4e32a69 - <rustc_hir_typeck[7e40077950def15e]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  33:     0x7ffff539fd88 - <rustc_hir_typeck[7e40077950def15e]::fn_ctxt::FnCtxt>::check_return_expr
  34:     0x7ffff539e5ab - rustc_hir_typeck[7e40077950def15e]::check::check_fn
  35:     0x7ffff538a483 - rustc_hir_typeck[7e40077950def15e]::typeck
  36:     0x7ffff4c520be - rustc_query_impl[7e9da624c7438cfe]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[7e9da624c7438cfe]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[99297203a9599a56]::query::erase::Erased<[u8; 8usize]>>
  37:     0x7ffff4c5208e - <rustc_query_impl[7e9da624c7438cfe]::query_impl::typeck::dynamic_query::{closure#2} as core[d6db75e283dce156]::ops::function::FnOnce<(rustc_middle[99297203a9599a56]::ty::context::TyCtxt, rustc_span[bbf7b08c8648562e]::def_id::LocalDefId)>>::call_once
  38:     0x7ffff52a46e0 - rustc_query_system[f97f1b1c716e5ed3]::query::plumbing::try_execute_query::<rustc_query_impl[7e9da624c7438cfe]::DynamicConfig<rustc_query_system[f97f1b1c716e5ed3]::query::caches::VecCache<rustc_span[bbf7b08c8648562e]::def_id::LocalDefId, rustc_middle[99297203a9599a56]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[7e9da624c7438cfe]::plumbing::QueryCtxt, true>
  39:     0x7ffff64c5cf1 - rustc_query_impl[7e9da624c7438cfe]::query_impl::typeck::get_query_incr::__rust_end_short_backtrace
  40:     0x7ffff5abfb23 - rustc_hir_analysis[37a30d08878fd5d]::check_crate
  41:     0x7ffff5ab8efa - rustc_interface[219b97010207cb3]::passes::analysis
  42:     0x7ffff60597ca - rustc_query_impl[7e9da624c7438cfe]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[7e9da624c7438cfe]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[99297203a9599a56]::query::erase::Erased<[u8; 1usize]>>
  43:     0x7ffff60597b9 - <rustc_query_impl[7e9da624c7438cfe]::query_impl::analysis::dynamic_query::{closure#2} as core[d6db75e283dce156]::ops::function::FnOnce<(rustc_middle[99297203a9599a56]::ty::context::TyCtxt, ())>>::call_once
  44:     0x7ffff6334928 - rustc_query_system[f97f1b1c716e5ed3]::query::plumbing::try_execute_query::<rustc_query_impl[7e9da624c7438cfe]::DynamicConfig<rustc_query_system[f97f1b1c716e5ed3]::query::caches::SingleCache<rustc_middle[99297203a9599a56]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[7e9da624c7438cfe]::plumbing::QueryCtxt, true>
  45:     0x7ffff6334484 - rustc_query_impl[7e9da624c7438cfe]::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
  46:     0x7ffff5e218a6 - <rustc_middle[99297203a9599a56]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[ef6a0d9a5572f1d2]::run_compiler::{closure#1}::{closure#2}::{closure#6}, core[d6db75e283dce156]::result::Result<(), rustc_span[bbf7b08c8648562e]::ErrorGuaranteed>>
  47:     0x7ffff5e20d2c - <rustc_interface[219b97010207cb3]::interface::Compiler>::enter::<rustc_driver_impl[ef6a0d9a5572f1d2]::run_compiler::{closure#1}::{closure#2}, core[d6db75e283dce156]::result::Result<core[d6db75e283dce156]::option::Option<rustc_interface[219b97010207cb3]::queries::Linker>, rustc_span[bbf7b08c8648562e]::ErrorGuaranteed>>
  48:     0x7ffff5e1e048 - std[f6dab3b182b9be26]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[219b97010207cb3]::util::run_in_thread_pool_with_globals<rustc_interface[219b97010207cb3]::interface::run_compiler<core[d6db75e283dce156]::result::Result<(), rustc_span[bbf7b08c8648562e]::ErrorGuaranteed>, rustc_driver_impl[ef6a0d9a5572f1d2]::run_compiler::{closure#1}>::{closure#0}, core[d6db75e283dce156]::result::Result<(), rustc_span[bbf7b08c8648562e]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d6db75e283dce156]::result::Result<(), rustc_span[bbf7b08c8648562e]::ErrorGuaranteed>>
  49:     0x7ffff63c8525 - <<std[f6dab3b182b9be26]::thread::Builder>::spawn_unchecked_<rustc_interface[219b97010207cb3]::util::run_in_thread_pool_with_globals<rustc_interface[219b97010207cb3]::interface::run_compiler<core[d6db75e283dce156]::result::Result<(), rustc_span[bbf7b08c8648562e]::ErrorGuaranteed>, rustc_driver_impl[ef6a0d9a5572f1d2]::run_compiler::{closure#1}>::{closure#0}, core[d6db75e283dce156]::result::Result<(), rustc_span[bbf7b08c8648562e]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[d6db75e283dce156]::result::Result<(), rustc_span[bbf7b08c8648562e]::ErrorGuaranteed>>::{closure#1} as core[d6db75e283dce156]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  50:     0x7ffff39213f5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h13a8377f793e536e
                               at /rustc/734a0d0aa0d5cab60f94f6d0c6a014dae12915f1/library/alloc/src/boxed.rs:2007:9
  51:     0x7ffff39213f5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hb5e362578b76df77
                               at /rustc/734a0d0aa0d5cab60f94f6d0c6a014dae12915f1/library/alloc/src/boxed.rs:2007:9
  52:     0x7ffff39213f5 - std::sys::unix::thread::Thread::new::thread_start::h9411d5912fbb349b
                               at /rustc/734a0d0aa0d5cab60f94f6d0c6a014dae12915f1/library/std/src/sys/unix/thread.rs:108:17
  53:     0x7ffff36b4dd4 - start_thread
  54:     0x7ffff37369b0 - __clone3
  55:                0x0 - <unknown>


rustc version: 1.74.0-nightly (734a0d0aa 2023-08-25)
platform: x86_64-unknown-linux-gnu

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

error: internal compiler error: /rustc/734a0d0aa0d5cab60f94f6d0c6a014dae12915f1/compiler/rustc_middle/src/ty/fold.rs:285:33: unexpected bound ty in binder: 0

thread 'rustc' panicked at /rustc/734a0d0aa0d5cab60f94f6d0c6a014dae12915f1/compiler/rustc_errors/src/lib.rs:1649:9:
Box<dyn Any>
stack backtrace:
   0: std::panicking::begin_panic::<rustc_errors::ExplicitBug>
   1: <rustc_errors::HandlerInner>::bug::<alloc::string::String>
   2: <rustc_errors::Handler>::bug::<alloc::string::String>
   3: rustc_middle::util::bug::opt_span_bug_fmt::<rustc_span::span_encoding::Span>::{closure#0}
   4: rustc_middle::ty::context::tls::with_opt::<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}
   5: rustc_middle::ty::context::tls::with_context_opt::<rustc_middle::ty::context::tls::with_opt<rustc_middle::util::bug::opt_span_bug_fmt<rustc_span::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
   6: rustc_middle::util::bug::bug_fmt
   7: <rustc_middle::ty::context::TyCtxt>::replace_late_bound_regions_uncached::<rustc_middle::ty::sty::FnSig, <rustc_middle::ty::context::TyCtxt>::liberate_late_bound_regions<rustc_middle::ty::sty::FnSig>::{closure#0}>::{closure#0}
   8: <&rustc_middle::ty::list::List<rustc_middle::ty::generic_args::GenericArg> as rustc_type_ir::fold::TypeFoldable<rustc_middle::ty::context::TyCtxt>>::try_fold_with::<rustc_middle::ty::fold::BoundVarReplacer<rustc_middle::ty::fold::FnMutDelegate>>
   9: <rustc_middle::ty::Ty as rustc_type_ir::fold::TypeSuperFoldable<rustc_middle::ty::context::TyCtxt>>::try_super_fold_with::<rustc_middle::ty::fold::BoundVarReplacer<rustc_middle::ty::fold::FnMutDelegate>>
  10: <rustc_middle::ty::sty::FnSig as rustc_type_ir::fold::TypeFoldable<rustc_middle::ty::context::TyCtxt>>::fold_with::<rustc_middle::ty::fold::BoundVarReplacer<rustc_middle::ty::fold::FnMutDelegate>>
  11: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_closure
  12: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  13: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_argument_types
  14: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  15: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_block_with_expected
  16: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  17: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_return_expr
  18: rustc_hir_typeck::check::check_fn
  19: rustc_hir_typeck::typeck
      [... omitted 2 frames ...]
  20: rustc_hir_analysis::check_crate
  21: rustc_interface::passes::analysis
      [... omitted 2 frames ...]
  22: <rustc_middle::ty::context::GlobalCtxt>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#6}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
  23: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_span::ErrorGuaranteed>>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

@benluelo benluelo 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 22, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Oct 22, 2023
@benluelo
Copy link
Contributor Author

(I believe this could be a duplicate of #108814)

@fmease fmease added F-non_lifetime_binders `#![feature(non_lifetime_binders)]` and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Oct 23, 2023
@fmease
Copy link
Member

fmease commented Oct 23, 2023

Yes, it looks like a duplicate (use of for<T> … FnOnce(… T …) and same backtrace).

@fmease fmease closed this as not planned Won't fix, can't repro, duplicate, stale Oct 23, 2023
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) ❄️ 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