Auto merge of #83799 - crlf0710:stablize_non_ascii_idents, r=Manishearth

Stablize `non-ascii-idents`

This is the stablization PR for RFC 2457. Currently this is waiting on fcp in [tracking issue](https://github.com/rust-lang/rust/issues/55467).

r? `@Manishearth`
This commit is contained in:
bors 2021-04-18 23:28:43 +00:00
commit c4ba8e3e5f
57 changed files with 166 additions and 549 deletions

View File

@ -8,7 +8,7 @@ use rustc_feature::{Features, GateIssue};
use rustc_session::parse::{feature_err, feature_err_issue};
use rustc_session::Session;
use rustc_span::source_map::Spanned;
use rustc_span::symbol::{sym, Symbol};
use rustc_span::symbol::sym;
use rustc_span::Span;
use tracing::debug;
@ -328,17 +328,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
}
}
fn visit_name(&mut self, sp: Span, name: Symbol) {
if !name.as_str().is_ascii() {
gate_feature_post!(
&self,
non_ascii_idents,
self.sess.parse_sess.source_map().guess_head_span(sp),
"non-ascii idents are not fully supported"
);
}
}
fn visit_item(&mut self, i: &'a ast::Item) {
match i.kind {
ast::ItemKind::ForeignMod(ref foreign_module) => {

View File

@ -4,8 +4,8 @@ beta compilers will not comply.
Erroneous code example:
```ignore (depends on release channel)
#![feature(non_ascii_idents)] // error: `#![feature]` may not be used on the
// stable release channel
#![feature(lang_items)] // error: `#![feature]` may not be used on the
// stable release channel
```
If you need the feature, make sure to use a nightly release of the compiler

View File

@ -3,7 +3,6 @@ A non-ASCII identifier was used in an invalid context.
Erroneous code examples:
```compile_fail,E0754
# #![feature(non_ascii_idents)]
mod řųśť; // error!
@ -17,8 +16,6 @@ Non-ASCII can be used as module names if it is inlined or if a `#[path]`
attribute is specified. For example:
```
# #![feature(non_ascii_idents)]
mod řųśť { // ok!
const IS_GREAT: bool = true;
}

View File

@ -279,6 +279,8 @@ declare_features! (
(accepted, unsafe_block_in_unsafe_fn, "1.52.0", Some(71668), None),
/// Allows the use of or-patterns (e.g., `0 | 1`).
(accepted, or_patterns, "1.53.0", Some(54883), None),
/// Allows defining identifiers beyond ASCII.
(accepted, non_ascii_idents, "1.53.0", Some(55467), None),
// -------------------------------------------------------------------------
// feature-group-end: accepted features

View File

@ -255,9 +255,6 @@ declare_features! (
// feature-group-start: actual feature gates
// -------------------------------------------------------------------------
/// Allows defining identifiers beyond ASCII.
(active, non_ascii_idents, "1.0.0", Some(55467), None),
/// Allows using `#[plugin_registrar]` on functions.
(active, plugin_registrar, "1.0.0", Some(29597), None),

View File

@ -10,7 +10,6 @@ declare_lint! {
///
/// ```rust,compile_fail
/// # #![allow(unused)]
/// #![feature(non_ascii_idents)]
/// #![deny(non_ascii_idents)]
/// fn main() {
/// let föö = 1;
@ -21,14 +20,11 @@ declare_lint! {
///
/// ### Explanation
///
/// Currently on stable Rust, identifiers must contain ASCII characters.
/// The [`non_ascii_idents`] nightly-only feature allows identifiers to
/// contain non-ASCII characters. This lint allows projects that wish to
/// retain the limit of only using ASCII characters to switch this lint to
/// "forbid" (for example to ease collaboration or for security reasons).
/// This lint allows projects that wish to retain the limit of only using
/// ASCII characters to switch this lint to "forbid" (for example to ease
/// collaboration or for security reasons).
/// See [RFC 2457] for more details.
///
/// [`non_ascii_idents`]: https://doc.rust-lang.org/nightly/unstable-book/language-features/non-ascii-idents.html
/// [RFC 2457]: https://github.com/rust-lang/rfcs/blob/master/text/2457-non-ascii-idents.md
pub NON_ASCII_IDENTS,
Allow,
@ -44,7 +40,6 @@ declare_lint! {
///
/// ```rust
/// # #![allow(unused)]
/// #![feature(non_ascii_idents)]
/// const µ: f64 = 0.000001;
/// ```
///
@ -52,10 +47,8 @@ declare_lint! {
///
/// ### Explanation
///
/// With the [`non_ascii_idents`] nightly-only feature enabled,
/// identifiers are allowed to use non-ASCII characters. This lint warns
/// about using characters which are not commonly used, and may cause
/// visual confusion.
/// This lint warns about using characters which are not commonly used, and may
/// cause visual confusion.
///
/// This lint is triggered by identifiers that contain a codepoint that is
/// not part of the set of "Allowed" codepoints as described by [Unicode®
@ -66,7 +59,6 @@ declare_lint! {
/// that if you "forbid" this lint that existing code may fail in the
/// future.
///
/// [`non_ascii_idents`]: https://doc.rust-lang.org/nightly/unstable-book/language-features/non-ascii-idents.html
/// [TR39Allowed]: https://www.unicode.org/reports/tr39/#General_Security_Profile
pub UNCOMMON_CODEPOINTS,
Warn,
@ -81,8 +73,6 @@ declare_lint! {
/// ### Example
///
/// ```rust
/// #![feature(non_ascii_idents)]
///
/// // Latin Capital Letter E With Caron
/// pub const Ě: i32 = 1;
/// // Latin Capital Letter E With Breve
@ -93,10 +83,8 @@ declare_lint! {
///
/// ### Explanation
///
/// With the [`non_ascii_idents`] nightly-only feature enabled,
/// identifiers are allowed to use non-ASCII characters. This lint warns
/// when different identifiers may appear visually similar, which can
/// cause confusion.
/// This lint warns when different identifiers may appear visually similar,
/// which can cause confusion.
///
/// The confusable detection algorithm is based on [Unicode® Technical
/// Standard #39 Unicode Security Mechanisms Section 4 Confusable
@ -110,7 +98,6 @@ declare_lint! {
/// Beware that if you "forbid" this lint that existing code may fail in
/// the future.
///
/// [`non_ascii_idents`]: https://doc.rust-lang.org/nightly/unstable-book/language-features/non-ascii-idents.html
/// [TR39Confusable]: https://www.unicode.org/reports/tr39/#Confusable_Detection
pub CONFUSABLE_IDENTS,
Warn,
@ -127,8 +114,6 @@ declare_lint! {
/// ### Example
///
/// ```rust
/// #![feature(non_ascii_idents)]
///
/// // The Japanese katakana character エ can be confused with the Han character 工.
/// const エ: &'static str = "アイウ";
/// ```
@ -137,10 +122,8 @@ declare_lint! {
///
/// ### Explanation
///
/// With the [`non_ascii_idents`] nightly-only feature enabled,
/// identifiers are allowed to use non-ASCII characters. This lint warns
/// when characters between different scripts may appear visually similar,
/// which can cause confusion.
/// This lint warns when characters between different scripts may appear
/// visually similar, which can cause confusion.
///
/// If the crate contains other identifiers in the same script that have
/// non-confusable characters, then this lint will *not* be issued. For
@ -152,8 +135,6 @@ declare_lint! {
/// Note that the set of confusable characters may change over time.
/// Beware that if you "forbid" this lint that existing code may fail in
/// the future.
///
/// [`non_ascii_idents`]: https://doc.rust-lang.org/nightly/unstable-book/language-features/non-ascii-idents.html
pub MIXED_SCRIPT_CONFUSABLES,
Warn,
"detects Unicode scripts whose mixed script confusables codepoints are solely used",

View File

@ -1,48 +0,0 @@
# `non_ascii_idents`
The tracking issue for this feature is: [#55467]
[#55467]: https://github.com/rust-lang/rust/issues/55467
------------------------
The `non_ascii_idents` feature adds support for non-ASCII identifiers.
## Examples
```rust
#![feature(non_ascii_idents)]
const ε: f64 = 0.00001f64;
const Π: f64 = 3.14f64;
```
## Changes to the language reference
> **<sup>Lexer:<sup>**\
> IDENTIFIER :\
> &nbsp;&nbsp; &nbsp;&nbsp; XID_start XID_continue<sup>\*</sup>\
> &nbsp;&nbsp; | `_` XID_continue<sup>+</sup>
An identifier is any nonempty Unicode string of the following form:
Either
* The first character has property [`XID_start`]
* The remaining characters have property [`XID_continue`]
Or
* The first character is `_`
* The identifier is more than one character, `_` alone is not an identifier
* The remaining characters have property [`XID_continue`]
that does _not_ occur in the set of [strict keywords].
> **Note**: [`XID_start`] and [`XID_continue`] as character properties cover the
> character ranges used to form the more familiar C and Java language-family
> identifiers.
[`XID_start`]: http://unicode.org/cldr/utility/list-unicodeset.jsp?a=%5B%3AXID_Start%3A%5D&abb=on&g=&i=
[`XID_continue`]: http://unicode.org/cldr/utility/list-unicodeset.jsp?a=%5B%3AXID_Continue%3A%5D&abb=on&g=&i=
[strict keywords]: ../../reference/keywords.md#strict-keywords

View File

@ -2,8 +2,6 @@
// compile-flags:-g
#![feature(non_ascii_idents)]
// This test checks whether debuginfo generation can handle multi-byte UTF-8
// characters at the end of a block. There's no need to do anything in the
// debugger -- just make sure that the compiler doesn't crash.

View File

@ -1,5 +1,3 @@
#![feature(non_ascii_idents)]
fn main() {
let _ = ("a̐éö̲", 0u7); //~ ERROR invalid width
let _ = ("아あ", 1i42); //~ ERROR invalid width

View File

@ -1,5 +1,5 @@
error: invalid width `7` for integer literal
--> $DIR/unicode_2.rs:4:25
--> $DIR/unicode_2.rs:2:25
|
LL | let _ = ("a̐éö̲", 0u7);
| ^^^
@ -7,7 +7,7 @@ LL | let _ = ("a̐éö̲", 0u7);
= help: valid widths are 8, 16, 32, 64 and 128
error: invalid width `42` for integer literal
--> $DIR/unicode_2.rs:5:20
--> $DIR/unicode_2.rs:3:20
|
LL | let _ = ("아あ", 1i42);
| ^^^^
@ -15,7 +15,7 @@ LL | let _ = ("아あ", 1i42);
= help: valid widths are 8, 16, 32, 64 and 128
error[E0425]: cannot find value `a̐é` in this scope
--> $DIR/unicode_2.rs:6:13
--> $DIR/unicode_2.rs:4:13
|
LL | let _ = a̐é;
| ^^ not found in this scope

View File

@ -1,34 +0,0 @@
extern crate core as bäz; //~ ERROR non-ascii idents
use föö::bar; //~ ERROR non-ascii idents
mod föö { //~ ERROR non-ascii idents
pub fn bar() {}
}
fn bär( //~ ERROR non-ascii idents
bäz: isize //~ ERROR non-ascii idents
) {
let : isize; //~ ERROR non-ascii idents
match (1, 2) {
(, _) => {} //~ ERROR non-ascii idents
}
}
struct Föö { //~ ERROR non-ascii idents
föö: isize //~ ERROR non-ascii idents
}
enum Bär { //~ ERROR non-ascii idents
Bäz { //~ ERROR non-ascii idents
qüx: isize //~ ERROR non-ascii idents
}
}
extern "C" {
fn qüx(); //~ ERROR non-ascii idents
//~^ ERROR items in `extern` blocks
}
fn main() {}

View File

@ -1,130 +0,0 @@
error: items in `extern` blocks cannot use non-ascii identifiers
--> $DIR/feature-gate-non_ascii_idents.rs:30:8
|
LL | extern "C" {
| ---------- in this `extern` block
LL | fn qüx();
| ^^^
|
= note: This limitation may be lifted in the future; see issue #83942 <https://github.com/rust-lang/rust/issues/83942> for more information
error[E0658]: non-ascii idents are not fully supported
--> $DIR/feature-gate-non_ascii_idents.rs:1:22
|
LL | extern crate core as bäz;
| ^^^
|
= note: see issue #55467 <https://github.com/rust-lang/rust/issues/55467> for more information
= help: add `#![feature(non_ascii_idents)]` to the crate attributes to enable
error[E0658]: non-ascii idents are not fully supported
--> $DIR/feature-gate-non_ascii_idents.rs:3:5
|
LL | use föö::bar;
| ^^^
|
= note: see issue #55467 <https://github.com/rust-lang/rust/issues/55467> for more information
= help: add `#![feature(non_ascii_idents)]` to the crate attributes to enable
error[E0658]: non-ascii idents are not fully supported
--> $DIR/feature-gate-non_ascii_idents.rs:5:5
|
LL | mod föö {
| ^^^
|
= note: see issue #55467 <https://github.com/rust-lang/rust/issues/55467> for more information
= help: add `#![feature(non_ascii_idents)]` to the crate attributes to enable
error[E0658]: non-ascii idents are not fully supported
--> $DIR/feature-gate-non_ascii_idents.rs:9:4
|
LL | fn bär(
| ^^^
|
= note: see issue #55467 <https://github.com/rust-lang/rust/issues/55467> for more information
= help: add `#![feature(non_ascii_idents)]` to the crate attributes to enable
error[E0658]: non-ascii idents are not fully supported
--> $DIR/feature-gate-non_ascii_idents.rs:10:5
|
LL | bäz: isize
| ^^^
|
= note: see issue #55467 <https://github.com/rust-lang/rust/issues/55467> for more information
= help: add `#![feature(non_ascii_idents)]` to the crate attributes to enable
error[E0658]: non-ascii idents are not fully supported
--> $DIR/feature-gate-non_ascii_idents.rs:12:9
|
LL | let _ö: isize;
| ^^
|
= note: see issue #55467 <https://github.com/rust-lang/rust/issues/55467> for more information
= help: add `#![feature(non_ascii_idents)]` to the crate attributes to enable
error[E0658]: non-ascii idents are not fully supported
--> $DIR/feature-gate-non_ascii_idents.rs:15:10
|
LL | (_ä, _) => {}
| ^^
|
= note: see issue #55467 <https://github.com/rust-lang/rust/issues/55467> for more information
= help: add `#![feature(non_ascii_idents)]` to the crate attributes to enable
error[E0658]: non-ascii idents are not fully supported
--> $DIR/feature-gate-non_ascii_idents.rs:19:8
|
LL | struct Föö {
| ^^^
|
= note: see issue #55467 <https://github.com/rust-lang/rust/issues/55467> for more information
= help: add `#![feature(non_ascii_idents)]` to the crate attributes to enable
error[E0658]: non-ascii idents are not fully supported
--> $DIR/feature-gate-non_ascii_idents.rs:20:5
|
LL | föö: isize
| ^^^
|
= note: see issue #55467 <https://github.com/rust-lang/rust/issues/55467> for more information
= help: add `#![feature(non_ascii_idents)]` to the crate attributes to enable
error[E0658]: non-ascii idents are not fully supported
--> $DIR/feature-gate-non_ascii_idents.rs:23:6
|
LL | enum Bär {
| ^^^
|
= note: see issue #55467 <https://github.com/rust-lang/rust/issues/55467> for more information
= help: add `#![feature(non_ascii_idents)]` to the crate attributes to enable
error[E0658]: non-ascii idents are not fully supported
--> $DIR/feature-gate-non_ascii_idents.rs:24:5
|
LL | Bäz {
| ^^^
|
= note: see issue #55467 <https://github.com/rust-lang/rust/issues/55467> for more information
= help: add `#![feature(non_ascii_idents)]` to the crate attributes to enable
error[E0658]: non-ascii idents are not fully supported
--> $DIR/feature-gate-non_ascii_idents.rs:25:9
|
LL | qüx: isize
| ^^^
|
= note: see issue #55467 <https://github.com/rust-lang/rust/issues/55467> for more information
= help: add `#![feature(non_ascii_idents)]` to the crate attributes to enable
error[E0658]: non-ascii idents are not fully supported
--> $DIR/feature-gate-non_ascii_idents.rs:30:8
|
LL | fn qüx();
| ^^^
|
= note: see issue #55467 <https://github.com/rust-lang/rust/issues/55467> for more information
= help: add `#![feature(non_ascii_idents)]` to the crate attributes to enable
error: aborting due to 14 previous errors
For more information about this error, try `rustc --explain E0658`.

View File

@ -1,48 +1,22 @@
// `#[macro_export] macro_rules` that doesn't originate from macro expansions can be placed
// into the root module soon enough to act as usual items and shadow globs and preludes.
// Crate-local macro expanded `macro_export` macros cannot be accessed with module-relative paths.
#![feature(decl_macro)]
// `macro_export` shadows globs
use inner1::*;
mod inner1 {
pub macro exported() {}
}
exported!();
mod deep {
fn deep() {
type Deeper = [u8; {
#[macro_export]
macro_rules! exported {
() => ( struct Б; ) //~ ERROR non-ascii idents are not fully supported
}
0
}];
macro_rules! define_exported { () => {
#[macro_export]
macro_rules! exported {
() => ()
}
}}
define_exported!();
mod m {
use exported;
//~^ ERROR macro-expanded `macro_export` macros from the current crate cannot
//~| WARN this was previously accepted
}
// `macro_export` shadows std prelude
fn main() {
panic!();
}
mod inner3 {
#[macro_export]
macro_rules! panic {
() => ( struct Г; ) //~ ERROR non-ascii idents are not fully supported
}
}
// `macro_export` shadows builtin macros
include!();
mod inner4 {
#[macro_export]
macro_rules! include {
() => ( struct Д; ) //~ ERROR non-ascii idents are not fully supported
}
::exported!();
//~^ ERROR macro-expanded `macro_export` macros from the current crate cannot
//~| WARN this was previously accepted
}

View File

@ -1,42 +1,43 @@
error[E0658]: non-ascii idents are not fully supported
--> $DIR/local-modularized-tricky-fail-2.rs:20:32
error: macro-expanded `macro_export` macros from the current crate cannot be referred to by absolute paths
--> $DIR/local-modularized-tricky-fail-2.rs:13:9
|
LL | exported!();
| ------------ in this macro invocation
LL | use exported;
| ^^^^^^^^
|
= note: `#[deny(macro_expanded_macro_exports_accessed_by_absolute_paths)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #52234 <https://github.com/rust-lang/rust/issues/52234>
note: the macro is defined here
--> $DIR/local-modularized-tricky-fail-2.rs:5:5
|
LL | / macro_rules! exported {
LL | | () => ()
LL | | }
| |_____^
...
LL | () => ( struct Б; )
| ^
|
= note: see issue #55467 <https://github.com/rust-lang/rust/issues/55467> for more information
= help: add `#![feature(non_ascii_idents)]` to the crate attributes to enable
LL | define_exported!();
| ------------------- in this macro invocation
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0658]: non-ascii idents are not fully supported
--> $DIR/local-modularized-tricky-fail-2.rs:36:24
error: macro-expanded `macro_export` macros from the current crate cannot be referred to by absolute paths
--> $DIR/local-modularized-tricky-fail-2.rs:19:5
|
LL | panic!();
| --------- in this macro invocation
LL | ::exported!();
| ^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #52234 <https://github.com/rust-lang/rust/issues/52234>
note: the macro is defined here
--> $DIR/local-modularized-tricky-fail-2.rs:5:5
|
LL | / macro_rules! exported {
LL | | () => ()
LL | | }
| |_____^
...
LL | () => ( struct Г; )
| ^
|
= note: see issue #55467 <https://github.com/rust-lang/rust/issues/55467> for more information
= help: add `#![feature(non_ascii_idents)]` to the crate attributes to enable
LL | define_exported!();
| ------------------- in this macro invocation
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0658]: non-ascii idents are not fully supported
--> $DIR/local-modularized-tricky-fail-2.rs:46:24
|
LL | include!();
| ----------- in this macro invocation
...
LL | () => ( struct Д; )
| ^
|
= note: see issue #55467 <https://github.com/rust-lang/rust/issues/55467> for more information
= help: add `#![feature(non_ascii_idents)]` to the crate attributes to enable
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0658`.

View File

@ -1,22 +0,0 @@
// Crate-local macro expanded `macro_export` macros cannot be accessed with module-relative paths.
macro_rules! define_exported { () => {
#[macro_export]
macro_rules! exported {
() => ()
}
}}
define_exported!();
mod m {
use exported;
//~^ ERROR macro-expanded `macro_export` macros from the current crate cannot
//~| WARN this was previously accepted
}
fn main() {
::exported!();
//~^ ERROR macro-expanded `macro_export` macros from the current crate cannot
//~| WARN this was previously accepted
}

View File

@ -1,43 +0,0 @@
error: macro-expanded `macro_export` macros from the current crate cannot be referred to by absolute paths
--> $DIR/local-modularized-tricky-fail-3.rs:13:9
|
LL | use exported;
| ^^^^^^^^
|
= note: `#[deny(macro_expanded_macro_exports_accessed_by_absolute_paths)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #52234 <https://github.com/rust-lang/rust/issues/52234>
note: the macro is defined here
--> $DIR/local-modularized-tricky-fail-3.rs:5:5
|
LL | / macro_rules! exported {
LL | | () => ()
LL | | }
| |_____^
...
LL | define_exported!();
| ------------------- in this macro invocation
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: macro-expanded `macro_export` macros from the current crate cannot be referred to by absolute paths
--> $DIR/local-modularized-tricky-fail-3.rs:19:5
|
LL | ::exported!();
| ^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #52234 <https://github.com/rust-lang/rust/issues/52234>
note: the macro is defined here
--> $DIR/local-modularized-tricky-fail-3.rs:5:5
|
LL | / macro_rules! exported {
LL | | () => ()
LL | | }
| |_____^
...
LL | define_exported!();
| ------------------- in this macro invocation
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
error: aborting due to 2 previous errors

View File

@ -0,0 +1,50 @@
// check-pass
//
// `#[macro_export] macro_rules` that doesn't originate from macro expansions can be placed
// into the root module soon enough to act as usual items and shadow globs and preludes.
#![feature(decl_macro)]
// `macro_export` shadows globs
use inner1::*;
mod inner1 {
pub macro exported() {}
}
exported!();
mod deep {
fn deep() {
type Deeper = [u8; {
#[macro_export]
macro_rules! exported {
() => ( struct Б; )
}
0
}];
}
}
// `macro_export` shadows std prelude
fn main() {
panic!();
}
mod inner3 {
#[macro_export]
macro_rules! panic {
() => ( struct Г; )
}
}
// `macro_export` shadows builtin macros
include!();
mod inner4 {
#[macro_export]
macro_rules! include {
() => ( struct Д; )
}
}

View File

@ -1,5 +1,3 @@
#![feature(non_ascii_idents)]
pub fn main () {}
fn _გემრიელი_სადილი ( ) -> isize { //~ ERROR mismatched types

View File

@ -1,5 +1,5 @@
error[E0308]: mismatched types
--> $DIR/issue-44023.rs:5:36
--> $DIR/issue-44023.rs:3:36
|
LL | fn საჭმელად_გემრიელი_სადილი ( ) -> isize {
| ------------------------ ^^^^^ expected `isize`, found `()`

View File

@ -3,7 +3,6 @@
#![allow(dead_code)]
// pretty-expanded FIXME #23616
#![feature(non_ascii_idents)]
#![deny(non_snake_case)]
// This name is neither upper nor lower case

View File

@ -1,7 +1,6 @@
#![allow(dead_code)]
#![forbid(non_camel_case_types)]
#![feature(non_ascii_idents)]
// Some scripts (e.g., hiragana) don't have a concept of
// upper/lowercase

View File

@ -1,5 +1,5 @@
error: type `χa` should have an upper camel case name
--> $DIR/lint-nonstandard-style-unicode-1.rs:15:8
--> $DIR/lint-nonstandard-style-unicode-1.rs:14:8
|
LL | struct χa;
| ^^ help: convert the identifier to upper camel case: `Χa`
@ -11,37 +11,37 @@ LL | #![forbid(non_camel_case_types)]
| ^^^^^^^^^^^^^^^^^^^^
error: type `__χa` should have an upper camel case name
--> $DIR/lint-nonstandard-style-unicode-1.rs:23:8
--> $DIR/lint-nonstandard-style-unicode-1.rs:22:8
|
LL | struct __χa;
| ^^^^ help: convert the identifier to upper camel case: `Χa`
error: type `对__否` should have an upper camel case name
--> $DIR/lint-nonstandard-style-unicode-1.rs:28:8
--> $DIR/lint-nonstandard-style-unicode-1.rs:27:8
|
LL | struct 对__否;
| ^^^^^^ help: convert the identifier to upper camel case: `对_否`
error: type `ヒ__χ` should have an upper camel case name
--> $DIR/lint-nonstandard-style-unicode-1.rs:31:8
--> $DIR/lint-nonstandard-style-unicode-1.rs:30:8
|
LL | struct ヒ__χ;
| ^^^^^ help: convert the identifier to upper camel case: `ヒΧ`
error: type `Hello_你好` should have an upper camel case name
--> $DIR/lint-nonstandard-style-unicode-1.rs:37:8
--> $DIR/lint-nonstandard-style-unicode-1.rs:36:8
|
LL | struct Hello_你好;
| ^^^^^^^^^^ help: convert the identifier to upper camel case: `Hello你好`
error: type `Hello_World` should have an upper camel case name
--> $DIR/lint-nonstandard-style-unicode-1.rs:40:8
--> $DIR/lint-nonstandard-style-unicode-1.rs:39:8
|
LL | struct Hello_World;
| ^^^^^^^^^^^ help: convert the identifier to upper camel case: `HelloWorld`
error: type `你_ӟ` should have an upper camel case name
--> $DIR/lint-nonstandard-style-unicode-1.rs:43:8
--> $DIR/lint-nonstandard-style-unicode-1.rs:42:8
|
LL | struct 你_ӟ;
| ^^^^ help: convert the identifier to upper camel case: `你Ӟ`

View File

@ -1,7 +1,6 @@
#![allow(dead_code)]
#![forbid(non_snake_case)]
#![feature(non_ascii_idents)]
// Some scripts (e.g., hiragana) don't have a concept of
// upper/lowercase

View File

@ -1,5 +1,5 @@
error: function `Ц` should have a snake case name
--> $DIR/lint-nonstandard-style-unicode-2.rs:18:4
--> $DIR/lint-nonstandard-style-unicode-2.rs:17:4
|
LL | fn Ц() {}
| ^ help: convert the identifier to snake case: `ц`
@ -11,7 +11,7 @@ LL | #![forbid(non_snake_case)]
| ^^^^^^^^^^^^^^
error: function `分__隔` should have a snake case name
--> $DIR/lint-nonstandard-style-unicode-2.rs:23:4
--> $DIR/lint-nonstandard-style-unicode-2.rs:22:4
|
LL | fn 分__隔() {}
| ^^^^^^ help: convert the identifier to snake case: `分_隔`

View File

@ -1,7 +1,6 @@
#![allow(dead_code)]
#![forbid(non_upper_case_globals)]
#![feature(non_ascii_idents)]
// Some scripts (e.g., hiragana) don't have a concept of
// upper/lowercase

View File

@ -1,5 +1,5 @@
error: static variable `τεχ` should have an upper case name
--> $DIR/lint-nonstandard-style-unicode-3.rs:18:8
--> $DIR/lint-nonstandard-style-unicode-3.rs:17:8
|
LL | static τεχ: f32 = 3.14159265;
| ^^^ help: convert the identifier to upper case: `ΤΕΧ`

View File

@ -1,4 +1,3 @@
#![feature(non_ascii_idents)]
#![deny(confusable_idents)]
#![allow(uncommon_codepoints, non_upper_case_globals)]

View File

@ -1,5 +1,5 @@
error: identifier pair considered confusable between `` and `s`
--> $DIR/lint-confusable-idents.rs:9:9
--> $DIR/lint-confusable-idents.rs:8:9
|
LL | const : usize = 42;
| -- this is where the previous identifier occurred
@ -8,13 +8,13 @@ LL | let s = "rust";
| ^
|
note: the lint level is defined here
--> $DIR/lint-confusable-idents.rs:2:9
--> $DIR/lint-confusable-idents.rs:1:9
|
LL | #![deny(confusable_idents)]
| ^^^^^^^^^^^^^^^^^
error: identifier pair considered confusable between `s_s` and `_`
--> $DIR/lint-confusable-idents.rs:10:9
--> $DIR/lint-confusable-idents.rs:9:9
|
LL | const s_s: usize = 42;
| --- this is where the previous identifier occurred

View File

@ -1,5 +1,4 @@
// check-pass
#![feature(non_ascii_idents)]
#![deny(mixed_script_confusables)]
struct ΑctuallyNotLatin;

View File

@ -1,4 +1,3 @@
#![feature(non_ascii_idents)]
#![deny(mixed_script_confusables)]
struct ΑctuallyNotLatin;

View File

@ -1,11 +1,11 @@
error: The usage of Script Group `Greek` in this crate consists solely of mixed script confusables
--> $DIR/lint-mixed-script-confusables.rs:4:8
--> $DIR/lint-mixed-script-confusables.rs:3:8
|
LL | struct ΑctuallyNotLatin;
| ^^^^^^^^^^^^^^^^
|
note: the lint level is defined here
--> $DIR/lint-mixed-script-confusables.rs:2:9
--> $DIR/lint-mixed-script-confusables.rs:1:9
|
LL | #![deny(mixed_script_confusables)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
@ -13,7 +13,7 @@ LL | #![deny(mixed_script_confusables)]
= note: Please recheck to make sure their usages are indeed what you want.
error: The usage of Script Group `Cyrillic` in this crate consists solely of mixed script confusables
--> $DIR/lint-mixed-script-confusables.rs:11:5
--> $DIR/lint-mixed-script-confusables.rs:10:5
|
LL | mod роре {
| ^^^^
@ -22,7 +22,7 @@ LL | mod роре {
= note: Please recheck to make sure their usages are indeed what you want.
error: The usage of Script Group `Japanese, Katakana` in this crate consists solely of mixed script confusables
--> $DIR/lint-mixed-script-confusables.rs:13:11
--> $DIR/lint-mixed-script-confusables.rs:12:11
|
LL | const エ: &'static str = "アイウ";
| ^^

View File

@ -1,4 +1,3 @@
#![feature(non_ascii_idents)]
#![deny(non_ascii_idents)]
const חלודה: usize = 2; //~ ERROR identifier contains non-ASCII characters

View File

@ -1,23 +1,23 @@
error: identifier contains non-ASCII characters
--> $DIR/lint-non-ascii-idents.rs:4:7
--> $DIR/lint-non-ascii-idents.rs:3:7
|
LL | const חלודה: usize = 2;
| ^^^^^
|
note: the lint level is defined here
--> $DIR/lint-non-ascii-idents.rs:2:9
--> $DIR/lint-non-ascii-idents.rs:1:9
|
LL | #![deny(non_ascii_idents)]
| ^^^^^^^^^^^^^^^^
error: identifier contains non-ASCII characters
--> $DIR/lint-non-ascii-idents.rs:6:4
--> $DIR/lint-non-ascii-idents.rs:5:4
|
LL | fn coöperation() {}
| ^^^^^^^^^^^
error: identifier contains non-ASCII characters
--> $DIR/lint-non-ascii-idents.rs:9:9
--> $DIR/lint-non-ascii-idents.rs:8:9
|
LL | let naïveté = 2;
| ^^^^^^^

View File

@ -1,4 +1,3 @@
#![feature(non_ascii_idents)]
#![deny(uncommon_codepoints)]
const µ: f64 = 0.000001; //~ ERROR identifier contains uncommon Unicode codepoints

View File

@ -1,23 +1,23 @@
error: identifier contains uncommon Unicode codepoints
--> $DIR/lint-uncommon-codepoints.rs:4:7
--> $DIR/lint-uncommon-codepoints.rs:3:7
|
LL | const µ: f64 = 0.000001;
| ^
|
note: the lint level is defined here
--> $DIR/lint-uncommon-codepoints.rs:2:9
--> $DIR/lint-uncommon-codepoints.rs:1:9
|
LL | #![deny(uncommon_codepoints)]
| ^^^^^^^^^^^^^^^^^^^
error: identifier contains uncommon Unicode codepoints
--> $DIR/lint-uncommon-codepoints.rs:6:4
--> $DIR/lint-uncommon-codepoints.rs:5:4
|
LL | fn dijkstra() {}
| ^^^^^^^
error: identifier contains uncommon Unicode codepoints
--> $DIR/lint-uncommon-codepoints.rs:9:9
--> $DIR/lint-uncommon-codepoints.rs:8:9
|
LL | let ㇻㇲㇳ = "rust";
| ^^^^^^

View File

@ -5,7 +5,6 @@
// check-pass
#![feature(non_ascii_idents)]
#![allow(uncommon_codepoints, unused)]
struct 𝕟𝕠𝕥𝕒𝕔𝕒𝕞𝕖𝕝;

View File

@ -1,5 +1,5 @@
warning: type `𝕟𝕠𝕥𝕒𝕔𝕒𝕞𝕖𝕝` should have an upper camel case name
--> $DIR/special-upper-lower-cases.rs:11:8
--> $DIR/special-upper-lower-cases.rs:10:8
|
LL | struct 𝕟𝕠𝕥𝕒𝕔𝕒𝕞𝕖𝕝;
| ^^^^^^^^^ should have an UpperCamelCase name
@ -7,13 +7,13 @@ LL | struct 𝕟𝕠𝕥𝕒𝕔𝕒𝕞𝕖𝕝;
= note: `#[warn(non_camel_case_types)]` on by default
warning: type `𝕟𝕠𝕥_𝕒_𝕔𝕒𝕞𝕖𝕝` should have an upper camel case name
--> $DIR/special-upper-lower-cases.rs:15:8
--> $DIR/special-upper-lower-cases.rs:14:8
|
LL | struct 𝕟𝕠𝕥_𝕒_𝕔𝕒𝕞𝕖𝕝;
| ^^^^^^^^^^^ should have an UpperCamelCase name
warning: static variable `𝗻𝗼𝗻𝘂𝗽𝗽𝗲𝗿𝗰𝗮𝘀𝗲` should have an upper case name
--> $DIR/special-upper-lower-cases.rs:18:8
--> $DIR/special-upper-lower-cases.rs:17:8
|
LL | static 𝗻𝗼𝗻𝘂𝗽𝗽𝗲𝗿𝗰𝗮𝘀𝗲: i32 = 1;
| ^^^^^^^^^^^^ should have an UPPER_CASE name
@ -21,7 +21,7 @@ LL | static 𝗻𝗼𝗻𝘂𝗽𝗽𝗲𝗿𝗰𝗮𝘀𝗲: i32 = 1;
= note: `#[warn(non_upper_case_globals)]` on by default
warning: variable `𝓢𝓝𝓐𝓐𝓐𝓐𝓚𝓔𝓢` should have a snake case name
--> $DIR/special-upper-lower-cases.rs:22:9
--> $DIR/special-upper-lower-cases.rs:21:9
|
LL | let 𝓢𝓝𝓐𝓐𝓐𝓐𝓚𝓔𝓢 = 1;
| ^^^^^^^^^ should have a snake_case name

View File

@ -10,7 +10,6 @@
// ignore-pretty issue #37195
// ignore-asmjs wasm2js does not support source maps yet
#![feature(non_ascii_idents)]
#![allow(uncommon_codepoints)]
#[path = "issue-48508-aux.rs"]

View File

@ -4,9 +4,7 @@ fn main() {
(()é);
//~^ ERROR: expected one of `)`, `,`, `.`, `?`, or an operator
//~| ERROR: cannot find value `é` in this scope
//~| ERROR: non-ascii idents are not fully supported
(());
//~^ ERROR: expected one of `)`, `,`, `.`, `?`, or an operator
//~| ERROR: cannot find value `氷` in this scope
//~| ERROR: non-ascii idents are not fully supported
}

View File

@ -8,7 +8,7 @@ LL | (()é);
| help: missing `,`
error: expected one of `)`, `,`, `.`, `?`, or an operator, found `氷`
--> $DIR/multibyte-char-use-seperator-issue-80134.rs:8:8
--> $DIR/multibyte-char-use-seperator-issue-80134.rs:7:8
|
LL | (()氷);
| -^
@ -23,30 +23,11 @@ LL | (()é);
| ^ not found in this scope
error[E0425]: cannot find value `氷` in this scope
--> $DIR/multibyte-char-use-seperator-issue-80134.rs:8:8
--> $DIR/multibyte-char-use-seperator-issue-80134.rs:7:8
|
LL | (()氷);
| ^^ not found in this scope
error[E0658]: non-ascii idents are not fully supported
--> $DIR/multibyte-char-use-seperator-issue-80134.rs:4:8
|
LL | (()é);
| ^
|
= note: see issue #55467 <https://github.com/rust-lang/rust/issues/55467> for more information
= help: add `#![feature(non_ascii_idents)]` to the crate attributes to enable
error: aborting due to 4 previous errors
error[E0658]: non-ascii idents are not fully supported
--> $DIR/multibyte-char-use-seperator-issue-80134.rs:8:8
|
LL | (()氷);
| ^^
|
= note: see issue #55467 <https://github.com/rust-lang/rust/issues/55467> for more information
= help: add `#![feature(non_ascii_idents)]` to the crate attributes to enable
error: aborting due to 6 previous errors
Some errors have detailed explanations: E0425, E0658.
For more information about an error, try `rustc --explain E0425`.
For more information about this error, try `rustc --explain E0425`.

View File

@ -1,5 +1,3 @@
#![feature(non_ascii_idents)]
extern crate ьаг; //~ ERROR cannot load a crate with a non-ascii name `ьаг`
fn main() {}

View File

@ -1,5 +1,5 @@
error: cannot load a crate with a non-ascii name `ьаг`
--> $DIR/crate_name_nonascii_forbidden-1.rs:3:1
--> $DIR/crate_name_nonascii_forbidden-1.rs:1:1
|
LL | extern crate ьаг;
| ^^^^^^^^^^^^^^^^^

View File

@ -1,6 +1,5 @@
// compile-flags:--extern му_сгате
// edition:2018
#![feature(non_ascii_idents)]
use му_сгате::baz; //~ ERROR cannot load a crate with a non-ascii name `му_сгате`

View File

@ -1,5 +1,5 @@
error: cannot load a crate with a non-ascii name `му_сгате`
--> $DIR/crate_name_nonascii_forbidden-2.rs:5:5
--> $DIR/crate_name_nonascii_forbidden-2.rs:4:5
|
LL | use му_сгате::baz;
| ^^^^^^^^

View File

@ -1,5 +1,4 @@
#![feature(extern_types)]
#![feature(non_ascii_idents)]
extern "C" {
type ; //~ items in `extern` blocks cannot use non-ascii identifiers

View File

@ -1,5 +1,5 @@
error: items in `extern` blocks cannot use non-ascii identifiers
--> $DIR/extern_block_nonascii_forbidden.rs:5:10
--> $DIR/extern_block_nonascii_forbidden.rs:4:10
|
LL | extern "C" {
| ---------- in this `extern` block
@ -9,7 +9,7 @@ LL | type 一;
= note: This limitation may be lifted in the future; see issue #83942 <https://github.com/rust-lang/rust/issues/83942> for more information
error: items in `extern` blocks cannot use non-ascii identifiers
--> $DIR/extern_block_nonascii_forbidden.rs:6:8
--> $DIR/extern_block_nonascii_forbidden.rs:5:8
|
LL | extern "C" {
| ---------- in this `extern` block
@ -20,7 +20,7 @@ LL | fn 二();
= note: This limitation may be lifted in the future; see issue #83942 <https://github.com/rust-lang/rust/issues/83942> for more information
error: items in `extern` blocks cannot use non-ascii identifiers
--> $DIR/extern_block_nonascii_forbidden.rs:7:12
--> $DIR/extern_block_nonascii_forbidden.rs:6:12
|
LL | extern "C" {
| ---------- in this `extern` block

View File

@ -1,5 +1,4 @@
// check-pass
#![feature(non_ascii_idents)]
struct Résumé; // ['LATIN SMALL LETTER E WITH ACUTE']

View File

@ -1,5 +1,3 @@
#![feature(non_ascii_idents)]
mod řųśť; //~ trying to load file for
//~^ file not found for

View File

@ -1,5 +1,5 @@
error[E0583]: file not found for module `řųśť`
--> $DIR/mod_file_nonascii_forbidden.rs:3:1
--> $DIR/mod_file_nonascii_forbidden.rs:1:1
|
LL | mod řųśť;
| ^^^^^^^^^
@ -7,7 +7,7 @@ LL | mod řųśť;
= help: to create the module `řųśť`, create file "$DIR/řųśť.rs"
error[E0754]: trying to load file for module `řųśť` with non-ascii identifier name
--> $DIR/mod_file_nonascii_forbidden.rs:3:5
--> $DIR/mod_file_nonascii_forbidden.rs:1:5
|
LL | mod řųśť;
| ^^^^

View File

@ -1,5 +1,4 @@
// check-pass
#![feature(non_ascii_idents)]
#[path="auxiliary/mod_file_nonascii_with_path_allowed-aux.rs"]
mod řųśť;

View File

@ -1,5 +1,4 @@
// check-pass
#![feature(non_ascii_idents)]
mod řųśť {
const IS_GREAT: bool = true;

View File

@ -1,5 +1,3 @@
#![feature(non_ascii_idents)]
#[no_mangle]
pub fn řųśť() {} //~ `#[no_mangle]` requires ASCII identifier

View File

@ -1,5 +1,5 @@
error[E0754]: `#[no_mangle]` requires ASCII identifier
--> $DIR/no_mangle_nonascii_forbidden.rs:4:1
--> $DIR/no_mangle_nonascii_forbidden.rs:2:1
|
LL | pub fn řųśť() {}
| ^^^^^^^^^^^^^

View File

@ -2,8 +2,6 @@
//
#![allow(non_snake_case)]
#![feature(non_ascii_idents)]
pub fn main() {
let ε = 0.00001f64;
let Π = 3.14f64;

View File

@ -1,15 +1,16 @@
#![allow(mixed_script_confusables)]
// check-pass
//
#![allow(mixed_script_confusables, non_camel_case_types)]
fn foo<
'β, //~ ERROR non-ascii idents are not fully supported
γ //~ ERROR non-ascii idents are not fully supported
//~^ WARN type parameter `γ` should have an upper camel case name
'β,
γ
>() {}
struct X {
δ: usize //~ ERROR non-ascii idents are not fully supported
δ: usize
}
pub fn main() {
let α = 0.00001f64; //~ ERROR non-ascii idents are not fully supported
let α = 0.00001f64;
}

View File

@ -1,47 +0,0 @@
error[E0658]: non-ascii idents are not fully supported
--> $DIR/utf8_idents.rs:4:5
|
LL | 'β,
| ^^
|
= note: see issue #55467 <https://github.com/rust-lang/rust/issues/55467> for more information
= help: add `#![feature(non_ascii_idents)]` to the crate attributes to enable
error[E0658]: non-ascii idents are not fully supported
--> $DIR/utf8_idents.rs:5:5
|
LL | γ
| ^
|
= note: see issue #55467 <https://github.com/rust-lang/rust/issues/55467> for more information
= help: add `#![feature(non_ascii_idents)]` to the crate attributes to enable
error[E0658]: non-ascii idents are not fully supported
--> $DIR/utf8_idents.rs:10:5
|
LL | δ: usize
| ^
|
= note: see issue #55467 <https://github.com/rust-lang/rust/issues/55467> for more information
= help: add `#![feature(non_ascii_idents)]` to the crate attributes to enable
error[E0658]: non-ascii idents are not fully supported
--> $DIR/utf8_idents.rs:14:9
|
LL | let α = 0.00001f64;
| ^
|
= note: see issue #55467 <https://github.com/rust-lang/rust/issues/55467> for more information
= help: add `#![feature(non_ascii_idents)]` to the crate attributes to enable
warning: type parameter `γ` should have an upper camel case name
--> $DIR/utf8_idents.rs:5:5
|
LL | γ
| ^ help: convert the identifier to upper camel case: `Γ`
|
= note: `#[warn(non_camel_case_types)]` on by default
error: aborting due to 4 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0658`.