From dbb33c77ab2b072b40e1a03f2dc30ef5bf768780 Mon Sep 17 00:00:00 2001 From: Noah Lev Date: Sat, 1 Nov 2025 14:39:21 -0400 Subject: [PATCH] Update crashes tests based on fixed or changed ICEs --- tests/crashes/119783.rs | 7 +++-- tests/crashes/131046.rs | 15 ----------- tests/crashes/134641.rs | 13 ---------- tests/crashes/138089.rs | 1 + .../associated_const_equality/coherence.rs | 18 +++++++++++++ .../coherence.stderr | 11 ++++++++ ...es-with-generic-in-ace-no-feature-gate.rs} | 4 +-- ...with-generic-in-ace-no-feature-gate.stderr | 23 ++++++++++++++++ .../mismatched-types-with-generic-in-ace.rs} | 8 +++--- ...ismatched-types-with-generic-in-ace.stderr | 26 +++++++++++++++++++ 10 files changed, 91 insertions(+), 35 deletions(-) delete mode 100644 tests/crashes/131046.rs delete mode 100644 tests/crashes/134641.rs create mode 100644 tests/ui/const-generics/associated_const_equality/coherence.rs create mode 100644 tests/ui/const-generics/associated_const_equality/coherence.stderr rename tests/{crashes/131406.rs => ui/const-generics/associated_const_equality/mismatched-types-with-generic-in-ace-no-feature-gate.rs} (61%) create mode 100644 tests/ui/const-generics/associated_const_equality/mismatched-types-with-generic-in-ace-no-feature-gate.stderr rename tests/{crashes/127643.rs => ui/const-generics/associated_const_equality/mismatched-types-with-generic-in-ace.rs} (51%) create mode 100644 tests/ui/const-generics/associated_const_equality/mismatched-types-with-generic-in-ace.stderr diff --git a/tests/crashes/119783.rs b/tests/crashes/119783.rs index 9a41abe69206..efde7f89ade2 100644 --- a/tests/crashes/119783.rs +++ b/tests/crashes/119783.rs @@ -1,7 +1,10 @@ //@ known-bug: #119783 -#![feature(associated_const_equality)] +#![feature(associated_const_equality, min_generic_const_args)] -trait Trait { const F: fn(); } +trait Trait { + #[type_const] + const F: fn(); +} fn take(_: impl Trait) {} diff --git a/tests/crashes/131046.rs b/tests/crashes/131046.rs deleted file mode 100644 index 2638705ae18b..000000000000 --- a/tests/crashes/131046.rs +++ /dev/null @@ -1,15 +0,0 @@ -//@ known-bug: #131046 - -trait Owner { - const C: u32; -} - -impl Owner for () { - const C: u32 = N; -} - -fn take0(_: impl Owner = { N }>) {} - -fn main() { - take0::<128>(()); -} diff --git a/tests/crashes/134641.rs b/tests/crashes/134641.rs deleted file mode 100644 index e3e5ab69287b..000000000000 --- a/tests/crashes/134641.rs +++ /dev/null @@ -1,13 +0,0 @@ -//@ known-bug: #134641 -#![feature(associated_const_equality)] - -pub trait IsVoid { - const IS_VOID: bool; -} -impl IsVoid for () { - const IS_VOID: bool = true; -} - -pub trait Maybe {} -impl Maybe for () {} -impl Maybe for () where (): IsVoid {} diff --git a/tests/crashes/138089.rs b/tests/crashes/138089.rs index acf27072bdd5..054d1b216959 100644 --- a/tests/crashes/138089.rs +++ b/tests/crashes/138089.rs @@ -5,6 +5,7 @@ struct OnDiskDirEntry<'a> {} impl<'a> OnDiskDirEntry<'a> { + #[type_const] const LFN_FRAGMENT_LEN: i64 = 2; fn lfn_contents() -> [char; Self::LFN_FRAGMENT_LEN] { diff --git a/tests/ui/const-generics/associated_const_equality/coherence.rs b/tests/ui/const-generics/associated_const_equality/coherence.rs new file mode 100644 index 000000000000..fb5f255c1dc4 --- /dev/null +++ b/tests/ui/const-generics/associated_const_equality/coherence.rs @@ -0,0 +1,18 @@ +#![feature(associated_const_equality, min_generic_const_args)] +#![expect(incomplete_features)] + +pub trait IsVoid { + #[type_const] + const IS_VOID: bool; +} +impl IsVoid for () { + #[type_const] + const IS_VOID: bool = true; +} + +pub trait Maybe {} +impl Maybe for () {} +impl Maybe for () where (): IsVoid {} +//~^ ERROR conflicting implementations of trait `Maybe` for type `()` + +fn main() {} diff --git a/tests/ui/const-generics/associated_const_equality/coherence.stderr b/tests/ui/const-generics/associated_const_equality/coherence.stderr new file mode 100644 index 000000000000..23d6495a16a4 --- /dev/null +++ b/tests/ui/const-generics/associated_const_equality/coherence.stderr @@ -0,0 +1,11 @@ +error[E0119]: conflicting implementations of trait `Maybe` for type `()` + --> $DIR/coherence.rs:15:1 + | +LL | impl Maybe for () {} + | ----------------- first implementation here +LL | impl Maybe for () where (): IsVoid {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `()` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/crashes/131406.rs b/tests/ui/const-generics/associated_const_equality/mismatched-types-with-generic-in-ace-no-feature-gate.rs similarity index 61% rename from tests/crashes/131406.rs rename to tests/ui/const-generics/associated_const_equality/mismatched-types-with-generic-in-ace-no-feature-gate.rs index ea642f949280..1bc7c3cf3391 100644 --- a/tests/crashes/131406.rs +++ b/tests/ui/const-generics/associated_const_equality/mismatched-types-with-generic-in-ace-no-feature-gate.rs @@ -1,11 +1,11 @@ -//@ known-bug: #131406 - trait Owner { const C: u32 = N; + //~^ ERROR: generic const items are experimental } impl Owner for () {} fn take0(_: impl Owner = { N }>) {} +//~^ ERROR: associated const equality is incomplete fn main() { take0::<128>(()); diff --git a/tests/ui/const-generics/associated_const_equality/mismatched-types-with-generic-in-ace-no-feature-gate.stderr b/tests/ui/const-generics/associated_const_equality/mismatched-types-with-generic-in-ace-no-feature-gate.stderr new file mode 100644 index 000000000000..0b487b6a7aa0 --- /dev/null +++ b/tests/ui/const-generics/associated_const_equality/mismatched-types-with-generic-in-ace-no-feature-gate.stderr @@ -0,0 +1,23 @@ +error[E0658]: associated const equality is incomplete + --> $DIR/mismatched-types-with-generic-in-ace-no-feature-gate.rs:7:38 + | +LL | fn take0(_: impl Owner = { N }>) {} + | ^^^^^^^^^^^^ + | + = note: see issue #92827 for more information + = help: add `#![feature(associated_const_equality)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error[E0658]: generic const items are experimental + --> $DIR/mismatched-types-with-generic-in-ace-no-feature-gate.rs:2:12 + | +LL | const C: u32 = N; + | ^^^^^^^^^^^^^^ + | + = note: see issue #113521 for more information + = help: add `#![feature(generic_const_items)]` to the crate attributes to enable + = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/crashes/127643.rs b/tests/ui/const-generics/associated_const_equality/mismatched-types-with-generic-in-ace.rs similarity index 51% rename from tests/crashes/127643.rs rename to tests/ui/const-generics/associated_const_equality/mismatched-types-with-generic-in-ace.rs index b5ec58b70e93..33afa7e3228e 100644 --- a/tests/crashes/127643.rs +++ b/tests/ui/const-generics/associated_const_equality/mismatched-types-with-generic-in-ace.rs @@ -1,18 +1,20 @@ -//@ known-bug: #127643 - -#![feature(generic_const_items, associated_const_equality)] +#![feature(generic_const_items, associated_const_equality, min_generic_const_args)] #![expect(incomplete_features)] trait Foo { + #[type_const] const ASSOC: u32; } impl Foo for () { + #[type_const] const ASSOC: u32 = N; } fn bar = { N }>>() {} +//~^ ERROR: the constant `N` is not of type `u32` fn main() { bar::<10_u64, ()>(); + //~^ ERROR: the constant `10` is not of type `u32` } diff --git a/tests/ui/const-generics/associated_const_equality/mismatched-types-with-generic-in-ace.stderr b/tests/ui/const-generics/associated_const_equality/mismatched-types-with-generic-in-ace.stderr new file mode 100644 index 000000000000..c2fb7faa3a3a --- /dev/null +++ b/tests/ui/const-generics/associated_const_equality/mismatched-types-with-generic-in-ace.stderr @@ -0,0 +1,26 @@ +error: the constant `N` is not of type `u32` + --> $DIR/mismatched-types-with-generic-in-ace.rs:14:29 + | +LL | fn bar = { N }>>() {} + | ^^^^^^^^^^^^^^^^ expected `u32`, found `u64` + | +note: required by a const generic parameter in `Foo::ASSOC` + --> $DIR/mismatched-types-with-generic-in-ace.rs:6:17 + | +LL | const ASSOC: u32; + | ^^^^^^^^^^^^ required by this const generic parameter in `Foo::ASSOC` + +error: the constant `10` is not of type `u32` + --> $DIR/mismatched-types-with-generic-in-ace.rs:18:5 + | +LL | bar::<10_u64, ()>(); + | ^^^^^^^^^^^^^^^^^^^ expected `u32`, found `u64` + | +note: required by a const generic parameter in `Foo::ASSOC` + --> $DIR/mismatched-types-with-generic-in-ace.rs:6:17 + | +LL | const ASSOC: u32; + | ^^^^^^^^^^^^ required by this const generic parameter in `Foo::ASSOC` + +error: aborting due to 2 previous errors +