-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
resolve: Levenshtein-based suggestions for non-import paths
- Loading branch information
1 parent
9dedc81
commit 589bd64
Showing
4 changed files
with
157 additions
and
19 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,33 @@ | ||
// Copyright 2016 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. | ||
|
||
const MAX_ITEM: usize = 10; | ||
|
||
fn foo_bar() {} | ||
|
||
fn foo(c: esize) {} // Misspelled primitive type name. | ||
|
||
enum Bar { } | ||
|
||
type A = Baz; // Misspelled type name. | ||
type B = Opiton<u8>; // Misspelled type name from the prelude. | ||
|
||
mod m { | ||
type A = Baz; // No suggestion here, Bar is not visible | ||
|
||
pub struct First; | ||
pub struct Second; | ||
} | ||
|
||
fn main() { | ||
let v = [0u32; MAXITEM]; // Misspelled constant name. | ||
foobar(); // Misspelled function name. | ||
let b: m::first = m::second; // Misspelled item in module. | ||
} |
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,56 @@ | ||
error[E0412]: cannot find type `esize` in this scope | ||
--> $DIR/levenshtein.rs:15:11 | ||
| | ||
15 | fn foo(c: esize) {} // Misspelled primitive type name. | ||
| ^^^^^ did you mean `isize`? | ||
|
||
error[E0412]: cannot find type `Baz` in this scope | ||
--> $DIR/levenshtein.rs:19:10 | ||
| | ||
19 | type A = Baz; // Misspelled type name. | ||
| ^^^ did you mean `Bar`? | ||
|
||
error[E0412]: cannot find type `Opiton` in this scope | ||
--> $DIR/levenshtein.rs:20:10 | ||
| | ||
20 | type B = Opiton<u8>; // Misspelled type name from the prelude. | ||
| ^^^^^^^^^^ did you mean `Option`? | ||
|
||
error[E0412]: cannot find type `Baz` in this scope | ||
--> $DIR/levenshtein.rs:23:14 | ||
| | ||
23 | type A = Baz; // No suggestion here, Bar is not visible | ||
| ^^^ not found in this scope | ||
|
||
error[E0425]: cannot find value `MAXITEM` in this scope | ||
--> $DIR/levenshtein.rs:30:20 | ||
| | ||
30 | let v = [0u32; MAXITEM]; // Misspelled constant name. | ||
| ^^^^^^^ did you mean `MAX_ITEM`? | ||
|
||
error[E0425]: cannot find function `foobar` in this scope | ||
--> $DIR/levenshtein.rs:31:5 | ||
| | ||
31 | foobar(); // Misspelled function name. | ||
| ^^^^^^ did you mean `foo_bar`? | ||
|
||
error[E0412]: cannot find type `first` in module `m` | ||
--> $DIR/levenshtein.rs:32:12 | ||
| | ||
32 | let b: m::first = m::second; // Misspelled item in module. | ||
| ^^^^^^^^ did you mean `m::First`? | ||
|
||
error[E0425]: cannot find value `second` in module `m` | ||
--> $DIR/levenshtein.rs:32:23 | ||
| | ||
32 | let b: m::first = m::second; // Misspelled item in module. | ||
| ^^^^^^^^^ did you mean `m::Second`? | ||
|
||
error[E0080]: constant evaluation error | ||
--> $DIR/levenshtein.rs:30:20 | ||
| | ||
30 | let v = [0u32; MAXITEM]; // Misspelled constant name. | ||
| ^^^^^^^ unresolved path in constant expression | ||
|
||
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