Skip to content

suggest calling Self::associated_function() #96453

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
qutesy opened this issue Apr 26, 2022 · 0 comments · Fixed by #96507
Closed

suggest calling Self::associated_function() #96453

qutesy opened this issue Apr 26, 2022 · 0 comments · Fixed by #96507
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@qutesy
Copy link

qutesy commented Apr 26, 2022

Given the following code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=72d0a7426f82aeca7615c923eb4d2da4

struct S;

impl S {
    fn helper() {}

    fn doer(&self) {
        helper();
    }
}

The current output is:

Compiling playground v0.0.1 (/playground)
error[[E0425]](https://doc.rust-lang.org/stable/error-index.html#E0425): cannot find function `helper` in this scope
 [--> src/lib.rs:7:9
](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=72d0a7426f82aeca7615c923eb4d2da4#)  |
7 |         helper();
  |         ^^^^^^ not found in this scope

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

Ideally the output should look like:

Consider calling the associated function `Self::helper()`.
@qutesy qutesy added A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 26, 2022
@TaKO8Ki TaKO8Ki self-assigned this Apr 27, 2022
@bors bors closed this as completed in 34bf620 May 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants