From 4a18d46130e13aad28fc072dafdd7e7b4baa8736 Mon Sep 17 00:00:00 2001 From: jmgrosen Date: Tue, 3 Sep 2013 16:11:00 -0700 Subject: [PATCH] Fixes #8881. condition! imports parent's pub identifiers --- src/librustpkg/conditions.rs | 16 ++++++++-------- src/libstd/c_str.rs | 2 ++ src/libstd/rt/io/mod.rs | 4 ++++ src/libsyntax/ext/expand.rs | 8 ++++++++ src/test/auxiliary/xc_conditions_4.rs | 3 +-- 5 files changed, 23 insertions(+), 10 deletions(-) diff --git a/src/librustpkg/conditions.rs b/src/librustpkg/conditions.rs index 785c635e08561..16ee9c1afb445 100644 --- a/src/librustpkg/conditions.rs +++ b/src/librustpkg/conditions.rs @@ -14,33 +14,33 @@ pub use std::path::Path; pub use package_id::PkgId; condition! { - bad_path: (super::Path, ~str) -> super::Path; + bad_path: (Path, ~str) -> Path; } condition! { - nonexistent_package: (super::PkgId, ~str) -> super::Path; + nonexistent_package: (PkgId, ~str) -> Path; } condition! { - copy_failed: (super::Path, super::Path) -> (); + copy_failed: (Path, Path) -> (); } condition! { - missing_pkg_files: (super::PkgId) -> (); + missing_pkg_files: (PkgId) -> (); } condition! { - bad_pkg_id: (super::Path, ~str) -> super::PkgId; + bad_pkg_id: (Path, ~str) -> PkgId; } condition! { - no_rust_path: (~str) -> super::Path; + no_rust_path: (~str) -> Path; } condition! { - not_a_workspace: (~str) -> super::Path; + not_a_workspace: (~str) -> Path; } condition! { - failed_to_create_temp_dir: (~str) -> super::Path; + failed_to_create_temp_dir: (~str) -> Path; } diff --git a/src/libstd/c_str.rs b/src/libstd/c_str.rs index 70b04e37ee1ff..8e7129578ee67 100644 --- a/src/libstd/c_str.rs +++ b/src/libstd/c_str.rs @@ -29,6 +29,8 @@ pub enum NullByteResolution { condition! { // this should be &[u8] but there's a lifetime issue + // NOTE: this super::NullByteResolution should be NullByteResolution + // Change this next time the snapshot it updated. null_byte: (~[u8]) -> super::NullByteResolution; } diff --git a/src/libstd/rt/io/mod.rs b/src/libstd/rt/io/mod.rs index 116d240308a36..a2002c989f0b1 100644 --- a/src/libstd/rt/io/mod.rs +++ b/src/libstd/rt/io/mod.rs @@ -385,6 +385,8 @@ impl ToStr for IoErrorKind { // Raised by `I/O` operations on error. condition! { // FIXME (#6009): uncomment `pub` after expansion support lands. + // NOTE: this super::IoError should be IoError + // Change this next time the snapshot it updated. /*pub*/ io_error: super::IoError -> (); } @@ -392,6 +394,8 @@ condition! { // Raised by `read` on error condition! { // FIXME (#6009): uncomment `pub` after expansion support lands. + // NOTE: this super::IoError should be IoError + // Change this next time the snapshot it updated. /*pub*/ read_error: super::IoError -> (); } diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 0827a9fabee5c..f183067a9c179 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -889,7 +889,11 @@ pub fn std_macros() -> @str { { pub $c:ident: $input:ty -> $out:ty; } => { pub mod $c { + #[allow(unused_imports)]; #[allow(non_uppercase_statics)]; + + use super::*; + static key: ::std::local_data::Key< @::std::condition::Handler<$input, $out>> = &::std::local_data::Key; @@ -907,7 +911,11 @@ pub fn std_macros() -> @str { // FIXME (#6009): remove mod's `pub` below once variant above lands. pub mod $c { + #[allow(unused_imports)]; #[allow(non_uppercase_statics)]; + + use super::*; + static key: ::std::local_data::Key< @::std::condition::Handler<$input, $out>> = &::std::local_data::Key; diff --git a/src/test/auxiliary/xc_conditions_4.rs b/src/test/auxiliary/xc_conditions_4.rs index c9b5a1dc2b820..e98e6929970b0 100644 --- a/src/test/auxiliary/xc_conditions_4.rs +++ b/src/test/auxiliary/xc_conditions_4.rs @@ -16,7 +16,7 @@ pub enum Color { } condition! { - pub oops: (int,float,~str) -> ::Color; + pub oops: (int,float,~str) -> Color; } pub trait Thunk { @@ -26,4 +26,3 @@ pub trait Thunk { pub fn callback>(t:TH) -> T { t.call() } -