Skip to content

Poor suggestion of alternative function when a name is incorrect #109291

Closed
@Wilfred

Description

@Wilfred

Code

println!("Custom backtrace: {}", std::backtrace::Backtrace::forced_capture());

Current output

error[E0599]: no function or associated item named `forced_capture` found for struct `Backtrace` in the current scope
  --> src/line_parser.rs:19:65
   |
19 |     println!("Custom backtrace: {}", std::backtrace::Backtrace::forced_capture());
   |                                                                 ^^^^^^^^^^^^^^
   |                                                                 |
   |                                                                 function or associated item not found in `Backtrace`
   |                                                                 help: there is an associated function with a similar name: `capture`

For more information about this error, try `rustc --explain E0599`.
error: could not compile `difftastic` due to previous error

Desired output

It would be better to suggest force_capture rather than capture, as that was the function I was looking for.

Rationale and extra context

No response

Other cases

No response

Anything else?

No response

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsT-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