-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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 #66592 - estebank:raw-raw-ah-ah-ah, r=cramertj
Rework raw ident suggestions Use heuristics to determine whethersuggesting raw identifiers is appropriate. Account for raw identifiers when printing a path in a `use` suggestion. Fix #66126.
- Loading branch information
Showing
10 changed files
with
63 additions
and
34 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
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
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,9 @@ | ||
mod foo { | ||
pub fn r#let() {} | ||
pub fn break() {} //~ ERROR expected identifier, found keyword `break` | ||
} | ||
|
||
fn main() { | ||
foo::let(); //~ ERROR expected identifier, found keyword `let` | ||
r#break(); //~ ERROR cannot find function `break` in this scope | ||
} |
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,36 @@ | ||
error: expected identifier, found keyword `break` | ||
--> $DIR/raw-name-use-suggestion.rs:3:12 | ||
| | ||
LL | pub fn break() {} | ||
| ^^^^^ expected identifier, found keyword | ||
| | ||
help: you can escape reserved keywords to use them as identifiers | ||
| | ||
LL | pub fn r#break() {} | ||
| ^^^^^^^ | ||
|
||
error: expected identifier, found keyword `let` | ||
--> $DIR/raw-name-use-suggestion.rs:7:10 | ||
| | ||
LL | foo::let(); | ||
| ^^^ expected identifier, found keyword | ||
| | ||
help: you can escape reserved keywords to use them as identifiers | ||
| | ||
LL | foo::r#let(); | ||
| ^^^^^ | ||
|
||
error[E0425]: cannot find function `break` in this scope | ||
--> $DIR/raw-name-use-suggestion.rs:8:5 | ||
| | ||
LL | r#break(); | ||
| ^^^^^^^ not found in this scope | ||
| | ||
help: possible candidate is found in another module, you can import it into scope | ||
| | ||
LL | use foo::r#break; | ||
| | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0425`. |
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