Repository: rust
Issue: ice: non_lifetime_binders: `bound types encountered in structurally_relate_tys`
Labels: I-ICE,T-compiler,C-bug,S-bug-has-test,F-non_lifetime_binders

<!--
[31mICE[0m: Rustc ./610B19B30B97451DDCFDA64A024BF37F83E9616A1CDCF349DDC9BADF7E4F1F46.rs '' 'error: internal compiler error: /rustc/61d3b263a793b390f6231f08d862e8c71d04e3ef/compiler/rustc_middle/src/ty/relate.rs:423:13: bound types encountered in structurally_relate_tys', 'error: internal compiler error: /rustc/61d3b263a793b390f6231f08d862e8c71d04e3ef/compiler/rustc_middle/src/ty/relate.rs:423:13: bound types encountered in structurally_relate_tys'
File: /tmp/icemaker/610B19B30B97451DDCFDA64A024BF37F83E9616A1CDCF349DDC9BADF7E4F1F46.rs
-->

auto-reduced (treereduce-rust):
````rust
#![feature(non_lifetime_binders)]

fn trivial<A>()
where
    for<B> dyn Fn(A, *const A): Fn(A, *const B),
{
}

fn main() {
    trivial::<u8>();
}


````

original:
````rust
// revisions: current next
//[next] compile-flags: -Ztrait-solver=next
// check-pass

#![feature(non_lifetime_binders)]
//~^ WARN the feature `non_lifetime_binders` is incomplete and may not be safe

fn trivial<A>()
where
    for<B> dyn Fn(A, *const A): Fn(A, *const B),
{
}

fn main() {
    trivial::<u8>();
}

````

Version information
````
rustc 1.76.0-nightly (61d3b263a 2023-11-18)
binary: rustc
commit-hash: 61d3b263a793b390f6231f08d862e8c71d04e3ef
commit-date: 2023-11-18
host: x86_64-unknown-linux-gnu
release: 1.76.0-nightly
LLVM version: 17.0.5

````

Command:
`/home/matthias/.rustup/toolchains/master/bin/rustc `

<!--
Include a backtrace in the code block by setting `RUST_BACKTRACE=1` in your
environment. E.g. `RUST_BACKTRACE=1 cargo build`.
-->
<details><summary><strong>Program output</strong></summary>
<p>

```
warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
 --> /tmp/icemaker_global_tempdir.OhsTT01V6N41/rustc_testrunner_tmpdir_reporting.8TZDJAlSWQGa/mvce.rs: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/61d3b263a793b390f6231f08d862e8c71d04e3ef/compiler/rustc_middle/src/ty/relate.rs:423:13: bound types encountered in structurally_relate_tys

thread 'rustc' panicked at /rustc/61d3b263a793b390f6231f08d862e8c71d04e3ef/compiler/rustc_errors/src/lib.rs:1660:9:
Box<dyn Any>
stack backtrace:
   0:     0x7fe9bb98b89c - std::backtrace_rs::backtrace::libunwind::trace::h18e53f661b5c2edd
                               at /rustc/61d3b263a793b390f6231f08d862e8c71d04e3ef/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7fe9bb98b89c - std::backtrace_rs::backtrace::trace_unsynchronized::h97f5f547f87e4bc4
                               at /rustc/61d3b263a793b390f6231f08d862e8c71d04e3ef/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fe9bb98b89c - std::sys_common::backtrace::_print_fmt::he219141209927ec6
                               at /rustc/61d3b263a793b390f6231f08d862e8c71d04e3ef/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7fe9bb98b89c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h75fd41d15240b650
                               at /rustc/61d3b263a793b390f6231f08d862e8c71d04e3ef/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fe9bb9de8a0 - core::fmt::rt::Argument::fmt::hbbbb412b3ad80712
                               at /rustc/61d3b263a793b390f6231f08d862e8c71d04e3ef/library/core/src/fmt/rt.rs:142:9
   5:     0x7fe9bb9de8a0 - core::fmt::write::hf122c916b8c75abc
                               at /rustc/61d3b263a793b390f6231f08d862e8c71d04e3ef/library/core/src/fmt/mod.rs:1120:17
   6:     0x7fe9bb97f72f - std::io::Write::write_fmt::h08e32726ad4d5025
                               at /rustc/61d3b263a793b390f6231f08d862e8c71d04e3ef/library/std/src/io/mod.rs:1762:15
   7:     0x7fe9bb98b684 - std::sys_common::backtrace::_print::h541afed6f1b86622
                               at /rustc/61d3b263a793b390f6231f08d862e8c71d04e3ef/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7fe9bb98b684 - std::sys_common::backtrace::print::h795545ffc54466d1
                               at /rustc/61d3b263a793b390f6231f08d862e8c71d04e3ef/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7fe9bb98e317 - std::panicking::default_hook::{{closure}}::h4dcebe6d98c6a397
  10:     0x7fe9bb98e07f - std::panicking::default_hook::h59ee74b606814155
                               at /rustc/61d3b263a793b390f6231f08d862e8c71d04e3ef/library/std/src/panicking.rs:292:9
  11:     0x7fe9be707440 - std[22951113092b5ae0]::panicking::update_hook::<alloc[b5d0ee5bb39797a7]::boxed::Box<rustc_driver_impl[b71c95451d1b6e1e]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7fe9bb98ea58 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hfa11abfd6ea5364d
                               at /rustc/61d3b263a793b390f6231f08d862e8c71d04e3ef/library/alloc/src/boxed.rs:2021:9
  13:     0x7fe9bb98ea58 - std::panicking::rust_panic_with_hook::hd410976983b968ed
                               at /rustc/61d3b263a793b390f6231f08d862e8c71d04e3ef/library/std/src/panicking.rs:783:13
  14:     0x7fe9beb53964 - std[22951113092b5ae0]::panicking::begin_panic::<rustc_errors[55613f3f74c29b9a]::ExplicitBug>::{closure#0}
  15:     0x7fe9beb47f06 - std[22951113092b5ae0]::sys_common::backtrace::__rust_end_short_backtrace::<std[22951113092b5ae0]::panicking::begin_panic<rustc_errors[55613f3f74c29b9a]::ExplicitBug>::{closure#0}, !>
  16:     0x7fe9beb363f6 - std[22951113092b5ae0]::panicking::begin_panic::<rustc_errors[55613f3f74c29b9a]::ExplicitBug>
  17:     0x7fe9beb2d534 - <rustc_errors[55613f3f74c29b9a]::HandlerInner>::bug::<alloc[b5d0ee5bb39797a7]::string::String>
  18:     0x7fe9beb2d23a - <rustc_errors[55613f3f74c29b9a]::Handler>::bug::<alloc[b5d0ee5bb39797a7]::string::String>
  19:     0x7fe9bebcfa8d - rustc_middle[6494474247fbca]::util::bug::opt_span_bug_fmt::<rustc_span[a0d827a73196df23]::span_encoding::Span>::{closure#0}
  20:     0x7fe9bebb666a - rustc_middle[6494474247fbca]::ty::context::tls::with_opt::<rustc_middle[6494474247fbca]::util::bug::opt_span_bug_fmt<rustc_span[a0d827a73196df23]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7fe9bebb64e8 - rustc_middle[6494474247fbca]::ty::context::tls::with_context_opt::<rustc_middle[6494474247fbca]::ty::context::tls::with_opt<rustc_middle[6494474247fbca]::util::bug::opt_span_bug_fmt<rustc_span[a0d827a73196df23]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7fe9bcb31330 - rustc_middle[6494474247fbca]::util::bug::bug_fmt
  23:     0x7fe9be9dbe2c - <rustc_infer[184fea3002c66c88]::infer::error_reporting::SameTypeModuloInfer as rustc_middle[6494474247fbca]::ty::relate::TypeRelation>::tys
  24:     0x7fe9be97640d - rustc_middle[6494474247fbca]::ty::relate::relate_type_and_mut::<rustc_infer[184fea3002c66c88]::infer::error_reporting::SameTypeModuloInfer>
  25:     0x7fe9be9db82c - <rustc_infer[184fea3002c66c88]::infer::error_reporting::SameTypeModuloInfer as rustc_middle[6494474247fbca]::ty::relate::TypeRelation>::tys
  26:     0x7fe9be98a066 - <core[3dfd8817c7ccc872]::result::Result<rustc_middle[6494474247fbca]::ty::Ty, rustc_middle[6494474247fbca]::ty::error::TypeError> as rustc_type_ir[37dafa415bf19879]::interner::CollectAndApply<rustc_middle[6494474247fbca]::ty::Ty, rustc_middle[6494474247fbca]::ty::Ty>>::collect_and_apply::<core[3dfd8817c7ccc872]::iter::adapters::map::Map<core[3dfd8817c7ccc872]::iter::adapters::zip::Zip<core[3dfd8817c7ccc872]::iter::adapters::copied::Copied<core[3dfd8817c7ccc872]::slice::iter::Iter<rustc_middle[6494474247fbca]::ty::Ty>>, core[3dfd8817c7ccc872]::iter::adapters::copied::Copied<core[3dfd8817c7ccc872]::slice::iter::Iter<rustc_middle[6494474247fbca]::ty::Ty>>>, rustc_middle[6494474247fbca]::ty::relate::structurally_relate_tys<rustc_infer[184fea3002c66c88]::infer::error_reporting::SameTypeModuloInfer>::{closure#0}::{closure#1}>, <rustc_middle[6494474247fbca]::ty::Ty>::new_tup_from_iter<core[3dfd8817c7ccc872]::iter::adapters::map::Map<core[3dfd8817c7ccc872]::iter::adapters::zip::Zip<core[3dfd8817c7ccc872]::iter::adapters::copied::Copied<core[3dfd8817c7ccc872]::slice::iter::Iter<rustc_middle[6494474247fbca]::ty::Ty>>, core[3dfd8817c7ccc872]::iter::adapters::copied::Copied<core[3dfd8817c7ccc872]::slice::iter::Iter<rustc_middle[6494474247fbca]::ty::Ty>>>, rustc_middle[6494474247fbca]::ty::relate::structurally_relate_tys<rustc_infer[184fea3002c66c88]::infer::error_reporting::SameTypeModuloInfer>::{closure#0}::{closure#1}>, core[3dfd8817c7ccc872]::result::Result<rustc_middle[6494474247fbca]::ty::Ty, rustc_middle[6494474247fbca]::ty::error::TypeError>>::{closure#0}>
  27:     0x7fe9be9dbda5 - <rustc_infer[184fea3002c66c88]::infer::error_reporting::SameTypeModuloInfer as rustc_middle[6494474247fbca]::ty::relate::TypeRelation>::tys
  28:     0x7fe9bf272a3f - <rustc_infer[184fea3002c66c88]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[706461a95b9b000c]::traits::error_reporting::type_err_ctxt_ext::InferCtxtPrivExt>::add_help_message_for_fn_trait
  29:     0x7fe9bf266718 - <rustc_infer[184fea3002c66c88]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[706461a95b9b000c]::traits::error_reporting::type_err_ctxt_ext::TypeErrCtxtExt>::report_selection_error
  30:     0x7fe9bf28cfe8 - <rustc_infer[184fea3002c66c88]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[706461a95b9b000c]::traits::error_reporting::type_err_ctxt_ext::InferCtxtPrivExt>::report_fulfillment_error
  31:     0x7fe9bf261bca - <rustc_infer[184fea3002c66c88]::infer::error_reporting::TypeErrCtxt as rustc_trait_selection[706461a95b9b000c]::traits::error_reporting::type_err_ctxt_ext::TypeErrCtxtExt>::report_fulfillment_errors
  32:     0x7fe9c041e3a3 - <rustc_hir_typeck[cdd295ee7ed2e530]::fn_ctxt::FnCtxt>::check_argument_types
  33:     0x7fe9c0412da9 - <rustc_hir_typeck[cdd295ee7ed2e530]::fn_ctxt::FnCtxt>::check_call
  34:     0x7fe9c04c1997 - <rustc_hir_typeck[cdd295ee7ed2e530]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  35:     0x7fe9bfedbca6 - <rustc_hir_typeck[cdd295ee7ed2e530]::fn_ctxt::FnCtxt>::check_block_with_expected
  36:     0x7fe9c04c1d26 - <rustc_hir_typeck[cdd295ee7ed2e530]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  37:     0x7fe9bff185f3 - rustc_hir_typeck[cdd295ee7ed2e530]::check::check_fn
  38:     0x7fe9bfd26ef2 - rustc_hir_typeck[cdd295ee7ed2e530]::typeck
  39:     0x7fe9bfd262d3 - rustc_query_impl[ea80110a39650050]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[ea80110a39650050]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[6494474247fbca]::query::erase::Erased<[u8; 8usize]>>
  40:     0x7fe9bfb6a303 - rustc_query_system[4c90f055e7d33a4d]::query::plumbing::try_execute_query::<rustc_query_impl[ea80110a39650050]::DynamicConfig<rustc_query_system[4c90f055e7d33a4d]::query::caches::VecCache<rustc_span[a0d827a73196df23]::def_id::LocalDefId, rustc_middle[6494474247fbca]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[ea80110a39650050]::plumbing::QueryCtxt, false>
  41:     0x7fe9bfb69f90 - rustc_query_impl[ea80110a39650050]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
  42:     0x7fe9bffa8a80 - rustc_hir_analysis[1b85d4eab7c4978b]::check_crate
  43:     0x7fe9bfd90d97 - rustc_interface[4be4aa47c0816fa1]::passes::analysis
  44:     0x7fe9bfd909f7 - rustc_query_impl[ea80110a39650050]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[ea80110a39650050]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[6494474247fbca]::query::erase::Erased<[u8; 1usize]>>
  45:     0x7fe9c08eb624 - rustc_query_system[4c90f055e7d33a4d]::query::plumbing::try_execute_query::<rustc_query_impl[ea80110a39650050]::DynamicConfig<rustc_query_system[4c90f055e7d33a4d]::query::caches::SingleCache<rustc_middle[6494474247fbca]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[ea80110a39650050]::plumbing::QueryCtxt, false>
  46:     0x7fe9c08eb415 - rustc_query_impl[ea80110a39650050]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  47:     0x7fe9c096800f - rustc_interface[4be4aa47c0816fa1]::interface::run_compiler::<core[3dfd8817c7ccc872]::result::Result<(), rustc_span[a0d827a73196df23]::ErrorGuaranteed>, rustc_driver_impl[b71c95451d1b6e1e]::run_compiler::{closure#1}>::{closure#0}
  48:     0x7fe9c0919b89 - std[22951113092b5ae0]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[4be4aa47c0816fa1]::util::run_in_thread_with_globals<rustc_interface[4be4aa47c0816fa1]::util::run_in_thread_pool_with_globals<rustc_interface[4be4aa47c0816fa1]::interface::run_compiler<core[3dfd8817c7ccc872]::result::Result<(), rustc_span[a0d827a73196df23]::ErrorGuaranteed>, rustc_driver_impl[b71c95451d1b6e1e]::run_compiler::{closure#1}>::{closure#0}, core[3dfd8817c7ccc872]::result::Result<(), rustc_span[a0d827a73196df23]::ErrorGuaranteed>>::{closure#0}, core[3dfd8817c7ccc872]::result::Result<(), rustc_span[a0d827a73196df23]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[3dfd8817c7ccc872]::result::Result<(), rustc_span[a0d827a73196df23]::ErrorGuaranteed>>
  49:     0x7fe9c09199b3 - <<std[22951113092b5ae0]::thread::Builder>::spawn_unchecked_<rustc_interface[4be4aa47c0816fa1]::util::run_in_thread_with_globals<rustc_interface[4be4aa47c0816fa1]::util::run_in_thread_pool_with_globals<rustc_interface[4be4aa47c0816fa1]::interface::run_compiler<core[3dfd8817c7ccc872]::result::Result<(), rustc_span[a0d827a73196df23]::ErrorGuaranteed>, rustc_driver_impl[b71c95451d1b6e1e]::run_compiler::{closure#1}>::{closure#0}, core[3dfd8817c7ccc872]::result::Result<(), rustc_span[a0d827a73196df23]::ErrorGuaranteed>>::{closure#0}, core[3dfd8817c7ccc872]::result::Result<(), rustc_span[a0d827a73196df23]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[3dfd8817c7ccc872]::result::Result<(), rustc_span[a0d827a73196df23]::ErrorGuaranteed>>::{closure#1} as core[3dfd8817c7ccc872]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  50:     0x7fe9bb998915 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h3cbdac04e5224628
                               at /rustc/61d3b263a793b390f6231f08d862e8c71d04e3ef/library/alloc/src/boxed.rs:2007:9
  51:     0x7fe9bb998915 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h2d8c79ee6cf14901
                               at /rustc/61d3b263a793b390f6231f08d862e8c71d04e3ef/library/alloc/src/boxed.rs:2007:9
  52:     0x7fe9bb998915 - std::sys::unix::thread::Thread::new::thread_start::hc684a012994dd85b
                               at /rustc/61d3b263a793b390f6231f08d862e8c71d04e3ef/library/std/src/sys/unix/thread.rs:108:17
  53:     0x7fe9bb7899eb - <unknown>
  54:     0x7fe9bb80d7cc - <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.76.0-nightly (61d3b263a 2023-11-18) running on 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
error: aborting due to previous error; 1 warning emitted


```

</p>
</details>

<!--
query stack:
#0 [typeck] type-checking `main`
#1 [analysis] running analysis passes on this crate

-->