Skip to content

Custom (synonym) suggestions for nonexistent methods #51398

Open
@varkor

Description

@varkor

Currently if the user types a method that does not exist, a suggestion may be provided if what was typed is reasonably close to an existing method.

let set = ::std::collections::HashSet::new();
set.insrt(0u8); // = help: did you mean `insert`?

However, this only catches typos — completely different names aren't considered "close". I think it'd be helpful, especially for people coming from other languages (or switching between them frequently) to be able to specify custom suggestions for potential alternate names, so that something like the following works:

let set = ::std::collections::HashSet::new();
set.add(0u8); // = help: did you mean `insert`?
set.push(0u8); // = help: did you mean `insert`?
// etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.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