From 899d4180ef052c3bd7598d18ad1e5af0bc57fc88 Mon Sep 17 00:00:00 2001 From: Carol Nichols Date: Wed, 29 Apr 2015 22:43:26 -0400 Subject: [PATCH 1/3] Remove lingering mention of 'priv' in the reference --- src/doc/reference.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/doc/reference.md b/src/doc/reference.md index a71f8cf4250..eab28a4b7f2 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -1562,8 +1562,7 @@ warnings are generated, or otherwise "you used a private item of another module and weren't allowed to." By default, everything in Rust is *private*, with one exception. Enum variants -in a `pub` enum are also public by default. You are allowed to alter this -default visibility with the `priv` keyword. When an item is declared as `pub`, +in a `pub` enum are also public by default. When an item is declared as `pub`, it can be thought of as being accessible to the outside world. For example: ``` From 31b7001b49fe8ce2f3d6aed882b41e55da020ab6 Mon Sep 17 00:00:00 2001 From: Carol Nichols Date: Wed, 29 Apr 2015 22:43:47 -0400 Subject: [PATCH 2/3] Remove mention of 'priv'; visibility is either PUB or nothing --- src/librustc_typeck/collect.rs | 2 +- src/libsyntax/parse/parser.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 6cb6df008c1..18d0031badb 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -899,7 +899,7 @@ fn convert_item(ccx: &CrateCtxt, it: &ast::Item) { if let ast::MethodImplItem(ref sig, _) = ii.node { // if the method specifies a visibility, use that, otherwise // inherit the visibility from the impl (so `foo` in `pub impl - // { fn foo(); }` is public, but private in `priv impl { fn + // { fn foo(); }` is public, but private in `impl { fn // foo(); }`). let method_vis = ii.vis.inherit_from(parent_visibility); Some((sig, ii.id, ii.ident, method_vis, ii.span)) diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index f76de1f04ce..a277dda6f0f 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -4772,7 +4772,7 @@ impl<'a> Parser<'a> { return self.parse_single_struct_field(Inherited, attrs); } - /// Parse visibility: PUB, PRIV, or nothing + /// Parse visibility: PUB or nothing fn parse_visibility(&mut self) -> PResult { if try!(self.eat_keyword(keywords::Pub)) { Ok(Public) } else { Ok(Inherited) } From 2fdd1b01987314c0b0fc27a3a572d452c0b29ab1 Mon Sep 17 00:00:00 2001 From: Carol Nichols Date: Wed, 29 Apr 2015 22:53:22 -0400 Subject: [PATCH 3/3] Remove `priv` from tests that aren't testing deprecated `priv` --- src/test/run-pass/issue-4241.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/test/run-pass/issue-4241.rs b/src/test/run-pass/issue-4241.rs index c650fc25ee1..c9b684fd656 100644 --- a/src/test/run-pass/issue-4241.rs +++ b/src/test/run-pass/issue-4241.rs @@ -28,7 +28,7 @@ enum Result { Status(String) } -priv fn parse_data(len: usize, io: @io::Reader) -> Result { +fn parse_data(len: usize, io: @io::Reader) -> Result { let res = if (len > 0) { let bytes = io.read_bytes(len as usize); @@ -42,7 +42,7 @@ priv fn parse_data(len: usize, io: @io::Reader) -> Result { return res; } -priv fn parse_list(len: usize, io: @io::Reader) -> Result { +fn parse_list(len: usize, io: @io::Reader) -> Result { let mut list: ~[Result] = ~[]; for _ in 0..len { let v = match io.read_char() { @@ -55,11 +55,11 @@ priv fn parse_list(len: usize, io: @io::Reader) -> Result { return List(list); } -priv fn chop(s: String) -> String { +fn chop(s: String) -> String { s.slice(0, s.len() - 1).to_string() } -priv fn parse_bulk(io: @io::Reader) -> Result { +fn parse_bulk(io: @io::Reader) -> Result { match from_str::(chop(io.read_line())) { None => panic!(), Some(-1) => Nil, @@ -68,7 +68,7 @@ priv fn parse_bulk(io: @io::Reader) -> Result { } } -priv fn parse_multi(io: @io::Reader) -> Result { +fn parse_multi(io: @io::Reader) -> Result { match from_str::(chop(io.read_line())) { None => panic!(), Some(-1) => Nil, @@ -78,14 +78,14 @@ priv fn parse_multi(io: @io::Reader) -> Result { } } -priv fn parse_int(io: @io::Reader) -> Result { +fn parse_int(io: @io::Reader) -> Result { match from_str::(chop(io.read_line())) { None => panic!(), Some(i) => Int(i) } } -priv fn parse_response(io: @io::Reader) -> Result { +fn parse_response(io: @io::Reader) -> Result { match io.read_char() { '$' => parse_bulk(io), '*' => parse_multi(io), @@ -96,7 +96,7 @@ priv fn parse_response(io: @io::Reader) -> Result { } } -priv fn cmd_to_string(cmd: ~[String]) -> String { +fn cmd_to_string(cmd: ~[String]) -> String { let mut res = "*".to_string(); res.push_str(cmd.len().to_string()); res.push_str("\r\n");