about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-08-13 07:26:23 -0700
committerbors <bors@rust-lang.org>2013-08-13 07:26:23 -0700
commit0d817ee869387322dec4d3f7d407dcc9f91c2632 (patch)
tree958140150cb50faae2b56a21bf4759261ec306d2 /src/libsyntax
parentf02cc6bf0a276115a31354b1c1530e6fe9eb4d58 (diff)
parent930885d5e5f817e3d7609f93d5ba89b1abebfaf4 (diff)
downloadrust-0d817ee869387322dec4d3f7d407dcc9f91c2632.tar.gz
rust-0d817ee869387322dec4d3f7d407dcc9f91c2632.zip
auto merge of #8423 : alexcrichton/rust/less-priv-again, r=bstrie
Closes #5495
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ast_util.rs2
-rw-r--r--src/libsyntax/attr.rs6
-rw-r--r--src/libsyntax/codemap.rs4
-rw-r--r--src/libsyntax/ext/deriving/generic.rs2
-rw-r--r--src/libsyntax/ext/quote.rs6
-rw-r--r--src/libsyntax/opt_vec.rs4
-rw-r--r--src/libsyntax/parse/obsolete.rs21
-rw-r--r--src/libsyntax/parse/parser.rs23
8 files changed, 30 insertions, 38 deletions
diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs
index d99f8cab493..02eaf432b54 100644
--- a/src/libsyntax/ast_util.rs
+++ b/src/libsyntax/ast_util.rs
@@ -672,7 +672,7 @@ pub fn walk_pat(pat: @pat, it: &fn(@pat) -> bool) -> bool {
 }
 
 pub trait EachViewItem {
-    pub fn each_view_item(&self, f: @fn(&ast::view_item) -> bool) -> bool;
+    fn each_view_item(&self, f: @fn(&ast::view_item) -> bool) -> bool;
 }
 
 struct EachViewItemData {
diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs
index 47d8ebecca0..51df08f5228 100644
--- a/src/libsyntax/attr.rs
+++ b/src/libsyntax/attr.rs
@@ -82,7 +82,7 @@ impl AttrMetaMethods for MetaItem {
         }
     }
 
-    pub fn name_str_pair(&self) -> Option<(@str, @str)> {
+    fn name_str_pair(&self) -> Option<(@str, @str)> {
         self.value_str().map_move(|s| (self.name(), s))
     }
 }
@@ -105,14 +105,14 @@ pub trait AttributeMethods {
 
 impl AttributeMethods for Attribute {
     /// Extract the MetaItem from inside this Attribute.
-    pub fn meta(&self) -> @MetaItem {
+    fn meta(&self) -> @MetaItem {
         self.node.value
     }
 
     /// Convert self to a normal #[doc="foo"] comment, if it is a
     /// comment like `///` or `/** */`. (Returns self unchanged for
     /// non-sugared doc attributes.)
-    pub fn desugar_doc(&self) -> Attribute {
+    fn desugar_doc(&self) -> Attribute {
         if self.node.is_sugared_doc {
             let comment = self.value_str().unwrap();
             let meta = mk_name_value_item_str(@"doc",
diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs
index 8c70f128d9a..d4337523cfb 100644
--- a/src/libsyntax/codemap.rs
+++ b/src/libsyntax/codemap.rs
@@ -194,10 +194,10 @@ pub struct FileLines
 // represents the origin of a file:
 pub enum FileSubstr {
     // indicates that this is a normal standalone file:
-    pub FssNone,
+    FssNone,
     // indicates that this "file" is actually a substring
     // of another file that appears earlier in the codemap
-    pub FssInternal(span),
+    FssInternal(span),
 }
 
 /// Identifies an offset of a multi-byte character in a FileMap
diff --git a/src/libsyntax/ext/deriving/generic.rs b/src/libsyntax/ext/deriving/generic.rs
index a1abe47e090..6b028e25c0f 100644
--- a/src/libsyntax/ext/deriving/generic.rs
+++ b/src/libsyntax/ext/deriving/generic.rs
@@ -542,7 +542,7 @@ impl<'self> MethodDef<'self> {
             id: cx.next_id(),
             span: span,
             self_id: cx.next_id(),
-            vis: ast::public
+            vis: ast::inherited,
         }
     }
 
diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs
index d218be5e476..9d82bb9c4f8 100644
--- a/src/libsyntax/ext/quote.rs
+++ b/src/libsyntax/ext/quote.rs
@@ -40,11 +40,11 @@ pub mod rt {
     pub use codemap::{BytePos, span, dummy_spanned};
 
     pub trait ToTokens {
-        pub fn to_tokens(&self, _cx: @ExtCtxt) -> ~[token_tree];
+        fn to_tokens(&self, _cx: @ExtCtxt) -> ~[token_tree];
     }
 
     impl ToTokens for ~[token_tree] {
-        pub fn to_tokens(&self, _cx: @ExtCtxt) -> ~[token_tree] {
+        fn to_tokens(&self, _cx: @ExtCtxt) -> ~[token_tree] {
             (*self).clone()
         }
     }
@@ -65,7 +65,7 @@ pub mod rt {
 
     pub trait ToSource {
         // Takes a thing and generates a string containing rust code for it.
-        pub fn to_source(&self) -> @str;
+        fn to_source(&self) -> @str;
     }
 
     impl ToSource for ast::ident {
diff --git a/src/libsyntax/opt_vec.rs b/src/libsyntax/opt_vec.rs
index 3a10206b513..2d7801a22de 100644
--- a/src/libsyntax/opt_vec.rs
+++ b/src/libsyntax/opt_vec.rs
@@ -124,7 +124,7 @@ impl<T:Clone> OptVec<T> {
 }
 
 impl<A:Eq> Eq for OptVec<A> {
-    pub fn eq(&self, other: &OptVec<A>) -> bool {
+    fn eq(&self, other: &OptVec<A>) -> bool {
         // Note: cannot use #[deriving(Eq)] here because
         // (Empty, Vec(~[])) ought to be equal.
         match (self, other) {
@@ -135,7 +135,7 @@ impl<A:Eq> Eq for OptVec<A> {
         }
     }
 
-    pub fn ne(&self, other: &OptVec<A>) -> bool {
+    fn ne(&self, other: &OptVec<A>) -> bool {
         !self.eq(other)
     }
 }
diff --git a/src/libsyntax/parse/obsolete.rs b/src/libsyntax/parse/obsolete.rs
index dda5e990221..01c1af7464d 100644
--- a/src/libsyntax/parse/obsolete.rs
+++ b/src/libsyntax/parse/obsolete.rs
@@ -65,6 +65,7 @@ pub enum ObsoleteSyntax {
     ObsoleteExternVisibility,
     ObsoleteUnsafeExternFn,
     ObsoletePrivVisibility,
+    ObsoleteTraitFuncVisibility,
 }
 
 impl to_bytes::IterBytes for ObsoleteSyntax {
@@ -95,7 +96,7 @@ pub trait ParserObsoleteMethods {
 
 impl ParserObsoleteMethods for Parser {
     /// Reports an obsolete syntax non-fatal error.
-    pub fn obsolete(&self, sp: span, kind: ObsoleteSyntax) {
+    fn obsolete(&self, sp: span, kind: ObsoleteSyntax) {
         let (kind_str, desc) = match kind {
             ObsoleteLet => (
                 "`let` in field declaration",
@@ -258,6 +259,10 @@ impl ParserObsoleteMethods for Parser {
                 "`priv` not necessary",
                 "an item without a visibility qualifier is private by default"
             ),
+            ObsoleteTraitFuncVisibility => (
+                "visibility not necessary",
+                "trait functions inherit the visibility of the trait itself"
+            ),
         };
 
         self.report(sp, kind, kind_str, desc);
@@ -265,7 +270,7 @@ impl ParserObsoleteMethods for Parser {
 
     // Reports an obsolete syntax non-fatal error, and returns
     // a placeholder expression
-    pub fn obsolete_expr(&self, sp: span, kind: ObsoleteSyntax) -> @expr {
+    fn obsolete_expr(&self, sp: span, kind: ObsoleteSyntax) -> @expr {
         self.obsolete(sp, kind);
         self.mk_expr(sp.lo, sp.hi, expr_lit(@respan(sp, lit_nil)))
     }
@@ -283,7 +288,7 @@ impl ParserObsoleteMethods for Parser {
         }
     }
 
-    pub fn token_is_obsolete_ident(&self, ident: &str, token: &Token)
+    fn token_is_obsolete_ident(&self, ident: &str, token: &Token)
                                    -> bool {
         match *token {
             token::IDENT(sid, _) => {
@@ -293,11 +298,11 @@ impl ParserObsoleteMethods for Parser {
         }
     }
 
-    pub fn is_obsolete_ident(&self, ident: &str) -> bool {
+    fn is_obsolete_ident(&self, ident: &str) -> bool {
         self.token_is_obsolete_ident(ident, self.token)
     }
 
-    pub fn eat_obsolete_ident(&self, ident: &str) -> bool {
+    fn eat_obsolete_ident(&self, ident: &str) -> bool {
         if self.is_obsolete_ident(ident) {
             self.bump();
             true
@@ -306,7 +311,7 @@ impl ParserObsoleteMethods for Parser {
         }
     }
 
-    pub fn try_parse_obsolete_struct_ctor(&self) -> bool {
+    fn try_parse_obsolete_struct_ctor(&self) -> bool {
         if self.eat_obsolete_ident("new") {
             self.obsolete(*self.last_span, ObsoleteStructCtor);
             self.parse_fn_decl();
@@ -317,7 +322,7 @@ impl ParserObsoleteMethods for Parser {
         }
     }
 
-    pub fn try_parse_obsolete_with(&self) -> bool {
+    fn try_parse_obsolete_with(&self) -> bool {
         if *self.token == token::COMMA
             && self.look_ahead(1,
                                |t| self.token_is_obsolete_ident("with", t)) {
@@ -332,7 +337,7 @@ impl ParserObsoleteMethods for Parser {
         }
     }
 
-    pub fn try_parse_obsolete_priv_section(&self, attrs: &[Attribute])
+    fn try_parse_obsolete_priv_section(&self, attrs: &[Attribute])
                                            -> bool {
         if self.is_keyword(keywords::Priv) &&
                 self.look_ahead(1, |t| *t == token::LBRACE) {
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 7e18c440d81..b38de31c56a 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -70,24 +70,7 @@ use parse::common::{SeqSep, seq_sep_none};
 use parse::common::{seq_sep_trailing_disallowed, seq_sep_trailing_allowed};
 use parse::lexer::reader;
 use parse::lexer::TokenAndSpan;
-use parse::obsolete::{ObsoleteClassTraits};
-use parse::obsolete::{ObsoleteLet, ObsoleteFieldTerminator};
-use parse::obsolete::{ObsoleteMoveInit, ObsoleteBinaryMove, ObsoleteSwap};
-use parse::obsolete::ObsoleteSyntax;
-use parse::obsolete::{ObsoleteUnsafeBlock, ObsoleteImplSyntax};
-use parse::obsolete::{ObsoleteMutOwnedPointer};
-use parse::obsolete::{ObsoleteMutVector, ObsoleteImplVisibility};
-use parse::obsolete::{ObsoleteRecordType, ObsoleteRecordPattern};
-use parse::obsolete::{ObsoletePostFnTySigil};
-use parse::obsolete::{ObsoleteBareFnType, ObsoleteNewtypeEnum};
-use parse::obsolete::ObsoleteMode;
-use parse::obsolete::{ObsoleteLifetimeNotation, ObsoleteConstManagedPointer};
-use parse::obsolete::{ObsoletePurity, ObsoleteStaticMethod};
-use parse::obsolete::{ObsoleteConstItem, ObsoleteFixedLengthVectorType};
-use parse::obsolete::{ObsoleteNamedExternModule, ObsoleteMultipleLocalDecl};
-use parse::obsolete::{ObsoleteMutWithMultipleBindings};
-use parse::obsolete::{ObsoleteExternVisibility, ObsoleteUnsafeExternFn};
-use parse::obsolete::{ParserObsoleteMethods, ObsoletePrivVisibility};
+use parse::obsolete::*;
 use parse::token::{can_begin_expr, get_ident_interner, ident_to_str, is_ident};
 use parse::token::{is_ident_or_path};
 use parse::token::{is_plain_ident, INTERPOLATED, keywords, special_idents};
@@ -932,6 +915,10 @@ impl Parser {
                 debug!("parse_trait_methods(): parsing required method");
                 // NB: at the moment, visibility annotations on required
                 // methods are ignored; this could change.
+                if vis != ast::inherited {
+                    self.obsolete(*self.last_span,
+                                  ObsoleteTraitFuncVisibility);
+                }
                 required(TypeMethod {
                     ident: ident,
                     attrs: attrs,