rust/tests/ui/methods/method-not-found-but-doc-alias.rs
Robin Schroer f908f0be5a
Consider doc(alias) when providing typo suggestions
This means that

```rust
impl Foo {
    #[doc(alias = "quux")]
    fn bar(&self) {}
}

fn main() {
    (Foo {}).quux();
}
```

will suggest `bar`. This currently uses the "there is a method with a
similar name" help text, because the point where we choose and emit a
suggestion is different from where we gather the suggestions. Changes
have mainly been made to the latter.

The selection code will now fall back to aliased candidates, but
generally only if there is no candidate that matches based on the
existing Levenshtein methodology.

Fixes #83968.
2023-01-23 10:07:10 +09:00

12 lines
188 B
Rust

struct Foo;
impl Foo {
#[doc(alias = "quux")]
fn bar(&self) {}
}
fn main() {
Foo.quux();
//~^ ERROR no method named `quux` found for struct `Foo` in the current scope
}