mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 23:34:48 +00:00
Promote most restricted keywords to strict keywords
This commit is contained in:
parent
233e595b61
commit
ef9aa80438
@ -411,22 +411,13 @@ fn contextual_keyword_table() -> hashmap<~str, ()> {
|
||||
fn restricted_keyword_table() -> hashmap<~str, ()> {
|
||||
let words = str_hash();
|
||||
let keys = ~[
|
||||
~"as",
|
||||
~"assert",
|
||||
~"break",
|
||||
~"const", ~"copy",
|
||||
~"do", ~"drop",
|
||||
~"else", ~"enum", ~"export", ~"extern",
|
||||
~"fail", ~"false", ~"fn", ~"for",
|
||||
~"if", ~"impl", ~"import",
|
||||
~"let", ~"log", ~"loop",
|
||||
~"match", ~"mod", ~"move", ~"mut",
|
||||
~"priv", ~"pub", ~"pure",
|
||||
~"ref", ~"return",
|
||||
~"fail", ~"fn",
|
||||
~"impl",
|
||||
~"priv", ~"pub",
|
||||
~"return",
|
||||
~"struct",
|
||||
~"true", ~"trait", ~"type",
|
||||
~"unchecked", ~"unsafe", ~"use",
|
||||
~"while"
|
||||
~"unsafe"
|
||||
];
|
||||
for keys.each |word| {
|
||||
words.insert(word, ());
|
||||
@ -438,6 +429,19 @@ fn restricted_keyword_table() -> hashmap<~str, ()> {
|
||||
fn strict_keyword_table() -> hashmap<~str, ()> {
|
||||
let words = str_hash();
|
||||
let keys = ~[
|
||||
~"as", ~"assert",
|
||||
~"break",
|
||||
~"do", ~"drop",
|
||||
~"else", ~"enum", ~"export", ~"extern",
|
||||
~"false", ~"for",
|
||||
~"if", ~"import",
|
||||
~"let", ~"log", ~"loop",
|
||||
~"match", ~"mod", ~"move", ~"mut",
|
||||
~"pure",
|
||||
~"ref",
|
||||
~"true", ~"trait", ~"type",
|
||||
~"unchecked", ~"use",
|
||||
~"while"
|
||||
];
|
||||
for keys.each |word| {
|
||||
words.insert(word, ());
|
||||
|
@ -1,2 +1,2 @@
|
||||
fn false() { } //~ ERROR found `false` in restricted position
|
||||
fn false() { } //~ ERROR found `false` in ident position
|
||||
fn main() { }
|
@ -1,2 +1,2 @@
|
||||
fn true() { } //~ ERROR found `true` in restricted position
|
||||
fn true() { } //~ ERROR found `true` in ident position
|
||||
fn main() { }
|
3
src/test/compile-fail/keyword.rs
Normal file
3
src/test/compile-fail/keyword.rs
Normal file
@ -0,0 +1,3 @@
|
||||
mod break {
|
||||
//~^ ERROR found `break` in ident position
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
// error-pattern:found `let` in restricted position
|
||||
// error-pattern:found `fail` in restricted position
|
||||
|
||||
fn main() {
|
||||
match true {
|
||||
{let} { }
|
||||
{fail} { }
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
// error-pattern:found `let` in restricted position
|
||||
// error-pattern:found `fail` in restricted position
|
||||
|
||||
fn main() {
|
||||
enum let = int;
|
||||
enum fail = int;
|
||||
}
|
||||
|
@ -7,8 +7,8 @@ mod cat {
|
||||
#[path = "cat.rs"]
|
||||
mod inst;
|
||||
|
||||
#[path = "trait.rs"]
|
||||
mod trait;
|
||||
#[path = "trait_.rs"]
|
||||
mod trait_;
|
||||
|
||||
}
|
||||
|
||||
@ -20,7 +20,7 @@ mod dog {
|
||||
#[path = "dog.rs"]
|
||||
mod inst;
|
||||
|
||||
#[path = "trait.rs"]
|
||||
mod trait;
|
||||
#[path = "trait_.rs"]
|
||||
mod trait_;
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user