about summary refs log tree commit diff
path: root/tests/ui/traits
diff options
context:
space:
mode:
authorlcnr <rust@lcnr.de>2024-09-21 07:02:51 +0000
committerlcnr <rust@lcnr.de>2024-10-15 13:11:00 +0200
commit1a9d2d82a5ee24d05dac2287b87ffd96f77d6d77 (patch)
tree4bd60e251d47379d30ccdce1f1018e19772add9d /tests/ui/traits
parent88f311479dd19288e5ad85e22cd80368489ce1e9 (diff)
downloadrust-1a9d2d82a5ee24d05dac2287b87ffd96f77d6d77.tar.gz
rust-1a9d2d82a5ee24d05dac2287b87ffd96f77d6d77.zip
stabilize `-Znext-solver=coherence`
Diffstat (limited to 'tests/ui/traits')
-rw-r--r--tests/ui/traits/alias/issue-83613.rs2
-rw-r--r--tests/ui/traits/alias/issue-83613.stderr4
-rw-r--r--tests/ui/traits/issue-105231.rs3
-rw-r--r--tests/ui/traits/issue-105231.stderr22
-rw-r--r--tests/ui/traits/next-solver/coherence/issue-102048.rs10
-rw-r--r--tests/ui/traits/next-solver/coherence/issue-102048.stderr16
-rw-r--r--tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.rs2
-rw-r--r--tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.stderr26
8 files changed, 42 insertions, 43 deletions
diff --git a/tests/ui/traits/alias/issue-83613.rs b/tests/ui/traits/alias/issue-83613.rs
index 2462e703a71..6f0012bf089 100644
--- a/tests/ui/traits/alias/issue-83613.rs
+++ b/tests/ui/traits/alias/issue-83613.rs
@@ -8,5 +8,5 @@ fn mk_opaque() -> OpaqueType {
 trait AnotherTrait {}
 impl<T: Send> AnotherTrait for T {}
 impl AnotherTrait for OpaqueType {}
-//~^ ERROR conflicting implementations of trait `AnotherTrait` for type `OpaqueType`
+//~^ ERROR conflicting implementations of trait `AnotherTrait`
 fn main() {}
diff --git a/tests/ui/traits/alias/issue-83613.stderr b/tests/ui/traits/alias/issue-83613.stderr
index 847fda41776..47181c3f33e 100644
--- a/tests/ui/traits/alias/issue-83613.stderr
+++ b/tests/ui/traits/alias/issue-83613.stderr
@@ -1,10 +1,10 @@
-error[E0119]: conflicting implementations of trait `AnotherTrait` for type `OpaqueType`
+error[E0119]: conflicting implementations of trait `AnotherTrait`
   --> $DIR/issue-83613.rs:10:1
    |
 LL | impl<T: Send> AnotherTrait for T {}
    | -------------------------------- first implementation here
 LL | impl AnotherTrait for OpaqueType {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `OpaqueType`
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/traits/issue-105231.rs b/tests/ui/traits/issue-105231.rs
index 7338642beef..83c3158c106 100644
--- a/tests/ui/traits/issue-105231.rs
+++ b/tests/ui/traits/issue-105231.rs
@@ -1,4 +1,3 @@
-//~ ERROR overflow evaluating the requirement `A<A<A<A<A<A<A<...>>>>>>>: Send`
 struct A<T>(B<T>);
 //~^ ERROR recursive types `A` and `B` have infinite size
 //~| ERROR `T` is only used recursively
@@ -7,5 +6,5 @@ struct B<T>(A<A<T>>);
 trait Foo {}
 impl<T> Foo for T where T: Send {}
 impl Foo for B<u8> {}
-
+//~^ ERROR conflicting implementations of trait `Foo` for type `B<u8>`
 fn main() {}
diff --git a/tests/ui/traits/issue-105231.stderr b/tests/ui/traits/issue-105231.stderr
index d3014a79ad6..e113f8382b2 100644
--- a/tests/ui/traits/issue-105231.stderr
+++ b/tests/ui/traits/issue-105231.stderr
@@ -1,5 +1,5 @@
 error[E0072]: recursive types `A` and `B` have infinite size
-  --> $DIR/issue-105231.rs:2:1
+  --> $DIR/issue-105231.rs:1:1
    |
 LL | struct A<T>(B<T>);
    | ^^^^^^^^^^^ ---- recursive without indirection
@@ -16,7 +16,7 @@ LL ~ struct B<T>(Box<A<A<T>>>);
    |
 
 error: type parameter `T` is only used recursively
-  --> $DIR/issue-105231.rs:2:15
+  --> $DIR/issue-105231.rs:1:15
    |
 LL | struct A<T>(B<T>);
    |          -    ^
@@ -27,7 +27,7 @@ LL | struct A<T>(B<T>);
    = note: all type parameters must be used in a non-recursive way in order to constrain their variance
 
 error: type parameter `T` is only used recursively
-  --> $DIR/issue-105231.rs:5:17
+  --> $DIR/issue-105231.rs:4:17
    |
 LL | struct B<T>(A<A<T>>);
    |          -      ^
@@ -37,16 +37,18 @@ LL | struct B<T>(A<A<T>>);
    = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
    = note: all type parameters must be used in a non-recursive way in order to constrain their variance
 
-error[E0275]: overflow evaluating the requirement `A<A<A<A<A<A<A<...>>>>>>>: Send`
+error[E0119]: conflicting implementations of trait `Foo` for type `B<u8>`
+  --> $DIR/issue-105231.rs:8:1
    |
-   = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_105231`)
-note: required because it appears within the type `B<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<A<u8>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`
-  --> $DIR/issue-105231.rs:5:8
+LL | impl<T> Foo for T where T: Send {}
+   | ------------------------------- first implementation here
+LL | impl Foo for B<u8> {}
+   | ^^^^^^^^^^^^^^^^^^ conflicting implementation for `B<u8>`
    |
-LL | struct B<T>(A<A<T>>);
-   |        ^
+   = note: overflow evaluating the requirement `B<u8>: Send`
+   = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`issue_105231`)
 
 error: aborting due to 4 previous errors
 
-Some errors have detailed explanations: E0072, E0275.
+Some errors have detailed explanations: E0072, E0119.
 For more information about an error, try `rustc --explain E0072`.
diff --git a/tests/ui/traits/next-solver/coherence/issue-102048.rs b/tests/ui/traits/next-solver/coherence/issue-102048.rs
index 16ae5d98488..847816eba12 100644
--- a/tests/ui/traits/next-solver/coherence/issue-102048.rs
+++ b/tests/ui/traits/next-solver/coherence/issue-102048.rs
@@ -1,7 +1,7 @@
 // This must fail coherence.
 //
 // Getting this to pass was fairly difficult, so here's an explanation
-// of what's happening:
+// of what was previously happening for this to compile:
 //
 // Normalizing projections currently tries to replace them with inference variables
 // while emitting a nested `Projection` obligation. This cannot be done if the projection
@@ -17,12 +17,6 @@
 // that to `i32`. We then try to unify `i32` from `impl1` with `u32` from `impl2` which fails,
 // causing coherence to consider these two impls distinct.
 
-//@ revisions: classic next
-//@[next] compile-flags: -Znext-solver
-
-//@[classic] known-bug: #102048
-//@[classic] check-pass
-
 pub trait Trait<T> {}
 
 pub trait WithAssoc1<'a> {
@@ -42,7 +36,7 @@ where
 
 // impl 2
 impl<T, U> Trait<for<'a> fn(<U as WithAssoc1<'a>>::Assoc, u32)> for (T, U) where
-    U: for<'a> WithAssoc1<'a> //[next]~^ ERROR conflicting implementations of trait
+    U: for<'a> WithAssoc1<'a> //~^ ERROR conflicting implementations of trait
 {
 }
 
diff --git a/tests/ui/traits/next-solver/coherence/issue-102048.stderr b/tests/ui/traits/next-solver/coherence/issue-102048.stderr
new file mode 100644
index 00000000000..e496517464b
--- /dev/null
+++ b/tests/ui/traits/next-solver/coherence/issue-102048.stderr
@@ -0,0 +1,16 @@
+error[E0119]: conflicting implementations of trait `Trait<for<'a> fn(<_ as WithAssoc1<'a>>::Assoc, <_ as WithAssoc2<'a>>::Assoc)>` for type `(_, _)`
+  --> $DIR/issue-102048.rs:38:1
+   |
+LL | / impl<T, U> Trait<for<'a> fn(<T as WithAssoc1<'a>>::Assoc, <U as WithAssoc2<'a>>::Assoc)> for (T, U)
+LL | | where
+LL | |     T: for<'a> WithAssoc1<'a> + for<'a> WithAssoc2<'a, Assoc = i32>,
+LL | |     U: for<'a> WithAssoc2<'a>,
+   | |______________________________- first implementation here
+...
+LL | / impl<T, U> Trait<for<'a> fn(<U as WithAssoc1<'a>>::Assoc, u32)> for (T, U) where
+LL | |     U: for<'a> WithAssoc1<'a>
+   | |_____________________________^ conflicting implementation for `(_, _)`
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0119`.
diff --git a/tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.rs b/tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.rs
index d37943b929a..43443be88df 100644
--- a/tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.rs
+++ b/tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.rs
@@ -1,4 +1,3 @@
-//~ ERROR overflow
 // A regression test for #111729 checking that we correctly
 // track recursion depth for obligations returned by confirmation.
 use std::panic::RefUnwindSafe;
@@ -18,6 +17,7 @@ impl<T: RefUnwindSafe> Database for T {
     type Storage = SalsaStorage;
 }
 impl Database for RootDatabase {
+    //~^ ERROR conflicting implementations of trait `Database` for type `RootDatabase`
     type Storage = SalsaStorage;
 }
 
diff --git a/tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.stderr b/tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.stderr
index 2ab150fc0f6..1da7671b451 100644
--- a/tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.stderr
+++ b/tests/ui/traits/solver-cycles/cycle-via-builtin-auto-trait-impl.stderr
@@ -1,24 +1,12 @@
-error[E0275]: overflow evaluating the requirement `Runtime<RootDatabase>: RefUnwindSafe`
-   |
-   = help: consider increasing the recursion limit by adding a `#![recursion_limit = "256"]` attribute to your crate (`cycle_via_builtin_auto_trait_impl`)
-note: required because it appears within the type `RootDatabase`
-  --> $DIR/cycle-via-builtin-auto-trait-impl.rs:13:8
-   |
-LL | struct RootDatabase {
-   |        ^^^^^^^^^^^^
-note: required for `RootDatabase` to implement `Database`
-  --> $DIR/cycle-via-builtin-auto-trait-impl.rs:17:24
+error[E0119]: conflicting implementations of trait `Database` for type `RootDatabase`
+  --> $DIR/cycle-via-builtin-auto-trait-impl.rs:19:1
    |
 LL | impl<T: RefUnwindSafe> Database for T {
-   |         -------------  ^^^^^^^^     ^
-   |         |
-   |         unsatisfied trait bound introduced here
-note: required because it appears within the type `Runtime<RootDatabase>`
-  --> $DIR/cycle-via-builtin-auto-trait-impl.rs:24:8
-   |
-LL | struct Runtime<DB: Database> {
-   |        ^^^^^^^
+   | ------------------------------------- first implementation here
+...
+LL | impl Database for RootDatabase {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `RootDatabase`
 
 error: aborting due to 1 previous error
 
-For more information about this error, try `rustc --explain E0275`.
+For more information about this error, try `rustc --explain E0119`.