summary refs log tree commit diff
path: root/src/test/ui/parser
diff options
context:
space:
mode:
authorJack Huey <31162821+jackh726@users.noreply.github.com>2021-10-19 18:45:48 -0400
committerJack Huey <31162821+jackh726@users.noreply.github.com>2022-03-05 13:13:45 -0500
commitc20b4f558440c24e8ef84782a71163fe236d72de (patch)
tree6e09aa43d0f3eb54043950a2d89e237f23dde41e /src/test/ui/parser
parent379e94f5a4aebe7dc2d8742653ca244d92b06f3d (diff)
downloadrust-c20b4f558440c24e8ef84782a71163fe236d72de.tar.gz
rust-c20b4f558440c24e8ef84782a71163fe236d72de.zip
Change syntax for TyAlias where clauses
Diffstat (limited to 'src/test/ui/parser')
-rw-r--r--src/test/ui/parser/bounds-lifetime-where.rs2
-rw-r--r--src/test/ui/parser/bounds-lifetime-where.stderr4
-rw-r--r--src/test/ui/parser/removed-syntax-ptr-lifetime.rs2
-rw-r--r--src/test/ui/parser/removed-syntax-ptr-lifetime.stderr4
-rw-r--r--src/test/ui/parser/type-alias-where.rs14
-rw-r--r--src/test/ui/parser/type-alias-where.stderr32
6 files changed, 25 insertions, 33 deletions
diff --git a/src/test/ui/parser/bounds-lifetime-where.rs b/src/test/ui/parser/bounds-lifetime-where.rs
index e60cc153e67..7ff75233d3a 100644
--- a/src/test/ui/parser/bounds-lifetime-where.rs
+++ b/src/test/ui/parser/bounds-lifetime-where.rs
@@ -5,6 +5,6 @@ type A where 'a:, = u8; // OK
 type A where 'a: 'b + 'c = u8; // OK
 type A where = u8; // OK
 type A where 'a: 'b + = u8; // OK
-type A where , = u8; //~ ERROR expected one of `;`, `=`, lifetime, or type, found `,`
+type A where , = u8; //~ ERROR expected one of `;`, `=`, `where`, lifetime, or type, found `,`
 
 fn main() {}
diff --git a/src/test/ui/parser/bounds-lifetime-where.stderr b/src/test/ui/parser/bounds-lifetime-where.stderr
index 950fa46c66b..785a1fb6793 100644
--- a/src/test/ui/parser/bounds-lifetime-where.stderr
+++ b/src/test/ui/parser/bounds-lifetime-where.stderr
@@ -1,8 +1,8 @@
-error: expected one of `;`, `=`, lifetime, or type, found `,`
+error: expected one of `;`, `=`, `where`, lifetime, or type, found `,`
   --> $DIR/bounds-lifetime-where.rs:8:14
    |
 LL | type A where , = u8;
-   |              ^ expected one of `;`, `=`, lifetime, or type
+   |              ^ expected one of `;`, `=`, `where`, lifetime, or type
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/parser/removed-syntax-ptr-lifetime.rs b/src/test/ui/parser/removed-syntax-ptr-lifetime.rs
index 5b551addbc8..cc69af44a13 100644
--- a/src/test/ui/parser/removed-syntax-ptr-lifetime.rs
+++ b/src/test/ui/parser/removed-syntax-ptr-lifetime.rs
@@ -1 +1 @@
-type bptr = &lifetime/isize; //~ ERROR expected one of `!`, `(`, `::`, `;`, or `<`, found `/`
+type bptr = &lifetime/isize; //~ ERROR expected one of `!`, `(`, `::`, `;`, `<`, or `where`, found `/`
diff --git a/src/test/ui/parser/removed-syntax-ptr-lifetime.stderr b/src/test/ui/parser/removed-syntax-ptr-lifetime.stderr
index 5b388ff4ce0..914de43e62d 100644
--- a/src/test/ui/parser/removed-syntax-ptr-lifetime.stderr
+++ b/src/test/ui/parser/removed-syntax-ptr-lifetime.stderr
@@ -1,8 +1,8 @@
-error: expected one of `!`, `(`, `::`, `;`, or `<`, found `/`
+error: expected one of `!`, `(`, `::`, `;`, `<`, or `where`, found `/`
   --> $DIR/removed-syntax-ptr-lifetime.rs:1:22
    |
 LL | type bptr = &lifetime/isize;
-   |                      ^ expected one of `!`, `(`, `::`, `;`, or `<`
+   |                      ^ expected one of `!`, `(`, `::`, `;`, `<`, or `where`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/parser/type-alias-where.rs b/src/test/ui/parser/type-alias-where.rs
index a9fa23dd95e..99ab8a7c48c 100644
--- a/src/test/ui/parser/type-alias-where.rs
+++ b/src/test/ui/parser/type-alias-where.rs
@@ -6,9 +6,9 @@
 type Foo where u32: Copy = ();
 // Not fine.
 type Bar = () where u32: Copy;
-//~^ ERROR where clause not allowed here
+//~^ ERROR where clauses are not allowed
 type Baz = () where;
-//~^ ERROR where clause not allowed here
+//~^ ERROR where clauses are not allowed
 
 trait Trait {
     // Fine.
@@ -18,19 +18,19 @@ trait Trait {
 }
 
 impl Trait for u32 {
-    // Fine.
+    // Not fine, suggests moving.
     type Assoc where u32: Copy = ();
-    // Not fine, suggests moving `i32: Copy`
+    //~^ ERROR where clause not allowed here
+    // Not fine, suggests moving `u32: Copy`
     type Assoc2 where u32: Copy = () where i32: Copy;
     //~^ ERROR where clause not allowed here
 }
 
 impl Trait for i32 {
-    // Not fine, suggests moving `u32: Copy`
+    // Fine.
     type Assoc = () where u32: Copy;
-    //~^ ERROR where clause not allowed here
     // Not fine, suggests moving both.
-    type Assoc2 = () where u32: Copy, i32: Copy;
+    type Assoc2 where u32: Copy, i32: Copy = ();
     //~^ ERROR where clause not allowed here
 }
 
diff --git a/src/test/ui/parser/type-alias-where.stderr b/src/test/ui/parser/type-alias-where.stderr
index 7ab0b28c864..4cc8b703ced 100644
--- a/src/test/ui/parser/type-alias-where.stderr
+++ b/src/test/ui/parser/type-alias-where.stderr
@@ -1,40 +1,32 @@
-error: where clause not allowed here
+error: where clauses are not allowed after the type for type aliases
   --> $DIR/type-alias-where.rs:8:15
    |
 LL | type Bar = () where u32: Copy;
-   |         -     ^^^^^^^^^^^^^^^
-   |         |
-   |         help: move it here: `where u32: Copy`
+   |               ^^^^^^^^^^^^^^^
 
-error: where clause not allowed here
+error: where clauses are not allowed after the type for type aliases
   --> $DIR/type-alias-where.rs:10:15
    |
 LL | type Baz = () where;
    |               ^^^^^
 
 error: where clause not allowed here
-  --> $DIR/type-alias-where.rs:24:38
+  --> $DIR/type-alias-where.rs:22:16
    |
-LL |     type Assoc2 where u32: Copy = () where i32: Copy;
-   |                                -     ^^^^^^^^^^^^^^^
-   |                                |
-   |                                help: move it here: `, i32: Copy`
+LL |     type Assoc where u32: Copy = ();
+   |                ^^^^^^^^^^^^^^^     - help: move it here: `where u32: Copy`
 
 error: where clause not allowed here
-  --> $DIR/type-alias-where.rs:30:21
+  --> $DIR/type-alias-where.rs:25:17
    |
-LL |     type Assoc = () where u32: Copy;
-   |               -     ^^^^^^^^^^^^^^^
-   |               |
-   |               help: move it here: `where u32: Copy`
+LL |     type Assoc2 where u32: Copy = () where i32: Copy;
+   |                 ^^^^^^^^^^^^^^^                     - help: move it here: `, u32: Copy`
 
 error: where clause not allowed here
-  --> $DIR/type-alias-where.rs:33:22
+  --> $DIR/type-alias-where.rs:33:17
    |
-LL |     type Assoc2 = () where u32: Copy, i32: Copy;
-   |                -     ^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |                |
-   |                help: move it here: `where u32: Copy, i32: Copy`
+LL |     type Assoc2 where u32: Copy, i32: Copy = ();
+   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^     - help: move it here: `where u32: Copy, i32: Copy`
 
 error: aborting due to 5 previous errors