Feature gate raw identifiers.
This commit is contained in:
parent
fad1648e0f
commit
7d5c29b9ea
14 changed files with 62 additions and 5 deletions
|
|
@ -8,6 +8,8 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(raw_identifiers)]
|
||||
|
||||
use std::mem;
|
||||
|
||||
#[r#repr(r#C, r#packed)]
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(raw_identifiers)]
|
||||
|
||||
fn r#fn(r#match: u32) -> u32 {
|
||||
r#match
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,8 @@
|
|||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(raw_identifiers)]
|
||||
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
struct IntWrapper(u32);
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
// except according to those terms.
|
||||
|
||||
#![feature(decl_macro)]
|
||||
#![feature(raw_identifiers)]
|
||||
|
||||
r#macro_rules! r#struct {
|
||||
($r#struct:expr) => { $r#struct }
|
||||
|
|
|
|||
14
src/test/ui/feature-gate-raw-identifiers.rs
Normal file
14
src/test/ui/feature-gate-raw-identifiers.rs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
// Copyright 2018 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.
|
||||
|
||||
fn main() {
|
||||
let r#foo = 3; //~ ERROR raw identifiers are experimental and subject to change
|
||||
println!("{}", foo);
|
||||
}
|
||||
11
src/test/ui/feature-gate-raw-identifiers.stderr
Normal file
11
src/test/ui/feature-gate-raw-identifiers.stderr
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
error[E0658]: raw identifiers are experimental and subject to change (see issue #48589)
|
||||
--> $DIR/feature-gate-raw-identifiers.rs:12:9
|
||||
|
|
||||
LL | let r#foo = 3; //~ ERROR raw identifiers are experimental and subject to change
|
||||
| ^^^^^
|
||||
|
|
||||
= help: add #![feature(raw_identifiers)] to the crate attributes to enable
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
|
|
@ -11,6 +11,7 @@
|
|||
// compile-flags: -Z parse-only
|
||||
|
||||
#![feature(dyn_trait)]
|
||||
#![feature(raw_identifiers)]
|
||||
|
||||
fn test_if() {
|
||||
r#if true { } //~ ERROR found `true`
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `true`
|
||||
--> $DIR/raw-literal-keywords.rs:16:10
|
||||
--> $DIR/raw-literal-keywords.rs:17:10
|
||||
|
|
||||
LL | r#if true { } //~ ERROR found `true`
|
||||
| ^^^^ expected one of 8 possible tokens here
|
||||
|
||||
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `Test`
|
||||
--> $DIR/raw-literal-keywords.rs:20:14
|
||||
--> $DIR/raw-literal-keywords.rs:21:14
|
||||
|
|
||||
LL | r#struct Test; //~ ERROR found `Test`
|
||||
| ^^^^ expected one of 8 possible tokens here
|
||||
|
||||
error: expected one of `!`, `.`, `::`, `;`, `?`, `{`, `}`, or an operator, found `Test`
|
||||
--> $DIR/raw-literal-keywords.rs:24:13
|
||||
--> $DIR/raw-literal-keywords.rs:25:13
|
||||
|
|
||||
LL | r#union Test; //~ ERROR found `Test`
|
||||
| ^^^^ expected one of 8 possible tokens here
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
// compile-flags: -Z parse-only
|
||||
|
||||
#![feature(raw_identifiers)]
|
||||
|
||||
fn self_test(r#self: u32) {
|
||||
//~^ ERROR `r#self` is not currently supported.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: `r#self` is not currently supported.
|
||||
--> $DIR/raw-literal-self.rs:13:14
|
||||
--> $DIR/raw-literal-self.rs:15:14
|
||||
|
|
||||
LL | fn self_test(r#self: u32) {
|
||||
| ^^^^^^
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue