Skip to content

Commit 16086ec

Browse files
committed
libsyntax: Remove pub impl from the language
1 parent 9873f67 commit 16086ec

File tree

6 files changed

+25
-27
lines changed

6 files changed

+25
-27
lines changed

src/libextra/term.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pub struct Terminal {
5757
}
5858

5959
#[cfg(not(target_os = "win32"))]
60-
pub impl Terminal {
60+
impl Terminal {
6161
pub fn new(out: @io::Writer) -> Result<Terminal, ~str> {
6262
let term = os::getenv("TERM");
6363
if term.is_none() {
@@ -81,7 +81,7 @@ pub impl Terminal {
8181

8282
return Ok(Terminal {out: out, ti: inf, color_supported: cs});
8383
}
84-
fn fg(&self, color: u8) {
84+
pub fn fg(&self, color: u8) {
8585
if self.color_supported {
8686
let s = expand(*self.ti.strings.find_equiv(&("setaf")).unwrap(),
8787
[Number(color as int)], [], []);
@@ -92,7 +92,7 @@ pub impl Terminal {
9292
}
9393
}
9494
}
95-
fn bg(&self, color: u8) {
95+
pub fn bg(&self, color: u8) {
9696
if self.color_supported {
9797
let s = expand(*self.ti.strings.find_equiv(&("setab")).unwrap(),
9898
[Number(color as int)], [], []);
@@ -103,7 +103,7 @@ pub impl Terminal {
103103
}
104104
}
105105
}
106-
fn reset(&self) {
106+
pub fn reset(&self) {
107107
if self.color_supported {
108108
let s = expand(*self.ti.strings.find_equiv(&("op")).unwrap(), [], [], []);
109109
if s.is_ok() {
@@ -116,17 +116,17 @@ pub impl Terminal {
116116
}
117117

118118
#[cfg(target_os = "win32")]
119-
pub impl Terminal {
119+
impl Terminal {
120120
pub fn new(out: @io::Writer) -> Result<Terminal, ~str> {
121121
return Ok(Terminal {out: out, color_supported: false});
122122
}
123123

124-
fn fg(&self, color: u8) {
124+
pub fn fg(&self, color: u8) {
125125
}
126126

127-
fn bg(&self, color: u8) {
127+
pub fn bg(&self, color: u8) {
128128
}
129129

130-
fn reset(&self) {
130+
pub fn reset(&self) {
131131
}
132132
}

src/librustpkg/package_id.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ pub struct PkgId {
3535
version: Version
3636
}
3737

38-
pub impl PkgId {
39-
fn new(s: &str) -> PkgId {
38+
impl PkgId {
39+
pub fn new(s: &str) -> PkgId {
4040
use conditions::bad_pkg_id::cond;
4141

4242
let p = Path(s);
@@ -57,13 +57,13 @@ pub impl PkgId {
5757
}
5858
}
5959

60-
fn hash(&self) -> ~str {
60+
pub fn hash(&self) -> ~str {
6161
fmt!("%s-%s-%s", self.remote_path.to_str(),
6262
hash(self.remote_path.to_str() + self.version.to_str()),
6363
self.version.to_str())
6464
}
6565

66-
fn short_name_with_version(&self) -> ~str {
66+
pub fn short_name_with_version(&self) -> ~str {
6767
fmt!("%s-%s", self.short_name, self.version.to_str())
6868
}
6969
}

src/libsyntax/ast.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,8 +440,8 @@ pub struct expr {
440440
span: span,
441441
}
442442

443-
pub impl expr {
444-
fn get_callee_id(&self) -> Option<node_id> {
443+
impl expr {
444+
pub fn get_callee_id(&self) -> Option<node_id> {
445445
match self.node {
446446
expr_method_call(callee_id, _, _, _, _, _) |
447447
expr_index(callee_id, _, _) |

src/libsyntax/parse/obsolete.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pub enum ObsoleteSyntax {
4949
ObsoleteTraitBoundSeparator,
5050
ObsoleteMutOwnedPointer,
5151
ObsoleteMutVector,
52-
ObsoleteTraitImplVisibility,
52+
ObsoleteImplVisibility,
5353
ObsoleteRecordType,
5454
ObsoleteRecordPattern,
5555
ObsoletePostFnTySigil,
@@ -158,11 +158,10 @@ impl Parser {
158158
in a mutable location, like a mutable local variable or an \
159159
`@mut` box"
160160
),
161-
ObsoleteTraitImplVisibility => (
162-
"visibility-qualified trait implementation",
163-
"`pub` or `priv` is meaningless for trait implementations, \
164-
because the `impl...for...` form defines overloads for \
165-
methods that already exist; remove the `pub` or `priv`"
161+
ObsoleteImplVisibility => (
162+
"visibility-qualified implementation",
163+
"`pub` or `priv` goes on individual functions; remove the \
164+
`pub` or `priv`"
166165
),
167166
ObsoleteRecordType => (
168167
"structural record type",

src/libsyntax/parse/parser.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ use parse::obsolete::{ObsoleteMoveInit, ObsoleteBinaryMove, ObsoleteSwap};
7676
use parse::obsolete::{ObsoleteSyntax, ObsoleteLowerCaseKindBounds};
7777
use parse::obsolete::{ObsoleteUnsafeBlock, ObsoleteImplSyntax};
7878
use parse::obsolete::{ObsoleteTraitBoundSeparator, ObsoleteMutOwnedPointer};
79-
use parse::obsolete::{ObsoleteMutVector, ObsoleteTraitImplVisibility};
79+
use parse::obsolete::{ObsoleteMutVector, ObsoleteImplVisibility};
8080
use parse::obsolete::{ObsoleteRecordType, ObsoleteRecordPattern};
8181
use parse::obsolete::{ObsoletePostFnTySigil};
8282
use parse::obsolete::{ObsoleteBareFnType, ObsoleteNewtypeEnum};
@@ -3305,10 +3305,9 @@ impl Parser {
33053305
None
33063306
};
33073307

3308-
// Do not allow visibility to be specified in `impl...for...`. It is
3309-
// meaningless.
3310-
if opt_trait.is_some() && visibility != ast::inherited {
3311-
self.obsolete(*self.span, ObsoleteTraitImplVisibility);
3308+
// Do not allow visibility to be specified.
3309+
if visibility != ast::inherited {
3310+
self.obsolete(*self.span, ObsoleteImplVisibility);
33123311
}
33133312

33143313
let mut meths = ~[];

src/test/auxiliary/reexported_static_methods.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub mod sub_foo {
3434
unused_str: ~str
3535
}
3636

37-
pub impl Boz {
37+
impl Boz {
3838
pub fn boz(i: int) -> bool {
3939
i > 0
4040
}
@@ -45,7 +45,7 @@ pub mod sub_foo {
4545
Bort2
4646
}
4747

48-
pub impl Bort {
48+
impl Bort {
4949
pub fn bort() -> ~str {
5050
~"bort()"
5151
}

0 commit comments

Comments
 (0)