parent
7c7bb7dc01
commit
67a85925b1
@ -894,10 +894,13 @@ fn suggest_typo(
|
||||
|
||||
// If the trait has a single item (which wasn't matched by the algorithm), suggest it
|
||||
let suggestion = self.get_single_associated_item(path, &source, is_expected);
|
||||
if !self.r.add_typo_suggestion(err, suggestion, ident_span) {
|
||||
fallback = !self.let_binding_suggestion(err, ident_span);
|
||||
self.r.add_typo_suggestion(err, suggestion, ident_span);
|
||||
}
|
||||
|
||||
if self.let_binding_suggestion(err, ident_span) {
|
||||
fallback = false;
|
||||
}
|
||||
|
||||
fallback
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,16 @@ error[E0425]: cannot find value `y` in this scope
|
||||
--> $DIR/error-festival.rs:14:5
|
||||
|
|
||||
LL | y = 2;
|
||||
| ^ help: a local variable with a similar name exists: `x`
|
||||
| ^
|
||||
|
|
||||
help: a local variable with a similar name exists
|
||||
|
|
||||
LL | x = 2;
|
||||
| ~
|
||||
help: you might have meant to introduce a new binding
|
||||
|
|
||||
LL | let y = 2;
|
||||
| +++
|
||||
|
||||
error[E0603]: constant `FOO` is private
|
||||
--> $DIR/error-festival.rs:22:10
|
||||
|
@ -0,0 +1,7 @@
|
||||
fn main() {
|
||||
let x1 = 0;
|
||||
x2 = 1;
|
||||
//~^ ERROR E0425
|
||||
other_val = 2;
|
||||
//~^ ERROR E0425
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
error[E0425]: cannot find value `x2` in this scope
|
||||
--> $DIR/suggest-let-and-typo-issue-132483.rs:3:5
|
||||
|
|
||||
LL | x2 = 1;
|
||||
| ^^
|
||||
|
|
||||
help: a local variable with a similar name exists
|
||||
|
|
||||
LL | x1 = 1;
|
||||
| ~~
|
||||
help: you might have meant to introduce a new binding
|
||||
|
|
||||
LL | let x2 = 1;
|
||||
| +++
|
||||
|
||||
error[E0425]: cannot find value `other_val` in this scope
|
||||
--> $DIR/suggest-let-and-typo-issue-132483.rs:5:5
|
||||
|
|
||||
LL | other_val = 2;
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
help: you might have meant to introduce a new binding
|
||||
|
|
||||
LL | let other_val = 2;
|
||||
| +++
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0425`.
|
Loading…
Reference in New Issue
Block a user