Skip to content

Commit 154f3b0

Browse files
committed
auto merge of #6271 : pnkfelix/rust/issue6009-condition-pub-priv-variants, r=graydon
@brson: r? [please ignore the other one that was accidentally based off master due to back-button-bugs in github.com] My goal is to resolve the question of whether we want to encourage (by example) consistent use of pub to make identifiers publicly-accessible, even in syntax extensions. (If people don't want that, then we can just let this pull request die.) This is part one of two. Part two, whose contents should be clear from the FIXME's in this commit, would land after this gets incorporated into a snapshot. (The eventual goal is to address issue #6009 , which was implied by my choice of branch name, but not mentioned in the pull request, so github did not notice it.)
2 parents 4023f54 + 1cbf0a8 commit 154f3b0

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/libcore/rt/io/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,8 @@ pub enum IoErrorKind {
337337
// XXX: Can't put doc comments on macros
338338
// Raised by `I/O` operations on error.
339339
condition! {
340-
io_error: super::IoError -> ();
340+
// FIXME (#6009): uncomment `pub` after expansion support lands.
341+
/*pub*/ io_error: super::IoError -> ();
341342
}
342343

343344
pub trait Reader {

src/libsyntax/ext/expand.rs

+15
Original file line numberDiff line numberDiff line change
@@ -524,8 +524,23 @@ pub fn core_macros() -> ~str {
524524

525525
macro_rules! condition (
526526

527+
{ pub $c:ident: $in:ty -> $out:ty; } => {
528+
529+
pub mod $c {
530+
fn key(_x: @::core::condition::Handler<$in,$out>) { }
531+
532+
pub static cond :
533+
::core::condition::Condition<'static,$in,$out> =
534+
::core::condition::Condition {
535+
name: stringify!($c),
536+
key: key
537+
};
538+
}
539+
};
540+
527541
{ $c:ident: $in:ty -> $out:ty; } => {
528542

543+
// FIXME (#6009): remove mod's `pub` below once variant above lands.
529544
pub mod $c {
530545
fn key(_x: @::core::condition::Handler<$in,$out>) { }
531546

0 commit comments

Comments
 (0)