about summary refs log tree commit diff
path: root/src/test/ui/const-generics/issues
diff options
context:
space:
mode:
authorEllen <supbscripter@gmail.com>2022-05-05 17:44:54 +0100
committerEllen <supbscripter@gmail.com>2022-05-05 17:45:39 +0100
commitfea1d765033eada386ffc1684d47c00a48d104f1 (patch)
treefef19174b45842ee05a51064217311a101fed588 /src/test/ui/const-generics/issues
parent4208c53ed695ddb822b6510e3faa0a46e591060e (diff)
downloadrust-fea1d765033eada386ffc1684d47c00a48d104f1.tar.gz
rust-fea1d765033eada386ffc1684d47c00a48d104f1.zip
make `compare_generic_param_kinds` errors consistent
Diffstat (limited to 'src/test/ui/const-generics/issues')
-rw-r--r--src/test/ui/const-generics/issues/issue-86820.rs9
-rw-r--r--src/test/ui/const-generics/issues/issue-86820.stderr21
2 files changed, 15 insertions, 15 deletions
diff --git a/src/test/ui/const-generics/issues/issue-86820.rs b/src/test/ui/const-generics/issues/issue-86820.rs
index 04650403c6b..9bcb8e1aeed 100644
--- a/src/test/ui/const-generics/issues/issue-86820.rs
+++ b/src/test/ui/const-generics/issues/issue-86820.rs
@@ -1,6 +1,6 @@
 // Regression test for the ICE described in #86820.
 
-#![allow(unused,dead_code)]
+#![allow(unused, dead_code)]
 use std::ops::BitAnd;
 
 const C: fn() = || is_set();
@@ -9,13 +9,12 @@ fn is_set() {
 }
 
 trait Bits {
-    fn bit<const I : u8>(self) -> bool;
-    //~^ NOTE: the const parameter `I` has type `usize`, but the declaration in trait `Bits::bit` has type `u8`
+    fn bit<const I: u8>(self) -> bool;
 }
 
 impl Bits for u8 {
-    fn bit<const I : usize>(self) -> bool {
-    //~^ ERROR: method `bit` has an incompatible const parameter type for trait [E0053]
+    fn bit<const I: usize>(self) -> bool {
+        //~^ ERROR: method `bit` has an incompatible generic parameter for trait: `Bits` [E0053]
         let i = 1 << I;
         let mask = u8::from(i);
         mask & self == mask
diff --git a/src/test/ui/const-generics/issues/issue-86820.stderr b/src/test/ui/const-generics/issues/issue-86820.stderr
index f7b8d80eeca..4d54d654c12 100644
--- a/src/test/ui/const-generics/issues/issue-86820.stderr
+++ b/src/test/ui/const-generics/issues/issue-86820.stderr
@@ -1,14 +1,15 @@
-error[E0053]: method `bit` has an incompatible const parameter type for trait
-  --> $DIR/issue-86820.rs:17:12
+error[E0053]: method `bit` has an incompatible generic parameter for trait: `Bits`
+  --> $DIR/issue-86820.rs:16:12
    |
-LL |     fn bit<const I : usize>(self) -> bool {
-   |            ^^^^^^^^^^^^^^^
-   |
-note: the const parameter `I` has type `usize`, but the declaration in trait `Bits::bit` has type `u8`
-  --> $DIR/issue-86820.rs:12:12
-   |
-LL |     fn bit<const I : u8>(self) -> bool;
-   |            ^^^^^^^^^^^^
+LL | trait Bits {
+   |       ----
+LL |     fn bit<const I: u8>(self) -> bool;
+   |            ----------- expected const parameter with type `u8`
+...
+LL | impl Bits for u8 {
+   | ----------------
+LL |     fn bit<const I: usize>(self) -> bool {
+   |            ^^^^^^^^^^^^^^ found const parameter with type `usize`
 
 error: aborting due to previous error