diff options
Diffstat (limited to 'tests/ui/dollar-crate/dollar-crate-is-keyword.rs')
-rw-r--r-- | tests/ui/dollar-crate/dollar-crate-is-keyword.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/ui/dollar-crate/dollar-crate-is-keyword.rs b/tests/ui/dollar-crate/dollar-crate-is-keyword.rs new file mode 100644 index 000000000..d625163dc --- /dev/null +++ b/tests/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() {} |