-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #39291 - Freyskeyd:check_context_E0423, r=petrochenkov
Checker:: Execute levenshtein before other context checking As explain [here]() i think it's better to check for a miss typing before checking context dependent help. ```rust struct Handle {} struct Something { handle: Handle } fn main() { let handle: Handle = Handle {}; let s: Something = Something { // Checker detect an error and propose a solution with `Handle { /* ... */ }` // but it's a miss typing of `handle` handle: Handle }; } ``` Ping: @nagisa for #39226 Signed-off-by: Freyskeyd <simon.paitrault@gmail.com>
- Loading branch information
Showing
7 changed files
with
65 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
struct Handle {} | ||
|
||
struct Something { | ||
handle: Handle | ||
} | ||
|
||
fn main() { | ||
let handle: Handle = Handle {}; | ||
|
||
let s: Something = Something { | ||
handle: Handle | ||
//~^ ERROR cannot find value `Handle` in this scope | ||
//~| NOTE did you mean `handle`? | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
error[E0423]: expected value, found struct `Handle` | ||
--> $DIR/issue-39226.rs:20:17 | ||
| | ||
20 | handle: Handle | ||
| ^^^^^^ | ||
| | | ||
| did you mean `handle`? | ||
| did you mean `Handle { /* fields */ }`? | ||
|
||
error: aborting due to previous error | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters