about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2012-11-15 16:59:43 -0800
committerPatrick Walton <pcwalton@mimiga.net>2012-11-15 17:15:02 -0800
commit64305174c9f2925dcbec3cf24ccc4be3a52e1ff6 (patch)
tree02e6fd0029a95740c49474bd4622f9bde6467d0e /src
parentcb355bf7ad63d087a558c0509dfe350016dd35ba (diff)
librustc: Fix cross-crate reexports. rs=blocking-servo
Diffstat (limited to 'src')
-rw-r--r--src/libcore/float.rs18
-rw-r--r--src/librustc/middle/resolve.rs46
-rw-r--r--src/test/auxiliary/pub_use_mods_xcrate.rs11
-rw-r--r--src/test/run-pass/pub_use_mods_xcrate_exe.rs8
4 files changed, 56 insertions, 27 deletions
diff --git a/src/libcore/float.rs b/src/libcore/float.rs
index dd46d30d6ba..726ea31e7da 100644
--- a/src/libcore/float.rs
+++ b/src/libcore/float.rs
@@ -16,15 +16,15 @@
 
 use m_float = f64;
 
-use f64::{add, sub, mul, div, rem, lt, le, eq, ne, ge, gt};
-use f64::logarithm;
-use f64::{acos, asin, atan2, cbrt, ceil, copysign, cosh, floor};
-use f64::{erf, erfc, exp, expm1, exp2, abs_sub};
-use f64::{mul_add, fmax, fmin, nextafter, frexp, hypot, ldexp};
-use f64::{lgamma, ln, log_radix, ln1p, log10, log2, ilog_radix};
-use f64::{modf, pow, round, sinh, tanh, tgamma, trunc};
-use f64::signbit;
-use f64::{j0, j1, jn, y0, y1, yn};
+pub use f64::{add, sub, mul, div, rem, lt, le, eq, ne, ge, gt};
+pub use f64::logarithm;
+pub use f64::{acos, asin, atan2, cbrt, ceil, copysign, cosh, floor};
+pub use f64::{erf, erfc, exp, expm1, exp2, abs_sub};
+pub use f64::{mul_add, fmax, fmin, nextafter, frexp, hypot, ldexp};
+pub use f64::{lgamma, ln, log_radix, ln1p, log10, log2, ilog_radix};
+pub use f64::{modf, pow, round, sinh, tanh, tgamma, trunc};
+pub use f64::signbit;
+pub use f64::{j0, j1, jn, y0, y1, yn};
 use cmp::{Eq, Ord};
 use num::from_int;
 
diff --git a/src/librustc/middle/resolve.rs b/src/librustc/middle/resolve.rs
index 4d435bea7a2..6f67b948aa4 100644
--- a/src/librustc/middle/resolve.rs
+++ b/src/librustc/middle/resolve.rs
@@ -1687,7 +1687,7 @@ impl Resolver {
                     // avoid creating cycles in the
                     // module graph.
 
-                    let resolution = @ImportResolution(Private, dummy_sp());
+                    let resolution = @ImportResolution(Public, dummy_sp());
                     resolution.outstanding_references = 0;
 
                     match existing_module.parent_link {
@@ -3199,23 +3199,26 @@ impl Resolver {
     fn add_exports_of_namebindings(exports2: &mut ~[Export2],
                                    ident: ident,
                                    namebindings: @NameBindings,
+                                   ns: Namespace,
                                    reexport: bool) {
-        for [ TypeNS, ValueNS ].each |ns| {
-            match (namebindings.def_for_namespace(*ns),
-                   namebindings.privacy_for_namespace(*ns)) {
-                (Some(d), Some(Public)) => {
-                    debug!("(computing exports) YES: %s '%s' \
-                            => %?",
-                           if reexport { ~"reexport" } else { ~"export"},
-                           self.session.str_of(ident),
-                           def_id_of_def(d));
-                    exports2.push(Export2 {
-                        reexport: reexport,
-                        name: self.session.str_of(ident),
-                        def_id: def_id_of_def(d)
-                    });
-                }
-                _ => ()
+        match (namebindings.def_for_namespace(ns),
+               namebindings.privacy_for_namespace(ns)) {
+            (Some(d), Some(Public)) => {
+                debug!("(computing exports) YES: %s '%s' => %?",
+                       if reexport { ~"reexport" } else { ~"export"},
+                       self.session.str_of(ident),
+                       def_id_of_def(d));
+                exports2.push(Export2 {
+                    reexport: reexport,
+                    name: self.session.str_of(ident),
+                    def_id: def_id_of_def(d)
+                });
+            }
+            (Some(_), Some(privacy)) => {
+                debug!("(computing reexports) NO: privacy %?", privacy);
+            }
+            (d_opt, p_opt) => {
+                debug!("(computing reexports) NO: %?, %?", d_opt, p_opt);
             }
         }
     }
@@ -3227,7 +3230,13 @@ impl Resolver {
             self.add_exports_of_namebindings(exports2,
                                              *ident,
                                              *namebindings,
-                                             false)
+                                             TypeNS,
+                                             false);
+            self.add_exports_of_namebindings(exports2,
+                                             *ident,
+                                             *namebindings,
+                                             ValueNS,
+                                             false);
         }
 
         for module_.import_resolutions.each_ref |ident, importresolution| {
@@ -3244,6 +3253,7 @@ impl Resolver {
                         self.add_exports_of_namebindings(exports2,
                                                          *ident,
                                                          target.bindings,
+                                                         *ns,
                                                          true)
                     }
                     _ => ()
diff --git a/src/test/auxiliary/pub_use_mods_xcrate.rs b/src/test/auxiliary/pub_use_mods_xcrate.rs
new file mode 100644
index 00000000000..99a85c66b4f
--- /dev/null
+++ b/src/test/auxiliary/pub_use_mods_xcrate.rs
@@ -0,0 +1,11 @@
+pub mod a {
+    pub mod b {
+        pub mod c {
+            fn f(){}
+            fn g(){}
+        }
+    }
+
+    pub use b::c;
+}
+
diff --git a/src/test/run-pass/pub_use_mods_xcrate_exe.rs b/src/test/run-pass/pub_use_mods_xcrate_exe.rs
new file mode 100644
index 00000000000..ddba3e4a387
--- /dev/null
+++ b/src/test/run-pass/pub_use_mods_xcrate_exe.rs
@@ -0,0 +1,8 @@
+// xfail-fast
+// aux-build:pub_use_mods_xcrate.rs
+
+extern mod pub_use_mods_xcrate;
+use pub_use_mods_xcrate::a::c;
+
+fn main(){}
+