about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2013-06-03 16:56:35 -0700
committerPatrick Walton <pcwalton@mimiga.net>2013-06-04 21:45:42 -0700
commit16086ecff7edda82b114a72948762d59095f6fb4 (patch)
tree8f6e850a5803194c54d523703843bcec302f8ba3 /src
parent9873f67e944f2f9237caa3c670cbaa0ca988c9d0 (diff)
libsyntax: Remove `pub impl` from the language
Diffstat (limited to 'src')
-rw-r--r--src/libextra/term.rs16
-rw-r--r--src/librustpkg/package_id.rs8
-rw-r--r--src/libsyntax/ast.rs4
-rw-r--r--src/libsyntax/parse/obsolete.rs11
-rw-r--r--src/libsyntax/parse/parser.rs9
-rw-r--r--src/test/auxiliary/reexported_static_methods.rs4
6 files changed, 25 insertions, 27 deletions
diff --git a/src/libextra/term.rs b/src/libextra/term.rs
index e74a0f4e18e..455cc0b7450 100644
--- a/src/libextra/term.rs
+++ b/src/libextra/term.rs
@@ -57,7 +57,7 @@ pub struct Terminal {
 }
 
 #[cfg(not(target_os = "win32"))]
-pub impl Terminal {
+impl Terminal {
     pub fn new(out: @io::Writer) -> Result<Terminal, ~str> {
         let term = os::getenv("TERM");
         if term.is_none() {
@@ -81,7 +81,7 @@ pub impl Terminal {
 
         return Ok(Terminal {out: out, ti: inf, color_supported: cs});
     }
-    fn fg(&self, color: u8) {
+    pub fn fg(&self, color: u8) {
         if self.color_supported {
             let s = expand(*self.ti.strings.find_equiv(&("setaf")).unwrap(),
                            [Number(color as int)], [], []);
@@ -92,7 +92,7 @@ pub impl Terminal {
             }
         }
     }
-    fn bg(&self, color: u8) {
+    pub fn bg(&self, color: u8) {
         if self.color_supported {
             let s = expand(*self.ti.strings.find_equiv(&("setab")).unwrap(),
                            [Number(color as int)], [], []);
@@ -103,7 +103,7 @@ pub impl Terminal {
             }
         }
     }
-    fn reset(&self) {
+    pub fn reset(&self) {
         if self.color_supported {
             let s = expand(*self.ti.strings.find_equiv(&("op")).unwrap(), [], [], []);
             if s.is_ok() {
@@ -116,17 +116,17 @@ pub impl Terminal {
 }
 
 #[cfg(target_os = "win32")]
-pub impl Terminal {
+impl Terminal {
     pub fn new(out: @io::Writer) -> Result<Terminal, ~str> {
         return Ok(Terminal {out: out, color_supported: false});
     }
 
-    fn fg(&self, color: u8) {
+    pub fn fg(&self, color: u8) {
     }
 
-    fn bg(&self, color: u8) {
+    pub fn bg(&self, color: u8) {
     }
 
-    fn reset(&self) {
+    pub fn reset(&self) {
     }
 }
diff --git a/src/librustpkg/package_id.rs b/src/librustpkg/package_id.rs
index ca0210f469b..85c82787f26 100644
--- a/src/librustpkg/package_id.rs
+++ b/src/librustpkg/package_id.rs
@@ -35,8 +35,8 @@ pub struct PkgId {
     version: Version
 }
 
-pub impl PkgId {
-    fn new(s: &str) -> PkgId {
+impl PkgId {
+    pub fn new(s: &str) -> PkgId {
         use conditions::bad_pkg_id::cond;
 
         let p = Path(s);
@@ -57,13 +57,13 @@ pub impl PkgId {
         }
     }
 
-    fn hash(&self) -> ~str {
+    pub fn hash(&self) -> ~str {
         fmt!("%s-%s-%s", self.remote_path.to_str(),
              hash(self.remote_path.to_str() + self.version.to_str()),
              self.version.to_str())
     }
 
-    fn short_name_with_version(&self) -> ~str {
+    pub fn short_name_with_version(&self) -> ~str {
         fmt!("%s-%s", self.short_name, self.version.to_str())
     }
 }
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index dcb41629958..f694e37d42f 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -440,8 +440,8 @@ pub struct expr {
     span: span,
 }
 
-pub impl expr {
-    fn get_callee_id(&self) -> Option<node_id> {
+impl expr {
+    pub fn get_callee_id(&self) -> Option<node_id> {
         match self.node {
             expr_method_call(callee_id, _, _, _, _, _) |
             expr_index(callee_id, _, _) |
diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs
index f11219f6c9e..f37b430b480 100644
--- a/src/libsyntax/parse/obsolete.rs
+++ b/src/libsyntax/parse/obsolete.rs
@@ -49,7 +49,7 @@ pub enum ObsoleteSyntax {
     ObsoleteTraitBoundSeparator,
     ObsoleteMutOwnedPointer,
     ObsoleteMutVector,
-    ObsoleteTraitImplVisibility,
+    ObsoleteImplVisibility,
     ObsoleteRecordType,
     ObsoleteRecordPattern,
     ObsoletePostFnTySigil,
@@ -158,11 +158,10 @@ impl Parser {
                  in a mutable location, like a mutable local variable or an \
                  `@mut` box"
             ),
-            ObsoleteTraitImplVisibility => (
-                "visibility-qualified trait implementation",
-                "`pub` or `priv` is meaningless for trait implementations, \
-                 because the `impl...for...` form defines overloads for \
-                 methods that already exist; remove the `pub` or `priv`"
+            ObsoleteImplVisibility => (
+                "visibility-qualified implementation",
+                "`pub` or `priv` goes on individual functions; remove the \
+                 `pub` or `priv`"
             ),
             ObsoleteRecordType => (
                 "structural record type",
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index f013dfaceba..dd966815ad2 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -76,7 +76,7 @@ use parse::obsolete::{ObsoleteMoveInit, ObsoleteBinaryMove, ObsoleteSwap};
 use parse::obsolete::{ObsoleteSyntax, ObsoleteLowerCaseKindBounds};
 use parse::obsolete::{ObsoleteUnsafeBlock, ObsoleteImplSyntax};
 use parse::obsolete::{ObsoleteTraitBoundSeparator, ObsoleteMutOwnedPointer};
-use parse::obsolete::{ObsoleteMutVector, ObsoleteTraitImplVisibility};
+use parse::obsolete::{ObsoleteMutVector, ObsoleteImplVisibility};
 use parse::obsolete::{ObsoleteRecordType, ObsoleteRecordPattern};
 use parse::obsolete::{ObsoletePostFnTySigil};
 use parse::obsolete::{ObsoleteBareFnType, ObsoleteNewtypeEnum};
@@ -3305,10 +3305,9 @@ impl Parser {
             None
         };
 
-        // Do not allow visibility to be specified in `impl...for...`. It is
-        // meaningless.
-        if opt_trait.is_some() && visibility != ast::inherited {
-            self.obsolete(*self.span, ObsoleteTraitImplVisibility);
+        // Do not allow visibility to be specified.
+        if visibility != ast::inherited {
+            self.obsolete(*self.span, ObsoleteImplVisibility);
         }
 
         let mut meths = ~[];
diff --git a/src/test/auxiliary/reexported_static_methods.rs b/src/test/auxiliary/reexported_static_methods.rs
index 88e746585c9..811bf082ae8 100644
--- a/src/test/auxiliary/reexported_static_methods.rs
+++ b/src/test/auxiliary/reexported_static_methods.rs
@@ -34,7 +34,7 @@ pub mod sub_foo {
         unused_str: ~str
     }
 
-    pub impl Boz {
+    impl Boz {
         pub fn boz(i: int) -> bool {
             i > 0
         }
@@ -45,7 +45,7 @@ pub mod sub_foo {
         Bort2
     }
 
-    pub impl Bort {
+    impl Bort {
         pub fn bort() -> ~str {
             ~"bort()"
         }