diff options
| author | Michael Goulet <michael@errs.io> | 2025-06-26 20:15:29 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-26 20:15:29 -0400 |
| commit | 49944c36850fef34cb103f99a88a09c46314becc (patch) | |
| tree | 372874cd8e69a737824c584ffe2ee249e039c8cd | |
| parent | 4a3293402279c8399162787d789e506a08a6d3ab (diff) | |
| parent | 169e81cd5994c7612c795b6b2b45b787a7d57559 (diff) | |
| download | rust-49944c36850fef34cb103f99a88a09c46314becc.tar.gz rust-49944c36850fef34cb103f99a88a09c46314becc.zip | |
Rollup merge of #143056 - fmease:mv-ace-test-out-of-gci-dir, r=BoxyUwU
Move an ACE test out of the GCI directory In https://github.com/rust-lang/rust/pull/122988, a test pertaining to `associated_const_equality` was placed into the directory meant for `generic_const_items`. Let's move it where it belongs. While at it, I took the time to further minimize the test and to add a description. You can use 1.67.1 (as reported in rust-lang/rust#108220) to verify that I didn't butcher it. For additional context, the issue was likely fixed in rust-lang/rust#112718 (but I'm also cc'ing rust-lang/rust#140467 which further fixed things up and has more context). I only performed quick and dirty git/GitHub archeology, so I don't have the full picture here. For one, I'm not even sure if this regression test is worth it. Anyway, I just want it gone from the GCI dir :)
| -rw-r--r-- | tests/ui/associated-consts/assoc-const-eq-const_evaluatable_unchecked.rs | 17 | ||||
| -rw-r--r-- | tests/ui/generic-const-items/assoc-const-AnonConst-ice-108220.rs | 35 |
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() {} |
