diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-12-08 12:19:53 +0100 |
|---|---|---|
| committer | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-12-21 19:20:41 +0100 |
| commit | b5f00beaa5a77ff8bccbe4330ea0b5047661cbf5 (patch) | |
| tree | 25c6f4b6e62c7db4c1084bd784ba977c4fb687fd /src/test/ui/parser | |
| parent | 4625ba4872e17a98ea11940fff0e50b3b880b815 (diff) | |
| download | rust-b5f00beaa5a77ff8bccbe4330ea0b5047661cbf5.tar.gz rust-b5f00beaa5a77ff8bccbe4330ea0b5047661cbf5.zip | |
parse_generic_bounds: account for negative lifetime bounds
Diffstat (limited to 'src/test/ui/parser')
| -rw-r--r-- | src/test/ui/parser/issue-33418.fixed | 10 | ||||
| -rw-r--r-- | src/test/ui/parser/issue-33418.rs | 10 | ||||
| -rw-r--r-- | src/test/ui/parser/issue-33418.stderr | 30 | ||||
| -rw-r--r-- | src/test/ui/parser/issue-67146-negative-outlives-bound-syntactic-fail.rs | 12 | ||||
| -rw-r--r-- | src/test/ui/parser/issue-67146-negative-outlives-bound-syntactic-fail.stderr | 26 |
5 files changed, 63 insertions, 25 deletions
diff --git a/src/test/ui/parser/issue-33418.fixed b/src/test/ui/parser/issue-33418.fixed index 2aaa3b5b1ea..ed885ae1435 100644 --- a/src/test/ui/parser/issue-33418.fixed +++ b/src/test/ui/parser/issue-33418.fixed @@ -1,15 +1,15 @@ // run-rustfix trait Tr {} -//~^ ERROR negative trait bounds are not supported +//~^ ERROR negative bounds are not supported trait Tr2: SuperA {} -//~^ ERROR negative trait bounds are not supported +//~^ ERROR negative bounds are not supported trait Tr3: SuperB {} -//~^ ERROR negative trait bounds are not supported +//~^ ERROR negative bounds are not supported trait Tr4: SuperB + SuperD {} -//~^ ERROR negative trait bounds are not supported +//~^ ERROR negative bounds are not supported trait Tr5 {} -//~^ ERROR negative trait bounds are not supported +//~^ ERROR negative bounds are not supported trait SuperA {} trait SuperB {} diff --git a/src/test/ui/parser/issue-33418.rs b/src/test/ui/parser/issue-33418.rs index 55331520927..9934284abfb 100644 --- a/src/test/ui/parser/issue-33418.rs +++ b/src/test/ui/parser/issue-33418.rs @@ -1,17 +1,17 @@ // run-rustfix trait Tr: !SuperA {} -//~^ ERROR negative trait bounds are not supported +//~^ ERROR negative bounds are not supported trait Tr2: SuperA + !SuperB {} -//~^ ERROR negative trait bounds are not supported +//~^ ERROR negative bounds are not supported trait Tr3: !SuperA + SuperB {} -//~^ ERROR negative trait bounds are not supported +//~^ ERROR negative bounds are not supported trait Tr4: !SuperA + SuperB + !SuperC + SuperD {} -//~^ ERROR negative trait bounds are not supported +//~^ ERROR negative bounds are not supported trait Tr5: !SuperA + !SuperB {} -//~^ ERROR negative trait bounds are not supported +//~^ ERROR negative bounds are not supported trait SuperA {} trait SuperB {} diff --git a/src/test/ui/parser/issue-33418.stderr b/src/test/ui/parser/issue-33418.stderr index 479e7bed101..7f361dbe271 100644 --- a/src/test/ui/parser/issue-33418.stderr +++ b/src/test/ui/parser/issue-33418.stderr @@ -1,46 +1,46 @@ -error: negative trait bounds are not supported +error: negative bounds are not supported --> $DIR/issue-33418.rs:3:9 | LL | trait Tr: !SuperA {} - | ^^^^^^^^^ negative trait bounds are not supported + | ^^^^^^^^^ negative bounds are not supported | - = help: remove the trait bound + = help: remove the bound -error: negative trait bounds are not supported +error: negative bounds are not supported --> $DIR/issue-33418.rs:5:19 | LL | trait Tr2: SuperA + !SuperB {} - | ^^^^^^^^^ negative trait bounds are not supported + | ^^^^^^^^^ negative bounds are not supported | - = help: remove the trait bound + = help: remove the bound -error: negative trait bounds are not supported +error: negative bounds are not supported --> $DIR/issue-33418.rs:7:10 | LL | trait Tr3: !SuperA + SuperB {} - | ^^^^^^^^^ negative trait bounds are not supported + | ^^^^^^^^^ negative bounds are not supported | - = help: remove the trait bound + = help: remove the bound -error: negative trait bounds are not supported +error: negative bounds are not supported --> $DIR/issue-33418.rs:9:10 | LL | trait Tr4: !SuperA + SuperB | ^^^^^^^^^ LL | + !SuperC + SuperD {} - | ^^^^^^^^^ negative trait bounds are not supported + | ^^^^^^^^^ negative bounds are not supported | - = help: remove the trait bounds + = help: remove the bounds -error: negative trait bounds are not supported +error: negative bounds are not supported --> $DIR/issue-33418.rs:12:10 | LL | trait Tr5: !SuperA | ^^^^^^^^^ LL | + !SuperB {} - | ^^^^^^^^^ negative trait bounds are not supported + | ^^^^^^^^^ negative bounds are not supported | - = help: remove the trait bounds + = help: remove the bounds error: aborting due to 5 previous errors diff --git a/src/test/ui/parser/issue-67146-negative-outlives-bound-syntactic-fail.rs b/src/test/ui/parser/issue-67146-negative-outlives-bound-syntactic-fail.rs new file mode 100644 index 00000000000..5a109ba7c68 --- /dev/null +++ b/src/test/ui/parser/issue-67146-negative-outlives-bound-syntactic-fail.rs @@ -0,0 +1,12 @@ +// In this regression test for #67146, we check that the +// negative outlives bound `!'a` is rejected by the parser. +// This regression was first introduced in PR #57364. + +fn main() {} + +fn f1<T: !'static>() {} +//~^ ERROR negative bounds are not supported +fn f2<'a, T: Ord + !'a>() {} +//~^ ERROR negative bounds are not supported +fn f3<'a, T: !'a + Ord>() {} +//~^ ERROR negative bounds are not supported diff --git a/src/test/ui/parser/issue-67146-negative-outlives-bound-syntactic-fail.stderr b/src/test/ui/parser/issue-67146-negative-outlives-bound-syntactic-fail.stderr new file mode 100644 index 00000000000..74437c1a008 --- /dev/null +++ b/src/test/ui/parser/issue-67146-negative-outlives-bound-syntactic-fail.stderr @@ -0,0 +1,26 @@ +error: negative bounds are not supported + --> $DIR/issue-67146-negative-outlives-bound-syntactic-fail.rs:7:8 + | +LL | fn f1<T: !'static>() {} + | ^^^^^^^^^^ negative bounds are not supported + | + = help: remove the bound + +error: negative bounds are not supported + --> $DIR/issue-67146-negative-outlives-bound-syntactic-fail.rs:9:18 + | +LL | fn f2<'a, T: Ord + !'a>() {} + | ^^^^^ negative bounds are not supported + | + = help: remove the bound + +error: negative bounds are not supported + --> $DIR/issue-67146-negative-outlives-bound-syntactic-fail.rs:11:12 + | +LL | fn f3<'a, T: !'a + Ord>() {} + | ^^^^^ negative bounds are not supported + | + = help: remove the bound + +error: aborting due to 3 previous errors + |
