about summary refs log tree commit diff
path: root/tests/ui/parser
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-08-17 17:54:50 +0000
committerbors <bors@rust-lang.org>2023-08-17 17:54:50 +0000
commit07688726805d5db0a4bca445a6651d09708041ea (patch)
tree97a7ae14e041f4db47e749975d8fa2d2fe07cc12 /tests/ui/parser
parent4a0402cd805aa1f4dd8e2d96b038be664db293c3 (diff)
parentddcd7cac41b05995426b97f0f0bbca0866a1dd96 (diff)
downloadrust-07688726805d5db0a4bca445a6651d09708041ea.tar.gz
rust-07688726805d5db0a4bca445a6651d09708041ea.zip
Auto merge of #114802 - chenyukang:yukang-fix-114979-bad-parens-dyn, r=estebank
Fix bad suggestion when wrong parentheses around a dyn trait

Fixes #114797
Diffstat (limited to 'tests/ui/parser')
-rw-r--r--tests/ui/parser/trait-object-delimiters.rs4
-rw-r--r--tests/ui/parser/trait-object-delimiters.stderr12
2 files changed, 8 insertions, 8 deletions
diff --git a/tests/ui/parser/trait-object-delimiters.rs b/tests/ui/parser/trait-object-delimiters.rs
index c41cda18743..e9b13defe03 100644
--- a/tests/ui/parser/trait-object-delimiters.rs
+++ b/tests/ui/parser/trait-object-delimiters.rs
@@ -3,9 +3,9 @@
 fn foo1(_: &dyn Drop + AsRef<str>) {} //~ ERROR ambiguous `+` in a type
 //~^ ERROR only auto traits can be used as additional traits in a trait object
 
-fn foo2(_: &dyn (Drop + AsRef<str>)) {} //~ ERROR incorrect braces around trait bounds
+fn foo2(_: &dyn (Drop + AsRef<str>)) {} //~ ERROR incorrect parentheses around trait bounds
 
-fn foo2_no_space(_: &dyn(Drop + AsRef<str>)) {} //~ ERROR incorrect braces around trait bounds
+fn foo2_no_space(_: &dyn(Drop + AsRef<str>)) {} //~ ERROR incorrect parentheses around trait bounds
 
 fn foo3(_: &dyn {Drop + AsRef<str>}) {} //~ ERROR expected parameter name, found `{`
 //~^ ERROR expected one of `!`, `(`, `)`, `*`, `,`, `?`, `for`, `~`, lifetime, or path, found `{`
diff --git a/tests/ui/parser/trait-object-delimiters.stderr b/tests/ui/parser/trait-object-delimiters.stderr
index ccce3a8053e..51954675093 100644
--- a/tests/ui/parser/trait-object-delimiters.stderr
+++ b/tests/ui/parser/trait-object-delimiters.stderr
@@ -4,28 +4,28 @@ error: ambiguous `+` in a type
 LL | fn foo1(_: &dyn Drop + AsRef<str>) {}
    |             ^^^^^^^^^^^^^^^^^^^^^ help: use parentheses to disambiguate: `(dyn Drop + AsRef<str>)`
 
-error: incorrect braces around trait bounds
+error: incorrect parentheses around trait bounds
   --> $DIR/trait-object-delimiters.rs:6:17
    |
 LL | fn foo2(_: &dyn (Drop + AsRef<str>)) {}
    |                 ^                 ^
    |
-help: remove the parentheses
+help: fix the parentheses
    |
 LL - fn foo2(_: &dyn (Drop + AsRef<str>)) {}
-LL + fn foo2(_: &dyn  Drop + AsRef<str>) {}
+LL + fn foo2(_: &(dyn Drop + AsRef<str>)) {}
    |
 
-error: incorrect braces around trait bounds
+error: incorrect parentheses around trait bounds
   --> $DIR/trait-object-delimiters.rs:8:25
    |
 LL | fn foo2_no_space(_: &dyn(Drop + AsRef<str>)) {}
    |                         ^                 ^
    |
-help: remove the parentheses
+help: fix the parentheses
    |
 LL - fn foo2_no_space(_: &dyn(Drop + AsRef<str>)) {}
-LL + fn foo2_no_space(_: &dyn Drop + AsRef<str>) {}
+LL + fn foo2_no_space(_: &(dyn Drop + AsRef<str>)) {}
    |
 
 error: expected parameter name, found `{`