From 3bbbe3cf64ca15e2fb746661e8fa069c6de640e8 Mon Sep 17 00:00:00 2001 From: Kornel Date: Sun, 17 Mar 2024 23:40:12 +0000 Subject: [PATCH] Test generic arg suggestion inside nested item --- .../generic-type-less-params-with-defaults.rs | 9 +++++++++ ...neric-type-less-params-with-defaults.stderr | 18 +++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/tests/ui/generics/generic-type-less-params-with-defaults.rs b/tests/ui/generics/generic-type-less-params-with-defaults.rs index b0952a26332..d04b1c80d34 100644 --- a/tests/ui/generics/generic-type-less-params-with-defaults.rs +++ b/tests/ui/generics/generic-type-less-params-with-defaults.rs @@ -15,4 +15,13 @@ fn main() { let _x = (1..10).collect::(); //~^ ERROR missing generics for struct `HashMap` //~| SUGGESTION <_, _> + + ().extend::<[(); 0]>({ + fn not_the_extend() { + let _: Vec; + //~^ ERROR missing generics for struct `Vec` + //~| SUGGESTION + } + [] + }); } diff --git a/tests/ui/generics/generic-type-less-params-with-defaults.stderr b/tests/ui/generics/generic-type-less-params-with-defaults.stderr index 43956237e4c..a6771a6d5c8 100644 --- a/tests/ui/generics/generic-type-less-params-with-defaults.stderr +++ b/tests/ui/generics/generic-type-less-params-with-defaults.stderr @@ -30,6 +30,22 @@ help: add missing generic arguments LL | let _x = (1..10).collect::>(); | ++++++ -error: aborting due to 2 previous errors +error[E0107]: missing generics for struct `Vec` + --> $DIR/generic-type-less-params-with-defaults.rs:21:20 + | +LL | let _: Vec; + | ^^^ expected at least 1 generic argument + | +note: struct defined here, with at least 1 generic parameter: `T` + --> $DIR/generic-type-less-params-with-defaults.rs:5:8 + | +LL | struct Vec( + | ^^^ - +help: add missing generic argument + | +LL | let _: Vec; + | +++ + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0107`.