about 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>2022-02-14 13:00:10 -0500
committerJack Huey <31162821+jackh726@users.noreply.github.com>2022-03-05 13:15:00 -0500
commit2b151fd5c8a106f276477357b5371d1184d940d4 (patch)
treee381d0c80e535cdfaeb0f23da8eb9d2cfdf31dba /src/test/ui/parser
parentc920eb88b247c40a64437db54c652f14b83113c3 (diff)
downloadrust-2b151fd5c8a106f276477357b5371d1184d940d4.tar.gz
rust-2b151fd5c8a106f276477357b5371d1184d940d4.zip
Review changes
Diffstat (limited to 'src/test/ui/parser')
-rw-r--r--src/test/ui/parser/type-alias-where-fixable.fixed30
-rw-r--r--src/test/ui/parser/type-alias-where-fixable.rs30
-rw-r--r--src/test/ui/parser/type-alias-where-fixable.stderr42
-rw-r--r--src/test/ui/parser/type-alias-where.rs24
-rw-r--r--src/test/ui/parser/type-alias-where.stderr24
5 files changed, 106 insertions, 44 deletions
diff --git a/src/test/ui/parser/type-alias-where-fixable.fixed b/src/test/ui/parser/type-alias-where-fixable.fixed
new file mode 100644
index 00000000000..41dd10676d5
--- /dev/null
+++ b/src/test/ui/parser/type-alias-where-fixable.fixed
@@ -0,0 +1,30 @@
+// check-pass
+// run-rustfix
+
+#![feature(generic_associated_types)]
+
+trait Trait {
+    // Fine.
+    type Assoc where u32: Copy;
+    // Fine.
+    type Assoc2 where u32: Copy, i32: Copy;
+}
+
+impl Trait for u32 {
+    // Not fine, suggests moving.
+    type Assoc  = () where u32: Copy;
+    //~^ WARNING where clause not allowed here
+    // Not fine, suggests moving `u32: Copy`
+    type Assoc2  = () where i32: Copy, u32: Copy;
+    //~^ WARNING where clause not allowed here
+}
+
+impl Trait for i32 {
+    // Fine.
+    type Assoc = () where u32: Copy;
+    // Not fine, suggests moving both.
+    type Assoc2  = () where u32: Copy, i32: Copy;
+    //~^ WARNING where clause not allowed here
+}
+
+fn main() {}
diff --git a/src/test/ui/parser/type-alias-where-fixable.rs b/src/test/ui/parser/type-alias-where-fixable.rs
new file mode 100644
index 00000000000..562a530a7f3
--- /dev/null
+++ b/src/test/ui/parser/type-alias-where-fixable.rs
@@ -0,0 +1,30 @@
+// check-pass
+// run-rustfix
+
+#![feature(generic_associated_types)]
+
+trait Trait {
+    // Fine.
+    type Assoc where u32: Copy;
+    // Fine.
+    type Assoc2 where u32: Copy, i32: Copy;
+}
+
+impl Trait for u32 {
+    // Not fine, suggests moving.
+    type Assoc where u32: Copy = ();
+    //~^ WARNING where clause not allowed here
+    // Not fine, suggests moving `u32: Copy`
+    type Assoc2 where u32: Copy = () where i32: Copy;
+    //~^ WARNING where clause not allowed here
+}
+
+impl Trait for i32 {
+    // Fine.
+    type Assoc = () where u32: Copy;
+    // Not fine, suggests moving both.
+    type Assoc2 where u32: Copy, i32: Copy = ();
+    //~^ WARNING where clause not allowed here
+}
+
+fn main() {}
diff --git a/src/test/ui/parser/type-alias-where-fixable.stderr b/src/test/ui/parser/type-alias-where-fixable.stderr
new file mode 100644
index 00000000000..7ec1a965bae
--- /dev/null
+++ b/src/test/ui/parser/type-alias-where-fixable.stderr
@@ -0,0 +1,42 @@
+warning: where clause not allowed here
+  --> $DIR/type-alias-where-fixable.rs:15:16
+   |
+LL |     type Assoc where u32: Copy = ();
+   |                ^^^^^^^^^^^^^^^
+   |
+   = note: `#[warn(deprecated_where_clause_location)]` on by default
+   = note: see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information
+help: move it to the end of the type declaration
+   |
+LL -     type Assoc where u32: Copy = ();
+LL +     type Assoc  = () where u32: Copy;
+   | 
+
+warning: where clause not allowed here
+  --> $DIR/type-alias-where-fixable.rs:18:17
+   |
+LL |     type Assoc2 where u32: Copy = () where i32: Copy;
+   |                 ^^^^^^^^^^^^^^^
+   |
+   = note: see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information
+help: move it to the end of the type declaration
+   |
+LL -     type Assoc2 where u32: Copy = () where i32: Copy;
+LL +     type Assoc2  = () where i32: Copy, u32: Copy;
+   | 
+
+warning: where clause not allowed here
+  --> $DIR/type-alias-where-fixable.rs:26:17
+   |
+LL |     type Assoc2 where u32: Copy, i32: Copy = ();
+   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = note: see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information
+help: move it to the end of the type declaration
+   |
+LL -     type Assoc2 where u32: Copy, i32: Copy = ();
+LL +     type Assoc2  = () where u32: Copy, i32: Copy;
+   | 
+
+warning: 3 warnings emitted
+
diff --git a/src/test/ui/parser/type-alias-where.rs b/src/test/ui/parser/type-alias-where.rs
index 941acd5b5ab..f6e7dfb7b7b 100644
--- a/src/test/ui/parser/type-alias-where.rs
+++ b/src/test/ui/parser/type-alias-where.rs
@@ -10,28 +10,4 @@ type Bar = () where u32: Copy;
 type Baz = () where;
 //~^ ERROR where clauses are not allowed
 
-trait Trait {
-    // Fine.
-    type Assoc where u32: Copy;
-    // Fine.
-    type Assoc2 where u32: Copy, i32: Copy;
-}
-
-impl Trait for u32 {
-    // Not fine, suggests moving.
-    type Assoc where u32: Copy = ();
-    //~^ WARNING where clause not allowed here
-    // Not fine, suggests moving `u32: Copy`
-    type Assoc2 where u32: Copy = () where i32: Copy;
-    //~^ WARNING where clause not allowed here
-}
-
-impl Trait for i32 {
-    // Fine.
-    type Assoc = () where u32: Copy;
-    // Not fine, suggests moving both.
-    type Assoc2 where u32: Copy, i32: Copy = ();
-    //~^ WARNING where clause not allowed here
-}
-
 fn main() {}
diff --git a/src/test/ui/parser/type-alias-where.stderr b/src/test/ui/parser/type-alias-where.stderr
index 166302c9e1d..8789d2665ad 100644
--- a/src/test/ui/parser/type-alias-where.stderr
+++ b/src/test/ui/parser/type-alias-where.stderr
@@ -3,32 +3,16 @@ error: where clauses are not allowed after the type for type aliases
    |
 LL | type Bar = () where u32: Copy;
    |               ^^^^^^^^^^^^^^^
+   |
+   = note: see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information
 
 error: where clauses are not allowed after the type for type aliases
   --> $DIR/type-alias-where.rs:10:15
    |
 LL | type Baz = () where;
    |               ^^^^^
-
-warning: where clause not allowed here
-  --> $DIR/type-alias-where.rs:22:16
-   |
-LL |     type Assoc where u32: Copy = ();
-   |                ^^^^^^^^^^^^^^^     - help: move it here: `where u32: Copy`
-   |
-   = note: `#[warn(deprecated_where_clause_location)]` on by default
-
-warning: where clause not allowed here
-  --> $DIR/type-alias-where.rs:25:17
-   |
-LL |     type Assoc2 where u32: Copy = () where i32: Copy;
-   |                 ^^^^^^^^^^^^^^^                     - help: move it here: `, u32: Copy`
-
-warning: where clause not allowed here
-  --> $DIR/type-alias-where.rs:33:17
    |
-LL |     type Assoc2 where u32: Copy, i32: Copy = ();
-   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^     - help: move it here: `where u32: Copy, i32: Copy`
+   = note: see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information
 
-error: aborting due to 2 previous errors; 3 warnings emitted
+error: aborting due to 2 previous errors