Skip to content

Commit 5ef9245

Browse files
authored
Rollup merge of rust-lang#74197 - estebank:self-sugg, r=petrochenkov
Reword incorrect `self` token suggestion
2 parents 212ce2f + 520fb92 commit 5ef9245

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/librustc_resolve/late/diagnostics.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,9 @@ impl<'a> LateResolutionVisitor<'a, '_, '_> {
168168
if ["this", "my"].contains(&&*item_str.as_str())
169169
&& self.self_value_is_available(path[0].ident.span, span)
170170
{
171-
err.span_suggestion(
171+
err.span_suggestion_short(
172172
span,
173-
"did you mean",
173+
"you might have meant to use `self` here instead",
174174
"self".to_string(),
175175
Applicability::MaybeIncorrect,
176176
);

src/test/ui/self/suggest-self.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | this.x
55
| ^^^^
66
| |
77
| not found in this scope
8-
| help: did you mean: `self`
8+
| help: you might have meant to use `self` here instead
99

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

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

2828
error: aborting due to 3 previous errors
2929

0 commit comments

Comments
 (0)