about summary refs log tree commit diff
path: root/tests/ui/const-generics/generic_const_exprs
diff options
context:
space:
mode:
authorBoxy <rust@boxyuwu.dev>2024-08-19 01:14:09 +0100
committerBoxy <rust@boxyuwu.dev>2024-08-19 01:14:22 +0100
commitb8eedfa3d217e19f806fd4f46a89b074f5e8659f (patch)
treed6b049a54b54f6086ec0314b887ba7fcaf4c59f7 /tests/ui/const-generics/generic_const_exprs
parentf04f6ca36d2439375d20a98be013384afbab0782 (diff)
downloadrust-b8eedfa3d217e19f806fd4f46a89b074f5e8659f.tar.gz
rust-b8eedfa3d217e19f806fd4f46a89b074f5e8659f.zip
Retroactively feature gate `ConstArgKind::Path`
Diffstat (limited to 'tests/ui/const-generics/generic_const_exprs')
-rw-r--r--tests/ui/const-generics/generic_const_exprs/type_mismatch.rs1
-rw-r--r--tests/ui/const-generics/generic_const_exprs/type_mismatch.stderr12
-rw-r--r--tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.rs10
-rw-r--r--tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.stderr4
4 files changed, 17 insertions, 10 deletions
diff --git a/tests/ui/const-generics/generic_const_exprs/type_mismatch.rs b/tests/ui/const-generics/generic_const_exprs/type_mismatch.rs
index 8e5e23b2337..a45deabbb0f 100644
--- a/tests/ui/const-generics/generic_const_exprs/type_mismatch.rs
+++ b/tests/ui/const-generics/generic_const_exprs/type_mismatch.rs
@@ -8,6 +8,7 @@ trait Q {
 impl<const N: u64> Q for [u8; N] {}
 //~^ ERROR not all trait items implemented
 //~| ERROR the constant `N` is not of type `usize`
+//~| ERROR mismatched types
 
 pub fn q_user() -> [u8; <[u8; 13] as Q>::ASSOC] {}
 //~^ ERROR the constant `13` is not of type `u64`
diff --git a/tests/ui/const-generics/generic_const_exprs/type_mismatch.stderr b/tests/ui/const-generics/generic_const_exprs/type_mismatch.stderr
index e03580ec007..68870a8d38d 100644
--- a/tests/ui/const-generics/generic_const_exprs/type_mismatch.stderr
+++ b/tests/ui/const-generics/generic_const_exprs/type_mismatch.stderr
@@ -14,7 +14,7 @@ LL | impl<const N: u64> Q for [u8; N] {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `ASSOC` in implementation
 
 error: the constant `13` is not of type `u64`
-  --> $DIR/type_mismatch.rs:12:26
+  --> $DIR/type_mismatch.rs:13:26
    |
 LL | pub fn q_user() -> [u8; <[u8; 13] as Q>::ASSOC] {}
    |                          ^^^^^^^^ expected `u64`, found `usize`
@@ -28,14 +28,20 @@ LL | impl<const N: u64> Q for [u8; N] {}
    |      unsatisfied trait bound introduced here
 
 error[E0308]: mismatched types
-  --> $DIR/type_mismatch.rs:12:20
+  --> $DIR/type_mismatch.rs:13:20
    |
 LL | pub fn q_user() -> [u8; <[u8; 13] as Q>::ASSOC] {}
    |        ------      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `[u8; <[u8; 13] as Q>::ASSOC]`, found `()`
    |        |
    |        implicitly returns `()` as its body has no tail or `return` expression
 
-error: aborting due to 4 previous errors
+error[E0308]: mismatched types
+  --> $DIR/type_mismatch.rs:8:31
+   |
+LL | impl<const N: u64> Q for [u8; N] {}
+   |                               ^ expected `usize`, found `u64`
+
+error: aborting due to 5 previous errors
 
 Some errors have detailed explanations: E0046, E0308.
 For more information about an error, try `rustc --explain E0046`.
diff --git a/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.rs b/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.rs
index 8b7ee577569..05a3487ffca 100644
--- a/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.rs
+++ b/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.rs
@@ -14,8 +14,8 @@ mod v20 {
     //~^ ERROR cannot find value `v8` in this scope
     //~| ERROR cannot find function `v6` in this scope
     pub struct v17<const v10: usize, const v7: v11> {
-    //~^ WARN type `v17` should have an upper camel case name
-    //~| ERROR `[[usize; v4]; v4]` is forbidden as the type of a const generic parameter
+        //~^ WARN type `v17` should have an upper camel case name
+        //~| ERROR `[[usize; v4]; v4]` is forbidden as the type of a const generic parameter
         _p: (),
     }
 
@@ -25,10 +25,10 @@ mod v20 {
     }
 
     impl<const v10: usize> v17<v10, v2> {
-    //~^ ERROR maximum number of nodes exceeded in constant v20::v17::<v10, v2>::{constant#0}
-    //~| ERROR maximum number of nodes exceeded in constant v20::v17::<v10, v2>::{constant#0}
+        //~^ ERROR maximum number of nodes exceeded in constant v20::v17::<v10, v2>::{constant#1}
+        //~| ERROR maximum number of nodes exceeded in constant v20::v17::<v10, v2>::{constant#1}
         pub const fn v21() -> v18 {
-        //~^ ERROR cannot find type `v18` in this scope
+            //~^ ERROR cannot find type `v18` in this scope
             v18 { _p: () }
             //~^ ERROR cannot find struct, variant or union type `v18` in this scope
         }
diff --git a/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.stderr b/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.stderr
index 15d3c472585..39f022fbee9 100644
--- a/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.stderr
+++ b/tests/ui/const-generics/generic_const_exprs/unevaluated-const-ice-119731.stderr
@@ -72,13 +72,13 @@ help: add `#![feature(adt_const_params)]` to the crate attributes to enable more
 LL + #![feature(adt_const_params)]
    |
 
-error: maximum number of nodes exceeded in constant v20::v17::<v10, v2>::{constant#0}
+error: maximum number of nodes exceeded in constant v20::v17::<v10, v2>::{constant#1}
   --> $DIR/unevaluated-const-ice-119731.rs:27:37
    |
 LL |     impl<const v10: usize> v17<v10, v2> {
    |                                     ^^
 
-error: maximum number of nodes exceeded in constant v20::v17::<v10, v2>::{constant#0}
+error: maximum number of nodes exceeded in constant v20::v17::<v10, v2>::{constant#1}
   --> $DIR/unevaluated-const-ice-119731.rs:27:37
    |
 LL |     impl<const v10: usize> v17<v10, v2> {