Feature gate raw identifiers.

This commit is contained in:
Lymia Aluysia 2018-03-14 02:00:41 -05:00
parent fad1648e0f
commit 7d5c29b9ea
No known key found for this signature in database
GPG key ID: DB2E204C989251F7
14 changed files with 62 additions and 5 deletions

View file

@ -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)]

View file

@ -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
}

View file

@ -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);

View file

@ -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 }

View 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);
}

View 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`.

View file

@ -11,6 +11,7 @@
// compile-flags: -Z parse-only
#![feature(dyn_trait)]
#![feature(raw_identifiers)]
fn test_if() {
r#if true { } //~ ERROR found `true`

View file

@ -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

View file

@ -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.
}

View file

@ -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) {
| ^^^^^^