From 1cbf0a84dc9d12d4c15379537a51ad75fcb1bdcf Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Mon, 6 May 2013 19:05:36 +0200 Subject: [PATCH] Step one for 'proper' pub condition: support pub keyword in form. --- src/libcore/rt/io/mod.rs | 3 ++- src/libsyntax/ext/expand.rs | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/libcore/rt/io/mod.rs b/src/libcore/rt/io/mod.rs index 97b3ee3e30ef6..fea32bc5b7509 100644 --- a/src/libcore/rt/io/mod.rs +++ b/src/libcore/rt/io/mod.rs @@ -337,7 +337,8 @@ pub enum IoErrorKind { // XXX: Can't put doc comments on macros // Raised by `I/O` operations on error. condition! { - io_error: super::IoError -> (); + // FIXME (#6009): uncomment `pub` after expansion support lands. + /*pub*/ io_error: super::IoError -> (); } pub trait Reader { diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 02721a02fbd0c..b1267ee757816 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -485,8 +485,23 @@ pub fn core_macros() -> ~str { macro_rules! condition ( + { pub $c:ident: $in:ty -> $out:ty; } => { + + pub mod $c { + fn key(_x: @::core::condition::Handler<$in,$out>) { } + + pub static cond : + ::core::condition::Condition<'static,$in,$out> = + ::core::condition::Condition { + name: stringify!($c), + key: key + }; + } + }; + { $c:ident: $in:ty -> $out:ty; } => { + // FIXME (#6009): remove mod's `pub` below once variant above lands. pub mod $c { fn key(_x: @::core::condition::Handler<$in,$out>) { }