-
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.
Auto merge of #72295 - RalfJung:rollup-icmhbs7, r=RalfJung
Rollup of 3 pull requests Successful merges: - #72259 (Disallow forbidden usage of non-ascii identifiers.) - #72261 (Break out early on empty span when generate_fn_span) - #72291 (bootstrap: fix typo) Failed merges: r? @ghost
- Loading branch information
Showing
12 changed files
with
146 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
An non-ascii identifier was used in an invalid context. | ||
|
||
Erroneous code example: | ||
|
||
```compile_fail,E0754 | ||
# #![feature(non_ascii_idents)] | ||
mod řųśť; | ||
// ^ error! | ||
fn main() {} | ||
``` | ||
|
||
```compile_fail,E0754 | ||
# #![feature(non_ascii_idents)] | ||
#[no_mangle] | ||
fn řųśť() {} | ||
// ^ error! | ||
fn main() {} | ||
``` | ||
|
||
Non-ascii can be used as module names if it is inline | ||
or a #\[path\] attribute is specified. For example: | ||
|
||
``` | ||
# #![feature(non_ascii_idents)] | ||
mod řųśť { | ||
const IS_GREAT: bool = true; | ||
} | ||
fn main() {} | ||
``` |
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
1 change: 1 addition & 0 deletions
1
src/test/ui/rfc-2457/auxiliary/mod_file_nonascii_with_path_allowed-aux.rs
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 @@ | ||
pub trait Foo {} |
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,6 @@ | ||
#![feature(non_ascii_idents)] | ||
|
||
mod řųśť; //~ trying to load file for | ||
//~^ file not found for | ||
|
||
fn main() {} |
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,20 @@ | ||
error[E0583]: file not found for module `řųśť` | ||
--> $DIR/mod_file_nonascii_forbidden.rs:3:1 | ||
| | ||
LL | mod řųśť; | ||
| ^^^^^^^^^ | ||
| | ||
= help: to create the module `řųśť`, create file "$DIR/řųśť.rs" | ||
|
||
error[E0754]: trying to load file for module `řųśť` with non ascii identifer name | ||
--> $DIR/mod_file_nonascii_forbidden.rs:3:5 | ||
| | ||
LL | mod řųśť; | ||
| ^^^^ | ||
| | ||
= help: consider using `#[path]` attribute to specify filesystem path | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
Some errors have detailed explanations: E0583, E0754. | ||
For more information about an error, try `rustc --explain E0583`. |
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,7 @@ | ||
// check-pass | ||
#![feature(non_ascii_idents)] | ||
|
||
#[path="auxiliary/mod_file_nonascii_with_path_allowed-aux.rs"] | ||
mod řųśť; | ||
|
||
fn main() {} |
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,8 @@ | ||
// check-pass | ||
#![feature(non_ascii_idents)] | ||
|
||
mod řųśť { | ||
const IS_GREAT: bool = true; | ||
} | ||
|
||
fn main() {} |
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,6 @@ | ||
#![feature(non_ascii_idents)] | ||
|
||
#[no_mangle] | ||
pub fn řųśť() {} //~ `#[no_mangle]` requires ASCII identifier | ||
|
||
fn main() {} |
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 @@ | ||
error[E0754]: `#[no_mangle]` requires ASCII identifier | ||
--> $DIR/no_mangle_nonascii_forbidden.rs:4:1 | ||
| | ||
LL | pub fn řųśť() {} | ||
| ^^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0754`. |