diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2025-06-07 22:22:58 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-07 22:22:58 +0200 |
| commit | 7c3cb5688d55f4e6d1ca5f2e2b2893864aa6b437 (patch) | |
| tree | 1bf33e68930d39092127d3ad485318471dfd0dc9 /tests | |
| parent | 215dc8c49934db724384fefad532d1a67a808d29 (diff) | |
| parent | aa1b296dd6ff158a8fac8e33fb575b24d960ede9 (diff) | |
Rollup merge of #142126 - compiler-errors:normalize-uv-via-relate, r=BoxyUwU
Treat normalizing consts like normalizing types in deeply normalize ...so that we don't end up putting a top-level normalizes-to goal in the fulfillment context, which ICEs. This basically just models the normalize-const code off of the normalize-ty code above it, which uses an alias-relate goal instead. Fixes rust-lang/rust#140571 r? lcnr
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/specialization/overlap-due-to-unsatisfied-const-bound.rs (renamed from tests/crashes/140571.rs) | 11 | ||||
| -rw-r--r-- | tests/ui/specialization/overlap-due-to-unsatisfied-const-bound.stderr | 21 |
2 files changed, 30 insertions, 2 deletions
diff --git a/tests/crashes/140571.rs b/tests/ui/specialization/overlap-due-to-unsatisfied-const-bound.rs index 97fa1d8432d..f4cde1d62b2 100644 --- a/tests/crashes/140571.rs +++ b/tests/ui/specialization/overlap-due-to-unsatisfied-const-bound.rs @@ -1,14 +1,21 @@ -//@ known-bug: #140571 +// Regression test for #140571. The compiler used to ICE + +#![feature(associated_const_equality, specialization)] +//~^ WARN the feature `specialization` is incomplete + pub trait IsVoid { const IS_VOID: bool; } impl<T> IsVoid for T { default const IS_VOID: bool = false; } -impl<T> Maybe<T> for () where T: NotVoid + ?Sized {} pub trait NotVoid {} impl<T> NotVoid for T where T: IsVoid<IS_VOID = false> + ?Sized {} pub trait Maybe<T> {} impl<T> Maybe<T> for T {} +impl<T> Maybe<T> for () where T: NotVoid + ?Sized {} +//~^ ERROR conflicting implementations of trait `Maybe<()>` for type `()` + +fn main() {} diff --git a/tests/ui/specialization/overlap-due-to-unsatisfied-const-bound.stderr b/tests/ui/specialization/overlap-due-to-unsatisfied-const-bound.stderr new file mode 100644 index 00000000000..a26b30fbb63 --- /dev/null +++ b/tests/ui/specialization/overlap-due-to-unsatisfied-const-bound.stderr @@ -0,0 +1,21 @@ +warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/overlap-due-to-unsatisfied-const-bound.rs:3:39 + | +LL | #![feature(associated_const_equality, specialization)] + | ^^^^^^^^^^^^^^ + | + = note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information + = help: consider using `min_specialization` instead, which is more stable and complete + = note: `#[warn(incomplete_features)]` on by default + +error[E0119]: conflicting implementations of trait `Maybe<()>` for type `()` + --> $DIR/overlap-due-to-unsatisfied-const-bound.rs:18:1 + | +LL | impl<T> Maybe<T> for T {} + | ---------------------- first implementation here +LL | impl<T> Maybe<T> for () where T: NotVoid + ?Sized {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `()` + +error: aborting due to 1 previous error; 1 warning emitted + +For more information about this error, try `rustc --explain E0119`. |
