diff options
| author | Michael Goulet <michael@errs.io> | 2024-07-10 17:49:50 -0400 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2024-07-10 17:49:50 -0400 |
| commit | 898ed2ffa6c485530af1fbe6117c0deb4290715f (patch) | |
| tree | 4813396f722c85139d412395a3a9a9c05858de40 /tests/ui/parser | |
| parent | 32c8bfdb11e519c6608ead730b6dfafc6cafb9c5 (diff) | |
| download | rust-898ed2ffa6c485530af1fbe6117c0deb4290715f.tar.gz rust-898ed2ffa6c485530af1fbe6117c0deb4290715f.zip | |
Enforce that ? and for<...> are not combined
Diffstat (limited to 'tests/ui/parser')
| -rw-r--r-- | tests/ui/parser/bounds-type.rs | 2 | ||||
| -rw-r--r-- | tests/ui/parser/bounds-type.stderr | 10 |
2 files changed, 10 insertions, 2 deletions
diff --git a/tests/ui/parser/bounds-type.rs b/tests/ui/parser/bounds-type.rs index 2b2a44b7062..47fec7b1e77 100644 --- a/tests/ui/parser/bounds-type.rs +++ b/tests/ui/parser/bounds-type.rs @@ -5,7 +5,7 @@ struct S< T: Tr + 'a, // OK T: 'a, // OK T:, // OK - T: for<'a> ?Trait, // OK + T: for<'a> ?Trait, //~ ERROR `for<...>` binder not allowed with `?` trait polarity modifier T: Tr +, // OK T: ?'a, //~ ERROR `?` may only modify trait bounds, not lifetime bounds diff --git a/tests/ui/parser/bounds-type.stderr b/tests/ui/parser/bounds-type.stderr index d1210e88d66..fa8ab6812b1 100644 --- a/tests/ui/parser/bounds-type.stderr +++ b/tests/ui/parser/bounds-type.stderr @@ -1,3 +1,11 @@ +error: `for<...>` binder not allowed with `?` trait polarity modifier + --> $DIR/bounds-type.rs:8:16 + | +LL | T: for<'a> ?Trait, + | ---- ^ + | | + | there is not a well-defined meaning for a higher-ranked `?` trait + error: `?` may only modify trait bounds, not lifetime bounds --> $DIR/bounds-type.rs:10:8 | @@ -16,5 +24,5 @@ error: `const` may only modify trait bounds, not lifetime bounds LL | T: const 'a, | ^^^^^ -error: aborting due to 3 previous errors +error: aborting due to 4 previous errors |
