Skip to content
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

Reword incorrect self token suggestion #74197

Merged
merged 1 commit into from
Jul 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/librustc_resolve/late/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ impl<'a> LateResolutionVisitor<'a, '_, '_> {
if ["this", "my"].contains(&&*item_str.as_str())
&& self.self_value_is_available(path[0].ident.span, span)
{
err.span_suggestion(
err.span_suggestion_short(
span,
"did you mean",
"you might have meant to use `self` here instead",
"self".to_string(),
Applicability::MaybeIncorrect,
);
Expand Down
6 changes: 3 additions & 3 deletions src/test/ui/self/suggest-self.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LL | this.x
| ^^^^
| |
| not found in this scope
| help: did you mean: `self`
| help: you might have meant to use `self` here instead

error[E0425]: cannot find value `this` in this scope
--> $DIR/suggest-self.rs:26:9
Expand All @@ -14,7 +14,7 @@ LL | this.foo()
| ^^^^
| |
| not found in this scope
| help: did you mean: `self`
| help: you might have meant to use `self` here instead

error[E0425]: cannot find value `my` in this scope
--> $DIR/suggest-self.rs:31:9
Expand All @@ -23,7 +23,7 @@ LL | my.bar()
| ^^
| |
| not found in this scope
| help: did you mean: `self`
| help: you might have meant to use `self` here instead

error: aborting due to 3 previous errors

Expand Down