Skip to content

Conversation

@reddevilmidzy
Copy link
Member

@reddevilmidzy reddevilmidzy commented Feb 2, 2026

close: #151625
close: #150983

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 2, 2026
Comment on lines +16 to +19
#[type_const]
const WRAP<T : ConstParamTy_> : T = { //~ ERROR: generic const items are experimental
Foo::<T>{field : 1} //~ ERROR: expected `T`, found {integer}
};
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I removed generic_const_parameter_types and added generic_const_items, ICE did not reproduce.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I tried adding both in one file, but when I place them together, the ICE doesn't work. haha,
I'll fix it.

https://godbolt.org/z/1xEjGYTvo

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I was mistaken. The reason ICE didn't occur wasn't because I merged the two, but because I didn't add adt_const_params.

Still, I think it's better to separate the two, so I'll do that.

@rust-log-analyzer
Copy link
Collaborator

The job aarch64-gnu-llvm-20-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
test [ui] tests/ui/asm/aarch64/type-check-2.rs ... ok
test [ui] tests/ui/asm/aarch64/type-check-3.rs ... ok
test [ui] tests/ui/asm/aarch64/sym.rs ... ok
test [ui] tests/ui/asm/aarch64/type-f16.rs ... ok
test [ui] tests/ui/asm/aarch64v8r.rs#hf ... ok
test [ui] tests/ui/asm/asm-with-nested-closure.rs ... ok
test [ui] tests/ui/asm/aarch64v8r.rs#sf ... ok
test [ui] tests/ui/asm/binary_asm_labels.rs ... ignored, only executed when the architecture is x86_64
test [ui] tests/ui/asm/arm-low-dreg.rs ... ok
test [ui] tests/ui/asm/cfg-parse-error.rs ... ok
test [ui] tests/ui/asm/cfg.rs#reva ... ignored, only executed when the architecture is x86_64
test [ui] tests/ui/asm/cfg.rs#revb ... ignored, only executed when the architecture is x86_64
---
test [ui] tests/ui/extern/issue-64655-extern-rust-must-allow-unwind.rs#fat2 ... ok
test [ui] tests/ui/extern/issue-64655-extern-rust-must-allow-unwind.rs#fat3 ... ok
test [ui] tests/ui/extern/issue-80074.rs ... ok
test [ui] tests/ui/extern/issue-95829.rs ... ok
test [ui] tests/ui/extern/lgamma-linkage.rs ... ok
test [ui] tests/ui/extern/no-mangle-associated-fn.rs ... ok
test [ui] tests/ui/extern/not-in-block.rs ... ok
test [ui] tests/ui/extern/unsized-extern-derefmove.rs ... ok
test [ui] tests/ui/extern/windows-tcb-trash-13259.rs ... ok
test [ui] tests/ui/feature-gates/allow-features-empty.rs ... ok
---
test [ui] tests/ui/imports/ambiguous-5.rs ... ok
test [ui] tests/ui/imports/ambiguous-4.rs ... ok
test [ui] tests/ui/imports/ambiguous-9.rs ... ok
test [ui] tests/ui/imports/ambiguous-7.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-glob-vs-multiouter.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-globvsglob.rs ... ok
test [ui] tests/ui/imports/ambiguous-8.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-no-implicit-prelude.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-non-prelude-core-glob.rs ... ok
test [ui] tests/ui/imports/ambiguous-glob-vs-expanded-extern.rs ... ok
test [ui] tests/ui/imports/ambiguous-panic-non-prelude-std-glob.rs ... ok
---

- error: rustc_dump_predicates
-   --> $DIR/byte-string-u8-validation.rs:8:1
-    |
- LL | struct ConstBytes<const T: &'static [*mut u8; 3]>
-    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-    |
-    = note: Binder { value: ConstArgHasType(T/#0, &'static [*mut u8; 3_usize]), bound_vars: [] }
-    = note: Binder { value: TraitPredicate(<ConstBytes<{const error}> as std::marker::Sized>, polarity:Positive), bound_vars: [] }
- 
10 error[E0308]: mismatched types
11   --> $DIR/byte-string-u8-validation.rs:13:16
12    |

15    |
16    = note: expected reference `&'static [*mut u8; 3]`
17               found reference `&'static [u8; 3]`
+ 
+ error: rustc_dump_predicates
+   --> $DIR/byte-string-u8-validation.rs:8:1
+    |
+ LL | struct ConstBytes<const T: &'static [*mut u8; 3]>
+    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+    |
+    = note: Binder { value: ConstArgHasType(T/#0, &'static [*mut u8; 3_usize]), bound_vars: [] }
+    = note: Binder { value: TraitPredicate(<ConstBytes<b"AAA"> as std::marker::Sized>, polarity:Positive), bound_vars: [] }
18 
19 error: aborting due to 2 previous errors
20 

Note: some mismatched output was normalized before being compared
-   --> /checkout/tests/ui/const-generics/adt_const_params/byte-string-u8-validation.rs:8:1
+ 
+ error: rustc_dump_predicates
+   --> $DIR/byte-string-u8-validation.rs:8:1
+    |
+ LL | struct ConstBytes<const T: &'static [*mut u8; 3]>
+    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+    |
+    = note: Binder { value: ConstArgHasType(T/#0, &'static [*mut u8; 3_usize]), bound_vars: [] }
+    = note: Binder { value: TraitPredicate(<ConstBytes<b"AAA"> as std::marker::Sized>, polarity:Positive), bound_vars: [] }


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args const-generics/adt_const_params/byte-string-u8-validation.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/const-generics/adt_const_params/byte-string-u8-validation.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/const-generics/adt_const_params/byte-string-u8-validation" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error[E0308]: mismatched types
##[error]  --> /checkout/tests/ui/const-generics/adt_const_params/byte-string-u8-validation.rs:13:16
   |
LL |     ConstBytes<b"AAA">: Sized;
   |                ^^^^^^ expected `&[*mut u8; 3]`, found `&[u8; 3]`
   |
   = note: expected reference `&'static [*mut u8; 3]`
              found reference `&'static [u8; 3]`

error: rustc_dump_predicates
##[error]  --> /checkout/tests/ui/const-generics/adt_const_params/byte-string-u8-validation.rs:8:1
   |
LL | struct ConstBytes<const T: &'static [*mut u8; 3]>
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: Binder { value: ConstArgHasType(T/#0, &'static [*mut u8; 3_usize]), bound_vars: [] }
   = note: Binder { value: TraitPredicate(<ConstBytes<b"AAA"> as std::marker::Sized>, polarity:Positive), bound_vars: [] }

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0308`.
------------------------------------------

---- [ui] tests/ui/const-generics/adt_const_params/byte-string-u8-validation.rs stdout end ----
---- [ui] tests/ui/const-generics/adt_const_params/mismatch-raw-ptr-in-adt.rs stdout ----
Saved the actual stderr to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/const-generics/adt_const_params/mismatch-raw-ptr-in-adt/mismatch-raw-ptr-in-adt.stderr`
diff of stderr:

8    = note: `[*mut u8; 3]` must implement `ConstParamTy_`, but it does not
9 
10 error[E0308]: mismatched types
-   --> $DIR/mismatch-raw-ptr-in-adt.rs:9:46
+   --> $DIR/mismatch-raw-ptr-in-adt.rs:9:23
12    |
13 LL |     let _: ConstBytes<b"AAA"> = ConstBytes::<b"BBB">;
-    |                                              ^^^^^^ expected `&[*mut u8; 3]`, found `&[u8; 3]`
+    |                       ^^^^^^ expected `&[*mut u8; 3]`, found `&[u8; 3]`
15    |
16    = note: expected reference `&'static [*mut u8; 3]`
17               found reference `&'static [u8; 3]`

18 
19 error[E0308]: mismatched types
-   --> $DIR/mismatch-raw-ptr-in-adt.rs:9:23
+   --> $DIR/mismatch-raw-ptr-in-adt.rs:9:46
21    |
22 LL |     let _: ConstBytes<b"AAA"> = ConstBytes::<b"BBB">;
-    |                       ^^^^^^ expected `&[*mut u8; 3]`, found `&[u8; 3]`
+    |                                              ^^^^^^ expected `&[*mut u8; 3]`, found `&[u8; 3]`
24    |
25    = note: expected reference `&'static [*mut u8; 3]`
26               found reference `&'static [u8; 3]`

Note: some mismatched output was normalized before being compared
-   --> /checkout/tests/ui/const-generics/adt_const_params/mismatch-raw-ptr-in-adt.rs:9:23
-   --> /checkout/tests/ui/const-generics/adt_const_params/mismatch-raw-ptr-in-adt.rs:9:46
+   --> $DIR/mismatch-raw-ptr-in-adt.rs:9:23
+    |                       ^^^^^^ expected `&[*mut u8; 3]`, found `&[u8; 3]`
+   --> $DIR/mismatch-raw-ptr-in-adt.rs:9:46
+    |                                              ^^^^^^ expected `&[*mut u8; 3]`, found `&[u8; 3]`


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args const-generics/adt_const_params/mismatch-raw-ptr-in-adt.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/const-generics/adt_const_params/mismatch-raw-ptr-in-adt.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/const-generics/adt_const_params/mismatch-raw-ptr-in-adt" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error[E0741]: `&'static [*mut u8; 3]` can't be used as a const parameter type
##[error]  --> /checkout/tests/ui/const-generics/adt_const_params/mismatch-raw-ptr-in-adt.rs:5:28
   |
LL | struct ConstBytes<const T: &'static [*mut u8; 3]>;
   |                            ^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `*mut u8` must implement `ConstParamTy_`, but it does not
   = note: `[*mut u8; 3]` must implement `ConstParamTy_`, but it does not

error[E0308]: mismatched types
##[error]  --> /checkout/tests/ui/const-generics/adt_const_params/mismatch-raw-ptr-in-adt.rs:9:23
   |
LL |     let _: ConstBytes<b"AAA"> = ConstBytes::<b"BBB">;
   |                       ^^^^^^ expected `&[*mut u8; 3]`, found `&[u8; 3]`
   |
   = note: expected reference `&'static [*mut u8; 3]`
              found reference `&'static [u8; 3]`

error[E0308]: mismatched types
##[error]  --> /checkout/tests/ui/const-generics/adt_const_params/mismatch-raw-ptr-in-adt.rs:9:46
   |
LL |     let _: ConstBytes<b"AAA"> = ConstBytes::<b"BBB">;
   |                                              ^^^^^^ expected `&[*mut u8; 3]`, found `&[u8; 3]`
   |
   = note: expected reference `&'static [*mut u8; 3]`
              found reference `&'static [u8; 3]`

error: aborting due to 3 previous errors

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

---- [ui] tests/ui/const-generics/adt_const_params/mismatch-raw-ptr-in-adt.rs stdout end ----
---- [ui] tests/ui/const-generics/generic_const_exprs/lit_type_mismatch.rs stdout ----

error: Error: expected failure status (Some(1)) but received status Some(101).
status: exit status: 101
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/const-generics/generic_const_exprs/lit_type_mismatch.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/const-generics/generic_const_exprs/lit_type_mismatch" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error: generic parameters with a default must be trailing
##[error]  --> /checkout/tests/ui/const-generics/generic_const_exprs/lit_type_mismatch.rs:11:16
   |
LL | struct A<const B: () = 1, C>(C);
   |                ^


thread 'rustc' (51958) panicked at compiler/rustc_type_ir/src/binder.rs:658:13:
Binder { value: TraitPredicate(<C as std::marker::Sized>, polarity:Positive), bound_vars: [] } has parameters, but no args were provided in instantiate
stack backtrace:
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_fmt
   2: <rustc_type_ir::binder::EarlyBinder<rustc_middle::ty::context::TyCtxt, rustc_middle::ty::predicate::Clause>>::instantiate::<&rustc_middle::ty::list::RawList<(), rustc_middle::ty::generic_args::GenericArg>>
   3: <core::iter::adapters::map::Map<core::slice::iter::Iter<(rustc_middle::ty::predicate::Clause, rustc_span::span_encoding::Span)>, <rustc_middle::ty::generics::GenericPredicates>::instantiate_into::{closure#0}> as core::iter::traits::iterator::Iterator>::fold::<(), core::iter::traits::iterator::Iterator::for_each::call<rustc_middle::ty::predicate::Clause, <alloc::vec::Vec<rustc_middle::ty::predicate::Clause>>::extend_trusted<core::iter::adapters::map::Map<core::slice::iter::Iter<(rustc_middle::ty::predicate::Clause, rustc_span::span_encoding::Span)>, <rustc_middle::ty::generics::GenericPredicates>::instantiate_into::{closure#0}>>::{closure#0}>::{closure#0}>
   4: <alloc::vec::Vec<rustc_middle::ty::predicate::Clause>>::extend_trusted::<core::iter::adapters::map::Map<core::slice::iter::Iter<(rustc_middle::ty::predicate::Clause, rustc_span::span_encoding::Span)>, <rustc_middle::ty::generics::GenericPredicates>::instantiate_into::{closure#0}>>
   5: <rustc_middle::ty::generics::GenericPredicates>::instantiate_into
   6: <rustc_middle::ty::generics::GenericPredicates>::instantiate
   7: <rustc_trait_selection::traits::wf::WfPredicates>::nominal_obligations
   8: <rustc_trait_selection::traits::wf::WfPredicates as rustc_type_ir::visit::TypeVisitor<rustc_middle::ty::context::TyCtxt>>::visit_const
   9: <rustc_trait_selection::traits::wf::WfPredicates>::add_wf_preds_for_term
  10: rustc_trait_selection::traits::wf::obligations
  11: <rustc_trait_selection::traits::fulfill::FulfillProcessor as rustc_data_structures::obligation_forest::ObligationProcessor>::process_obligation
  12: <rustc_data_structures::obligation_forest::ObligationForest<rustc_trait_selection::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection::traits::fulfill::FulfillProcessor>
  13: <rustc_trait_selection::traits::fulfill::FulfillmentContext<rustc_trait_selection::traits::FulfillmentError> as rustc_infer::traits::engine::TraitEngine<rustc_trait_selection::traits::FulfillmentError>>::try_evaluate_obligations
  14: <rustc_trait_selection::traits::fulfill::FulfillmentContext<rustc_trait_selection::traits::FulfillmentError> as rustc_infer::traits::engine::TraitEngine<rustc_trait_selection::traits::FulfillmentError>>::evaluate_obligations_error_on_ambiguity
  15: rustc_hir_analysis::check::wfcheck::check_type_defn
  16: rustc_hir_analysis::check::wfcheck::check_item
  17: rustc_hir_analysis::check::check::check_item_type
  18: rustc_hir_analysis::check::wfcheck::check_well_formed
      [... omitted 3 frames ...]
  19: rustc_middle::query::inner::query_ensure_error_guaranteed::<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::ErasedData<[u8; 1]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, ()>
  20: std::panicking::catch_unwind::<core::result::Result<(), rustc_span::ErrorGuaranteed>, core::panic::unwind_safe::AssertUnwindSafe<rustc_data_structures::sync::parallel::try_par_for_each_in<&[rustc_hir::hir::TraitItemId], rustc_span::ErrorGuaranteed, <rustc_middle::hir::ModuleItems>::par_trait_items<rustc_hir_analysis::check::wfcheck::check_type_wf::{closure#2}>::{closure#0}>::{closure#0}::{closure#1}::{closure#0}>>
  21: rustc_data_structures::sync::parallel::try_par_for_each_in::<&[rustc_hir::hir::ItemId], rustc_span::ErrorGuaranteed, <rustc_middle::hir::ModuleItems>::par_items<rustc_hir_analysis::check::wfcheck::check_type_wf::{closure#0}>::{closure#0}>
  22: rustc_hir_analysis::check::wfcheck::check_type_wf
      [... omitted 3 frames ...]
  23: <rustc_session::session::Session>::time::<(), rustc_hir_analysis::check_crate::{closure#0}>
  24: rustc_hir_analysis::check_crate
  25: rustc_interface::passes::analysis
      [... omitted 3 frames ...]
  26: <std::thread::local::LocalKey<core::cell::Cell<*const ()>>>::with::<rustc_middle::ty::context::tls::enter_context<<rustc_middle::ty::context::GlobalCtxt>::enter<rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}, core::option::Option<rustc_interface::queries::Linker>>::{closure#1}, core::option::Option<rustc_interface::queries::Linker>>::{closure#0}, core::option::Option<rustc_interface::queries::Linker>>
  27: <rustc_middle::ty::context::TyCtxt>::create_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}>
  28: <rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core::ops::function::FnOnce<(&rustc_session::session::Session, rustc_middle::ty::context::CurrentGcx, alloc::sync::Arc<rustc_data_structures::jobserver::Proxy>, &std::sync::once_lock::OnceLock<rustc_middle::ty::context::GlobalCtxt>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_middle::arena::Arena>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_hir::Arena>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
  29: <alloc::boxed::Box<dyn for<'a> core::ops::function::FnOnce<(&'a rustc_session::session::Session, rustc_middle::ty::context::CurrentGcx, alloc::sync::Arc<rustc_data_structures::jobserver::Proxy>, &'a std::sync::once_lock::OnceLock<rustc_middle::ty::context::GlobalCtxt<'a>>, &'a rustc_data_structures::sync::worker_local::WorkerLocal<rustc_middle::arena::Arena<'a>>, &'a rustc_data_structures::sync::worker_local::WorkerLocal<rustc_hir::Arena<'a>>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}), Output = core::option::Option<rustc_interface::queries::Linker>>> as core::ops::function::FnOnce<(&rustc_session::session::Session, rustc_middle::ty::context::CurrentGcx, alloc::sync::Arc<rustc_data_structures::jobserver::Proxy>, &std::sync::once_lock::OnceLock<rustc_middle::ty::context::GlobalCtxt>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_middle::arena::Arena>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_hir::Arena>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2})>>::call_once
  30: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>
  31: std::panicking::catch_unwind::<(), core::panic::unwind_safe::AssertUnwindSafe<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}::{closure#0}>>
  32: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}::{closure#0}, ()>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

---
note: please make sure that you have updated to the latest nightly

note: rustc 1.95.0-nightly (2c92a3520 2026-02-02) running on aarch64-unknown-linux-gnu

note: compiler flags: -Z threads=1 -Z simulate-remapped-rust-src-base=/rustc/FAKE_PREFIX -Z translate-remapped-path-to-local-path=no -Z ignore-directory-in-diagnostics-source-blocks=/cargo -Z ignore-directory-in-diagnostics-source-blocks=/checkout/vendor -C codegen-units=1 -Z ui-testing -Z deduplicate-diagnostics=no -Z write-long-types-to-disk=no -C strip=debuginfo -C prefer-dynamic -C rpath -C debuginfo=0

query stack during panic:
#0 [check_well_formed] checking that `A` is well-formed
#1 [check_type_wf] checking that types are well-formed
#2 [analysis] running analysis passes on crate `lit_type_mismatch`
end of query stack

thread 'rustc' (51958) panicked at compiler/rustc_type_ir/src/binder.rs:658:13:
Cond<UnevaluatedConst { def: DefId(0:15 ~ lit_type_mismatch[0ea4]::Thing::{constant#0}), args: [T/#0] }> has parameters, but no args were provided in instantiate
stack backtrace:
   0: __rustc::rust_begin_unwind
   1: core::panicking::panic_fmt
   2: <rustc_type_ir::binder::EarlyBinder<rustc_middle::ty::context::TyCtxt, rustc_middle::ty::Ty>>::instantiate::<&[rustc_middle::ty::generic_args::GenericArg]>
   3: <<dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_generic_args_of_path::{closure#0}::GenericArgsCtxt as rustc_hir_analysis::hir_ty_lowering::GenericArgsLowerer>::inferred_kind
   4: rustc_hir_analysis::hir_ty_lowering::generics::lower_generic_args::<<dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_generic_args_of_path::{closure#0}::GenericArgsCtxt>
   5: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_generic_args_of_path
   6: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_path_segment
   7: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_resolved_ty_path
   8: <dyn rustc_hir_analysis::hir_ty_lowering::HirTyLowerer>::lower_ty
   9: rustc_hir_analysis::collect::type_of::type_of
      [... omitted 3 frames ...]
  10: rustc_hir_analysis::check::check::check_item_type
  11: rustc_hir_analysis::check::wfcheck::check_well_formed
      [... omitted 3 frames ...]
  12: rustc_middle::query::inner::query_ensure_error_guaranteed::<rustc_data_structures::vec_cache::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::ErasedData<[u8; 1]>, rustc_query_system::dep_graph::graph::DepNodeIndex>, ()>
  13: std::panicking::catch_unwind::<core::result::Result<(), rustc_span::ErrorGuaranteed>, core::panic::unwind_safe::AssertUnwindSafe<rustc_data_structures::sync::parallel::try_par_for_each_in<&[rustc_hir::hir::TraitItemId], rustc_span::ErrorGuaranteed, <rustc_middle::hir::ModuleItems>::par_trait_items<rustc_hir_analysis::check::wfcheck::check_type_wf::{closure#2}>::{closure#0}>::{closure#0}::{closure#1}::{closure#0}>>
  14: rustc_data_structures::sync::parallel::try_par_for_each_in::<&[rustc_hir::hir::ItemId], rustc_span::ErrorGuaranteed, <rustc_middle::hir::ModuleItems>::par_items<rustc_hir_analysis::check::wfcheck::check_type_wf::{closure#0}>::{closure#0}>
  15: rustc_hir_analysis::check::wfcheck::check_type_wf
      [... omitted 3 frames ...]
  16: <rustc_session::session::Session>::time::<(), rustc_hir_analysis::check_crate::{closure#0}>
  17: rustc_hir_analysis::check_crate
  18: rustc_interface::passes::analysis
      [... omitted 3 frames ...]
  19: <std::thread::local::LocalKey<core::cell::Cell<*const ()>>>::with::<rustc_middle::ty::context::tls::enter_context<<rustc_middle::ty::context::GlobalCtxt>::enter<rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}, core::option::Option<rustc_interface::queries::Linker>>::{closure#1}, core::option::Option<rustc_interface::queries::Linker>>::{closure#0}, core::option::Option<rustc_interface::queries::Linker>>
  20: <rustc_middle::ty::context::TyCtxt>::create_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2}::{closure#0}>
  21: <rustc_interface::passes::create_and_enter_global_ctxt<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>::{closure#2} as core::ops::function::FnOnce<(&rustc_session::session::Session, rustc_middle::ty::context::CurrentGcx, alloc::sync::Arc<rustc_data_structures::jobserver::Proxy>, &std::sync::once_lock::OnceLock<rustc_middle::ty::context::GlobalCtxt>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_middle::arena::Arena>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_hir::Arena>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2})>>::call_once::{shim:vtable#0}
  22: <alloc::boxed::Box<dyn for<'a> core::ops::function::FnOnce<(&'a rustc_session::session::Session, rustc_middle::ty::context::CurrentGcx, alloc::sync::Arc<rustc_data_structures::jobserver::Proxy>, &'a std::sync::once_lock::OnceLock<rustc_middle::ty::context::GlobalCtxt<'a>>, &'a rustc_data_structures::sync::worker_local::WorkerLocal<rustc_middle::arena::Arena<'a>>, &'a rustc_data_structures::sync::worker_local::WorkerLocal<rustc_hir::Arena<'a>>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}), Output = core::option::Option<rustc_interface::queries::Linker>>> as core::ops::function::FnOnce<(&rustc_session::session::Session, rustc_middle::ty::context::CurrentGcx, alloc::sync::Arc<rustc_data_structures::jobserver::Proxy>, &std::sync::once_lock::OnceLock<rustc_middle::ty::context::GlobalCtxt>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_middle::arena::Arena>, &rustc_data_structures::sync::worker_local::WorkerLocal<rustc_hir::Arena>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2})>>::call_once
  23: rustc_interface::passes::create_and_enter_global_ctxt::<core::option::Option<rustc_interface::queries::Linker>, rustc_driver_impl::run_compiler::{closure#0}::{closure#2}>
  24: std::panicking::catch_unwind::<(), core::panic::unwind_safe::AssertUnwindSafe<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}::{closure#0}>>
  25: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<(), rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}::{closure#0}, ()>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

---
note: please make sure that you have updated to the latest nightly

note: rustc 1.95.0-nightly (2c92a3520 2026-02-02) running on aarch64-unknown-linux-gnu

note: compiler flags: -Z threads=1 -Z simulate-remapped-rust-src-base=/rustc/FAKE_PREFIX -Z translate-remapped-path-to-local-path=no -Z ignore-directory-in-diagnostics-source-blocks=/cargo -Z ignore-directory-in-diagnostics-source-blocks=/checkout/vendor -C codegen-units=1 -Z ui-testing -Z deduplicate-diagnostics=no -Z write-long-types-to-disk=no -C strip=debuginfo -C prefer-dynamic -C rpath -C debuginfo=0

query stack during panic:
#0 [type_of] computing type of `<impl at /checkout/tests/ui/const-generics/generic_const_exprs/lit_type_mismatch.rs:20:1: 20:11>`
#1 [check_well_formed] checking that `<impl at /checkout/tests/ui/const-generics/generic_const_exprs/lit_type_mismatch.rs:20:1: 20:11>` is well-formed
#2 [check_type_wf] checking that types are well-formed
#3 [analysis] running analysis passes on crate `lit_type_mismatch`
end of query stack
error: aborting due to 1 previous error
------------------------------------------

---

+ error[E0308]: mismatched types
+   --> $DIR/invalid-patterns.rs:31:21
+    |
+ LL |   get_flag::<false, 0xFF>();
+    |                     ^^^^ expected `char`, found `u8`
+ 
+ error[E0308]: mismatched types
+   --> $DIR/invalid-patterns.rs:33:14
+    |
+ LL |   get_flag::<7, 'c'>();
+    |              ^ expected `bool`, found integer
+ 
+ error[E0308]: mismatched types
+   --> $DIR/invalid-patterns.rs:35:14
+    |
+ LL |   get_flag::<42, 0x5ad>();
+    |              ^^ expected `bool`, found integer
+ 
+ error[E0308]: mismatched types
+   --> $DIR/invalid-patterns.rs:35:18
+    |
+ LL |   get_flag::<42, 0x5ad>();
+    |                  ^^^^^ expected `char`, found `u8`
+ 
1 error[E0080]: reading memory at ALLOC0[0x0..0x4], but memory is uninitialized at [0x1..0x4], and this operation requires initialized memory
2   --> $DIR/invalid-patterns.rs:40:32
3    |

39    = note: the raw bytes of the constant (size: 4, align: 4) {
40                ff __ __ __                                     │ .░░░
41            }
- 
- error[E0308]: mismatched types
-   --> $DIR/invalid-patterns.rs:31:21
-    |
- LL |   get_flag::<false, 0xFF>();
-    |                     ^^^^ expected `char`, found `u8`
- 
- error[E0308]: mismatched types
-   --> $DIR/invalid-patterns.rs:33:14
-    |
- LL |   get_flag::<7, 'c'>();
-    |              ^ expected `bool`, found integer
- 
- error[E0308]: mismatched types
-   --> $DIR/invalid-patterns.rs:35:14
-    |
- LL |   get_flag::<42, 0x5ad>();
-    |              ^^ expected `bool`, found integer
- 
- error[E0308]: mismatched types
-   --> $DIR/invalid-patterns.rs:35:18
-    |
- LL |   get_flag::<42, 0x5ad>();
-    |                  ^^^^^ expected `char`, found `u8`
66 
67 error: aborting due to 8 previous errors
68 

Note: some mismatched output was normalized before being compared
-   --> /checkout/tests/ui/const-generics/min_const_generics/invalid-patterns.rs:31:21
-   --> /checkout/tests/ui/const-generics/min_const_generics/invalid-patterns.rs:33:14
-   --> /checkout/tests/ui/const-generics/min_const_generics/invalid-patterns.rs:35:14
-   --> /checkout/tests/ui/const-generics/min_const_generics/invalid-patterns.rs:35:18
+ error[E0308]: mismatched types
+   --> $DIR/invalid-patterns.rs:31:21
+    |
+ LL |   get_flag::<false, 0xFF>();
+    |                     ^^^^ expected `char`, found `u8`
+ 
+ error[E0308]: mismatched types
+   --> $DIR/invalid-patterns.rs:33:14
+    |
+ LL |   get_flag::<7, 'c'>();
+    |              ^ expected `bool`, found integer
+ 
+ error[E0308]: mismatched types
+   --> $DIR/invalid-patterns.rs:35:14
+    |
+ LL |   get_flag::<42, 0x5ad>();
+    |              ^^ expected `bool`, found integer
+ 
+ error[E0308]: mismatched types
+   --> $DIR/invalid-patterns.rs:35:18
+    |
+ LL |   get_flag::<42, 0x5ad>();
+    |                  ^^^^^ expected `char`, found `u8`
+ 


The actual 64bit.stderr differed from the expected 64bit.stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args const-generics/min_const_generics/invalid-patterns.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/const-generics/min_const_generics/invalid-patterns.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/const-generics/min_const_generics/invalid-patterns" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error[E0308]: mismatched types
##[error]  --> /checkout/tests/ui/const-generics/min_const_generics/invalid-patterns.rs:31:21
   |
LL |   get_flag::<false, 0xFF>();
   |                     ^^^^ expected `char`, found `u8`

error[E0308]: mismatched types
##[error]  --> /checkout/tests/ui/const-generics/min_const_generics/invalid-patterns.rs:33:14
   |
LL |   get_flag::<7, 'c'>();
   |              ^ expected `bool`, found integer

error[E0308]: mismatched types
##[error]  --> /checkout/tests/ui/const-generics/min_const_generics/invalid-patterns.rs:35:14
   |
LL |   get_flag::<42, 0x5ad>();
   |              ^^ expected `bool`, found integer

error[E0308]: mismatched types
##[error]  --> /checkout/tests/ui/const-generics/min_const_generics/invalid-patterns.rs:35:18
   |
LL |   get_flag::<42, 0x5ad>();
   |                  ^^^^^ expected `char`, found `u8`

error[E0080]: reading memory at alloc6[0x0..0x4], but memory is uninitialized at [0x1..0x4], and this operation requires initialized memory
##[error]  --> /checkout/tests/ui/const-generics/min_const_generics/invalid-patterns.rs:40:32
   |
LL |   get_flag::<false, { unsafe { char_raw.character } }>();
   |                                ^^^^^^^^^^^^^^^^^^ evaluation of `main::{constant#7}` failed here
   |
   = note: the raw bytes of the constant (size: 4, align: 4) {
               ff __ __ __                                     │ .░░░
           }

error[E0080]: constructing invalid value: encountered 0x42, but expected a boolean
##[error]  --> /checkout/tests/ui/const-generics/min_const_generics/invalid-patterns.rs:42:14
   |
LL |   get_flag::<{ unsafe { bool_raw.boolean } }, 'z'>();
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ it is undefined behavior to use this value
   |
   = note: the rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
   = note: the raw bytes of the constant (size: 1, align: 1) {
               42                                              │ B
           }

error[E0080]: constructing invalid value: encountered 0x42, but expected a boolean
##[error]  --> /checkout/tests/ui/const-generics/min_const_generics/invalid-patterns.rs:44:14
   |
LL |   get_flag::<{ unsafe { bool_raw.boolean } }, { unsafe { char_raw.character } }>();
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ it is undefined behavior to use this value
   |
   = note: the rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
   = note: the raw bytes of the constant (size: 1, align: 1) {
               42                                              │ B
           }

error[E0080]: reading memory at alloc12[0x0..0x4], but memory is uninitialized at [0x1..0x4], and this operation requires initialized memory
##[error]  --> /checkout/tests/ui/const-generics/min_const_generics/invalid-patterns.rs:44:58
   |
LL |   get_flag::<{ unsafe { bool_raw.boolean } }, { unsafe { char_raw.character } }>();
   |                                                          ^^^^^^^^^^^^^^^^^^ evaluation of `main::{constant#11}` failed here
   |
   = note: the raw bytes of the constant (size: 4, align: 4) {
               ff __ __ __                                     │ .░░░
           }

error: aborting due to 8 previous errors

Some errors have detailed explanations: E0080, E0308.
---
18 
19 error[E0308]: mismatched types
-   --> $DIR/repeat_count.rs:33:17
-    |
- LL |     let g = [0; G { g: () }];
-    |                 ^^^^^^^^^^^ expected `usize`, found `G`
- 
- error[E0308]: mismatched types
26   --> $DIR/repeat_count.rs:12:17
27    |
28 LL |     let c = [0; true];

55    |                       ^^^^^^^^ expected `usize`, found `isize`
56    |
57    = note: `-1_isize` cannot fit into type `usize`
+ 
+ error[E0308]: mismatched types
+   --> $DIR/repeat_count.rs:33:17
+    |
+ LL |     let g = [0; G { g: () }];
+    |                 ^^^^^^^^^^^ expected `usize`, found `G`
58 
59 error[E0308]: mismatched types
60   --> $DIR/repeat_count.rs:27:17

Note: some mismatched output was normalized before being compared
-   --> /checkout/tests/ui/repeat-expr/repeat_count.rs:33:17
+ 
+ error[E0308]: mismatched types
+   --> $DIR/repeat_count.rs:33:17
+    |
+ LL |     let g = [0; G { g: () }];
+    |                 ^^^^^^^^^^^ expected `usize`, found `G`


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args repeat-expr/repeat_count.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/repeat-expr/repeat_count.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/repeat-expr/repeat_count" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error[E0435]: attempt to use a non-constant value in a constant
##[error]  --> /checkout/tests/ui/repeat-expr/repeat_count.rs:7:17
   |
LL |     let a = [0; n];
   |                 ^ non-constant value
   |
help: consider using `const` instead of `let`
   |
LL -     let n = 1;
LL +     const n: /* Type */ = 1;
   |

error[E0308]: mismatched types
##[error]  --> /checkout/tests/ui/repeat-expr/repeat_count.rs:9:17
   |
LL |     let b = [0; ()];
   |                 ^^ expected `usize`, found `()`

error[E0308]: mismatched types
##[error]  --> /checkout/tests/ui/repeat-expr/repeat_count.rs:12:17
   |
LL |     let c = [0; true];
   |                 ^^^^ expected `usize`, found `bool`

error[E0308]: mismatched types
##[error]  --> /checkout/tests/ui/repeat-expr/repeat_count.rs:15:17
   |
LL |     let d = [0; 0.5];
   |                 ^^^ expected `usize`, found floating-point number

error[E0308]: mismatched types
##[error]  --> /checkout/tests/ui/repeat-expr/repeat_count.rs:18:17
   |
LL |     let e = [0; "foo"];
   |                 ^^^^^ expected `usize`, found `&str`

error[E0308]: mismatched types
##[error]  --> /checkout/tests/ui/repeat-expr/repeat_count.rs:21:17
   |
LL |     let f = [0; -4_isize];
   |                 ^^^^^^^^ expected `usize`, found `isize`
   |
   = note: `-4_isize` cannot fit into type `usize`

error[E0308]: mismatched types
##[error]  --> /checkout/tests/ui/repeat-expr/repeat_count.rs:24:23
   |
LL |     let f = [0_usize; -1_isize];
   |                       ^^^^^^^^ expected `usize`, found `isize`
   |
   = note: `-1_isize` cannot fit into type `usize`

error[E0308]: mismatched types
##[error]  --> /checkout/tests/ui/repeat-expr/repeat_count.rs:33:17
   |
LL |     let g = [0; G { g: () }];
   |                 ^^^^^^^^^^^ expected `usize`, found `G`

error[E0308]: mismatched types
##[error]  --> /checkout/tests/ui/repeat-expr/repeat_count.rs:27:17
   |
LL |     let f = [0; 4u8];
   |                 ^^^ expected `usize`, found `u8`
   |
help: change the type of the numeric literal from `u8` to `usize`
   |
LL -     let f = [0; 4u8];
LL +     let f = [0; 4usize];
   |

error: aborting due to 9 previous errors

Some errors have detailed explanations: E0308, E0435.
---
44    | ^^^^^^^^^^^^^^^^^^^^^^^^^^
45    = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
46 
- error: aborting due to 1 previous error; 2 warnings emitted
+ error: `(dyn Bar<2> + 'static)` is forbidden as the type of a const generic parameter
+   --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:3:20
+    |
+ LL | trait Foo<const N: Bar<2>> {
+    |                    ^^^^^^
+    |
+    = note: the only supported types are integers, `bool`, and `char`
+ 
+ error: `(dyn Foo<2> + 'static)` is forbidden as the type of a const generic parameter
+   --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:10:20
+    |
+ LL | trait Bar<const M: Foo<2>> {}
+    |                    ^^^^^^
+    |
+    = note: the only supported types are integers, `bool`, and `char`
+ 
+ error: aborting due to 3 previous errors; 2 warnings emitted
48 
49 For more information about this error, try `rustc --explain E0391`.
50 

Note: some mismatched output was normalized before being compared
-   --> /checkout/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.rs:3:20
-   --> /checkout/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.rs:10:20
+ error: `(dyn Bar<2> + 'static)` is forbidden as the type of a const generic parameter
+   --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:3:20
+    |
+ LL | trait Foo<const N: Bar<2>> {
+    |                    ^^^^^^
+    |
+    = note: the only supported types are integers, `bool`, and `char`
+ 
+ error: `(dyn Foo<2> + 'static)` is forbidden as the type of a const generic parameter
+   --> $DIR/ice-hir-wf-check-anon-const-issue-122989.rs:10:20
+    |
+ LL | trait Bar<const M: Foo<2>> {}
+    |                    ^^^^^^
+    |
+    = note: the only supported types are integers, `bool`, and `char`
+ 
+ error: aborting due to 3 previous errors; 2 warnings emitted
---
To only update this specific test, also pass `--test-args wf/ice-hir-wf-check-anon-const-issue-122989.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/wf/ice-hir-wf-check-anon-const-issue-122989" "-A" "unused" "-W" "unused_attributes" "-A" "internal_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2015"
stdout: none
--- stderr -------------------------------
warning: trait objects without an explicit `dyn` are deprecated
##[warning]  --> /checkout/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.rs:3:20
   |
LL | trait Foo<const N: Bar<2>> {
   |                    ^^^^^^
   |
   = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
   = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html>
   = note: `#[warn(bare_trait_objects)]` (part of `#[warn(rust_2021_compatibility)]`) on by default
help: if this is a dyn-compatible trait, use `dyn`
   |
LL | trait Foo<const N: dyn Bar<2>> {
   |                    +++

warning: trait objects without an explicit `dyn` are deprecated
##[warning]  --> /checkout/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.rs:10:20
   |
LL | trait Bar<const M: Foo<2>> {}
   |                    ^^^^^^
   |
   = warning: this is accepted in the current edition (Rust 2015) but is a hard error in Rust 2021!
   = note: for more information, see <https://doc.rust-lang.org/edition-guide/rust-2021/warnings-promoted-to-error.html>
help: if this is a dyn-compatible trait, use `dyn`
   |
LL | trait Bar<const M: dyn Foo<2>> {}
   |                    +++

error[E0391]: cycle detected when computing type of `Foo::N`
##[error]  --> /checkout/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.rs:3:11
   |
LL | trait Foo<const N: Bar<2>> {
   |           ^^^^^^^^^^^^^^^
   |
note: ...which requires computing type of `Bar::M`...
  --> /checkout/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.rs:10:11
   |
LL | trait Bar<const M: Foo<2>> {}
   |           ^^^^^^^^^^^^^^^
   = note: ...which again requires computing type of `Foo::N`, completing the cycle
note: cycle used when checking that `Foo` is well-formed
  --> /checkout/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.rs:3:1
   |
LL | trait Foo<const N: Bar<2>> {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^
   = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information

error: `(dyn Bar<2> + 'static)` is forbidden as the type of a const generic parameter
##[error]  --> /checkout/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.rs:3:20
   |
LL | trait Foo<const N: Bar<2>> {
   |                    ^^^^^^
   |
   = note: the only supported types are integers, `bool`, and `char`

error: `(dyn Foo<2> + 'static)` is forbidden as the type of a const generic parameter
##[error]  --> /checkout/tests/ui/wf/ice-hir-wf-check-anon-const-issue-122989.rs:10:20
   |
LL | trait Bar<const M: Foo<2>> {}
   |                    ^^^^^^
   |
   = note: the only supported types are integers, `bool`, and `char`

error: aborting due to 3 previous errors; 2 warnings emitted

@BoxyUwU BoxyUwU self-assigned this Feb 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ICE]: ty::ConstKind::Error constructed but no error reported ICE: ty::ConstKind::Error constructed but no error reported

4 participants