From cd03fe18d8a24434c1510d08c88231fbe9d6b8bf Mon Sep 17 00:00:00 2001 From: EdwinRy Date: Thu, 2 Jun 2022 18:22:25 +0100 Subject: Suggest replace parentheses with angle brackets --- .../gat-trait-path-parenthesised-args.rs | 5 ++++ .../gat-trait-path-parenthesised-args.stderr | 31 +++++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/test/ui/generic-associated-types/gat-trait-path-parenthesised-args.rs b/src/test/ui/generic-associated-types/gat-trait-path-parenthesised-args.rs index f01da8c61ed..c55b0530c9d 100644 --- a/src/test/ui/generic-associated-types/gat-trait-path-parenthesised-args.rs +++ b/src/test/ui/generic-associated-types/gat-trait-path-parenthesised-args.rs @@ -10,4 +10,9 @@ fn foo<'a>(arg: Box>) {} //~| ERROR this associated type takes 0 generic arguments but 1 generic argument //~| ERROR this associated type takes 1 lifetime argument but 0 lifetime arguments + +fn bar<'a>(arg: Box>) {} + //~^ ERROR: parenthesized generic arguments cannot be used + //~| ERROR this associated type takes 1 lifetime argument but 0 lifetime arguments + fn main() {} diff --git a/src/test/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr b/src/test/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr index 6014a02c4d9..162214063e7 100644 --- a/src/test/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr +++ b/src/test/ui/generic-associated-types/gat-trait-path-parenthesised-args.stderr @@ -9,6 +9,19 @@ error: parenthesized generic arguments cannot be used in associated type constra | LL | fn foo<'a>(arg: Box>) {} | ^^^^^ + | +help: use angle brackets instead + | +LL | fn foo<'a>(arg: Box = &'a ()>>) {} + | ~ ~ + +error: parenthesized generic arguments cannot be used in associated type constraints + --> $DIR/gat-trait-path-parenthesised-args.rs:14:27 + | +LL | fn bar<'a>(arg: Box>) {} + | ^-- + | | + | help: remove these parentheses error[E0107]: this associated type takes 1 lifetime argument but 0 lifetime arguments were supplied --> $DIR/gat-trait-path-parenthesised-args.rs:7:27 @@ -40,6 +53,22 @@ note: associated type defined here, with 0 generic parameters LL | type Y<'a>; | ^ -error: aborting due to 4 previous errors +error[E0107]: this associated type takes 1 lifetime argument but 0 lifetime arguments were supplied + --> $DIR/gat-trait-path-parenthesised-args.rs:14:27 + | +LL | fn bar<'a>(arg: Box>) {} + | ^ expected 1 lifetime argument + | +note: associated type defined here, with 1 lifetime parameter: `'a` + --> $DIR/gat-trait-path-parenthesised-args.rs:4:8 + | +LL | type Y<'a>; + | ^ -- +help: add missing lifetime argument + | +LL | fn bar<'a>(arg: Box>) {} + | ++ + +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0107`. -- cgit 1.4.1-3-g733a5