summaryrefslogtreecommitdiffstats
path: root/src/test/ui/const-generics/defaults
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/const-generics/defaults')
-rw-r--r--src/test/ui/const-generics/defaults/rp_impl_trait_fail.stderr8
-rw-r--r--src/test/ui/const-generics/defaults/self-referential.rs4
-rw-r--r--src/test/ui/const-generics/defaults/self-referential.stderr11
3 files changed, 17 insertions, 6 deletions
diff --git a/src/test/ui/const-generics/defaults/rp_impl_trait_fail.stderr b/src/test/ui/const-generics/defaults/rp_impl_trait_fail.stderr
index f2e7777ce..a46bd5352 100644
--- a/src/test/ui/const-generics/defaults/rp_impl_trait_fail.stderr
+++ b/src/test/ui/const-generics/defaults/rp_impl_trait_fail.stderr
@@ -18,9 +18,7 @@ LL |
LL | 1_u32
| ----- return type was inferred to be `u32` here
|
- = help: the following other types implement trait `Traitor<N, M>`:
- <u32 as Traitor<N, 2>>
- <u64 as Traitor<1, 2>>
+ = help: the trait `Traitor<N, 2>` is implemented for `u32`
error[E0277]: the trait bound `u64: Traitor` is not satisfied
--> $DIR/rp_impl_trait_fail.rs:21:13
@@ -31,9 +29,7 @@ LL |
LL | 1_u64
| ----- return type was inferred to be `u64` here
|
- = help: the following other types implement trait `Traitor<N, M>`:
- <u32 as Traitor<N, 2>>
- <u64 as Traitor<1, 2>>
+ = help: the trait `Traitor<1, 2>` is implemented for `u64`
error: aborting due to 3 previous errors
diff --git a/src/test/ui/const-generics/defaults/self-referential.rs b/src/test/ui/const-generics/defaults/self-referential.rs
new file mode 100644
index 000000000..14a870dc3
--- /dev/null
+++ b/src/test/ui/const-generics/defaults/self-referential.rs
@@ -0,0 +1,4 @@
+trait Foo<const M: u8, const M: u8 = M> {}
+//~^ ERROR the name `M` is already used for a generic parameter in this item's generic parameters
+impl Foo<2> for () {}
+fn main() {}
diff --git a/src/test/ui/const-generics/defaults/self-referential.stderr b/src/test/ui/const-generics/defaults/self-referential.stderr
new file mode 100644
index 000000000..170c1f7f7
--- /dev/null
+++ b/src/test/ui/const-generics/defaults/self-referential.stderr
@@ -0,0 +1,11 @@
+error[E0403]: the name `M` is already used for a generic parameter in this item's generic parameters
+ --> $DIR/self-referential.rs:1:30
+ |
+LL | trait Foo<const M: u8, const M: u8 = M> {}
+ | - ^ already used
+ | |
+ | first use of `M`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0403`.