Skip to content

ICE: Normalizing Binder .. without wrapping in a Binder #131637

Open

Description

snippet:

#![feature(non_lifetime_binders)]
trait Trait<Type> {
    type Type;

    fn method(&self) -> impl for<T> Trait<impl Trait<T>>;
}

Version information

rustc 1.83.0-nightly (ef4e8259b 2024-10-12)
binary: rustc
commit-hash: ef4e8259b5016d85e261587b605028b2ff06c13d
commit-date: 2024-10-12
host: x86_64-unknown-linux-gnu
release: 1.83.0-nightly
LLVM version: 19.1.1

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zcrate-attr=feature(non_lifetime_binders)

Program output

error[E0666]: nested `impl Trait` is not allowed
 --> /tmp/icemaker_global_tempdir.FSJ0vzRiWJPZ/rustc_testrunner_tmpdir_reporting.H5iY5qnka74L/mvce.rs:4:43
  |
4 |     fn method(&self) -> impl for<T> Trait<impl Trait<T>>;
  |                         ------------------^^^^^^^^^^^^^-
  |                         |                 |
  |                         |                 nested `impl Trait` here
  |                         outer `impl Trait`

warning: the feature `non_lifetime_binders` is incomplete and may not be safe to use and/or cause compiler crashes
 --> <crate attribute>:1:9
  |
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[E0601]: `main` function not found in crate `mvce`
 --> /tmp/icemaker_global_tempdir.FSJ0vzRiWJPZ/rustc_testrunner_tmpdir_reporting.H5iY5qnka74L/mvce.rs:5:2
  |
5 | }
  |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.FSJ0vzRiWJPZ/rustc_testrunner_tmpdir_reporting.H5iY5qnka74L/mvce.rs`

thread 'rustc' panicked at /rustc/ef4e8259b5016d85e261587b605028b2ff06c13d/compiler/rustc_trait_selection/src/traits/normalize.rs:152:9:
Normalizing Binder { value: TraitPredicate(<impl Trait<T> as Trait<T>>, polarity:Positive), bound_vars: [] } without wrapping in a `Binder`
stack backtrace:
   0:     0x71709b5d1a1a - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hb71c2cbac72cdb5b
   1:     0x71709be034a6 - core::fmt::write::heb09cf10dd28415d
   2:     0x71709d01d551 - std::io::Write::write_fmt::he7930bf346a8968a
   3:     0x71709b5d1872 - std::sys::backtrace::BacktraceLock::print::h0a899fd0a1901c8e
   4:     0x71709b5d3d46 - std::panicking::default_hook::{{closure}}::h18bcfec0b7bcc716
   5:     0x71709b5d3b90 - std::panicking::default_hook::h55fad4ebc08cd150
   6:     0x71709a628e7f - std[2d7f46ec46e78cda]::panicking::update_hook::<alloc[e7629bc0fb789452]::boxed::Box<rustc_driver_impl[3fef95598012341d]::install_ice_hook::{closure#0}>>::{closure#0}
   7:     0x71709b5d4458 - std::panicking::rust_panic_with_hook::h1948796bede27b1d
   8:     0x71709b5d422a - std::panicking::begin_panic_handler::{{closure}}::h0990fea1223f6893
   9:     0x71709b5d1ec9 - std::sys::backtrace::__rust_end_short_backtrace::hf37c728b4c065dea
  10:     0x71709b5d3eec - rust_begin_unwind
  11:     0x7170982ec730 - core::panicking::panic_fmt::h44a7f0c2b4452277
  12:     0x71709cd02233 - rustc_trait_selection[8ec19655a831e168]::traits::normalize::normalize_with_depth_to::<rustc_middle[36f32f9ecfcbfe2]::ty::predicate::Clause>::{closure#0}
  13:     0x71709cd01ca4 - <rustc_trait_selection[8ec19655a831e168]::traits::engine::ObligationCtxt<rustc_trait_selection[8ec19655a831e168]::traits::FulfillmentError>>::normalize::<rustc_middle[36f32f9ecfcbfe2]::ty::predicate::Clause>
  14:     0x71709cd01aad - <rustc_hir_analysis[32b0d2be82dc9eb]::check::wfcheck::WfCheckingCtxt>::normalize::<rustc_middle[36f32f9ecfcbfe2]::ty::predicate::Clause>
  15:     0x71709c5e6103 - rustc_hir_analysis[32b0d2be82dc9eb]::check::wfcheck::check_associated_item
  16:     0x71709977e4a6 - rustc_hir_analysis[32b0d2be82dc9eb]::check::wfcheck::check_well_formed
  17:     0x71709c8428fd - rustc_query_impl[2ff63d9f917ec697]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[2ff63d9f917ec697]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[36f32f9ecfcbfe2]::query::erase::Erased<[u8; 1usize]>>
  18:     0x71709c84205f - rustc_query_system[82bc41041ee47c07]::query::plumbing::try_execute_query::<rustc_query_impl[2ff63d9f917ec697]::DynamicConfig<rustc_query_system[82bc41041ee47c07]::query::caches::VecCache<rustc_span[3e9061d2e044f211]::def_id::LocalDefId, rustc_middle[36f32f9ecfcbfe2]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[2ff63d9f917ec697]::plumbing::QueryCtxt, false>
  19:     0x71709c841cd0 - rustc_query_impl[2ff63d9f917ec697]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  20:     0x71709c84297d - rustc_middle[36f32f9ecfcbfe2]::query::plumbing::query_ensure_error_guaranteed::<rustc_query_system[82bc41041ee47c07]::query::caches::VecCache<rustc_span[3e9061d2e044f211]::def_id::LocalDefId, rustc_middle[36f32f9ecfcbfe2]::query::erase::Erased<[u8; 1usize]>>, ()>
  21:     0x71709c842edc - rustc_hir_analysis[32b0d2be82dc9eb]::check::wfcheck::check_mod_type_wf
  22:     0x71709c8429a5 - rustc_query_impl[2ff63d9f917ec697]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[2ff63d9f917ec697]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[36f32f9ecfcbfe2]::query::erase::Erased<[u8; 1usize]>>
  23:     0x71709c83c27b - rustc_query_system[82bc41041ee47c07]::query::plumbing::try_execute_query::<rustc_query_impl[2ff63d9f917ec697]::DynamicConfig<rustc_query_system[82bc41041ee47c07]::query::caches::DefaultCache<rustc_span[3e9061d2e044f211]::def_id::LocalModDefId, rustc_middle[36f32f9ecfcbfe2]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[2ff63d9f917ec697]::plumbing::QueryCtxt, false>
  24:     0x71709c83c02d - rustc_query_impl[2ff63d9f917ec697]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
  25:     0x71709c26da3b - rustc_hir_analysis[32b0d2be82dc9eb]::check_crate
  26:     0x71709c26a797 - rustc_interface[2b62aadc68a12e2c]::passes::run_required_analyses
  27:     0x71709cc8c39e - rustc_interface[2b62aadc68a12e2c]::passes::analysis
  28:     0x71709cc8c371 - rustc_query_impl[2ff63d9f917ec697]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[2ff63d9f917ec697]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[36f32f9ecfcbfe2]::query::erase::Erased<[u8; 1usize]>>
  29:     0x71709ccca16e - rustc_query_system[82bc41041ee47c07]::query::plumbing::try_execute_query::<rustc_query_impl[2ff63d9f917ec697]::DynamicConfig<rustc_query_system[82bc41041ee47c07]::query::caches::SingleCache<rustc_middle[36f32f9ecfcbfe2]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[2ff63d9f917ec697]::plumbing::QueryCtxt, false>
  30:     0x71709ccc9e4f - rustc_query_impl[2ff63d9f917ec697]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  31:     0x71709cb32c1b - rustc_interface[2b62aadc68a12e2c]::interface::run_compiler::<core[5b4c807c5a0efff6]::result::Result<(), rustc_span[3e9061d2e044f211]::ErrorGuaranteed>, rustc_driver_impl[3fef95598012341d]::run_compiler::{closure#0}>::{closure#1}
  32:     0x71709cc02f14 - std[2d7f46ec46e78cda]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[2b62aadc68a12e2c]::util::run_in_thread_with_globals<rustc_interface[2b62aadc68a12e2c]::util::run_in_thread_pool_with_globals<rustc_interface[2b62aadc68a12e2c]::interface::run_compiler<core[5b4c807c5a0efff6]::result::Result<(), rustc_span[3e9061d2e044f211]::ErrorGuaranteed>, rustc_driver_impl[3fef95598012341d]::run_compiler::{closure#0}>::{closure#1}, core[5b4c807c5a0efff6]::result::Result<(), rustc_span[3e9061d2e044f211]::ErrorGuaranteed>>::{closure#0}, core[5b4c807c5a0efff6]::result::Result<(), rustc_span[3e9061d2e044f211]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[5b4c807c5a0efff6]::result::Result<(), rustc_span[3e9061d2e044f211]::ErrorGuaranteed>>
  33:     0x71709cc03328 - <<std[2d7f46ec46e78cda]::thread::Builder>::spawn_unchecked_<rustc_interface[2b62aadc68a12e2c]::util::run_in_thread_with_globals<rustc_interface[2b62aadc68a12e2c]::util::run_in_thread_pool_with_globals<rustc_interface[2b62aadc68a12e2c]::interface::run_compiler<core[5b4c807c5a0efff6]::result::Result<(), rustc_span[3e9061d2e044f211]::ErrorGuaranteed>, rustc_driver_impl[3fef95598012341d]::run_compiler::{closure#0}>::{closure#1}, core[5b4c807c5a0efff6]::result::Result<(), rustc_span[3e9061d2e044f211]::ErrorGuaranteed>>::{closure#0}, core[5b4c807c5a0efff6]::result::Result<(), rustc_span[3e9061d2e044f211]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[5b4c807c5a0efff6]::result::Result<(), rustc_span[3e9061d2e044f211]::ErrorGuaranteed>>::{closure#1} as core[5b4c807c5a0efff6]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  34:     0x71709cc03deb - std::sys::pal::unix::thread::Thread::new::thread_start::h67d76ed3602b4ec2
  35:     0x71709e3f339d - <unknown>
  36:     0x71709e47849c - <unknown>
  37:                0x0 - <unknown>

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: please make sure that you have updated to the latest nightly

note: rustc 1.83.0-nightly (ef4e8259b 2024-10-12) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z crate-attr=feature(non_lifetime_binders) -Z dump-mir-dir=dir

query stack during panic:
#0 [check_well_formed] checking that `Trait::method` is well-formed
#1 [check_mod_type_wf] checking that types are well-formed in top-level module
end of query stack
error: aborting due to 2 previous errors; 1 warning emitted

Some errors have detailed explanations: E0601, E0666.
For more information about an error, try `rustc --explain E0601`.

@rustbot label +F-non_lifetime_binders

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions