diff options
| author | bors <bors@rust-lang.org> | 2022-03-06 07:22:09 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-03-06 07:22:09 +0000 |
| commit | ad0d1d71d3bc6f85f53d8ab2bf47daa7c8bc2c51 (patch) | |
| tree | 1770b05f82d090b965fbad680818a99c26482ef4 /src/test/ui/parser | |
| parent | 5d9d1e88910f2c7f58e8258b87d30b1340b647fa (diff) | |
| parent | d16ec7b9d1bc6550af3a68e250582a628f5be800 (diff) | |
| download | rust-ad0d1d71d3bc6f85f53d8ab2bf47daa7c8bc2c51.tar.gz rust-ad0d1d71d3bc6f85f53d8ab2bf47daa7c8bc2c51.zip | |
Auto merge of #90076 - jackh726:wherethewhere, r=nikomatsakis
Change location of where clause on GATs Closes #89122 ~Blocked on lang FCP~ r? `@nikomatsakis`
Diffstat (limited to 'src/test/ui/parser')
| -rw-r--r-- | src/test/ui/parser/bounds-lifetime-where.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/parser/bounds-lifetime-where.stderr | 4 | ||||
| -rw-r--r-- | src/test/ui/parser/removed-syntax-ptr-lifetime.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/parser/removed-syntax-ptr-lifetime.stderr | 4 | ||||
| -rw-r--r-- | src/test/ui/parser/type-alias-where-fixable.fixed | 30 | ||||
| -rw-r--r-- | src/test/ui/parser/type-alias-where-fixable.rs | 30 | ||||
| -rw-r--r-- | src/test/ui/parser/type-alias-where-fixable.stderr | 42 | ||||
| -rw-r--r-- | src/test/ui/parser/type-alias-where.rs | 28 | ||||
| -rw-r--r-- | src/test/ui/parser/type-alias-where.stderr | 36 |
9 files changed, 117 insertions, 61 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-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 a9fa23dd95e..f6e7dfb7b7b 100644 --- a/src/test/ui/parser/type-alias-where.rs +++ b/src/test/ui/parser/type-alias-where.rs @@ -6,32 +6,8 @@ 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 - -trait Trait { - // Fine. - type Assoc where u32: Copy; - // Fine. - type Assoc2 where u32: Copy, i32: Copy; -} - -impl Trait for u32 { - // Fine. - type Assoc where u32: Copy = (); - // Not fine, suggests moving `i32: 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` - type Assoc = () where u32: Copy; - //~^ ERROR where clause not allowed here - // Not fine, suggests moving both. - type Assoc2 = () where u32: Copy, i32: Copy; - //~^ ERROR where clause not allowed here -} +//~^ ERROR where clauses are not allowed fn main() {} diff --git a/src/test/ui/parser/type-alias-where.stderr b/src/test/ui/parser/type-alias-where.stderr index 7ab0b28c864..8789d2665ad 100644 --- a/src/test/ui/parser/type-alias-where.stderr +++ b/src/test/ui/parser/type-alias-where.stderr @@ -1,40 +1,18 @@ -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` + | ^^^^^^^^^^^^^^^ + | + = note: see issue #89122 <https://github.com/rust-lang/rust/issues/89122> for more information -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 - | -LL | type Assoc2 where u32: Copy = () where i32: Copy; - | - ^^^^^^^^^^^^^^^ - | | - | help: move it here: `, i32: Copy` - -error: where clause not allowed here - --> $DIR/type-alias-where.rs:30:21 - | -LL | type Assoc = () where u32: Copy; - | - ^^^^^^^^^^^^^^^ - | | - | help: move it here: `where u32: Copy` - -error: where clause not allowed here - --> $DIR/type-alias-where.rs:33:22 | -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 5 previous errors +error: aborting due to 2 previous errors |
