summaryrefslogtreecommitdiffstats
path: root/tests/ui/keyword/extern
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/keyword/extern')
-rw-r--r--tests/ui/keyword/extern/keyword-extern-as-identifier-expr.rs3
-rw-r--r--tests/ui/keyword/extern/keyword-extern-as-identifier-expr.stderr8
-rw-r--r--tests/ui/keyword/extern/keyword-extern-as-identifier-pat.rs3
-rw-r--r--tests/ui/keyword/extern/keyword-extern-as-identifier-pat.stderr13
-rw-r--r--tests/ui/keyword/extern/keyword-extern-as-identifier-type.rs3
-rw-r--r--tests/ui/keyword/extern/keyword-extern-as-identifier-type.stderr8
-rw-r--r--tests/ui/keyword/extern/keyword-extern-as-identifier-use.rs4
-rw-r--r--tests/ui/keyword/extern/keyword-extern-as-identifier-use.stderr22
8 files changed, 64 insertions, 0 deletions
diff --git a/tests/ui/keyword/extern/keyword-extern-as-identifier-expr.rs b/tests/ui/keyword/extern/keyword-extern-as-identifier-expr.rs
new file mode 100644
index 000000000..b738eb4c7
--- /dev/null
+++ b/tests/ui/keyword/extern/keyword-extern-as-identifier-expr.rs
@@ -0,0 +1,3 @@
+fn main() {
+ let s = extern::foo::Bar; //~ ERROR expected expression, found keyword `extern`
+}
diff --git a/tests/ui/keyword/extern/keyword-extern-as-identifier-expr.stderr b/tests/ui/keyword/extern/keyword-extern-as-identifier-expr.stderr
new file mode 100644
index 000000000..8bb89d2ee
--- /dev/null
+++ b/tests/ui/keyword/extern/keyword-extern-as-identifier-expr.stderr
@@ -0,0 +1,8 @@
+error: expected expression, found keyword `extern`
+ --> $DIR/keyword-extern-as-identifier-expr.rs:2:13
+ |
+LL | let s = extern::foo::Bar;
+ | ^^^^^^ expected expression
+
+error: aborting due to previous error
+
diff --git a/tests/ui/keyword/extern/keyword-extern-as-identifier-pat.rs b/tests/ui/keyword/extern/keyword-extern-as-identifier-pat.rs
new file mode 100644
index 000000000..8a420f720
--- /dev/null
+++ b/tests/ui/keyword/extern/keyword-extern-as-identifier-pat.rs
@@ -0,0 +1,3 @@
+fn main() {
+ let extern = 0; //~ ERROR expected identifier, found keyword `extern`
+}
diff --git a/tests/ui/keyword/extern/keyword-extern-as-identifier-pat.stderr b/tests/ui/keyword/extern/keyword-extern-as-identifier-pat.stderr
new file mode 100644
index 000000000..9bf416341
--- /dev/null
+++ b/tests/ui/keyword/extern/keyword-extern-as-identifier-pat.stderr
@@ -0,0 +1,13 @@
+error: expected identifier, found keyword `extern`
+ --> $DIR/keyword-extern-as-identifier-pat.rs:2:9
+ |
+LL | let extern = 0;
+ | ^^^^^^ expected identifier, found keyword
+ |
+help: escape `extern` to use it as an identifier
+ |
+LL | let r#extern = 0;
+ | ++
+
+error: aborting due to previous error
+
diff --git a/tests/ui/keyword/extern/keyword-extern-as-identifier-type.rs b/tests/ui/keyword/extern/keyword-extern-as-identifier-type.rs
new file mode 100644
index 000000000..12aa05976
--- /dev/null
+++ b/tests/ui/keyword/extern/keyword-extern-as-identifier-type.rs
@@ -0,0 +1,3 @@
+type A = extern::foo::bar; //~ ERROR expected type, found keyword `extern`
+
+fn main() {}
diff --git a/tests/ui/keyword/extern/keyword-extern-as-identifier-type.stderr b/tests/ui/keyword/extern/keyword-extern-as-identifier-type.stderr
new file mode 100644
index 000000000..20ecf6bac
--- /dev/null
+++ b/tests/ui/keyword/extern/keyword-extern-as-identifier-type.stderr
@@ -0,0 +1,8 @@
+error: expected type, found keyword `extern`
+ --> $DIR/keyword-extern-as-identifier-type.rs:1:10
+ |
+LL | type A = extern::foo::bar;
+ | ^^^^^^ expected type
+
+error: aborting due to previous error
+
diff --git a/tests/ui/keyword/extern/keyword-extern-as-identifier-use.rs b/tests/ui/keyword/extern/keyword-extern-as-identifier-use.rs
new file mode 100644
index 000000000..a46ce67d4
--- /dev/null
+++ b/tests/ui/keyword/extern/keyword-extern-as-identifier-use.rs
@@ -0,0 +1,4 @@
+use extern::foo; //~ ERROR expected identifier, found keyword `extern`
+ //~| ERROR unresolved import `r#extern`
+
+fn main() {}
diff --git a/tests/ui/keyword/extern/keyword-extern-as-identifier-use.stderr b/tests/ui/keyword/extern/keyword-extern-as-identifier-use.stderr
new file mode 100644
index 000000000..54ee45c28
--- /dev/null
+++ b/tests/ui/keyword/extern/keyword-extern-as-identifier-use.stderr
@@ -0,0 +1,22 @@
+error: expected identifier, found keyword `extern`
+ --> $DIR/keyword-extern-as-identifier-use.rs:1:5
+ |
+LL | use extern::foo;
+ | ^^^^^^ expected identifier, found keyword
+ |
+help: escape `extern` to use it as an identifier
+ |
+LL | use r#extern::foo;
+ | ++
+
+error[E0432]: unresolved import `r#extern`
+ --> $DIR/keyword-extern-as-identifier-use.rs:1:5
+ |
+LL | use extern::foo;
+ | ^^^^^^ maybe a missing crate `r#extern`?
+ |
+ = help: consider adding `extern crate r#extern` to use the `r#extern` crate
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0432`.