1 // Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // This is an equivalent of issue #50504, but for declarative macros.
13 #![feature(decl_macro, rustc_attrs)]
15 macro genmod($FromOutside: ident, $Outer: ident) {
16 type A = $FromOutside;
19 type A = $FromOutside; // `FromOutside` shouldn't be available from here
20 type Inner = $Outer; // `Outer` shouldn't be available from here
24 #[rustc_transparent_macro]
25 macro genmod_transparent() {
29 type A = FromOutside; //~ ERROR cannot find type `FromOutside` in this scope
30 type Inner = Outer; //~ ERROR cannot find type `Outer` in this scope
34 macro_rules! genmod_legacy { () => {
38 type A = FromOutside; //~ ERROR cannot find type `FromOutside` in this scope
39 type Inner = Outer; //~ ERROR cannot find type `Outer` in this scope
45 genmod!(FromOutside, Outer); //~ ERROR cannot find type `FromOutside` in this scope
46 //~| ERROR cannot find type `Outer` in this scope
49 fn check_transparent() {
51 genmod_transparent!();