Skip to content

Commit

Permalink
update crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
lcnr committed Nov 26, 2024
1 parent d25ecfd commit fa66288
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 15 deletions.
15 changes: 0 additions & 15 deletions tests/crashes/129444.rs

This file was deleted.

20 changes: 20 additions & 0 deletions tests/ui/coherence/fuzzing/best-obligation-ICE.rs
Original file line number Diff line number Diff line change
@@ -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<T: Trait>(*mut T);
impl<T> Trait for W<W<W<T>>> {}
//~^ ERROR the trait bound `W<W<T>>: Trait` is not satisfied
//~| ERROR the trait bound `W<T>: Trait` is not satisfied
//~| ERROR the trait bound `T: Trait` is not satisfied
//~| ERROR not all trait items implemented, missing: `Assoc`

trait NoOverlap {}
impl<T: Trait> NoOverlap for T {}
impl<T: Trait<Assoc = u32>> NoOverlap for W<T> {}
//~^ ERROR conflicting implementations of trait `NoOverlap` for type `W<W<W<W<_>>>>`
fn main() {}
69 changes: 69 additions & 0 deletions tests/ui/coherence/fuzzing/best-obligation-ICE.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
error[E0277]: the trait bound `W<W<T>>: Trait` is not satisfied
--> $DIR/best-obligation-ICE.rs:10:19
|
LL | impl<T> Trait for W<W<W<T>>> {}
| ^^^^^^^^^^ the trait `Trait` is not implemented for `W<W<T>>`
|
note: required by a bound in `W`
--> $DIR/best-obligation-ICE.rs:9:13
|
LL | struct W<T: Trait>(*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<T> Trait for W<W<W<T>>> where W<W<T>>: Trait {}
| ++++++++++++++++++++

error[E0277]: the trait bound `W<T>: Trait` is not satisfied
--> $DIR/best-obligation-ICE.rs:10:19
|
LL | impl<T> Trait for W<W<W<T>>> {}
| ^^^^^^^^^^ the trait `Trait` is not implemented for `W<T>`
|
note: required by a bound in `W`
--> $DIR/best-obligation-ICE.rs:9:13
|
LL | struct W<T: Trait>(*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<T> Trait for W<W<W<T>>> where W<T>: Trait {}
| +++++++++++++++++

error[E0277]: the trait bound `T: Trait` is not satisfied
--> $DIR/best-obligation-ICE.rs:10:19
|
LL | impl<T> Trait for W<W<W<T>>> {}
| ^^^^^^^^^^ 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<T: Trait>(*mut T);
| ^^^^^ required by this bound in `W`
help: consider restricting type parameter `T`
|
LL | impl<T: Trait> Trait for W<W<W<T>>> {}
| +++++++

error[E0046]: not all trait items implemented, missing: `Assoc`
--> $DIR/best-obligation-ICE.rs:10:1
|
LL | type Assoc;
| ---------- `Assoc` from trait
...
LL | impl<T> Trait for W<W<W<T>>> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `Assoc` in implementation

error[E0119]: conflicting implementations of trait `NoOverlap` for type `W<W<W<W<_>>>>`
--> $DIR/best-obligation-ICE.rs:18:1
|
LL | impl<T: Trait> NoOverlap for T {}
| ------------------------------ first implementation here
LL | impl<T: Trait<Assoc = u32>> NoOverlap for W<T> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `W<W<W<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`.

0 comments on commit fa66288

Please sign in to comment.