Skip to content

ice: Normalizing Alias(Weak, .. without wrapping it in a Binder #119209

Closed
@matthiaskrgr

Description

@matthiaskrgr
Member

auto-reduced (treereduce-rust):

type Foo<'a, 'b> = (i32, impl PartialEq);

fn main<'a, 'main>(i: &'a i32) -> Foo<'a, 'b> {}

original:

#![feature(type_alias_impl_trait)]

type Bar<'b, 'b> = impl PartialEq<Bar<'b, 'b>> + std::fmt::Debug;

fn bar<'a, 'b>(i: &'muh i32) -> PartialEq<Foo<'a, 'b>> {
    //~^ ERROR can't compare `&i32` with `Bar<'b, 'a>`
    i
}

type Foo<'a, 'b> = (i32, impl PartialEq<Moo<'b, 'a>> + std::fmt::Debug);

fn main<'a, 'main>(i: &'a i32) -> Foo<'a, 'b> {
    let meh = 42;
    let muh = 69;
    assert_eq!(bar(&meh), bar(&meh));
}

type Moo<'a, 'b> = (i32, impl PartialEq<Moo<'b, 'a>> + std::fmt::Debug);

fn moo<'a, 'a>(i: &'a i32) -> Moo<'a, 'a> {
    //~^ ERROR can't compare `&i32` with `(i32, Moo<'b, 'a>::{opaque#0})`
    (42, i)
}

fn main() {
    let muh = 69;
    let muh = 69;
    assert_eq!(bar(&meh), bar(&meh));
}

Version information

rustc 1.77.0-nightly (767453eb7 2023-12-21)
binary: rustc
commit-hash: 767453eb7ca188e991ac5568c17b984dd4893e77
commit-date: 2023-12-21
host: x86_64-unknown-linux-gnu
release: 1.77.0-nightly
LLVM version: 17.0.6

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

error[E0261]: use of undeclared lifetime name `'b`
 --> /tmp/icemaker_global_tempdir.B42R90mmNE5j/rustc_testrunner_tmpdir_reporting.YzkVDJKC7PfJ/mvce.rs:3:43
  |
3 | fn main<'a, 'main>(i: &'a i32) -> Foo<'a, 'b> {}
  |         -                                 ^^ undeclared lifetime
  |         |
  |         help: consider introducing lifetime `'b` here: `'b,`

error[E0658]: `impl Trait` in type aliases is unstable
 --> /tmp/icemaker_global_tempdir.B42R90mmNE5j/rustc_testrunner_tmpdir_reporting.YzkVDJKC7PfJ/mvce.rs:1:26
  |
1 | type Foo<'a, 'b> = (i32, impl PartialEq);
  |                          ^^^^^^^^^^^^^^
  |
  = note: see issue #63063 <https://github.com/rust-lang/rust/issues/63063> for more information
  = help: add `#![feature(type_alias_impl_trait)]` to the crate attributes to enable

error[E0308]: mismatched types
 --> /tmp/icemaker_global_tempdir.B42R90mmNE5j/rustc_testrunner_tmpdir_reporting.YzkVDJKC7PfJ/mvce.rs:3:35
  |
3 | fn main<'a, 'main>(i: &'a i32) -> Foo<'a, 'b> {}
  |    ----                           ^^^^^^^^^^^ expected `(i32, _)`, found `()`
  |    |
  |    implicitly returns `()` as its body has no tail or `return` expression
  |
  = note:  expected tuple `(i32, _)`
          found unit type `()`

thread 'rustc' panicked at /rustc/767453eb7ca188e991ac5568c17b984dd4893e77/compiler/rustc_trait_selection/src/traits/project.rs:486:9:
Normalizing Alias(Weak, AliasTy { args: [ReBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed(DefId(0:7 ~ mvce[4ba3]::main::'a), 'a) }), ReError], def_id: DefId(0:3 ~ mvce[4ba3]::Foo) }) without wrapping in a `Binder`
stack backtrace:
   0:     0x7f1eaf38b6f6 - std::backtrace_rs::backtrace::libunwind::trace::hcd45df0585a5632e
                               at /rustc/767453eb7ca188e991ac5568c17b984dd4893e77/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7f1eaf38b6f6 - std::backtrace_rs::backtrace::trace_unsynchronized::h195da99cf8e2fd54
                               at /rustc/767453eb7ca188e991ac5568c17b984dd4893e77/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f1eaf38b6f6 - std::sys_common::backtrace::_print_fmt::h262e79324a83e225
                               at /rustc/767453eb7ca188e991ac5568c17b984dd4893e77/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7f1eaf38b6f6 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h3898f35ef0ca54d5
                               at /rustc/767453eb7ca188e991ac5568c17b984dd4893e77/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f1eaf3ddf40 - core::fmt::rt::Argument::fmt::h8d1b33c649461322
                               at /rustc/767453eb7ca188e991ac5568c17b984dd4893e77/library/core/src/fmt/rt.rs:142:9
   5:     0x7f1eaf3ddf40 - core::fmt::write::ha50192d3a32248da
                               at /rustc/767453eb7ca188e991ac5568c17b984dd4893e77/library/core/src/fmt/mod.rs:1120:17
   6:     0x7f1eaf37f53f - std::io::Write::write_fmt::h8abf221f3aa8e5cd
                               at /rustc/767453eb7ca188e991ac5568c17b984dd4893e77/library/std/src/io/mod.rs:1810:15
   7:     0x7f1eaf38b4d4 - std::sys_common::backtrace::_print::haf5efe20c2739270
                               at /rustc/767453eb7ca188e991ac5568c17b984dd4893e77/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f1eaf38b4d4 - std::sys_common::backtrace::print::h0a4325d21f82186c
                               at /rustc/767453eb7ca188e991ac5568c17b984dd4893e77/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f1eaf38e267 - std::panicking::default_hook::{{closure}}::h0dd1d67390b9ca78
  10:     0x7f1eaf38dfc9 - std::panicking::default_hook::h695297bcdcf25d64
                               at /rustc/767453eb7ca188e991ac5568c17b984dd4893e77/library/std/src/panicking.rs:292:9
  11:     0x7f1eb21a1e7b - std[3d4a347d4b60aa5c]::panicking::update_hook::<alloc[ff74c2bc34e84412]::boxed::Box<rustc_driver_impl[825d30c548056d90]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f1eaf38e9b6 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h71dc5e7c88edc0fd
                               at /rustc/767453eb7ca188e991ac5568c17b984dd4893e77/library/alloc/src/boxed.rs:2029:9
  13:     0x7f1eaf38e9b6 - std::panicking::rust_panic_with_hook::hae536ee97f103a54
                               at /rustc/767453eb7ca188e991ac5568c17b984dd4893e77/library/std/src/panicking.rs:783:13
  14:     0x7f1eaf38e702 - std::panicking::begin_panic_handler::{{closure}}::h2788c2493b3e7f9e
                               at /rustc/767453eb7ca188e991ac5568c17b984dd4893e77/library/std/src/panicking.rs:657:13
  15:     0x7f1eaf38bbf6 - std::sys_common::backtrace::__rust_end_short_backtrace::hfc5e328ccb4034f4
                               at /rustc/767453eb7ca188e991ac5568c17b984dd4893e77/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x7f1eaf38e460 - rust_begin_unwind
                               at /rustc/767453eb7ca188e991ac5568c17b984dd4893e77/library/std/src/panicking.rs:645:5
  17:     0x7f1eaf3da645 - core::panicking::panic_fmt::h3e853967d7f83fbf
                               at /rustc/767453eb7ca188e991ac5568c17b984dd4893e77/library/core/src/panicking.rs:72:14
  18:     0x7f1eb3870e39 - <rustc_trait_selection[9cf4c997531174d8]::traits::engine::ObligationCtxt>::normalize::<rustc_middle[d7fe0914d11d0412]::ty::Ty>
  19:     0x7f1eb40b4d85 - rustc_hir_analysis[4c9d02161d6f28f2]::check::check::check_mod_item_types
  20:     0x7f1eb40b3447 - rustc_query_impl[4ab443e5c52f63d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[4ab443e5c52f63d]::query_impl::check_mod_item_types::dynamic_query::{closure#2}::{closure#0}, rustc_middle[d7fe0914d11d0412]::query::erase::Erased<[u8; 0usize]>>
  21:     0x7f1eb40bc6fb - rustc_query_system[1af031bf8266f50f]::query::plumbing::try_execute_query::<rustc_query_impl[4ab443e5c52f63d]::DynamicConfig<rustc_query_system[1af031bf8266f50f]::query::caches::DefaultCache<rustc_span[fa10d2db69bc2c22]::def_id::LocalModDefId, rustc_middle[d7fe0914d11d0412]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[4ab443e5c52f63d]::plumbing::QueryCtxt, false>
  22:     0x7f1eb40bc0d7 - rustc_query_impl[4ab443e5c52f63d]::query_impl::check_mod_item_types::get_query_non_incr::__rust_end_short_backtrace
  23:     0x7f1eb3d43593 - rustc_hir_analysis[4c9d02161d6f28f2]::check_crate
  24:     0x7f1eb3abc2e0 - rustc_interface[f8b5fde174ad67]::passes::analysis
  25:     0x7f1eb3abbf1d - rustc_query_impl[4ab443e5c52f63d]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[4ab443e5c52f63d]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[d7fe0914d11d0412]::query::erase::Erased<[u8; 1usize]>>
  26:     0x7f1eb43c5032 - rustc_query_system[1af031bf8266f50f]::query::plumbing::try_execute_query::<rustc_query_impl[4ab443e5c52f63d]::DynamicConfig<rustc_query_system[1af031bf8266f50f]::query::caches::SingleCache<rustc_middle[d7fe0914d11d0412]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[4ab443e5c52f63d]::plumbing::QueryCtxt, false>
  27:     0x7f1eb43c4e39 - rustc_query_impl[4ab443e5c52f63d]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  28:     0x7f1eb444fc52 - rustc_interface[f8b5fde174ad67]::interface::run_compiler::<core[3d376420add8b96f]::result::Result<(), rustc_span[fa10d2db69bc2c22]::ErrorGuaranteed>, rustc_driver_impl[825d30c548056d90]::run_compiler::{closure#0}>::{closure#0}
  29:     0x7f1eb43e2086 - std[3d4a347d4b60aa5c]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[f8b5fde174ad67]::util::run_in_thread_with_globals<rustc_interface[f8b5fde174ad67]::util::run_in_thread_pool_with_globals<rustc_interface[f8b5fde174ad67]::interface::run_compiler<core[3d376420add8b96f]::result::Result<(), rustc_span[fa10d2db69bc2c22]::ErrorGuaranteed>, rustc_driver_impl[825d30c548056d90]::run_compiler::{closure#0}>::{closure#0}, core[3d376420add8b96f]::result::Result<(), rustc_span[fa10d2db69bc2c22]::ErrorGuaranteed>>::{closure#0}, core[3d376420add8b96f]::result::Result<(), rustc_span[fa10d2db69bc2c22]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[3d376420add8b96f]::result::Result<(), rustc_span[fa10d2db69bc2c22]::ErrorGuaranteed>>
  30:     0x7f1eb43e1eb3 - <<std[3d4a347d4b60aa5c]::thread::Builder>::spawn_unchecked_<rustc_interface[f8b5fde174ad67]::util::run_in_thread_with_globals<rustc_interface[f8b5fde174ad67]::util::run_in_thread_pool_with_globals<rustc_interface[f8b5fde174ad67]::interface::run_compiler<core[3d376420add8b96f]::result::Result<(), rustc_span[fa10d2db69bc2c22]::ErrorGuaranteed>, rustc_driver_impl[825d30c548056d90]::run_compiler::{closure#0}>::{closure#0}, core[3d376420add8b96f]::result::Result<(), rustc_span[fa10d2db69bc2c22]::ErrorGuaranteed>>::{closure#0}, core[3d376420add8b96f]::result::Result<(), rustc_span[fa10d2db69bc2c22]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[3d376420add8b96f]::result::Result<(), rustc_span[fa10d2db69bc2c22]::ErrorGuaranteed>>::{closure#1} as core[3d376420add8b96f]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  31:     0x7f1eaf3988e5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h08e9f3a633db8c74
                               at /rustc/767453eb7ca188e991ac5568c17b984dd4893e77/library/alloc/src/boxed.rs:2015:9
  32:     0x7f1eaf3988e5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h852c72dc884e3d23
                               at /rustc/767453eb7ca188e991ac5568c17b984dd4893e77/library/alloc/src/boxed.rs:2015:9
  33:     0x7f1eaf3988e5 - std::sys::unix::thread::Thread::new::thread_start::h43781093432e8beb
                               at /rustc/767453eb7ca188e991ac5568c17b984dd4893e77/library/std/src/sys/unix/thread.rs:108:17
  34:     0x7f1eaf1849eb - <unknown>
  35:     0x7f1eaf2087cc - <unknown>
  36:                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: rustc 1.77.0-nightly (767453eb7 2023-12-21) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [check_mod_item_types] checking item types in top-level module
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 3 previous errors

Some errors have detailed explanations: E0261, E0308, E0658.
For more information about an error, try `rustc --explain E0261`.

Activity

added
I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
C-bugCategory: This is a bug.
on Dec 22, 2023
added
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Dec 22, 2023
matthiaskrgr

matthiaskrgr commented on Dec 22, 2023

@matthiaskrgr
MemberAuthor

Regression in #119047 ping @mu001999

added a commit that references this issue on Dec 22, 2023

Rollup merge of rust-lang#119215 - mu001999:fix/119209, r=Nilstrieb

b24e878
added a commit that references this issue on Dec 22, 2023
af7242c
removed
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Dec 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️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

      Participants

      @matthiaskrgr@saethlin@rustbot

      Issue actions

        ice: `Normalizing Alias(Weak, .. without wrapping it in a Binder` · Issue #119209 · rust-lang/rust