Skip to content

Commit

Permalink
auto merge of rust-lang#6271 : pnkfelix/rust/issue6009-condition-pub-…
Browse files Browse the repository at this point in the history
…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 rust-lang#6009 , which was implied by my choice of branch name, but not mentioned in the pull request, so github did not notice it.)
  • Loading branch information
bors committed May 7, 2013
2 parents 4023f54 + 1cbf0a8 commit 154f3b0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/libcore/rt/io/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
15 changes: 15 additions & 0 deletions src/libsyntax/ext/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -524,8 +524,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>) { }

Expand Down

0 comments on commit 154f3b0

Please sign in to comment.