]> git.lizzy.rs Git - rust.git/commitdiff
auto merge of #8739 : fhahn/rust/ticket_2275, r=brson
authorbors <bors@rust-lang.org>
Tue, 27 Aug 2013 01:20:56 +0000 (18:20 -0700)
committerbors <bors@rust-lang.org>
Tue, 27 Aug 2013 01:20:56 +0000 (18:20 -0700)
This is a pull request for #2275

I've created a small python script to generate test files for a list of keywords (as break do else enum extern false fn for if impl let loop match mod mut priv pub ref return self static struct super true trait type unsafe use while), but I'm not really sure where to put it. I've added the created files as well.

I did not use

     fn main() {
        let $KW = "foo"; //~ error
        println($KW); //~ error
    }

as template, because for return, self, ref, loop, mut and break this does not raise an error in the ```println``` line, only in the ```let``` line.

31 files changed:
src/etc/generate-keyword-tests.py [new file with mode: 0755]
src/test/compile-fail/keyword-as-as-identifier.rs [new file with mode: 0644]
src/test/compile-fail/keyword-break-as-identifier.rs [new file with mode: 0644]
src/test/compile-fail/keyword-do-as-identifier.rs [new file with mode: 0644]
src/test/compile-fail/keyword-else-as-identifier.rs [new file with mode: 0644]
src/test/compile-fail/keyword-enum-as-identifier.rs [new file with mode: 0644]
src/test/compile-fail/keyword-extern-as-identifier.rs [new file with mode: 0644]
src/test/compile-fail/keyword-false-as-identifier.rs [new file with mode: 0644]
src/test/compile-fail/keyword-fn-as-identifier.rs [new file with mode: 0644]
src/test/compile-fail/keyword-for-as-identifier.rs [new file with mode: 0644]
src/test/compile-fail/keyword-if-as-identifier.rs [new file with mode: 0644]
src/test/compile-fail/keyword-impl-as-identifier.rs [new file with mode: 0644]
src/test/compile-fail/keyword-let-as-identifier.rs [new file with mode: 0644]
src/test/compile-fail/keyword-loop-as-identifier.rs [new file with mode: 0644]
src/test/compile-fail/keyword-match-as-identifier.rs [new file with mode: 0644]
src/test/compile-fail/keyword-mod-as-identifier.rs [new file with mode: 0644]
src/test/compile-fail/keyword-mut-as-identifier.rs [new file with mode: 0644]
src/test/compile-fail/keyword-priv-as-identifier.rs [new file with mode: 0644]
src/test/compile-fail/keyword-pub-as-identifier.rs [new file with mode: 0644]
src/test/compile-fail/keyword-ref-as-identifier.rs [new file with mode: 0644]
src/test/compile-fail/keyword-return-as-identifier.rs [new file with mode: 0644]
src/test/compile-fail/keyword-self-as-identifier.rs [new file with mode: 0644]
src/test/compile-fail/keyword-static-as-identifier.rs [new file with mode: 0644]
src/test/compile-fail/keyword-struct-as-identifier.rs [new file with mode: 0644]
src/test/compile-fail/keyword-super-as-identifier.rs [new file with mode: 0644]
src/test/compile-fail/keyword-trait-as-identifier.rs [new file with mode: 0644]
src/test/compile-fail/keyword-true-as-identifier.rs [new file with mode: 0644]
src/test/compile-fail/keyword-type-as-identifier.rs [new file with mode: 0644]
src/test/compile-fail/keyword-unsafe-as-identifier.rs [new file with mode: 0644]
src/test/compile-fail/keyword-use-as-identifier.rs [new file with mode: 0644]
src/test/compile-fail/keyword-while-as-identifier.rs [new file with mode: 0644]

diff --git a/src/etc/generate-keyword-tests.py b/src/etc/generate-keyword-tests.py
new file mode 100755 (executable)
index 0000000..5b82755
--- /dev/null
@@ -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)
diff --git a/src/test/compile-fail/keyword-as-as-identifier.rs b/src/test/compile-fail/keyword-as-as-identifier.rs
new file mode 100644 (file)
index 0000000..f307b12
--- /dev/null
@@ -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
+}
diff --git a/src/test/compile-fail/keyword-break-as-identifier.rs b/src/test/compile-fail/keyword-break-as-identifier.rs
new file mode 100644 (file)
index 0000000..1e2725e
--- /dev/null
@@ -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
+}
diff --git a/src/test/compile-fail/keyword-do-as-identifier.rs b/src/test/compile-fail/keyword-do-as-identifier.rs
new file mode 100644 (file)
index 0000000..b2a0c8a
--- /dev/null
@@ -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
+}
diff --git a/src/test/compile-fail/keyword-else-as-identifier.rs b/src/test/compile-fail/keyword-else-as-identifier.rs
new file mode 100644 (file)
index 0000000..101fd93
--- /dev/null
@@ -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
+}
diff --git a/src/test/compile-fail/keyword-enum-as-identifier.rs b/src/test/compile-fail/keyword-enum-as-identifier.rs
new file mode 100644 (file)
index 0000000..ed504cc
--- /dev/null
@@ -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
+}
diff --git a/src/test/compile-fail/keyword-extern-as-identifier.rs b/src/test/compile-fail/keyword-extern-as-identifier.rs
new file mode 100644 (file)
index 0000000..3260506
--- /dev/null
@@ -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
+}
diff --git a/src/test/compile-fail/keyword-false-as-identifier.rs b/src/test/compile-fail/keyword-false-as-identifier.rs
new file mode 100644 (file)
index 0000000..d875898
--- /dev/null
@@ -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
+}
diff --git a/src/test/compile-fail/keyword-fn-as-identifier.rs b/src/test/compile-fail/keyword-fn-as-identifier.rs
new file mode 100644 (file)
index 0000000..8c98da2
--- /dev/null
@@ -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
+}
diff --git a/src/test/compile-fail/keyword-for-as-identifier.rs b/src/test/compile-fail/keyword-for-as-identifier.rs
new file mode 100644 (file)
index 0000000..196a339
--- /dev/null
@@ -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
+}
diff --git a/src/test/compile-fail/keyword-if-as-identifier.rs b/src/test/compile-fail/keyword-if-as-identifier.rs
new file mode 100644 (file)
index 0000000..05f82ec
--- /dev/null
@@ -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
+}
diff --git a/src/test/compile-fail/keyword-impl-as-identifier.rs b/src/test/compile-fail/keyword-impl-as-identifier.rs
new file mode 100644 (file)
index 0000000..1dd2180
--- /dev/null
@@ -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
+}
diff --git a/src/test/compile-fail/keyword-let-as-identifier.rs b/src/test/compile-fail/keyword-let-as-identifier.rs
new file mode 100644 (file)
index 0000000..0069a26
--- /dev/null
@@ -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
+}
diff --git a/src/test/compile-fail/keyword-loop-as-identifier.rs b/src/test/compile-fail/keyword-loop-as-identifier.rs
new file mode 100644 (file)
index 0000000..6e469e8
--- /dev/null
@@ -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
+}
diff --git a/src/test/compile-fail/keyword-match-as-identifier.rs b/src/test/compile-fail/keyword-match-as-identifier.rs
new file mode 100644 (file)
index 0000000..9155ebc
--- /dev/null
@@ -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
+}
diff --git a/src/test/compile-fail/keyword-mod-as-identifier.rs b/src/test/compile-fail/keyword-mod-as-identifier.rs
new file mode 100644 (file)
index 0000000..02f57e9
--- /dev/null
@@ -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
+}
diff --git a/src/test/compile-fail/keyword-mut-as-identifier.rs b/src/test/compile-fail/keyword-mut-as-identifier.rs
new file mode 100644 (file)
index 0000000..b5d36e5
--- /dev/null
@@ -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
+}
diff --git a/src/test/compile-fail/keyword-priv-as-identifier.rs b/src/test/compile-fail/keyword-priv-as-identifier.rs
new file mode 100644 (file)
index 0000000..7cbaeb9
--- /dev/null
@@ -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
+}
diff --git a/src/test/compile-fail/keyword-pub-as-identifier.rs b/src/test/compile-fail/keyword-pub-as-identifier.rs
new file mode 100644 (file)
index 0000000..aa67974
--- /dev/null
@@ -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
+}
diff --git a/src/test/compile-fail/keyword-ref-as-identifier.rs b/src/test/compile-fail/keyword-ref-as-identifier.rs
new file mode 100644 (file)
index 0000000..72af521
--- /dev/null
@@ -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
+}
diff --git a/src/test/compile-fail/keyword-return-as-identifier.rs b/src/test/compile-fail/keyword-return-as-identifier.rs
new file mode 100644 (file)
index 0000000..c567644
--- /dev/null
@@ -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
+}
diff --git a/src/test/compile-fail/keyword-self-as-identifier.rs b/src/test/compile-fail/keyword-self-as-identifier.rs
new file mode 100644 (file)
index 0000000..8bb5214
--- /dev/null
@@ -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
+}
diff --git a/src/test/compile-fail/keyword-static-as-identifier.rs b/src/test/compile-fail/keyword-static-as-identifier.rs
new file mode 100644 (file)
index 0000000..7268c4f
--- /dev/null
@@ -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
+}
diff --git a/src/test/compile-fail/keyword-struct-as-identifier.rs b/src/test/compile-fail/keyword-struct-as-identifier.rs
new file mode 100644 (file)
index 0000000..bd42eac
--- /dev/null
@@ -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
+}
diff --git a/src/test/compile-fail/keyword-super-as-identifier.rs b/src/test/compile-fail/keyword-super-as-identifier.rs
new file mode 100644 (file)
index 0000000..0378c32
--- /dev/null
@@ -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
+}
diff --git a/src/test/compile-fail/keyword-trait-as-identifier.rs b/src/test/compile-fail/keyword-trait-as-identifier.rs
new file mode 100644 (file)
index 0000000..95c0d17
--- /dev/null
@@ -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
+}
diff --git a/src/test/compile-fail/keyword-true-as-identifier.rs b/src/test/compile-fail/keyword-true-as-identifier.rs
new file mode 100644 (file)
index 0000000..048b640
--- /dev/null
@@ -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
+}
diff --git a/src/test/compile-fail/keyword-type-as-identifier.rs b/src/test/compile-fail/keyword-type-as-identifier.rs
new file mode 100644 (file)
index 0000000..0aaa2a6
--- /dev/null
@@ -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
+}
diff --git a/src/test/compile-fail/keyword-unsafe-as-identifier.rs b/src/test/compile-fail/keyword-unsafe-as-identifier.rs
new file mode 100644 (file)
index 0000000..1b631eb
--- /dev/null
@@ -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
+}
diff --git a/src/test/compile-fail/keyword-use-as-identifier.rs b/src/test/compile-fail/keyword-use-as-identifier.rs
new file mode 100644 (file)
index 0000000..e82afd5
--- /dev/null
@@ -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
+}
diff --git a/src/test/compile-fail/keyword-while-as-identifier.rs b/src/test/compile-fail/keyword-while-as-identifier.rs
new file mode 100644 (file)
index 0000000..95cea65
--- /dev/null
@@ -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
+}