From fa66288a32bc202b4a12513d1961190025d2d576 Mon Sep 17 00:00:00 2001 From: lcnr Date: Tue, 26 Nov 2024 12:05:39 +0100 Subject: [PATCH] update crashes --- tests/crashes/129444.rs | 15 ---- .../coherence/fuzzing/best-obligation-ICE.rs | 20 ++++++ .../fuzzing/best-obligation-ICE.stderr | 69 +++++++++++++++++++ 3 files changed, 89 insertions(+), 15 deletions(-) delete mode 100644 tests/crashes/129444.rs create mode 100644 tests/ui/coherence/fuzzing/best-obligation-ICE.rs create mode 100644 tests/ui/coherence/fuzzing/best-obligation-ICE.stderr diff --git a/tests/crashes/129444.rs b/tests/crashes/129444.rs deleted file mode 100644 index b1b547b5191bd..0000000000000 --- a/tests/crashes/129444.rs +++ /dev/null @@ -1,15 +0,0 @@ -//@ known-bug: rust-lang/rust#129444 - -//@ compile-flags: -Znext-solver=coherence - -trait Trait { - type Assoc; -} - -struct W(*mut T); -impl Trait for W>> {} - -trait NoOverlap {} -impl>> NoOverlap for T {} - -impl> NoOverlap for W {} diff --git a/tests/ui/coherence/fuzzing/best-obligation-ICE.rs b/tests/ui/coherence/fuzzing/best-obligation-ICE.rs new file mode 100644 index 0000000000000..49f40b579d400 --- /dev/null +++ b/tests/ui/coherence/fuzzing/best-obligation-ICE.rs @@ -0,0 +1,20 @@ +// A regression test for #129444. This previously ICE'd as +// computing the best obligation for one ambiguous obligation +// added spurious inference constraints which caused another +// candidate to pass. +trait Trait { + type Assoc; +} + +struct W(*mut T); +impl Trait for W>> {} +//~^ ERROR the trait bound `W>: Trait` is not satisfied +//~| ERROR the trait bound `W: Trait` is not satisfied +//~| ERROR the trait bound `T: Trait` is not satisfied +//~| ERROR not all trait items implemented, missing: `Assoc` + +trait NoOverlap {} +impl NoOverlap for T {} +impl> NoOverlap for W {} +//~^ ERROR conflicting implementations of trait `NoOverlap` for type `W>>>` +fn main() {} diff --git a/tests/ui/coherence/fuzzing/best-obligation-ICE.stderr b/tests/ui/coherence/fuzzing/best-obligation-ICE.stderr new file mode 100644 index 0000000000000..88de8023f6d79 --- /dev/null +++ b/tests/ui/coherence/fuzzing/best-obligation-ICE.stderr @@ -0,0 +1,69 @@ +error[E0277]: the trait bound `W>: Trait` is not satisfied + --> $DIR/best-obligation-ICE.rs:10:19 + | +LL | impl Trait for W>> {} + | ^^^^^^^^^^ the trait `Trait` is not implemented for `W>` + | +note: required by a bound in `W` + --> $DIR/best-obligation-ICE.rs:9:13 + | +LL | struct W(*mut T); + | ^^^^^ required by this bound in `W` +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement + | +LL | impl Trait for W>> where W>: Trait {} + | ++++++++++++++++++++ + +error[E0277]: the trait bound `W: Trait` is not satisfied + --> $DIR/best-obligation-ICE.rs:10:19 + | +LL | impl Trait for W>> {} + | ^^^^^^^^^^ the trait `Trait` is not implemented for `W` + | +note: required by a bound in `W` + --> $DIR/best-obligation-ICE.rs:9:13 + | +LL | struct W(*mut T); + | ^^^^^ required by this bound in `W` +help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement + | +LL | impl Trait for W>> where W: Trait {} + | +++++++++++++++++ + +error[E0277]: the trait bound `T: Trait` is not satisfied + --> $DIR/best-obligation-ICE.rs:10:19 + | +LL | impl Trait for W>> {} + | ^^^^^^^^^^ the trait `Trait` is not implemented for `T` + | +note: required by a bound in `W` + --> $DIR/best-obligation-ICE.rs:9:13 + | +LL | struct W(*mut T); + | ^^^^^ required by this bound in `W` +help: consider restricting type parameter `T` + | +LL | impl Trait for W>> {} + | +++++++ + +error[E0046]: not all trait items implemented, missing: `Assoc` + --> $DIR/best-obligation-ICE.rs:10:1 + | +LL | type Assoc; + | ---------- `Assoc` from trait +... +LL | impl Trait for W>> {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `Assoc` in implementation + +error[E0119]: conflicting implementations of trait `NoOverlap` for type `W>>>` + --> $DIR/best-obligation-ICE.rs:18:1 + | +LL | impl NoOverlap for T {} + | ------------------------------ first implementation here +LL | impl> NoOverlap for W {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `W>>>` + +error: aborting due to 5 previous errors + +Some errors have detailed explanations: E0046, E0119, E0277. +For more information about an error, try `rustc --explain E0046`.