Test generic arg suggestion inside nested item

This commit is contained in:
Kornel 2024-03-17 23:40:12 +00:00
parent 55067c539a
commit 3bbbe3cf64
2 changed files with 26 additions and 1 deletions

View File

@ -15,4 +15,13 @@ fn main() {
let _x = (1..10).collect::<HashMap>(); let _x = (1..10).collect::<HashMap>();
//~^ ERROR missing generics for struct `HashMap` //~^ ERROR missing generics for struct `HashMap`
//~| SUGGESTION <_, _> //~| SUGGESTION <_, _>
().extend::<[(); 0]>({
fn not_the_extend() {
let _: Vec;
//~^ ERROR missing generics for struct `Vec`
//~| SUGGESTION <T>
}
[]
});
} }

View File

@ -30,6 +30,22 @@ help: add missing generic arguments
LL | let _x = (1..10).collect::<HashMap<_, _>>(); LL | let _x = (1..10).collect::<HashMap<_, _>>();
| ++++++ | ++++++
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<T, A = Heap>(
| ^^^ -
help: add missing generic argument
|
LL | let _: Vec<T>;
| +++
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0107`. For more information about this error, try `rustc --explain E0107`.