Skip to content

libsyntax: Remove pub impl from the language #6922

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/libextra/term.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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)], [], []);
Expand All @@ -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)], [], []);
Expand All @@ -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() {
Expand All @@ -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) {
}
}
8 changes: 4 additions & 4 deletions src/librustpkg/package_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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())
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/libsyntax/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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, _, _) |
Expand Down
11 changes: 5 additions & 6 deletions src/libsyntax/parse/obsolete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub enum ObsoleteSyntax {
ObsoleteTraitBoundSeparator,
ObsoleteMutOwnedPointer,
ObsoleteMutVector,
ObsoleteTraitImplVisibility,
ObsoleteImplVisibility,
ObsoleteRecordType,
ObsoleteRecordPattern,
ObsoletePostFnTySigil,
Expand Down Expand Up @@ -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",
Expand Down
9 changes: 4 additions & 5 deletions src/libsyntax/parse/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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 = ~[];
Expand Down
4 changes: 2 additions & 2 deletions src/test/auxiliary/reexported_static_methods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub mod sub_foo {
unused_str: ~str
}

pub impl Boz {
impl Boz {
pub fn boz(i: int) -> bool {
i > 0
}
Expand All @@ -45,7 +45,7 @@ pub mod sub_foo {
Bort2
}

pub impl Bort {
impl Bort {
pub fn bort() -> ~str {
~"bort()"
}
Expand Down