summaryrefslogtreecommitdiffstats
path: root/src/test/ui/dollar-crate/dollar-crate-is-keyword.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/dollar-crate/dollar-crate-is-keyword.rs')
-rw-r--r--src/test/ui/dollar-crate/dollar-crate-is-keyword.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/ui/dollar-crate/dollar-crate-is-keyword.rs b/src/test/ui/dollar-crate/dollar-crate-is-keyword.rs
new file mode 100644
index 000000000..d625163dc
--- /dev/null
+++ b/src/test/ui/dollar-crate/dollar-crate-is-keyword.rs
@@ -0,0 +1,17 @@
+macro_rules! m {
+ () => {
+ // Avoid having more than one `$crate`-named item in the same module,
+ // as even though they error, they still parse as `$crate` and conflict.
+ mod foo {
+ struct $crate {} //~ ERROR expected identifier, found reserved identifier `$crate`
+ }
+
+ use $crate; //~ ERROR `$crate` may not be imported
+ use $crate as $crate; //~ ERROR expected identifier, found reserved identifier `$crate`
+ //~^ ERROR `$crate` may not be imported
+ }
+}
+
+m!();
+
+fn main() {}