diff options
| author | León Orell Valerian Liehr <me@fmease.dev> | 2025-08-15 22:14:37 +0200 |
|---|---|---|
| committer | León Orell Valerian Liehr <me@fmease.dev> | 2025-08-16 01:21:35 +0200 |
| commit | eb3e0d4c8a5599db0a4624662e5ab59380be8cd2 (patch) | |
| tree | 237a3761291924c77aadde70402e17b275d4d629 /tests/ui/impl-trait | |
| parent | 577166503aee7290e09374da21f4045c455acfd5 (diff) | |
| download | rust-eb3e0d4c8a5599db0a4624662e5ab59380be8cd2.tar.gz rust-eb3e0d4c8a5599db0a4624662e5ab59380be8cd2.zip | |
Properly recover from parenthesized use-bounds (precise capturing)
Diffstat (limited to 'tests/ui/impl-trait')
| -rw-r--r-- | tests/ui/impl-trait/precise-capturing/parenthesized.rs | 8 | ||||
| -rw-r--r-- | tests/ui/impl-trait/precise-capturing/parenthesized.stderr | 14 |
2 files changed, 22 insertions, 0 deletions
diff --git a/tests/ui/impl-trait/precise-capturing/parenthesized.rs b/tests/ui/impl-trait/precise-capturing/parenthesized.rs new file mode 100644 index 00000000000..e3f80fc1d9f --- /dev/null +++ b/tests/ui/impl-trait/precise-capturing/parenthesized.rs @@ -0,0 +1,8 @@ +// Ensure that we forbid parenthesized use-bounds. In the future we might want +// to lift this restriction but for now they bear no use whatsoever. + +fn f() -> impl Sized + (use<>) {} +//~^ ERROR precise capturing lists may not be parenthesized +//~| HELP remove the parentheses + +fn main() {} diff --git a/tests/ui/impl-trait/precise-capturing/parenthesized.stderr b/tests/ui/impl-trait/precise-capturing/parenthesized.stderr new file mode 100644 index 00000000000..c97fa9972ef --- /dev/null +++ b/tests/ui/impl-trait/precise-capturing/parenthesized.stderr @@ -0,0 +1,14 @@ +error: precise capturing lists may not be parenthesized + --> $DIR/parenthesized.rs:4:24 + | +LL | fn f() -> impl Sized + (use<>) {} + | ^^^^^^^ + | +help: remove the parentheses + | +LL - fn f() -> impl Sized + (use<>) {} +LL + fn f() -> impl Sized + use<> {} + | + +error: aborting due to 1 previous error + |
