Suggest new type param on single char ident
Suggest new type parameter on single char uppercase ident even if it doesn't appear in a field's type parameter. Address comment in #72641.
This commit is contained in:
parent
4606168dd5
commit
af45d8a5bb
4 changed files with 61 additions and 15 deletions
|
|
@ -4,7 +4,16 @@ error[E0412]: cannot find type `A` in this scope
|
|||
LL | fn foo2<I: Foo>(x: I) {
|
||||
| - similarly named type parameter `I` defined here
|
||||
LL | let _: A = x.boo();
|
||||
| ^ help: a type parameter with a similar name exists: `I`
|
||||
| ^
|
||||
|
|
||||
help: a type parameter with a similar name exists
|
||||
|
|
||||
LL | let _: I = x.boo();
|
||||
| ^
|
||||
help: you might be missing a type parameter
|
||||
|
|
||||
LL | fn foo2<I: Foo, A>(x: I) {
|
||||
| ^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
struct S {
|
||||
m: Vec<Hashmap<String, ()>>, //~ ERROR cannot find type `Hashmap` in this scope
|
||||
struct Struct {
|
||||
m: Vec<Someunknownname<String, ()>>, //~ ERROR cannot find type `Someunknownname` in this scope
|
||||
//~^ NOTE not found in this scope
|
||||
}
|
||||
struct OtherStruct { //~ HELP you might be missing a type parameter
|
||||
m: K, //~ ERROR cannot find type `K` in this scope
|
||||
//~^ NOTE not found in this scope
|
||||
}
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,17 @@
|
|||
error[E0412]: cannot find type `Hashmap` in this scope
|
||||
error[E0412]: cannot find type `Someunknownname` in this scope
|
||||
--> $DIR/type-not-found-in-adt-field.rs:2:12
|
||||
|
|
||||
LL | m: Vec<Hashmap<String, ()>>,
|
||||
| ^^^^^^^ not found in this scope
|
||||
LL | m: Vec<Someunknownname<String, ()>>,
|
||||
| ^^^^^^^^^^^^^^^ not found in this scope
|
||||
|
||||
error: aborting due to previous error
|
||||
error[E0412]: cannot find type `K` in this scope
|
||||
--> $DIR/type-not-found-in-adt-field.rs:6:8
|
||||
|
|
||||
LL | struct OtherStruct {
|
||||
| - help: you might be missing a type parameter: `<K>`
|
||||
LL | m: K,
|
||||
| ^ not found in this scope
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0412`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue