rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
97.98k stars 12.68k forks source link

ICE: panicked at Normalizing binder without wrapping in a Binder #111417

Closed matthiaskrgr closed 1 year ago

matthiaskrgr commented 1 year ago

Code

#![feature(generic_const_exprs)]

trait MyTrait<T> {}

fn bug<'a, T>() -> &'static dyn MyTrait<[(); { |x: &'a u32| { x }; 4 }]> {
    todo!()
}

Meta

rustc --version --verbose:

rustc 1.71.0-nightly (2f6bc5d25 2023-05-09)
binary: rustc
commit-hash: 2f6bc5d259e7ab25ddfdd33de53b892770218918
commit-date: 2023-05-09
host: x86_64-unknown-linux-gnu
release: 1.71.0-nightly
LLVM version: 16.0.2

Error output

<output>
Backtrace

``` thread 'rustc' panicked at 'Normalizing Binder(([&'a u32]; c_variadic: false)->_, []) without wrapping in a `Binder`', /rustc/2f6bc5d259e7ab25ddfdd33de53b892770218918/compiler/rustc_trait_selection/src/traits/project.rs:442:9 stack backtrace: 0: 0x7f936636a481 - std::backtrace_rs::backtrace::libunwind::trace::h28494931c73179b2 at /rustc/2f6bc5d259e7ab25ddfdd33de53b892770218918/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5 1: 0x7f936636a481 - std::backtrace_rs::backtrace::trace_unsynchronized::h9032c52edccf7bd1 at /rustc/2f6bc5d259e7ab25ddfdd33de53b892770218918/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x7f936636a481 - std::sys_common::backtrace::_print_fmt::hd90562e967f4e4e1 at /rustc/2f6bc5d259e7ab25ddfdd33de53b892770218918/library/std/src/sys_common/backtrace.rs:65:5 3: 0x7f936636a481 - ::fmt::h113657117676131e at /rustc/2f6bc5d259e7ab25ddfdd33de53b892770218918/library/std/src/sys_common/backtrace.rs:44:22 4: 0x7f93663ca84f - core::fmt::rt::Argument::fmt::hd56cdfa11c364505 at /rustc/2f6bc5d259e7ab25ddfdd33de53b892770218918/library/core/src/fmt/rt.rs:138:9 5: 0x7f93663ca84f - core::fmt::write::h24c20284e5d6be9e at /rustc/2f6bc5d259e7ab25ddfdd33de53b892770218918/library/core/src/fmt/mod.rs:1094:21 6: 0x7f936635d6e1 - std::io::Write::write_fmt::hbf02c94f0e7342d1 at /rustc/2f6bc5d259e7ab25ddfdd33de53b892770218918/library/std/src/io/mod.rs:1712:15 7: 0x7f936636a295 - std::sys_common::backtrace::_print::he85212e2c716c859 at /rustc/2f6bc5d259e7ab25ddfdd33de53b892770218918/library/std/src/sys_common/backtrace.rs:47:5 8: 0x7f936636a295 - std::sys_common::backtrace::print::h888aaf3ad10f084e at /rustc/2f6bc5d259e7ab25ddfdd33de53b892770218918/library/std/src/sys_common/backtrace.rs:34:9 9: 0x7f936636cf17 - std::panicking::default_hook::{{closure}}::hba0edb58dc223add 10: 0x7f936636cd04 - std::panicking::default_hook::h1555b8bada2010d7 at /rustc/2f6bc5d259e7ab25ddfdd33de53b892770218918/library/std/src/panicking.rs:288:9 11: 0x7f93695d593b - >::call_once::{shim:vtable#0} 12: 0x7f936636d637 - as core::ops::function::Fn>::call::h07438796673f3d04 at /rustc/2f6bc5d259e7ab25ddfdd33de53b892770218918/library/alloc/src/boxed.rs:1999:9 13: 0x7f936636d637 - std::panicking::rust_panic_with_hook::h72a06453beb2cbcb at /rustc/2f6bc5d259e7ab25ddfdd33de53b892770218918/library/std/src/panicking.rs:695:13 14: 0x7f936636d3b7 - std::panicking::begin_panic_handler::{{closure}}::h0281d6cc05cfd2a4 at /rustc/2f6bc5d259e7ab25ddfdd33de53b892770218918/library/std/src/panicking.rs:582:13 15: 0x7f936636a8c6 - std::sys_common::backtrace::__rust_end_short_backtrace::h1c79565770be27d9 at /rustc/2f6bc5d259e7ab25ddfdd33de53b892770218918/library/std/src/sys_common/backtrace.rs:150:18 16: 0x7f936636d122 - rust_begin_unwind at /rustc/2f6bc5d259e7ab25ddfdd33de53b892770218918/library/std/src/panicking.rs:578:5 17: 0x7f93663c6ad3 - core::panicking::panic_fmt::he6a2fe7a1b635de3 at /rustc/2f6bc5d259e7ab25ddfdd33de53b892770218918/library/core/src/panicking.rs:67:14 18: 0x7f9367b908e1 - ::fold::> 19: 0x7f9367b903c7 - rustc_trait_selection[430f5fa6108926ed]::traits::project::normalize_with_depth::> 20: 0x7f9367b8f9bc - ::normalize::> 21: 0x7f9367b8f891 - ::normalize::> 22: 0x7f9367b8f0e0 - ::supplied_sig_of_closure 23: 0x7f9367b8a370 - ::check_expr_closure 24: 0x7f9367b026fc - ::check_expr_with_expectation_and_args 25: 0x7f9367b474e0 - ::check_block_with_expected 26: 0x7f9367afee09 - ::check_expr_with_expectation_and_args 27: 0x7f9367b0cd70 - ::check_expr_coercible_to_type 28: 0x7f9367c1142c - rustc_hir_typeck[7fb44c8b93f9310b]::typeck 29: 0x7f9367c06d32 - rustc_query_system[ffc3e6874545e2cc]::query::plumbing::try_execute_query:: 30: 0x7f9367c069c5 - rustc_query_impl[677774657eb92e7b]::get_query::typeck 31: 0x7f9367f45e8b - rustc_mir_build[9b43786a7326c032]::thir::cx::thir_body 32: 0x7f9367f43fcc - rustc_query_system[ffc3e6874545e2cc]::query::plumbing::try_execute_query:: 33: 0x7f9367f43c65 - rustc_query_impl[677774657eb92e7b]::get_query::thir_body 34: 0x7f93686598b6 - rustc_query_system[ffc3e6874545e2cc]::query::plumbing::try_execute_query:: 35: 0x7f936865846a - rustc_query_impl[677774657eb92e7b]::get_query::thir_abstract_const 36: 0x7f9368a5f212 - rustc_middle[8c6563ccb890ccc7]::ty::query::query_get_at::>> 37: 0x7f9367662a38 - <::expand_abstract_consts::Expander as rustc_type_ir[a2a3eb09eb372e2d]::fold::TypeFolder>::fold_const 38: 0x7f9367829887 - rustc_trait_selection[430f5fa6108926ed]::traits::const_evaluatable::is_const_evaluatable 39: 0x7f93677bc0d2 - ::process_obligation 40: 0x7f93677b17c4 - >::process_obligations:: 41: 0x7f936793f62b - ::select_all_or_error 42: 0x7f93680e11c7 - rustc_hir_analysis[22ad3c510546d4fc]::check::wfcheck::check_item_fn 43: 0x7f93680dd6ea - rustc_hir_analysis[22ad3c510546d4fc]::check::wfcheck::check_well_formed 44: 0x7f9367970403 - rustc_query_system[ffc3e6874545e2cc]::query::plumbing::try_execute_query:: 45: 0x7f93689b15e7 - rustc_data_structures[78003e5995acb4f0]::sync::par_for_each_in::<&[rustc_hir[98be715f7d0986d7]::hir::ItemId], ::par_items::{closure#0}> 46: 0x7f93689b11fa - rustc_hir_analysis[22ad3c510546d4fc]::check::wfcheck::check_mod_type_wf 47: 0x7f9368c33dc1 - rustc_query_system[ffc3e6874545e2cc]::query::plumbing::try_execute_query:: 48: 0x7f9368c33a01 - rustc_query_impl[677774657eb92e7b]::get_query::check_mod_type_wf 49: 0x7f9368a03b97 - rustc_data_structures[78003e5995acb4f0]::sync::par_for_each_in::<&[rustc_hir[98be715f7d0986d7]::hir_id::OwnerId], ::par_for_each_module::{closure#0}> 50: 0x7f9368a00b17 - rustc_hir_analysis[22ad3c510546d4fc]::check_crate 51: 0x7f93689f43c0 - rustc_interface[e0c448f9df8a7367]::passes::analysis 52: 0x7f9368d421f7 - rustc_query_system[ffc3e6874545e2cc]::query::plumbing::try_execute_query:: 53: 0x7f9368d41f13 - rustc_query_impl[677774657eb92e7b]::get_query::analysis 54: 0x7f93687c4d8f - ::enter::> 55: 0x7f93687c3e6f - ::enter::, rustc_span[f344ead202b2f728]::ErrorGuaranteed>> 56: 0x7f93687c150b - std[9a33fd118bee7e76]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver_impl[c1e8e7e9cc0f0224]::run_compiler::{closure#1}>::{closure#0}, core[75e04f0db769f8d6]::result::Result<(), rustc_span[f344ead202b2f728]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[75e04f0db769f8d6]::result::Result<(), rustc_span[f344ead202b2f728]::ErrorGuaranteed>> 57: 0x7f9368eab7c5 - <::spawn_unchecked_, rustc_driver_impl[c1e8e7e9cc0f0224]::run_compiler::{closure#1}>::{closure#0}, core[75e04f0db769f8d6]::result::Result<(), rustc_span[f344ead202b2f728]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[75e04f0db769f8d6]::result::Result<(), rustc_span[f344ead202b2f728]::ErrorGuaranteed>>::{closure#1} as core[75e04f0db769f8d6]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 58: 0x7f9366377ae5 - as core::ops::function::FnOnce>::call_once::h71c821b130855373 at /rustc/2f6bc5d259e7ab25ddfdd33de53b892770218918/library/alloc/src/boxed.rs:1985:9 59: 0x7f9366377ae5 - as core::ops::function::FnOnce>::call_once::h1701cec9acb1061c at /rustc/2f6bc5d259e7ab25ddfdd33de53b892770218918/library/alloc/src/boxed.rs:1985:9 60: 0x7f9366377ae5 - std::sys::unix::thread::Thread::new::thread_start::h6dd5ef62dde103f1 at /rustc/2f6bc5d259e7ab25ddfdd33de53b892770218918/library/std/src/sys/unix/thread.rs:108:17 61: 0x7f9366114bb5 - 62: 0x7f9366196d90 - 63: 0x0 - error: the compiler unexpectedly panicked. this is a bug. 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 (2f6bc5d25 2023-05-09) running on x86_64-unknown-linux-gnu query stack during panic: #0 [typeck] type-checking `bug::{constant#0}` #1 [thir_body] building THIR for `bug::{constant#0}` #2 [thir_abstract_const] building an abstract representation for `bug::{constant#0}` #3 [check_well_formed] checking that `bug` is well-formed #4 [check_mod_type_wf] checking that types are well-formed in top-level module #5 [analysis] running analysis passes on this crate end of query stack error: aborting due to previous error; 1 warning emitted For more information about this error, try `rustc --explain E0601`. ```

BoxyUwU commented 1 year ago

dupe of #77357