about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-12-04 08:12:11 -0800
committerbors <bors@rust-lang.org>2013-12-04 08:12:11 -0800
commit5fa6bd526ef66ce9ce80e975340aa98bcc3596b7 (patch)
tree54eefd59d07cbcaa24968206320ba3a1dbf2cba1
parent91695797c2ff36017edc47af270ca665f2f4d1ef (diff)
parent7a2415f0e43efcbe398d883c32b53bab77986cab (diff)
downloadrust-5fa6bd526ef66ce9ce80e975340aa98bcc3596b7.tar.gz
rust-5fa6bd526ef66ce9ce80e975340aa98bcc3596b7.zip
auto merge of #10788 : alexcrichton/rust/fixes, r=pcwalton
I used the wrong condition where I was looking for "is this method public or is
this implementation a trait" rather than what was being checked.
-rw-r--r--src/librustc/middle/privacy.rs2
-rw-r--r--src/test/auxiliary/priv-impl-prim-ty.rs19
-rw-r--r--src/test/run-pass/priv-impl-prim-ty.rs19
3 files changed, 39 insertions, 1 deletions
diff --git a/src/librustc/middle/privacy.rs b/src/librustc/middle/privacy.rs
index 2556397caf9..b5d0fad7f95 100644
--- a/src/librustc/middle/privacy.rs
+++ b/src/librustc/middle/privacy.rs
@@ -243,7 +243,7 @@ impl<'self> Visitor<()> for EmbargoVisitor<'self> {
                             ast::sty_static => public_ty,
                             _ => true,
                         } && method.vis == ast::public;
-                        if meth_public || public_trait {
+                        if meth_public || tr.is_some() {
                             self.exported_items.insert(method.id);
                         }
                     }
diff --git a/src/test/auxiliary/priv-impl-prim-ty.rs b/src/test/auxiliary/priv-impl-prim-ty.rs
new file mode 100644
index 00000000000..16d3ca8fa64
--- /dev/null
+++ b/src/test/auxiliary/priv-impl-prim-ty.rs
@@ -0,0 +1,19 @@
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+trait A {
+    fn frob(&self);
+}
+
+impl A for int { fn frob(&self) {} }
+
+pub fn frob<T:A>(t: T) {
+    t.frob();
+}
diff --git a/src/test/run-pass/priv-impl-prim-ty.rs b/src/test/run-pass/priv-impl-prim-ty.rs
new file mode 100644
index 00000000000..4439da4f6f5
--- /dev/null
+++ b/src/test/run-pass/priv-impl-prim-ty.rs
@@ -0,0 +1,19 @@
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// xfail-fast
+// aux-build:priv-impl-prim-ty.rs
+
+extern mod bar(name = "priv-impl-prim-ty");
+
+fn main() {
+    bar::frob(1i);
+
+}