Skip to content

Do not suggest type parameter when followed by < #72640

Closed
@dtolnay

Description

@dtolnay
struct S {
    m: Vec<Hashmap<String, ()>>,
}
error[E0412]: cannot find type `Hashmap` in this scope
 --> src/main.rs:2:12
  |
1 | struct S {
  |         - help: you might be missing a type parameter: `<Hashmap>`
2 |     m: Vec<Hashmap<String, ()>>,
  |            ^^^^^^^ not found in this scope

Rustc should know that struct S<Hashmap> is not in the right direction because that still wouldn't make Hashmap<String, ()> a valid thing to write; type parameters can't have type parameters (yet??).

Separately, #70572 should also have prevented the suggestion in this case, but is an independent issue.

cc @estebank who worked on this recently in #68447.

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsA-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`C-bugCategory: This is a bug.D-invalid-suggestionDiagnostics: A structured suggestion resulting in incorrect code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions