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

ICE: inference variables in normalized parameter environment: unconstrained type #120033

Open
matthiaskrgr opened this issue Jan 16, 2024 · 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) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

snippet:

#![feature(non_lifetime_binders)]

pub trait Foo<T: ?Sized> {
    type Bar<K: ?Sized>;
}

pub struct Bar<T: ?AutoTrait> {}

pub fn f<T1, T2>()
where
    T1: for<T> Foo<usize, Bar = Bar<T>>,
    T2: for<L, T> Foo<usize, Bar<T> = T1::Bar<T>>,
{
}

Version information

rustc 1.77.0-nightly (e64f8495e 2024-01-16)
binary: rustc
commit-hash: e64f8495e73fbc3653b4bcb73268c58b9c4a0a0d
commit-date: 2024-01-16
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[E0405]: cannot find trait `AutoTrait` in this scope
 --> /tmp/icemaker_global_tempdir.sRdilPN7rXO6/rustc_testrunner_tmpdir_reporting.ngEGvTdeSLNZ/mvce.rs:7:20
  |
7 | pub struct Bar<T: ?AutoTrait> {}
  |                    ^^^^^^^^^ not found in this scope

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

warning: relaxing a default bound only does something for `?Sized`; all other traits are not bound by default
 --> /tmp/icemaker_global_tempdir.sRdilPN7rXO6/rustc_testrunner_tmpdir_reporting.ngEGvTdeSLNZ/mvce.rs:7:19
  |
7 | pub struct Bar<T: ?AutoTrait> {}
  |                   ^^^^^^^^^^

error[E0107]: missing generics for associated type `Foo::Bar`
  --> /tmp/icemaker_global_tempdir.sRdilPN7rXO6/rustc_testrunner_tmpdir_reporting.ngEGvTdeSLNZ/mvce.rs:11:27
   |
11 |     T1: for<T> Foo<usize, Bar = Bar<T>>,
   |                           ^^^ expected 1 generic argument
   |
note: associated type defined here, with 1 generic parameter: `K`
  --> /tmp/icemaker_global_tempdir.sRdilPN7rXO6/rustc_testrunner_tmpdir_reporting.ngEGvTdeSLNZ/mvce.rs:4:10
   |
4  |     type Bar<K: ?Sized>;
   |          ^^^ -
help: add missing generic argument
   |
11 |     T1: for<T> Foo<usize, Bar<K> = Bar<T>>,
   |                              +++

error[E0392]: parameter `T` is never used
 --> /tmp/icemaker_global_tempdir.sRdilPN7rXO6/rustc_testrunner_tmpdir_reporting.ngEGvTdeSLNZ/mvce.rs:7:16
  |
7 | pub struct Bar<T: ?AutoTrait> {}
  |                ^ unused parameter
  |
  = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`

error: internal compiler error: compiler/rustc_trait_selection/src/traits/mod.rs:236:13: inference variables in normalized parameter environment: unconstrained type
  --> /tmp/icemaker_global_tempdir.sRdilPN7rXO6/rustc_testrunner_tmpdir_reporting.ngEGvTdeSLNZ/mvce.rs:9:1
   |
9  | / pub fn f<T1, T2>()
10 | | where
11 | |     T1: for<T> Foo<usize, Bar = Bar<T>>,
12 | |     T2: for<L, T> Foo<usize, Bar<T> = T1::Bar<T>>,
   | |__________________________________________________^

thread 'rustc' panicked at /rustc/e64f8495e73fbc3653b4bcb73268c58b9c4a0a0d/compiler/rustc_errors/src/lib.rs:854:41:
Box<dyn Any>
stack backtrace:
   0:     0x7f0cd5817806 - std::backtrace_rs::backtrace::libunwind::trace::h4b22376ba0492652
                               at /rustc/e64f8495e73fbc3653b4bcb73268c58b9c4a0a0d/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7f0cd5817806 - std::backtrace_rs::backtrace::trace_unsynchronized::h0e3835b8afb2038f
                               at /rustc/e64f8495e73fbc3653b4bcb73268c58b9c4a0a0d/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f0cd5817806 - std::sys_common::backtrace::_print_fmt::h01e8ef90ace289e3
                               at /rustc/e64f8495e73fbc3653b4bcb73268c58b9c4a0a0d/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7f0cd5817806 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hf9dd6cae74685c81
                               at /rustc/e64f8495e73fbc3653b4bcb73268c58b9c4a0a0d/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f0cd5869e00 - core::fmt::rt::Argument::fmt::h8ea94010f89e6634
                               at /rustc/e64f8495e73fbc3653b4bcb73268c58b9c4a0a0d/library/core/src/fmt/rt.rs:142:9
   5:     0x7f0cd5869e00 - core::fmt::write::h72cc333598639a69
                               at /rustc/e64f8495e73fbc3653b4bcb73268c58b9c4a0a0d/library/core/src/fmt/mod.rs:1120:17
   6:     0x7f0cd580b1cf - std::io::Write::write_fmt::h4b8808e44803d04e
                               at /rustc/e64f8495e73fbc3653b4bcb73268c58b9c4a0a0d/library/std/src/io/mod.rs:1810:15
   7:     0x7f0cd58175e4 - std::sys_common::backtrace::_print::hb2c185826855226e
                               at /rustc/e64f8495e73fbc3653b4bcb73268c58b9c4a0a0d/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f0cd58175e4 - std::sys_common::backtrace::print::hf0402097dc954189
                               at /rustc/e64f8495e73fbc3653b4bcb73268c58b9c4a0a0d/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f0cd581a377 - std::panicking::default_hook::{{closure}}::h2879d7f688c03513
  10:     0x7f0cd581a0d9 - std::panicking::default_hook::h6b4d39921063eece
                               at /rustc/e64f8495e73fbc3653b4bcb73268c58b9c4a0a0d/library/std/src/panicking.rs:292:9
  11:     0x7f0cd2567b4c - std[45f158bc17f9e196]::panicking::update_hook::<alloc[f6bf7dd499ada734]::boxed::Box<rustc_driver_impl[856b55f1ad5b32fc]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f0cd581aac6 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hbefca42bded875fc
                               at /rustc/e64f8495e73fbc3653b4bcb73268c58b9c4a0a0d/library/alloc/src/boxed.rs:2030:9
  13:     0x7f0cd581aac6 - std::panicking::rust_panic_with_hook::h861adc023e7cc0c9
                               at /rustc/e64f8495e73fbc3653b4bcb73268c58b9c4a0a0d/library/std/src/panicking.rs:785:13
  14:     0x7f0cd2599ab4 - std[45f158bc17f9e196]::panicking::begin_panic::<rustc_errors[9a83f08cfa696d6d]::ExplicitBug>::{closure#0}
  15:     0x7f0cd2596076 - std[45f158bc17f9e196]::sys_common::backtrace::__rust_end_short_backtrace::<std[45f158bc17f9e196]::panicking::begin_panic<rustc_errors[9a83f08cfa696d6d]::ExplicitBug>::{closure#0}, !>
  16:     0x7f0cd2591136 - std[45f158bc17f9e196]::panicking::begin_panic::<rustc_errors[9a83f08cfa696d6d]::ExplicitBug>
  17:     0x7f0cd25a4c51 - <rustc_errors[9a83f08cfa696d6d]::diagnostic_builder::BugAbort as rustc_errors[9a83f08cfa696d6d]::diagnostic_builder::EmissionGuarantee>::emit_producing_guarantee
  18:     0x7f0cd2fbbb8d - rustc_middle[eb670d4eb5009434]::util::bug::opt_span_bug_fmt::<rustc_span[1828e6de90cfe8a6]::span_encoding::Span>::{closure#0}
  19:     0x7f0cd2fbbbba - rustc_middle[eb670d4eb5009434]::ty::context::tls::with_opt::<rustc_middle[eb670d4eb5009434]::util::bug::opt_span_bug_fmt<rustc_span[1828e6de90cfe8a6]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  20:     0x7f0cd2f8f0e8 - rustc_middle[eb670d4eb5009434]::ty::context::tls::with_context_opt::<rustc_middle[eb670d4eb5009434]::ty::context::tls::with_opt<rustc_middle[eb670d4eb5009434]::util::bug::opt_span_bug_fmt<rustc_span[1828e6de90cfe8a6]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  21:     0x7f0cd2f8c1f4 - rustc_middle[eb670d4eb5009434]::util::bug::span_bug_fmt::<rustc_span[1828e6de90cfe8a6]::span_encoding::Span>
  22:     0x7f0cd4199627 - rustc_trait_selection[bc7c8cde1afc0761]::traits::do_normalize_predicates
  23:     0x7f0cd3f786da - rustc_trait_selection[bc7c8cde1afc0761]::traits::normalize_param_env_or_error
  24:     0x7f0cd3ac9eb4 - rustc_ty_utils[a1af397cf76d45e7]::ty::param_env
  25:     0x7f0cd3ac9a59 - rustc_query_impl[a4ba8400aa2b99d0]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a4ba8400aa2b99d0]::query_impl::param_env::dynamic_query::{closure#2}::{closure#0}, rustc_middle[eb670d4eb5009434]::query::erase::Erased<[u8; 8usize]>>
  26:     0x7f0cd389cfd4 - rustc_query_system[1dd2241d09e5cc4c]::query::plumbing::try_execute_query::<rustc_query_impl[a4ba8400aa2b99d0]::DynamicConfig<rustc_query_system[1dd2241d09e5cc4c]::query::caches::DefaultCache<rustc_span[1828e6de90cfe8a6]::def_id::DefId, rustc_middle[eb670d4eb5009434]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[a4ba8400aa2b99d0]::plumbing::QueryCtxt, false>
  27:     0x7f0cd389cae1 - rustc_query_impl[a4ba8400aa2b99d0]::query_impl::param_env::get_query_non_incr::__rust_end_short_backtrace
  28:     0x7f0cd3c275a8 - rustc_middle[eb670d4eb5009434]::query::plumbing::query_get_at::<rustc_query_system[1dd2241d09e5cc4c]::query::caches::DefaultCache<rustc_span[1828e6de90cfe8a6]::def_id::DefId, rustc_middle[eb670d4eb5009434]::query::erase::Erased<[u8; 8usize]>>>
  29:     0x7f0cd3c3740e - rustc_hir_analysis[9d00e3e5b40bb3cf]::check::wfcheck::check_item_fn
  30:     0x7f0cd3c34e2d - rustc_hir_analysis[9d00e3e5b40bb3cf]::check::wfcheck::check_well_formed
  31:     0x7f0cd3c33b2f - rustc_query_impl[a4ba8400aa2b99d0]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a4ba8400aa2b99d0]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[eb670d4eb5009434]::query::erase::Erased<[u8; 1usize]>>
  32:     0x7f0cd3c3320b - rustc_query_system[1dd2241d09e5cc4c]::query::plumbing::try_execute_query::<rustc_query_impl[a4ba8400aa2b99d0]::DynamicConfig<rustc_query_system[1dd2241d09e5cc4c]::query::caches::VecCache<rustc_hir[5d84c8f70b537736]::hir_id::OwnerId, rustc_middle[eb670d4eb5009434]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[a4ba8400aa2b99d0]::plumbing::QueryCtxt, false>
  33:     0x7f0cd3c32f83 - rustc_query_impl[a4ba8400aa2b99d0]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  34:     0x7f0cd3c309b7 - rustc_hir_analysis[9d00e3e5b40bb3cf]::check::wfcheck::check_mod_type_wf
  35:     0x7f0cd3c308fb - rustc_query_impl[a4ba8400aa2b99d0]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a4ba8400aa2b99d0]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[eb670d4eb5009434]::query::erase::Erased<[u8; 1usize]>>
  36:     0x7f0cd3c2fa95 - rustc_query_system[1dd2241d09e5cc4c]::query::plumbing::try_execute_query::<rustc_query_impl[a4ba8400aa2b99d0]::DynamicConfig<rustc_query_system[1dd2241d09e5cc4c]::query::caches::DefaultCache<rustc_span[1828e6de90cfe8a6]::def_id::LocalModDefId, rustc_middle[eb670d4eb5009434]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[a4ba8400aa2b99d0]::plumbing::QueryCtxt, false>
  37:     0x7f0cd3c2f843 - rustc_query_impl[a4ba8400aa2b99d0]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
  38:     0x7f0cd3e982b0 - <rustc_middle[eb670d4eb5009434]::hir::map::Map>::try_par_for_each_module::<rustc_hir_analysis[9d00e3e5b40bb3cf]::check_crate::{closure#4}::{closure#0}>::{closure#0}
  39:     0x7f0cd3e96611 - rustc_hir_analysis[9d00e3e5b40bb3cf]::check_crate
  40:     0x7f0cd427e819 - rustc_interface[13fabbb621f7a7a7]::passes::analysis
  41:     0x7f0cd427e45f - rustc_query_impl[a4ba8400aa2b99d0]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[a4ba8400aa2b99d0]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[eb670d4eb5009434]::query::erase::Erased<[u8; 1usize]>>
  42:     0x7f0cd47a65a4 - rustc_query_system[1dd2241d09e5cc4c]::query::plumbing::try_execute_query::<rustc_query_impl[a4ba8400aa2b99d0]::DynamicConfig<rustc_query_system[1dd2241d09e5cc4c]::query::caches::SingleCache<rustc_middle[eb670d4eb5009434]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[a4ba8400aa2b99d0]::plumbing::QueryCtxt, false>
  43:     0x7f0cd47a6395 - rustc_query_impl[a4ba8400aa2b99d0]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  44:     0x7f0cd45463ad - rustc_interface[13fabbb621f7a7a7]::interface::run_compiler::<core[5977124cf3f69ab]::result::Result<(), rustc_span[1828e6de90cfe8a6]::ErrorGuaranteed>, rustc_driver_impl[856b55f1ad5b32fc]::run_compiler::{closure#0}>::{closure#0}
  45:     0x7f0cd4808e46 - std[45f158bc17f9e196]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[13fabbb621f7a7a7]::util::run_in_thread_with_globals<rustc_interface[13fabbb621f7a7a7]::util::run_in_thread_pool_with_globals<rustc_interface[13fabbb621f7a7a7]::interface::run_compiler<core[5977124cf3f69ab]::result::Result<(), rustc_span[1828e6de90cfe8a6]::ErrorGuaranteed>, rustc_driver_impl[856b55f1ad5b32fc]::run_compiler::{closure#0}>::{closure#0}, core[5977124cf3f69ab]::result::Result<(), rustc_span[1828e6de90cfe8a6]::ErrorGuaranteed>>::{closure#0}, core[5977124cf3f69ab]::result::Result<(), rustc_span[1828e6de90cfe8a6]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[5977124cf3f69ab]::result::Result<(), rustc_span[1828e6de90cfe8a6]::ErrorGuaranteed>>
  46:     0x7f0cd4808c73 - <<std[45f158bc17f9e196]::thread::Builder>::spawn_unchecked_<rustc_interface[13fabbb621f7a7a7]::util::run_in_thread_with_globals<rustc_interface[13fabbb621f7a7a7]::util::run_in_thread_pool_with_globals<rustc_interface[13fabbb621f7a7a7]::interface::run_compiler<core[5977124cf3f69ab]::result::Result<(), rustc_span[1828e6de90cfe8a6]::ErrorGuaranteed>, rustc_driver_impl[856b55f1ad5b32fc]::run_compiler::{closure#0}>::{closure#0}, core[5977124cf3f69ab]::result::Result<(), rustc_span[1828e6de90cfe8a6]::ErrorGuaranteed>>::{closure#0}, core[5977124cf3f69ab]::result::Result<(), rustc_span[1828e6de90cfe8a6]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[5977124cf3f69ab]::result::Result<(), rustc_span[1828e6de90cfe8a6]::ErrorGuaranteed>>::{closure#1} as core[5977124cf3f69ab]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  47:     0x7f0cd58243b5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h5d9d7f54a2e59c6d
                               at /rustc/e64f8495e73fbc3653b4bcb73268c58b9c4a0a0d/library/alloc/src/boxed.rs:2016:9
  48:     0x7f0cd58243b5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h48bf4b2427be9cd8
                               at /rustc/e64f8495e73fbc3653b4bcb73268c58b9c4a0a0d/library/alloc/src/boxed.rs:2016:9
  49:     0x7f0cd58243b5 - std::sys::pal::unix::thread::Thread::new::thread_start::hbf0f1ac511c22d9d
                               at /rustc/e64f8495e73fbc3653b4bcb73268c58b9c4a0a0d/library/std/src/sys/pal/unix/thread.rs:108:17
  50:     0x7f0ccf6aa9eb - <unknown>
  51:     0x7f0ccf72e7cc - <unknown>
  52:                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.77.0-nightly (e64f8495e 2024-01-16) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [param_env] computing normalized predicates of `f`
#1 [check_well_formed] checking that `f` is well-formed
#2 [check_mod_type_wf] checking that types are well-formed in top-level module
#3 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 5 previous errors; 2 warnings emitted

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

@matthiaskrgr matthiaskrgr added 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. C-bug Category: This is a bug. F-non_lifetime_binders `#![feature(non_lifetime_binders)]` labels Jan 16, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jan 16, 2024
@matthiaskrgr
Copy link
Member Author

#117449 cc @oli-obk 😅

@jieyouxu jieyouxu removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 15, 2024
@matthiaskrgr matthiaskrgr added the S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. label Apr 19, 2024
@matthiaskrgr
Copy link
Member Author

matthiaskrgr commented Apr 28, 2024

probably related, does not require non-lifetime-binders: inference variables in normalized parameter environment: unconstrained const value

auto-reduced (treereduce-rust):

trait Archive {
    type Archived;
}

type Archived<T> = <T as Archive>::Archived;

trait Deserialize<T: Archive, T: Archive> {}

impl<T, const N: usize> Archive for [T; B]
where
    T: Archive,
{
    type Archived = [T::Archived; N];
}

pub const MYSIZE: usize = 10;

impl<T> Archive for Sad<T>
where
    T: Archive,
    Archived<[T; MYSIZE]>: Deserialize<[T; MYSIZE], D>,
    T::Archived:,
{
}
original code

original:

// Traits and base impls:
trait Archive {
    type Archived;
}

type Archived<T> = <T as Archive>::Archived;

trait Deserialize<T: Archive, T: Archive> {}

impl<T, const N: usize> Archive for [T; B]
where
    T: Archive,
{
    type Archived = [T::Archived; N];
}

impl<T: Archive, D: ?Sized, const N: usize> Deserialize<[T; N], D> for [T::Archived; N]
where
    T: Archive,
    T::Archived: Deserialize<T, D>,
{
}

// A happy struct + impls that works perfectly fine:
pub enum Happy<T> {
    A([T; 10]),
    B([T; 10]),
}

impl<T> Archive for Happy<T>
where
    T: Archive,
    [T; 10]: Archive,
    [T; 10]: Archive,
{
    type Archived = Happy<Archived<T>>;
}

impl<D: ?Sized, T> Deserialize<Happy<T>, D> for Archived<Happy<T>>
where
    T: Archive,
    [T; 10]: Archive,
    Archived<[T; 10]>: Deserialize<[T; 10], D>,
    [T; 10]: Archive,
    Archived<[T; 10]>: Deserialize<[T; 10], D>,
{
}

// A sad struct + impls that causes a compiler error:
pub const MYSIZE: usize = 10;

pub enum Sad<T> {
    A([T; MYSIZE]),
    B([T; MYSIZE]),
}

impl<T> Archive for Sad<T>
where
    T: Archive,
    Archived<[T; MYSIZE]>: Deserialize<[T; MYSIZE], D>,
    T::Archived: Deserialize<T, D>,
{
    type Archived = Sad<Archived<T>>;
}

impl<D: ?Sized, T> Deserialize<Sad<T>, D> for Archived<Sad<T>>
where
    T: Archive,
    Archived<[T; 10]>: Deserialize<[T; 10], D>,
    Archived<[T; MYSIZE]>: Deserialize<[T; MYSIZE], D>,
    [T; MYSIZE]: Archive,                               // 💣
    Archived<[T; MYSIZE]>: Deserialize<[T; MYSIZE], D>, // 💣
{
}

Version information

rustc 1.80.0-nightly (91d5e4af8 2024-04-28)
binary: rustc
commit-hash: 91d5e4af8674bde06096bac1e7ac04af0e94c691
commit-date: 2024-04-28
host: x86_64-unknown-linux-gnu
release: 1.80.0-nightly
LLVM version: 18.1.4

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

Program output

error[E0403]: the name `T` is already used for a generic parameter in this item's generic parameters
 --> /tmp/icemaker_global_tempdir.o1fucsK3WfMn/rustc_testrunner_tmpdir_reporting.5gsYH20SuKQM/mvce.rs:7:31
  |
7 | trait Deserialize<T: Archive, T: Archive> {}
  |                   -           ^ already used
  |                   |
  |                   first use of `T`

error[E0425]: cannot find value `B` in this scope
 --> /tmp/icemaker_global_tempdir.o1fucsK3WfMn/rustc_testrunner_tmpdir_reporting.5gsYH20SuKQM/mvce.rs:9:41
  |
9 | impl<T, const N: usize> Archive for [T; B]
  |               -                         ^ help: a const parameter with a similar name exists: `N`
  |               |
  |               similarly named const parameter `N` defined here

error[E0412]: cannot find type `Sad` in this scope
  --> /tmp/icemaker_global_tempdir.o1fucsK3WfMn/rustc_testrunner_tmpdir_reporting.5gsYH20SuKQM/mvce.rs:18:21
   |
18 | impl<T> Archive for Sad<T>
   |                     ^^^ not found in this scope

error[E0412]: cannot find type `D` in this scope
  --> /tmp/icemaker_global_tempdir.o1fucsK3WfMn/rustc_testrunner_tmpdir_reporting.5gsYH20SuKQM/mvce.rs:21:53
   |
18 | impl<T> Archive for Sad<T>
   |      - similarly named type parameter `T` defined here
...
21 |     Archived<[T; MYSIZE]>: Deserialize<[T; MYSIZE], D>,
   |                                                     ^
   |
help: a type parameter with a similar name exists
   |
21 |     Archived<[T; MYSIZE]>: Deserialize<[T; MYSIZE], T>,
   |                                                     ~
help: you might be missing a type parameter
   |
18 | impl<T, D> Archive for Sad<T>
   |       +++

error[E0601]: `main` function not found in crate `mvce`
  --> /tmp/icemaker_global_tempdir.o1fucsK3WfMn/rustc_testrunner_tmpdir_reporting.5gsYH20SuKQM/mvce.rs:24:2
   |
24 | }
   |  ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.o1fucsK3WfMn/rustc_testrunner_tmpdir_reporting.5gsYH20SuKQM/mvce.rs`

error[E0207]: the const parameter `N` is not constrained by the impl trait, self type, or predicates
 --> /tmp/icemaker_global_tempdir.o1fucsK3WfMn/rustc_testrunner_tmpdir_reporting.5gsYH20SuKQM/mvce.rs:9:9
  |
9 | impl<T, const N: usize> Archive for [T; B]
  |         ^^^^^^^^^^^^^^ unconstrained const parameter
  |
  = note: expressions using a const parameter must map each value to a distinct output value
  = note: proving the result of expressions other than the parameter are unique is not supported

error: internal compiler error: compiler/rustc_trait_selection/src/traits/mod.rs:237:13: inference variables in normalized parameter environment: unconstrained const value
  --> /tmp/icemaker_global_tempdir.o1fucsK3WfMn/rustc_testrunner_tmpdir_reporting.5gsYH20SuKQM/mvce.rs:18:1
   |
18 | / impl<T> Archive for Sad<T>
19 | | where
20 | |     T: Archive,
21 | |     Archived<[T; MYSIZE]>: Deserialize<[T; MYSIZE], D>,
22 | |     T::Archived:,
   | |_________________^

thread 'rustc' panicked at compiler/rustc_trait_selection/src/traits/mod.rs:237:13:
Box<dyn Any>
stack backtrace:
   0:     0x7042d8170035 - std::backtrace_rs::backtrace::libunwind::trace::ha90ea7a57c64b8ab
                               at /rustc/91d5e4af8674bde06096bac1e7ac04af0e94c691/library/std/src/../../backtrace/src/backtrace/libunwind.rs:105:5
   1:     0x7042d8170035 - std::backtrace_rs::backtrace::trace_unsynchronized::ha58e55f622939b6e
                               at /rustc/91d5e4af8674bde06096bac1e7ac04af0e94c691/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7042d8170035 - std::sys_common::backtrace::_print_fmt::h687007ed504e7e64
                               at /rustc/91d5e4af8674bde06096bac1e7ac04af0e94c691/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7042d8170035 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hecfae54cdc6fec81
                               at /rustc/91d5e4af8674bde06096bac1e7ac04af0e94c691/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7042d81bf29b - core::fmt::rt::Argument::fmt::h1cf6305de42401ed
                               at /rustc/91d5e4af8674bde06096bac1e7ac04af0e94c691/library/core/src/fmt/rt.rs:165:63
   5:     0x7042d81bf29b - core::fmt::write::hb74fc275648248fb
                               at /rustc/91d5e4af8674bde06096bac1e7ac04af0e94c691/library/core/src/fmt/mod.rs:1157:21
   6:     0x7042d8164bdf - std::io::Write::write_fmt::h5209ffd8e6502f0c
                               at /rustc/91d5e4af8674bde06096bac1e7ac04af0e94c691/library/std/src/io/mod.rs:1832:15
   7:     0x7042d816fe0e - std::sys_common::backtrace::_print::h168707047d27c84e
                               at /rustc/91d5e4af8674bde06096bac1e7ac04af0e94c691/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7042d816fe0e - std::sys_common::backtrace::print::h2942d174d6b0e46d
                               at /rustc/91d5e4af8674bde06096bac1e7ac04af0e94c691/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7042d8172779 - std::panicking::default_hook::{{closure}}::h4215c46ca923b014
  10:     0x7042d81724bd - std::panicking::default_hook::h887f937d01fa1b64
                               at /rustc/91d5e4af8674bde06096bac1e7ac04af0e94c691/library/std/src/panicking.rs:298:9
  11:     0x7042d4a40a1c - std[aaff33ccdb7ea7e2]::panicking::update_hook::<alloc[d1c3a5de2ae3927d]::boxed::Box<rustc_driver_impl[d0a4257edbfecd8c]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7042d8172e76 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hfe27c2dc23f9f057
                               at /rustc/91d5e4af8674bde06096bac1e7ac04af0e94c691/library/alloc/src/boxed.rs:2036:9
  13:     0x7042d8172e76 - std::panicking::rust_panic_with_hook::h6ef218c13552449b
                               at /rustc/91d5e4af8674bde06096bac1e7ac04af0e94c691/library/std/src/panicking.rs:799:13
  14:     0x7042d4a70374 - std[aaff33ccdb7ea7e2]::panicking::begin_panic::<rustc_errors[6ff9940fea39db99]::ExplicitBug>::{closure#0}
  15:     0x7042d4a6cff6 - std[aaff33ccdb7ea7e2]::sys_common::backtrace::__rust_end_short_backtrace::<std[aaff33ccdb7ea7e2]::panicking::begin_panic<rustc_errors[6ff9940fea39db99]::ExplicitBug>::{closure#0}, !>
  16:     0x7042d4a6ccd6 - std[aaff33ccdb7ea7e2]::panicking::begin_panic::<rustc_errors[6ff9940fea39db99]::ExplicitBug>
  17:     0x7042d4a79181 - <rustc_errors[6ff9940fea39db99]::diagnostic::BugAbort as rustc_errors[6ff9940fea39db99]::diagnostic::EmissionGuarantee>::emit_producing_guarantee
  18:     0x7042d54c8d78 - <rustc_errors[6ff9940fea39db99]::DiagCtxt>::span_bug::<rustc_span[6a84a2dd20c85103]::span_encoding::Span, alloc[d1c3a5de2ae3927d]::string::String>
  19:     0x7042d5511fcd - rustc_middle[783a1d49f02736b7]::util::bug::opt_span_bug_fmt::<rustc_span[6a84a2dd20c85103]::span_encoding::Span>::{closure#0}
  20:     0x7042d551219a - rustc_middle[783a1d49f02736b7]::ty::context::tls::with_opt::<rustc_middle[783a1d49f02736b7]::util::bug::opt_span_bug_fmt<rustc_span[6a84a2dd20c85103]::span_encoding::Span>::{closure#0}, !>::{closure#0}
  21:     0x7042d54e9c0b - rustc_middle[783a1d49f02736b7]::ty::context::tls::with_context_opt::<rustc_middle[783a1d49f02736b7]::ty::context::tls::with_opt<rustc_middle[783a1d49f02736b7]::util::bug::opt_span_bug_fmt<rustc_span[6a84a2dd20c85103]::span_encoding::Span>::{closure#0}, !>::{closure#0}, !>
  22:     0x7042d54e8f07 - rustc_middle[783a1d49f02736b7]::util::bug::span_bug_fmt::<rustc_span[6a84a2dd20c85103]::span_encoding::Span>
  23:     0x7042d60730b8 - rustc_trait_selection[55c49d40a157c509]::traits::do_normalize_predicates
  24:     0x7042d2f2ed4e - rustc_trait_selection[55c49d40a157c509]::traits::normalize_param_env_or_error
  25:     0x7042d5e90b8b - rustc_ty_utils[a96e7d9f6f95dd10]::ty::param_env
  26:     0x7042d5e907d7 - rustc_query_impl[77a161a94332e7e1]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[77a161a94332e7e1]::query_impl::param_env::dynamic_query::{closure#2}::{closure#0}, rustc_middle[783a1d49f02736b7]::query::erase::Erased<[u8; 8usize]>>
  27:     0x7042d5e94f8e - rustc_query_system[61cd216fcfa07925]::query::plumbing::try_execute_query::<rustc_query_impl[77a161a94332e7e1]::DynamicConfig<rustc_query_system[61cd216fcfa07925]::query::caches::DefIdCache<rustc_middle[783a1d49f02736b7]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[77a161a94332e7e1]::plumbing::QueryCtxt, false>
  28:     0x7042d5e949db - rustc_query_impl[77a161a94332e7e1]::query_impl::param_env::get_query_non_incr::__rust_end_short_backtrace
  29:     0x7042d646072f - rustc_hir_analysis[52d62df79dc1fb71]::check::wfcheck::check_well_formed
  30:     0x7042d645ffad - rustc_query_impl[77a161a94332e7e1]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[77a161a94332e7e1]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[783a1d49f02736b7]::query::erase::Erased<[u8; 1usize]>>
  31:     0x7042d645f740 - rustc_query_system[61cd216fcfa07925]::query::plumbing::try_execute_query::<rustc_query_impl[77a161a94332e7e1]::DynamicConfig<rustc_query_system[61cd216fcfa07925]::query::caches::VecCache<rustc_hir[353c6e3d6d4db717]::hir_id::OwnerId, rustc_middle[783a1d49f02736b7]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[77a161a94332e7e1]::plumbing::QueryCtxt, false>
  32:     0x7042d645f4bf - rustc_query_impl[77a161a94332e7e1]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace
  33:     0x7042d645d437 - rustc_hir_analysis[52d62df79dc1fb71]::check::wfcheck::check_mod_type_wf
  34:     0x7042d645d267 - rustc_query_impl[77a161a94332e7e1]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[77a161a94332e7e1]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[783a1d49f02736b7]::query::erase::Erased<[u8; 1usize]>>
  35:     0x7042d6be8b70 - rustc_query_system[61cd216fcfa07925]::query::plumbing::try_execute_query::<rustc_query_impl[77a161a94332e7e1]::DynamicConfig<rustc_query_system[61cd216fcfa07925]::query::caches::DefaultCache<rustc_span[6a84a2dd20c85103]::def_id::LocalModDefId, rustc_middle[783a1d49f02736b7]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[77a161a94332e7e1]::plumbing::QueryCtxt, false>
  36:     0x7042d6be891b - rustc_query_impl[77a161a94332e7e1]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace
  37:     0x7042d61a08d3 - rustc_hir_analysis[52d62df79dc1fb71]::check_crate
  38:     0x7042d61827c7 - rustc_interface[3360209938edb6a7]::passes::analysis
  39:     0x7042d6182315 - rustc_query_impl[77a161a94332e7e1]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[77a161a94332e7e1]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[783a1d49f02736b7]::query::erase::Erased<[u8; 1usize]>>
  40:     0x7042d6bffba5 - rustc_query_system[61cd216fcfa07925]::query::plumbing::try_execute_query::<rustc_query_impl[77a161a94332e7e1]::DynamicConfig<rustc_query_system[61cd216fcfa07925]::query::caches::SingleCache<rustc_middle[783a1d49f02736b7]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[77a161a94332e7e1]::plumbing::QueryCtxt, false>
  41:     0x7042d6bff909 - rustc_query_impl[77a161a94332e7e1]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  42:     0x7042d6aa328e - rustc_interface[3360209938edb6a7]::interface::run_compiler::<core[8db7010e98043ac]::result::Result<(), rustc_span[6a84a2dd20c85103]::ErrorGuaranteed>, rustc_driver_impl[d0a4257edbfecd8c]::run_compiler::{closure#0}>::{closure#1}
  43:     0x7042d6a727c9 - std[aaff33ccdb7ea7e2]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[3360209938edb6a7]::util::run_in_thread_with_globals<rustc_interface[3360209938edb6a7]::util::run_in_thread_pool_with_globals<rustc_interface[3360209938edb6a7]::interface::run_compiler<core[8db7010e98043ac]::result::Result<(), rustc_span[6a84a2dd20c85103]::ErrorGuaranteed>, rustc_driver_impl[d0a4257edbfecd8c]::run_compiler::{closure#0}>::{closure#1}, core[8db7010e98043ac]::result::Result<(), rustc_span[6a84a2dd20c85103]::ErrorGuaranteed>>::{closure#0}, core[8db7010e98043ac]::result::Result<(), rustc_span[6a84a2dd20c85103]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[8db7010e98043ac]::result::Result<(), rustc_span[6a84a2dd20c85103]::ErrorGuaranteed>>
  44:     0x7042d6a72576 - <<std[aaff33ccdb7ea7e2]::thread::Builder>::spawn_unchecked_<rustc_interface[3360209938edb6a7]::util::run_in_thread_with_globals<rustc_interface[3360209938edb6a7]::util::run_in_thread_pool_with_globals<rustc_interface[3360209938edb6a7]::interface::run_compiler<core[8db7010e98043ac]::result::Result<(), rustc_span[6a84a2dd20c85103]::ErrorGuaranteed>, rustc_driver_impl[d0a4257edbfecd8c]::run_compiler::{closure#0}>::{closure#1}, core[8db7010e98043ac]::result::Result<(), rustc_span[6a84a2dd20c85103]::ErrorGuaranteed>>::{closure#0}, core[8db7010e98043ac]::result::Result<(), rustc_span[6a84a2dd20c85103]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[8db7010e98043ac]::result::Result<(), rustc_span[6a84a2dd20c85103]::ErrorGuaranteed>>::{closure#2} as core[8db7010e98043ac]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  45:     0x7042d817ccab - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h1c1c6804813d5e77
                               at /rustc/91d5e4af8674bde06096bac1e7ac04af0e94c691/library/alloc/src/boxed.rs:2022:9
  46:     0x7042d817ccab - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h3d84aa3b40a67b8f
                               at /rustc/91d5e4af8674bde06096bac1e7ac04af0e94c691/library/alloc/src/boxed.rs:2022:9
  47:     0x7042d817ccab - std::sys::pal::unix::thread::Thread::new::thread_start::h60cefba2ee6cce64
                               at /rustc/91d5e4af8674bde06096bac1e7ac04af0e94c691/library/std/src/sys/pal/unix/thread.rs:108:17
  48:     0x7042d18a955a - <unknown>
  49:     0x7042d1926a3c - <unknown>
  50:                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: please make sure that you have updated to the latest nightly

note: rustc 1.80.0-nightly (91d5e4af8 2024-04-28) running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [param_env] computing normalized predicates of `<impl at /tmp/icemaker_global_tempdir.o1fucsK3WfMn/rustc_testrunner_tmpdir_reporting.5gsYH20SuKQM/mvce.rs:18:1: 22:18>`
#1 [check_well_formed] checking that `<impl at /tmp/icemaker_global_tempdir.o1fucsK3WfMn/rustc_testrunner_tmpdir_reporting.5gsYH20SuKQM/mvce.rs:18:1: 22:18>` is well-formed
#2 [check_mod_type_wf] checking that types are well-formed in top-level module
#3 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 7 previous errors

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

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) ❄️ S-bug-has-test Status: This bug is tracked inside the repo by a `known-bug` test. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
Status: Todo
Development

No branches or pull requests

3 participants