diff options
| author | Michael Goulet <michael@errs.io> | 2024-05-07 21:54:19 -0400 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2024-05-16 10:00:11 -0400 |
| commit | d3e510eb9dcb81059d5bc31cbbf212b8d96537cf (patch) | |
| tree | 4bf302266b0d040ec08ac415b9efc2742582ee5b /tests | |
| parent | bf8801d36dfd28de7d3b0279b53d38593acdfd14 (diff) | |
| download | rust-d3e510eb9dcb81059d5bc31cbbf212b8d96537cf.tar.gz rust-d3e510eb9dcb81059d5bc31cbbf212b8d96537cf.zip | |
Don't ICE because recomputing overflow goals during find_best_leaf_obligation causes inference side-effects
Diffstat (limited to 'tests')
17 files changed, 81 insertions, 179 deletions
diff --git a/tests/ui/traits/next-solver/coherence/coherence-fulfill-overflow.stderr b/tests/ui/traits/next-solver/coherence/coherence-fulfill-overflow.stderr index 6e68646fbe4..57cba790b55 100644 --- a/tests/ui/traits/next-solver/coherence/coherence-fulfill-overflow.stderr +++ b/tests/ui/traits/next-solver/coherence/coherence-fulfill-overflow.stderr @@ -1,12 +1,12 @@ -error[E0119]: conflicting implementations of trait `Trait` for type `W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<_>>>>>>>>>>>>>>>>>>>>>>` +error[E0119]: conflicting implementations of trait `Trait` for type `W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<_>>>>>>>>>>>>>>>>>>>>>` --> $DIR/coherence-fulfill-overflow.rs:12:1 | LL | impl<T: ?Sized + TwoW> Trait for W<T> {} | ------------------------------------- first implementation here LL | impl<T: ?Sized + TwoW> Trait for T {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<_>>>>>>>>>>>>>>>>>>>>>>` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<_>>>>>>>>>>>>>>>>>>>>>` | - = note: overflow evaluating the requirement `W<W<W<W<_>>>>: TwoW` + = note: overflow evaluating the requirement `W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<W<_>>>>>>>>>>>>>>>>>>>>>: TwoW` = help: consider increasing the recursion limit by adding a `#![recursion_limit = "20"]` attribute to your crate (`coherence_fulfill_overflow`) error: aborting due to 1 previous error diff --git a/tests/ui/traits/next-solver/cycles/coinduction/fixpoint-exponential-growth.stderr b/tests/ui/traits/next-solver/cycles/coinduction/fixpoint-exponential-growth.stderr index df25150c21f..8d7d8cee08a 100644 --- a/tests/ui/traits/next-solver/cycles/coinduction/fixpoint-exponential-growth.stderr +++ b/tests/ui/traits/next-solver/cycles/coinduction/fixpoint-exponential-growth.stderr @@ -1,16 +1,9 @@ -error[E0275]: overflow evaluating the requirement `_: Sized` +error[E0275]: overflow evaluating the requirement `W<_>: Trait` --> $DIR/fixpoint-exponential-growth.rs:33:13 | LL | impls::<W<_>>(); | ^^^^ | -note: required for `W<(W<_>, W<_>)>` to implement `Trait` - --> $DIR/fixpoint-exponential-growth.rs:23:12 - | -LL | impl<T, U> Trait for W<(W<T>, W<U>)> - | - ^^^^^ ^^^^^^^^^^^^^^^ - | | - | unsatisfied trait bound introduced here note: required by a bound in `impls` --> $DIR/fixpoint-exponential-growth.rs:30:13 | diff --git a/tests/ui/traits/next-solver/cycles/double-cycle-inductive-coinductive.stderr b/tests/ui/traits/next-solver/cycles/double-cycle-inductive-coinductive.stderr index 86c71ad92ff..7cedb4d36c9 100644 --- a/tests/ui/traits/next-solver/cycles/double-cycle-inductive-coinductive.stderr +++ b/tests/ui/traits/next-solver/cycles/double-cycle-inductive-coinductive.stderr @@ -1,53 +1,21 @@ -error[E0275]: overflow evaluating the requirement `(): Inductive` +error[E0275]: overflow evaluating the requirement `(): Trait` --> $DIR/double-cycle-inductive-coinductive.rs:32:19 | LL | impls_trait::<()>(); | ^^ | -note: required for `()` to implement `Trait` - --> $DIR/double-cycle-inductive-coinductive.rs:9:34 - | -LL | impl<T: Inductive + Coinductive> Trait for T {} - | --------- ^^^^^ ^ - | | - | unsatisfied trait bound introduced here -note: required for `()` to implement `Inductive` - --> $DIR/double-cycle-inductive-coinductive.rs:12:16 - | -LL | impl<T: Trait> Inductive for T {} - | ----- ^^^^^^^^^ ^ - | | - | unsatisfied trait bound introduced here - = note: 7 redundant requirements hidden - = note: required for `()` to implement `Trait` note: required by a bound in `impls_trait` --> $DIR/double-cycle-inductive-coinductive.rs:17:19 | LL | fn impls_trait<T: Trait>() {} | ^^^^^ required by this bound in `impls_trait` -error[E0275]: overflow evaluating the requirement `(): CoinductiveRev` +error[E0275]: overflow evaluating the requirement `(): TraitRev` --> $DIR/double-cycle-inductive-coinductive.rs:35:23 | LL | impls_trait_rev::<()>(); | ^^ | -note: required for `()` to implement `TraitRev` - --> $DIR/double-cycle-inductive-coinductive.rs:21:40 - | -LL | impl<T: CoinductiveRev + InductiveRev> TraitRev for T {} - | -------------- ^^^^^^^^ ^ - | | - | unsatisfied trait bound introduced here -note: required for `()` to implement `CoinductiveRev` - --> $DIR/double-cycle-inductive-coinductive.rs:27:19 - | -LL | impl<T: TraitRev> CoinductiveRev for T {} - | -------- ^^^^^^^^^^^^^^ ^ - | | - | unsatisfied trait bound introduced here - = note: 7 redundant requirements hidden - = note: required for `()` to implement `TraitRev` note: required by a bound in `impls_trait_rev` --> $DIR/double-cycle-inductive-coinductive.rs:29:23 | diff --git a/tests/ui/traits/next-solver/cycles/inductive-fixpoint-hang.stderr b/tests/ui/traits/next-solver/cycles/inductive-fixpoint-hang.stderr index ea46c0fea97..a2a5c028cf8 100644 --- a/tests/ui/traits/next-solver/cycles/inductive-fixpoint-hang.stderr +++ b/tests/ui/traits/next-solver/cycles/inductive-fixpoint-hang.stderr @@ -1,19 +1,9 @@ -error[E0275]: overflow evaluating the requirement `W<W<_>>: Trait` +error[E0275]: overflow evaluating the requirement `W<_>: Trait` --> $DIR/inductive-fixpoint-hang.rs:31:19 | LL | impls_trait::<W<_>>(); | ^^^^ | -note: required for `W<W<W<_>>>` to implement `Trait` - --> $DIR/inductive-fixpoint-hang.rs:22:17 - | -LL | impl<T: ?Sized> Trait for W<W<T>> - | ^^^^^ ^^^^^^^ -LL | where -LL | W<T>: Trait, - | ----- unsatisfied trait bound introduced here - = note: 8 redundant requirements hidden - = note: required for `W<W<W<W<W<W<W<W<W<W<W<_>>>>>>>>>>>` to implement `Trait` note: required by a bound in `impls_trait` --> $DIR/inductive-fixpoint-hang.rs:28:19 | diff --git a/tests/ui/traits/next-solver/cycles/inductive-not-on-stack.rs b/tests/ui/traits/next-solver/cycles/inductive-not-on-stack.rs index 9d0ea51b1b2..78683372580 100644 --- a/tests/ui/traits/next-solver/cycles/inductive-not-on-stack.rs +++ b/tests/ui/traits/next-solver/cycles/inductive-not-on-stack.rs @@ -39,7 +39,7 @@ fn impls_ar<T: AR>() {} fn main() { impls_a::<()>(); - //~^ ERROR overflow evaluating the requirement `(): B` + //~^ ERROR overflow evaluating the requirement `(): A` impls_ar::<()>(); //~^ ERROR overflow evaluating the requirement `(): AR` diff --git a/tests/ui/traits/next-solver/cycles/inductive-not-on-stack.stderr b/tests/ui/traits/next-solver/cycles/inductive-not-on-stack.stderr index fe02d3c407c..e9cc6bc6c81 100644 --- a/tests/ui/traits/next-solver/cycles/inductive-not-on-stack.stderr +++ b/tests/ui/traits/next-solver/cycles/inductive-not-on-stack.stderr @@ -1,25 +1,9 @@ -error[E0275]: overflow evaluating the requirement `(): B` +error[E0275]: overflow evaluating the requirement `(): A` --> $DIR/inductive-not-on-stack.rs:41:15 | LL | impls_a::<()>(); | ^^ | -note: required for `()` to implement `A` - --> $DIR/inductive-not-on-stack.rs:21:16 - | -LL | impl<T: B + C> A for T {} - | - ^ ^ - | | - | unsatisfied trait bound introduced here -note: required for `()` to implement `B` - --> $DIR/inductive-not-on-stack.rs:22:12 - | -LL | impl<T: A> B for T {} - | - ^ ^ - | | - | unsatisfied trait bound introduced here - = note: 7 redundant requirements hidden - = note: required for `()` to implement `A` note: required by a bound in `impls_a` --> $DIR/inductive-not-on-stack.rs:25:15 | @@ -32,29 +16,6 @@ error[E0275]: overflow evaluating the requirement `(): AR` LL | impls_ar::<()>(); | ^^ | -note: required for `()` to implement `BR` - --> $DIR/inductive-not-on-stack.rs:35:13 - | -LL | impl<T: AR> BR for T {} - | -- ^^ ^ - | | - | unsatisfied trait bound introduced here -note: required for `()` to implement `CR` - --> $DIR/inductive-not-on-stack.rs:36:13 - | -LL | impl<T: BR> CR for T {} - | -- ^^ ^ - | | - | unsatisfied trait bound introduced here -note: required for `()` to implement `AR` - --> $DIR/inductive-not-on-stack.rs:34:18 - | -LL | impl<T: CR + BR> AR for T {} - | -- ^^ ^ - | | - | unsatisfied trait bound introduced here - = note: 6 redundant requirements hidden - = note: required for `()` to implement `AR` note: required by a bound in `impls_ar` --> $DIR/inductive-not-on-stack.rs:38:16 | diff --git a/tests/ui/traits/next-solver/cycles/mixed-cycles-1.rs b/tests/ui/traits/next-solver/cycles/mixed-cycles-1.rs index b90a354be1b..6d75d241864 100644 --- a/tests/ui/traits/next-solver/cycles/mixed-cycles-1.rs +++ b/tests/ui/traits/next-solver/cycles/mixed-cycles-1.rs @@ -35,5 +35,5 @@ fn impls_a<T: A>() {} fn main() { impls_a::<()>(); - //~^ ERROR overflow evaluating the requirement `(): CInd` + //~^ ERROR overflow evaluating the requirement `(): A` } diff --git a/tests/ui/traits/next-solver/cycles/mixed-cycles-1.stderr b/tests/ui/traits/next-solver/cycles/mixed-cycles-1.stderr index 03e61dbf99c..17544eb1da5 100644 --- a/tests/ui/traits/next-solver/cycles/mixed-cycles-1.stderr +++ b/tests/ui/traits/next-solver/cycles/mixed-cycles-1.stderr @@ -1,46 +1,9 @@ -error[E0275]: overflow evaluating the requirement `(): CInd` +error[E0275]: overflow evaluating the requirement `(): A` --> $DIR/mixed-cycles-1.rs:37:15 | LL | impls_a::<()>(); | ^^ | -note: required for `()` to implement `B` - --> $DIR/mixed-cycles-1.rs:31:28 - | -LL | impl<T: ?Sized + CInd + C> B for T {} - | ---- ^ ^ - | | - | unsatisfied trait bound introduced here -note: required for `()` to implement `C` - --> $DIR/mixed-cycles-1.rs:32:25 - | -LL | impl<T: ?Sized + B + A> C for T {} - | - ^ ^ - | | - | unsatisfied trait bound introduced here -note: required for `()` to implement `CInd` - --> $DIR/mixed-cycles-1.rs:28:21 - | -LL | impl<T: ?Sized + C> CInd for T {} - | - ^^^^ ^ - | | - | unsatisfied trait bound introduced here - = note: 4 redundant requirements hidden - = note: required for `()` to implement `B` -note: required for `()` to implement `BInd` - --> $DIR/mixed-cycles-1.rs:23:21 - | -LL | impl<T: ?Sized + B> BInd for T {} - | - ^^^^ ^ - | | - | unsatisfied trait bound introduced here -note: required for `()` to implement `A` - --> $DIR/mixed-cycles-1.rs:30:28 - | -LL | impl<T: ?Sized + BInd + C> A for T {} - | ---- ^ ^ - | | - | unsatisfied trait bound introduced here note: required by a bound in `impls_a` --> $DIR/mixed-cycles-1.rs:34:15 | diff --git a/tests/ui/traits/next-solver/cycles/mixed-cycles-2.rs b/tests/ui/traits/next-solver/cycles/mixed-cycles-2.rs index a3ffcaafb37..c939a6e5ef2 100644 --- a/tests/ui/traits/next-solver/cycles/mixed-cycles-2.rs +++ b/tests/ui/traits/next-solver/cycles/mixed-cycles-2.rs @@ -28,5 +28,5 @@ fn impls_a<T: A>() {} fn main() { impls_a::<()>(); - //~^ ERROR overflow evaluating the requirement `(): BInd` + //~^ ERROR overflow evaluating the requirement `(): A` } diff --git a/tests/ui/traits/next-solver/cycles/mixed-cycles-2.stderr b/tests/ui/traits/next-solver/cycles/mixed-cycles-2.stderr index 892426abe82..a9be1016c74 100644 --- a/tests/ui/traits/next-solver/cycles/mixed-cycles-2.stderr +++ b/tests/ui/traits/next-solver/cycles/mixed-cycles-2.stderr @@ -1,32 +1,9 @@ -error[E0275]: overflow evaluating the requirement `(): BInd` +error[E0275]: overflow evaluating the requirement `(): A` --> $DIR/mixed-cycles-2.rs:30:15 | LL | impls_a::<()>(); | ^^ | -note: required for `()` to implement `B` - --> $DIR/mixed-cycles-2.rs:25:24 - | -LL | impl<T: ?Sized + BInd> B for T {} - | ---- ^ ^ - | | - | unsatisfied trait bound introduced here -note: required for `()` to implement `BInd` - --> $DIR/mixed-cycles-2.rs:22:21 - | -LL | impl<T: ?Sized + B> BInd for T {} - | - ^^^^ ^ - | | - | unsatisfied trait bound introduced here - = note: 6 redundant requirements hidden - = note: required for `()` to implement `BInd` -note: required for `()` to implement `A` - --> $DIR/mixed-cycles-2.rs:24:28 - | -LL | impl<T: ?Sized + BInd + B> A for T {} - | ---- ^ ^ - | | - | unsatisfied trait bound introduced here note: required by a bound in `impls_a` --> $DIR/mixed-cycles-2.rs:27:15 | diff --git a/tests/ui/traits/next-solver/diagnostics/ambiguous-fail.rs b/tests/ui/traits/next-solver/diagnostics/ambiguous-fail.rs new file mode 100644 index 00000000000..4094ab84166 --- /dev/null +++ b/tests/ui/traits/next-solver/diagnostics/ambiguous-fail.rs @@ -0,0 +1,21 @@ +//@ compile-flags: -Znext-solver + +trait Trait { + type Assoc; +} + +struct W<T>(*mut T); +impl<T> Trait for W<W<T>> +where + W<T>: Trait, +{ + type 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<_>` + +fn main() {} diff --git a/tests/ui/traits/next-solver/diagnostics/ambiguous-fail.stderr b/tests/ui/traits/next-solver/diagnostics/ambiguous-fail.stderr new file mode 100644 index 00000000000..42be1960563 --- /dev/null +++ b/tests/ui/traits/next-solver/diagnostics/ambiguous-fail.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `NoOverlap` for type `W<_>` + --> $DIR/ambiguous-fail.rs:18:1 + | +LL | impl<T: Trait> NoOverlap for T {} + | ------------------------------ first implementation here +LL | +LL | impl<T: Trait<Assoc = u32>> NoOverlap for W<T> {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `W<_>` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/traits/next-solver/diagnostics/ambiguous-pass.rs b/tests/ui/traits/next-solver/diagnostics/ambiguous-pass.rs new file mode 100644 index 00000000000..2d40ba37a89 --- /dev/null +++ b/tests/ui/traits/next-solver/diagnostics/ambiguous-pass.rs @@ -0,0 +1,21 @@ +//@ compile-flags: -Znext-solver + +trait Trait { + type Assoc; +} + +struct W<T>(*mut T); +impl<T> Trait for W<W<T>> +where + W<T>: Trait, +{ + type Assoc = (); +} + +trait NoOverlap {} +impl<T: Trait> NoOverlap for T {} + +impl<T: Trait<Assoc = ()>> NoOverlap for W<T> {} +//~^ ERROR conflicting implementations of trait `NoOverlap` for type `W<_>` + +fn main() {} diff --git a/tests/ui/traits/next-solver/diagnostics/ambiguous-pass.stderr b/tests/ui/traits/next-solver/diagnostics/ambiguous-pass.stderr new file mode 100644 index 00000000000..5c77fc71e55 --- /dev/null +++ b/tests/ui/traits/next-solver/diagnostics/ambiguous-pass.stderr @@ -0,0 +1,12 @@ +error[E0119]: conflicting implementations of trait `NoOverlap` for type `W<_>` + --> $DIR/ambiguous-pass.rs:18:1 + | +LL | impl<T: Trait> NoOverlap for T {} + | ------------------------------ first implementation here +LL | +LL | impl<T: Trait<Assoc = ()>> NoOverlap for W<T> {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `W<_>` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0119`. diff --git a/tests/ui/traits/next-solver/overflow/exponential-trait-goals.rs b/tests/ui/traits/next-solver/overflow/exponential-trait-goals.rs index 052d803765d..186d0e8be56 100644 --- a/tests/ui/traits/next-solver/overflow/exponential-trait-goals.rs +++ b/tests/ui/traits/next-solver/overflow/exponential-trait-goals.rs @@ -15,5 +15,5 @@ fn impls<T: Trait>() {} fn main() { impls::<W<_>>(); - //~^ ERROR overflow evaluating the requirement `_: Sized` + //~^ ERROR overflow evaluating the requirement `W<_>: Trait` } diff --git a/tests/ui/traits/next-solver/overflow/exponential-trait-goals.stderr b/tests/ui/traits/next-solver/overflow/exponential-trait-goals.stderr index 6583cae8bb9..b032ae3e740 100644 --- a/tests/ui/traits/next-solver/overflow/exponential-trait-goals.stderr +++ b/tests/ui/traits/next-solver/overflow/exponential-trait-goals.stderr @@ -1,16 +1,9 @@ -error[E0275]: overflow evaluating the requirement `_: Sized` +error[E0275]: overflow evaluating the requirement `W<_>: Trait` --> $DIR/exponential-trait-goals.rs:17:13 | LL | impls::<W<_>>(); | ^^^^ | -note: required for `W<(W<_>, W<_>)>` to implement `Trait` - --> $DIR/exponential-trait-goals.rs:7:12 - | -LL | impl<T, U> Trait for W<(W<T>, W<U>)> - | - ^^^^^ ^^^^^^^^^^^^^^^ - | | - | unsatisfied trait bound introduced here note: required by a bound in `impls` --> $DIR/exponential-trait-goals.rs:14:13 | diff --git a/tests/ui/traits/next-solver/overflow/global-cache.stderr b/tests/ui/traits/next-solver/overflow/global-cache.stderr index 9e467721e83..67616619384 100644 --- a/tests/ui/traits/next-solver/overflow/global-cache.stderr +++ b/tests/ui/traits/next-solver/overflow/global-cache.stderr @@ -5,15 +5,6 @@ LL | impls_trait::<Four<Four<Four<Four<()>>>>>(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: consider increasing the recursion limit by adding a `#![recursion_limit = "18"]` attribute to your crate (`global_cache`) -note: required for `Inc<Inc<Inc<Inc<Inc<Inc<Inc<Inc<Inc<Inc<Inc<()>>>>>>>>>>>` to implement `Trait` - --> $DIR/global-cache.rs:12:16 - | -LL | impl<T: Trait> Trait for Inc<T> {} - | ----- ^^^^^ ^^^^^^ - | | - | unsatisfied trait bound introduced here - = note: 5 redundant requirements hidden - = note: required for `Inc<Inc<Inc<Inc<Inc<Inc<Inc<Inc<Inc<Inc<Inc<Inc<Inc<Inc<Inc<Inc<()>>>>>>>>>>>>>>>>` to implement `Trait` note: required by a bound in `impls_trait` --> $DIR/global-cache.rs:15:19 | |
