mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-02 18:12:51 +00:00
Add script and tests for using keywords as identifiers
This commit is contained in:
parent
18144b12b1
commit
c921331295
59
src/etc/generate-keyword-tests.py
Executable file
59
src/etc/generate-keyword-tests.py
Executable file
@ -0,0 +1,59 @@
|
||||
#!/usr/bin/env python
|
||||
# xfail-license
|
||||
# Copyright 2013 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.
|
||||
"""
|
||||
This script takes a list of keywords and generates a testcase, that checks
|
||||
if using the keyword as identifier fails, for every keyword. The generate
|
||||
test files are set read-only.
|
||||
Test for https://github.com/mozilla/rust/issues/2275
|
||||
|
||||
sample usage: src/etc/generate-keyword-tests.py as break
|
||||
"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
import datetime
|
||||
import stat
|
||||
|
||||
|
||||
template = """// Copyright %d 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.
|
||||
|
||||
// This file was auto-generated using 'src/etc/generate-keyword-tests.py %s'
|
||||
|
||||
fn main() {
|
||||
let %s = "foo"; //~ error: ident
|
||||
}
|
||||
"""
|
||||
|
||||
test_dir = os.path.abspath(
|
||||
os.path.join(os.path.dirname(__file__), '../test/compile-fail')
|
||||
)
|
||||
|
||||
for kw in sys.argv[1:]:
|
||||
test_file = os.path.join(test_dir, 'keyword-%s-as-identifier.rs' % kw)
|
||||
|
||||
# set write permission if file exists, so it can be changed
|
||||
if os.path.exists(test_file):
|
||||
os.chmod(test_file, stat.S_IWUSR)
|
||||
|
||||
with open(test_file, 'wt') as f:
|
||||
f.write(template % (datetime.datetime.now().year, kw, kw))
|
||||
|
||||
# mark file read-only
|
||||
os.chmod(test_file, stat.S_IRUSR|stat.S_IRGRP|stat.S_IROTH)
|
15
src/test/compile-fail/keyword-as-as-identifier.rs
Normal file
15
src/test/compile-fail/keyword-as-as-identifier.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2013 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.
|
||||
|
||||
// This file was auto-generated using 'src/etc/generate-keyword-tests.py as'
|
||||
|
||||
fn main() {
|
||||
let as = "foo"; //~ error: ident
|
||||
}
|
15
src/test/compile-fail/keyword-break-as-identifier.rs
Normal file
15
src/test/compile-fail/keyword-break-as-identifier.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2013 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.
|
||||
|
||||
// This file was auto-generated using 'src/etc/generate-keyword-tests.py break'
|
||||
|
||||
fn main() {
|
||||
let break = "foo"; //~ error: ident
|
||||
}
|
15
src/test/compile-fail/keyword-do-as-identifier.rs
Normal file
15
src/test/compile-fail/keyword-do-as-identifier.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2013 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.
|
||||
|
||||
// This file was auto-generated using 'src/etc/generate-keyword-tests.py do'
|
||||
|
||||
fn main() {
|
||||
let do = "foo"; //~ error: ident
|
||||
}
|
15
src/test/compile-fail/keyword-else-as-identifier.rs
Normal file
15
src/test/compile-fail/keyword-else-as-identifier.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2013 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.
|
||||
|
||||
// This file was auto-generated using 'src/etc/generate-keyword-tests.py else'
|
||||
|
||||
fn main() {
|
||||
let else = "foo"; //~ error: ident
|
||||
}
|
15
src/test/compile-fail/keyword-enum-as-identifier.rs
Normal file
15
src/test/compile-fail/keyword-enum-as-identifier.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2013 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.
|
||||
|
||||
// This file was auto-generated using 'src/etc/generate-keyword-tests.py enum'
|
||||
|
||||
fn main() {
|
||||
let enum = "foo"; //~ error: ident
|
||||
}
|
15
src/test/compile-fail/keyword-extern-as-identifier.rs
Normal file
15
src/test/compile-fail/keyword-extern-as-identifier.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2013 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.
|
||||
|
||||
// This file was auto-generated using 'src/etc/generate-keyword-tests.py extern'
|
||||
|
||||
fn main() {
|
||||
let extern = "foo"; //~ error: ident
|
||||
}
|
15
src/test/compile-fail/keyword-false-as-identifier.rs
Normal file
15
src/test/compile-fail/keyword-false-as-identifier.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2013 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.
|
||||
|
||||
// This file was auto-generated using 'src/etc/generate-keyword-tests.py false'
|
||||
|
||||
fn main() {
|
||||
let false = "foo"; //~ error: ident
|
||||
}
|
15
src/test/compile-fail/keyword-fn-as-identifier.rs
Normal file
15
src/test/compile-fail/keyword-fn-as-identifier.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2013 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.
|
||||
|
||||
// This file was auto-generated using 'src/etc/generate-keyword-tests.py fn'
|
||||
|
||||
fn main() {
|
||||
let fn = "foo"; //~ error: ident
|
||||
}
|
15
src/test/compile-fail/keyword-for-as-identifier.rs
Normal file
15
src/test/compile-fail/keyword-for-as-identifier.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2013 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.
|
||||
|
||||
// This file was auto-generated using 'src/etc/generate-keyword-tests.py for'
|
||||
|
||||
fn main() {
|
||||
let for = "foo"; //~ error: ident
|
||||
}
|
15
src/test/compile-fail/keyword-if-as-identifier.rs
Normal file
15
src/test/compile-fail/keyword-if-as-identifier.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2013 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.
|
||||
|
||||
// This file was auto-generated using 'src/etc/generate-keyword-tests.py if'
|
||||
|
||||
fn main() {
|
||||
let if = "foo"; //~ error: ident
|
||||
}
|
15
src/test/compile-fail/keyword-impl-as-identifier.rs
Normal file
15
src/test/compile-fail/keyword-impl-as-identifier.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2013 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.
|
||||
|
||||
// This file was auto-generated using 'src/etc/generate-keyword-tests.py impl'
|
||||
|
||||
fn main() {
|
||||
let impl = "foo"; //~ error: ident
|
||||
}
|
15
src/test/compile-fail/keyword-let-as-identifier.rs
Normal file
15
src/test/compile-fail/keyword-let-as-identifier.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2013 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.
|
||||
|
||||
// This file was auto-generated using 'src/etc/generate-keyword-tests.py let'
|
||||
|
||||
fn main() {
|
||||
let let = "foo"; //~ error: ident
|
||||
}
|
15
src/test/compile-fail/keyword-loop-as-identifier.rs
Normal file
15
src/test/compile-fail/keyword-loop-as-identifier.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2013 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.
|
||||
|
||||
// This file was auto-generated using 'src/etc/generate-keyword-tests.py loop'
|
||||
|
||||
fn main() {
|
||||
let loop = "foo"; //~ error: ident
|
||||
}
|
15
src/test/compile-fail/keyword-match-as-identifier.rs
Normal file
15
src/test/compile-fail/keyword-match-as-identifier.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2013 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.
|
||||
|
||||
// This file was auto-generated using 'src/etc/generate-keyword-tests.py match'
|
||||
|
||||
fn main() {
|
||||
let match = "foo"; //~ error: ident
|
||||
}
|
15
src/test/compile-fail/keyword-mod-as-identifier.rs
Normal file
15
src/test/compile-fail/keyword-mod-as-identifier.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2013 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.
|
||||
|
||||
// This file was auto-generated using 'src/etc/generate-keyword-tests.py mod'
|
||||
|
||||
fn main() {
|
||||
let mod = "foo"; //~ error: ident
|
||||
}
|
15
src/test/compile-fail/keyword-mut-as-identifier.rs
Normal file
15
src/test/compile-fail/keyword-mut-as-identifier.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2013 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.
|
||||
|
||||
// This file was auto-generated using 'src/etc/generate-keyword-tests.py mut'
|
||||
|
||||
fn main() {
|
||||
let mut = "foo"; //~ error: ident
|
||||
}
|
15
src/test/compile-fail/keyword-priv-as-identifier.rs
Normal file
15
src/test/compile-fail/keyword-priv-as-identifier.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2013 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.
|
||||
|
||||
// This file was auto-generated using 'src/etc/generate-keyword-tests.py priv'
|
||||
|
||||
fn main() {
|
||||
let priv = "foo"; //~ error: ident
|
||||
}
|
15
src/test/compile-fail/keyword-pub-as-identifier.rs
Normal file
15
src/test/compile-fail/keyword-pub-as-identifier.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2013 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.
|
||||
|
||||
// This file was auto-generated using 'src/etc/generate-keyword-tests.py pub'
|
||||
|
||||
fn main() {
|
||||
let pub = "foo"; //~ error: ident
|
||||
}
|
15
src/test/compile-fail/keyword-ref-as-identifier.rs
Normal file
15
src/test/compile-fail/keyword-ref-as-identifier.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2013 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.
|
||||
|
||||
// This file was auto-generated using 'src/etc/generate-keyword-tests.py ref'
|
||||
|
||||
fn main() {
|
||||
let ref = "foo"; //~ error: ident
|
||||
}
|
15
src/test/compile-fail/keyword-return-as-identifier.rs
Normal file
15
src/test/compile-fail/keyword-return-as-identifier.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2013 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.
|
||||
|
||||
// This file was auto-generated using 'src/etc/generate-keyword-tests.py return'
|
||||
|
||||
fn main() {
|
||||
let return = "foo"; //~ error: ident
|
||||
}
|
15
src/test/compile-fail/keyword-self-as-identifier.rs
Normal file
15
src/test/compile-fail/keyword-self-as-identifier.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2013 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.
|
||||
|
||||
// This file was auto-generated using 'src/etc/generate-keyword-tests.py self'
|
||||
|
||||
fn main() {
|
||||
let self = "foo"; //~ error: ident
|
||||
}
|
15
src/test/compile-fail/keyword-static-as-identifier.rs
Normal file
15
src/test/compile-fail/keyword-static-as-identifier.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2013 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.
|
||||
|
||||
// This file was auto-generated using 'src/etc/generate-keyword-tests.py static'
|
||||
|
||||
fn main() {
|
||||
let static = "foo"; //~ error: ident
|
||||
}
|
15
src/test/compile-fail/keyword-struct-as-identifier.rs
Normal file
15
src/test/compile-fail/keyword-struct-as-identifier.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2013 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.
|
||||
|
||||
// This file was auto-generated using 'src/etc/generate-keyword-tests.py struct'
|
||||
|
||||
fn main() {
|
||||
let struct = "foo"; //~ error: ident
|
||||
}
|
15
src/test/compile-fail/keyword-super-as-identifier.rs
Normal file
15
src/test/compile-fail/keyword-super-as-identifier.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2013 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.
|
||||
|
||||
// This file was auto-generated using 'src/etc/generate-keyword-tests.py super'
|
||||
|
||||
fn main() {
|
||||
let super = "foo"; //~ error: ident
|
||||
}
|
15
src/test/compile-fail/keyword-trait-as-identifier.rs
Normal file
15
src/test/compile-fail/keyword-trait-as-identifier.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2013 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.
|
||||
|
||||
// This file was auto-generated using 'src/etc/generate-keyword-tests.py trait'
|
||||
|
||||
fn main() {
|
||||
let trait = "foo"; //~ error: ident
|
||||
}
|
15
src/test/compile-fail/keyword-true-as-identifier.rs
Normal file
15
src/test/compile-fail/keyword-true-as-identifier.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2013 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.
|
||||
|
||||
// This file was auto-generated using 'src/etc/generate-keyword-tests.py true'
|
||||
|
||||
fn main() {
|
||||
let true = "foo"; //~ error: ident
|
||||
}
|
15
src/test/compile-fail/keyword-type-as-identifier.rs
Normal file
15
src/test/compile-fail/keyword-type-as-identifier.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2013 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.
|
||||
|
||||
// This file was auto-generated using 'src/etc/generate-keyword-tests.py type'
|
||||
|
||||
fn main() {
|
||||
let type = "foo"; //~ error: ident
|
||||
}
|
15
src/test/compile-fail/keyword-unsafe-as-identifier.rs
Normal file
15
src/test/compile-fail/keyword-unsafe-as-identifier.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2013 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.
|
||||
|
||||
// This file was auto-generated using 'src/etc/generate-keyword-tests.py unsafe'
|
||||
|
||||
fn main() {
|
||||
let unsafe = "foo"; //~ error: ident
|
||||
}
|
15
src/test/compile-fail/keyword-use-as-identifier.rs
Normal file
15
src/test/compile-fail/keyword-use-as-identifier.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2013 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.
|
||||
|
||||
// This file was auto-generated using 'src/etc/generate-keyword-tests.py use'
|
||||
|
||||
fn main() {
|
||||
let use = "foo"; //~ error: ident
|
||||
}
|
15
src/test/compile-fail/keyword-while-as-identifier.rs
Normal file
15
src/test/compile-fail/keyword-while-as-identifier.rs
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright 2013 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.
|
||||
|
||||
// This file was auto-generated using 'src/etc/generate-keyword-tests.py while'
|
||||
|
||||
fn main() {
|
||||
let while = "foo"; //~ error: ident
|
||||
}
|
Loading…
Reference in New Issue
Block a user