about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeón Orell Valerian Liehr <me@fmease.dev>2025-06-26 15:15:21 +0200
committerLeón Orell Valerian Liehr <me@fmease.dev>2025-06-26 15:42:57 +0200
commit169e81cd5994c7612c795b6b2b45b787a7d57559 (patch)
tree42c898bc03e6313c2992e0dfb33832823ddf3565
parent40daf23eeb711dadf140b2536e67e3ff4c999196 (diff)
downloadrust-169e81cd5994c7612c795b6b2b45b787a7d57559.tar.gz
rust-169e81cd5994c7612c795b6b2b45b787a7d57559.zip
Move an ACE test out of the GCI directory
-rw-r--r--tests/ui/associated-consts/assoc-const-eq-const_evaluatable_unchecked.rs17
-rw-r--r--tests/ui/generic-const-items/assoc-const-AnonConst-ice-108220.rs35
2 files changed, 17 insertions, 35 deletions
diff --git a/tests/ui/associated-consts/assoc-const-eq-const_evaluatable_unchecked.rs b/tests/ui/associated-consts/assoc-const-eq-const_evaluatable_unchecked.rs
new file mode 100644
index 00000000000..4b6de6f56d5
--- /dev/null
+++ b/tests/ui/associated-consts/assoc-const-eq-const_evaluatable_unchecked.rs
@@ -0,0 +1,17 @@
+// The impl of lint `const_evaluatable_unchecked` used to wrongly assume and `assert!` that
+// successfully evaluating a type-system constant that has non-region args had to be an anon const.
+// In the case below however we have a type-system assoc const (here: `<() as TraitA<T>>::K`).
+//
+// issue: <https://github.com/rust-lang/rust/issues/108220>
+//@ check-pass
+#![feature(associated_const_equality)]
+
+pub trait TraitA<T> { const K: u8 = 0; }
+pub trait TraitB<T> {}
+
+impl<T> TraitA<T> for () {}
+impl<T> TraitB<T> for () where (): TraitA<T, K = 0> {}
+
+fn check<T>() where (): TraitB<T> {}
+
+fn main() {}
diff --git a/tests/ui/generic-const-items/assoc-const-AnonConst-ice-108220.rs b/tests/ui/generic-const-items/assoc-const-AnonConst-ice-108220.rs
deleted file mode 100644
index f5babb67b56..00000000000
--- a/tests/ui/generic-const-items/assoc-const-AnonConst-ice-108220.rs
+++ /dev/null
@@ -1,35 +0,0 @@
-// ICE assertion failed: matches!(self.def_kind(ct.def.did), DefKind :: AnonConst)
-// issue: rust-lang/rust#108220
-//@ check-pass
-
-#![feature(associated_const_equality)]
-#![allow(unused)]
-
-use std::marker::PhantomData;
-
-pub struct NoPin;
-
-pub trait SetAlternate<const A: u8> {}
-
-impl SetAlternate<0> for NoPin {}
-
-pub trait PinA<PER> {
-    const A: u8;
-}
-
-impl<PER> PinA<PER> for NoPin {
-    const A: u8 = 0;
-}
-
-pub trait Pins<USART> {}
-
-impl<USART, T, const TA: u8> Pins<USART> for T where
-    T: PinA<USART, A = { TA }> + SetAlternate<TA>
-{
-}
-
-struct Serial<USART>(PhantomData<USART>);
-
-impl<USART> Serial<USART> where NoPin: Pins<USART> {}
-
-fn main() {}