about summary refs log tree commit diff
path: root/tests/ui/specialization
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-05-23 13:37:39 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2024-05-24 09:15:43 +0000
commit9dc76207ffdb225c4f4615dd59bce356b25eeab8 (patch)
tree1398dc11d5e8909059582369c20f5c5bc5085247 /tests/ui/specialization
parent7c547894c76efe9303caa3108754674c39bd901d (diff)
downloadrust-9dc76207ffdb225c4f4615dd59bce356b25eeab8.tar.gz
rust-9dc76207ffdb225c4f4615dd59bce356b25eeab8.zip
Fail relating constants of different types
Diffstat (limited to 'tests/ui/specialization')
-rw-r--r--tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.rs3
-rw-r--r--tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.stderr36
2 files changed, 29 insertions, 10 deletions
diff --git a/tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.rs b/tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.rs
index f89a463bc58..4d1cd4332fe 100644
--- a/tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.rs
+++ b/tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.rs
@@ -7,7 +7,8 @@ struct S<const L: usize>;
 
 impl<const N: i32> Copy for S<N> {}
 //~^ ERROR: mismatched types
+//~| ERROR: the trait bound `S<N>: Clone` is not satisfied
+//~| ERROR: the constant `N` is not of type `usize`
 impl<const M: usize> Copy for S<M> {}
-//~^ ERROR: conflicting implementations of trait `Copy` for type `S<_>`
 
 fn main() {}
diff --git a/tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.stderr b/tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.stderr
index 1dac58e1f69..716a4787948 100644
--- a/tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.stderr
+++ b/tests/ui/specialization/min_specialization/bad-const-wf-doesnt-specialize.stderr
@@ -1,11 +1,29 @@
-error[E0119]: conflicting implementations of trait `Copy` for type `S<_>`
-  --> $DIR/bad-const-wf-doesnt-specialize.rs:10:1
+error[E0277]: the trait bound `S<N>: Clone` is not satisfied
+  --> $DIR/bad-const-wf-doesnt-specialize.rs:8:29
    |
 LL | impl<const N: i32> Copy for S<N> {}
-   | -------------------------------- first implementation here
-LL |
-LL | impl<const M: usize> Copy for S<M> {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `S<_>`
+   |                             ^^^^ the trait `Clone` is not implemented for `S<N>`
+   |
+   = help: the trait `Clone` is implemented for `S<L>`
+note: required by a bound in `Copy`
+  --> $SRC_DIR/core/src/marker.rs:LL:COL
+help: consider annotating `S<N>` with `#[derive(Clone)]`
+   |
+LL + #[derive(Clone)]
+LL | struct S<const L: usize>;
+   |
+
+error: the constant `N` is not of type `usize`
+  --> $DIR/bad-const-wf-doesnt-specialize.rs:8:29
+   |
+LL | impl<const N: i32> Copy for S<N> {}
+   |                             ^^^^ expected `usize`, found `i32`
+   |
+note: required by a bound in `S`
+  --> $DIR/bad-const-wf-doesnt-specialize.rs:6:10
+   |
+LL | struct S<const L: usize>;
+   |          ^^^^^^^^^^^^^^ required by this bound in `S`
 
 error[E0308]: mismatched types
   --> $DIR/bad-const-wf-doesnt-specialize.rs:8:31
@@ -13,7 +31,7 @@ error[E0308]: mismatched types
 LL | impl<const N: i32> Copy for S<N> {}
    |                               ^ expected `usize`, found `i32`
 
-error: aborting due to 2 previous errors
+error: aborting due to 3 previous errors
 
-Some errors have detailed explanations: E0119, E0308.
-For more information about an error, try `rustc --explain E0119`.
+Some errors have detailed explanations: E0277, E0308.
+For more information about an error, try `rustc --explain E0277`.