diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-03-26 16:14:07 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-03-28 16:37:45 -0700 |
| commit | c6bbb95ce26e75214003190b643f5098e39b6428 (patch) | |
| tree | ddeebe963d1c6ded3112ddbb6625ed02eb28e884 /src/libstd | |
| parent | cbfc0a5e33eb3d97a2995d120536b8dadc0cc0a2 (diff) | |
| download | rust-c6bbb95ce26e75214003190b643f5098e39b6428.tar.gz rust-c6bbb95ce26e75214003190b643f5098e39b6428.zip | |
syntax: Accept meta matchers in macros
This removes the `attr` matcher and adds a `meta` matcher. The previous `attr` matcher is now ambiguous because it doesn't disambiguate whether it means inner attribute or outer attribute. The new behavior can still be achieved by taking an argument of the form `#[$foo:meta]` (the brackets are part of the macro pattern). Closes #13067
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/comm/mod.rs | 6 | ||||
| -rw-r--r-- | src/libstd/io/test.rs | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/libstd/comm/mod.rs b/src/libstd/comm/mod.rs index 94e3d5ce2d3..ef8894a258c 100644 --- a/src/libstd/comm/mod.rs +++ b/src/libstd/comm/mod.rs @@ -252,7 +252,7 @@ use sync::arc::UnsafeArc; pub use comm::select::{Select, Handle}; macro_rules! test ( - { fn $name:ident() $b:block $($a:attr)*} => ( + { fn $name:ident() $b:block $(#[$a:meta])*} => ( mod $name { #[allow(unused_imports)]; @@ -265,8 +265,8 @@ macro_rules! test ( fn f() $b - $($a)* #[test] fn uv() { f() } - $($a)* #[test] fn native() { + $(#[$a])* #[test] fn uv() { f() } + $(#[$a])* #[test] fn native() { use native; let (tx, rx) = channel(); native::task::spawn(proc() { tx.send(f()) }); diff --git a/src/libstd/io/test.rs b/src/libstd/io/test.rs index 9eeaf4635a4..6e987869238 100644 --- a/src/libstd/io/test.rs +++ b/src/libstd/io/test.rs @@ -19,7 +19,7 @@ use std::io::net::ip::*; use sync::atomics::{AtomicUint, INIT_ATOMIC_UINT, Relaxed}; macro_rules! iotest ( - { fn $name:ident() $b:block $($a:attr)* } => ( + { fn $name:ident() $b:block $(#[$a:meta])* } => ( mod $name { #[allow(unused_imports)]; @@ -43,8 +43,8 @@ macro_rules! iotest ( fn f() $b - $($a)* #[test] fn green() { f() } - $($a)* #[test] fn native() { + $(#[$a])* #[test] fn green() { f() } + $(#[$a])* #[test] fn native() { use native; let (tx, rx) = channel(); native::task::spawn(proc() { tx.send(f()) }); |
