mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 23:34:48 +00:00
Forbid priv
where it has no effect
This is everywhere except struct fields and enum variants.
This commit is contained in:
parent
5b4244d917
commit
18be2614bc
@ -129,27 +129,27 @@ struct FileInput_ {
|
|||||||
`Some(path)` is the file represented by `path`, `None` is
|
`Some(path)` is the file represented by `path`, `None` is
|
||||||
`stdin`. Consumed as the files are read.
|
`stdin`. Consumed as the files are read.
|
||||||
*/
|
*/
|
||||||
priv files: ~[Option<Path>],
|
files: ~[Option<Path>],
|
||||||
/**
|
/**
|
||||||
The current file: `Some(r)` for an open file, `None` before
|
The current file: `Some(r)` for an open file, `None` before
|
||||||
starting and after reading everything.
|
starting and after reading everything.
|
||||||
*/
|
*/
|
||||||
priv current_reader: Option<@io::Reader>,
|
current_reader: Option<@io::Reader>,
|
||||||
priv state: FileInputState,
|
state: FileInputState,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Used to keep track of whether we need to insert the newline at the
|
Used to keep track of whether we need to insert the newline at the
|
||||||
end of a file that is missing it, which is needed to separate the
|
end of a file that is missing it, which is needed to separate the
|
||||||
last and first lines.
|
last and first lines.
|
||||||
*/
|
*/
|
||||||
priv previous_was_newline: bool
|
previous_was_newline: bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// XXX: remove this when Reader has &mut self. Should be removable via
|
// XXX: remove this when Reader has &mut self. Should be removable via
|
||||||
// "self.fi." -> "self." and renaming FileInput_. Documentation above
|
// "self.fi." -> "self." and renaming FileInput_. Documentation above
|
||||||
// will likely have to be updated to use `let mut in = ...`.
|
// will likely have to be updated to use `let mut in = ...`.
|
||||||
pub struct FileInput {
|
pub struct FileInput {
|
||||||
priv fi: @mut FileInput_
|
fi: @mut FileInput_
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FileInput {
|
impl FileInput {
|
||||||
@ -198,7 +198,7 @@ impl FileInput {
|
|||||||
FileInput::from_vec(pathed)
|
FileInput::from_vec(pathed)
|
||||||
}
|
}
|
||||||
|
|
||||||
priv fn current_file_eof(&self) -> bool {
|
fn current_file_eof(&self) -> bool {
|
||||||
match self.fi.current_reader {
|
match self.fi.current_reader {
|
||||||
None => false,
|
None => false,
|
||||||
Some(r) => r.eof()
|
Some(r) => r.eof()
|
||||||
@ -240,7 +240,7 @@ impl FileInput {
|
|||||||
Returns `true` if it had to move to the next file and did
|
Returns `true` if it had to move to the next file and did
|
||||||
so successfully.
|
so successfully.
|
||||||
*/
|
*/
|
||||||
priv fn next_file_if_eof(&self) -> bool {
|
fn next_file_if_eof(&self) -> bool {
|
||||||
match self.fi.current_reader {
|
match self.fi.current_reader {
|
||||||
None => self.next_file(),
|
None => self.next_file(),
|
||||||
Some(r) => {
|
Some(r) => {
|
||||||
|
@ -46,7 +46,7 @@ impl<A> Drop for Future<A> {
|
|||||||
fn drop(&self) {}
|
fn drop(&self) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
priv enum FutureState<A> {
|
enum FutureState<A> {
|
||||||
Pending(~fn() -> A),
|
Pending(~fn() -> A),
|
||||||
Evaluating,
|
Evaluating,
|
||||||
Forced(A)
|
Forced(A)
|
||||||
|
@ -708,7 +708,7 @@ pub mod groups {
|
|||||||
* Fails during iteration if the string contains a non-whitespace
|
* Fails during iteration if the string contains a non-whitespace
|
||||||
* sequence longer than the limit.
|
* sequence longer than the limit.
|
||||||
*/
|
*/
|
||||||
priv fn each_split_within<'a>(ss: &'a str,
|
fn each_split_within<'a>(ss: &'a str,
|
||||||
lim: uint,
|
lim: uint,
|
||||||
it: &fn(&'a str) -> bool) -> bool {
|
it: &fn(&'a str) -> bool) -> bool {
|
||||||
// Just for fun, let's write this as an state machine:
|
// Just for fun, let's write this as an state machine:
|
||||||
@ -778,7 +778,7 @@ pub mod groups {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
priv fn test_split_within() {
|
fn test_split_within() {
|
||||||
fn t(s: &str, i: uint, u: &[~str]) {
|
fn t(s: &str, i: uint, u: &[~str]) {
|
||||||
let mut v = ~[];
|
let mut v = ~[];
|
||||||
do each_split_within(s, i) |s| { v.push(s.to_owned()); true };
|
do each_split_within(s, i) |s| { v.push(s.to_owned()); true };
|
||||||
|
@ -59,13 +59,13 @@ pub mod BigDigit {
|
|||||||
pub static bits: uint = 32;
|
pub static bits: uint = 32;
|
||||||
|
|
||||||
pub static base: uint = 1 << bits;
|
pub static base: uint = 1 << bits;
|
||||||
priv static hi_mask: uint = (-1 as uint) << bits;
|
static hi_mask: uint = (-1 as uint) << bits;
|
||||||
priv static lo_mask: uint = (-1 as uint) >> bits;
|
static lo_mask: uint = (-1 as uint) >> bits;
|
||||||
|
|
||||||
|
|
||||||
priv fn get_hi(n: uint) -> BigDigit { (n >> bits) as BigDigit }
|
fn get_hi(n: uint) -> BigDigit { (n >> bits) as BigDigit }
|
||||||
|
|
||||||
priv fn get_lo(n: uint) -> BigDigit { (n & lo_mask) as BigDigit }
|
fn get_lo(n: uint) -> BigDigit { (n & lo_mask) as BigDigit }
|
||||||
|
|
||||||
/// Split one machine sized unsigned integer into two BigDigits.
|
/// Split one machine sized unsigned integer into two BigDigits.
|
||||||
|
|
||||||
@ -613,7 +613,7 @@ impl BigUint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
priv fn shl_unit(&self, n_unit: uint) -> BigUint {
|
fn shl_unit(&self, n_unit: uint) -> BigUint {
|
||||||
if n_unit == 0 || self.is_zero() { return (*self).clone(); }
|
if n_unit == 0 || self.is_zero() { return (*self).clone(); }
|
||||||
|
|
||||||
return BigUint::new(vec::from_elem(n_unit, ZERO_BIG_DIGIT)
|
return BigUint::new(vec::from_elem(n_unit, ZERO_BIG_DIGIT)
|
||||||
@ -621,7 +621,7 @@ impl BigUint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
priv fn shl_bits(&self, n_bits: uint) -> BigUint {
|
fn shl_bits(&self, n_bits: uint) -> BigUint {
|
||||||
if n_bits == 0 || self.is_zero() { return (*self).clone(); }
|
if n_bits == 0 || self.is_zero() { return (*self).clone(); }
|
||||||
|
|
||||||
let mut carry = 0;
|
let mut carry = 0;
|
||||||
@ -637,7 +637,7 @@ impl BigUint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
priv fn shr_unit(&self, n_unit: uint) -> BigUint {
|
fn shr_unit(&self, n_unit: uint) -> BigUint {
|
||||||
if n_unit == 0 { return (*self).clone(); }
|
if n_unit == 0 { return (*self).clone(); }
|
||||||
if self.data.len() < n_unit { return Zero::zero(); }
|
if self.data.len() < n_unit { return Zero::zero(); }
|
||||||
return BigUint::from_slice(
|
return BigUint::from_slice(
|
||||||
@ -646,7 +646,7 @@ impl BigUint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
priv fn shr_bits(&self, n_bits: uint) -> BigUint {
|
fn shr_bits(&self, n_bits: uint) -> BigUint {
|
||||||
if n_bits == 0 || self.data.is_empty() { return (*self).clone(); }
|
if n_bits == 0 || self.data.is_empty() { return (*self).clone(); }
|
||||||
|
|
||||||
let mut borrow = 0;
|
let mut borrow = 0;
|
||||||
@ -661,7 +661,7 @@ impl BigUint {
|
|||||||
|
|
||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(target_arch = "x86_64")]
|
||||||
|
|
||||||
priv fn get_radix_base(radix: uint) -> (uint, uint) {
|
fn get_radix_base(radix: uint) -> (uint, uint) {
|
||||||
assert!(1 < radix && radix <= 16);
|
assert!(1 < radix && radix <= 16);
|
||||||
match radix {
|
match radix {
|
||||||
2 => (4294967296, 32),
|
2 => (4294967296, 32),
|
||||||
@ -687,7 +687,7 @@ priv fn get_radix_base(radix: uint) -> (uint, uint) {
|
|||||||
#[cfg(target_arch = "x86")]
|
#[cfg(target_arch = "x86")]
|
||||||
#[cfg(target_arch = "mips")]
|
#[cfg(target_arch = "mips")]
|
||||||
|
|
||||||
priv fn get_radix_base(radix: uint) -> (uint, uint) {
|
fn get_radix_base(radix: uint) -> (uint, uint) {
|
||||||
assert!(1 < radix && radix <= 16);
|
assert!(1 < radix && radix <= 16);
|
||||||
match radix {
|
match radix {
|
||||||
2 => (65536, 16),
|
2 => (65536, 16),
|
||||||
|
@ -222,7 +222,7 @@ impl<'self> Stats for &'self [f64] {
|
|||||||
|
|
||||||
// Helper function: extract a value representing the `pct` percentile of a sorted sample-set, using
|
// Helper function: extract a value representing the `pct` percentile of a sorted sample-set, using
|
||||||
// linear interpolation. If samples are not sorted, return nonsensical value.
|
// linear interpolation. If samples are not sorted, return nonsensical value.
|
||||||
priv fn percentile_of_sorted(sorted_samples: &[f64],
|
fn percentile_of_sorted(sorted_samples: &[f64],
|
||||||
pct: f64) -> f64 {
|
pct: f64) -> f64 {
|
||||||
assert!(sorted_samples.len() != 0);
|
assert!(sorted_samples.len() != 0);
|
||||||
if sorted_samples.len() == 1 {
|
if sorted_samples.len() == 1 {
|
||||||
|
@ -75,7 +75,7 @@ pub mod attr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(target_os = "win32"))]
|
#[cfg(not(target_os = "win32"))]
|
||||||
priv fn cap_for_attr(attr: attr::Attr) -> &'static str {
|
fn cap_for_attr(attr: attr::Attr) -> &'static str {
|
||||||
match attr {
|
match attr {
|
||||||
attr::Bold => "bold",
|
attr::Bold => "bold",
|
||||||
attr::Dim => "dim",
|
attr::Dim => "dim",
|
||||||
@ -234,7 +234,7 @@ impl Terminal {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
priv fn dim_if_necessary(&self, color: color::Color) -> color::Color {
|
fn dim_if_necessary(&self, color: color::Color) -> color::Color {
|
||||||
if color >= self.num_colors && color >= 8 && color < 16 {
|
if color >= self.num_colors && color >= 8 && color < 16 {
|
||||||
color-8
|
color-8
|
||||||
} else { color }
|
} else { color }
|
||||||
|
@ -430,7 +430,7 @@ pub fn expand(cap: &[u8], params: &[Param], vars: &mut Variables)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[deriving(Eq)]
|
#[deriving(Eq)]
|
||||||
priv struct Flags {
|
struct Flags {
|
||||||
width: uint,
|
width: uint,
|
||||||
precision: uint,
|
precision: uint,
|
||||||
alternate: bool,
|
alternate: bool,
|
||||||
@ -440,13 +440,13 @@ priv struct Flags {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Flags {
|
impl Flags {
|
||||||
priv fn new() -> Flags {
|
fn new() -> Flags {
|
||||||
Flags{ width: 0, precision: 0, alternate: false,
|
Flags{ width: 0, precision: 0, alternate: false,
|
||||||
left: false, sign: false, space: false }
|
left: false, sign: false, space: false }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
priv enum FormatOp {
|
enum FormatOp {
|
||||||
FormatDigit,
|
FormatDigit,
|
||||||
FormatOctal,
|
FormatOctal,
|
||||||
FormatHex,
|
FormatHex,
|
||||||
@ -455,7 +455,7 @@ priv enum FormatOp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl FormatOp {
|
impl FormatOp {
|
||||||
priv fn from_char(c: char) -> FormatOp {
|
fn from_char(c: char) -> FormatOp {
|
||||||
match c {
|
match c {
|
||||||
'd' => FormatDigit,
|
'd' => FormatDigit,
|
||||||
'o' => FormatOctal,
|
'o' => FormatOctal,
|
||||||
@ -465,7 +465,7 @@ impl FormatOp {
|
|||||||
_ => fail!("bad FormatOp char")
|
_ => fail!("bad FormatOp char")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
priv fn to_char(self) -> char {
|
fn to_char(self) -> char {
|
||||||
match self {
|
match self {
|
||||||
FormatDigit => 'd',
|
FormatDigit => 'd',
|
||||||
FormatOctal => 'o',
|
FormatOctal => 'o',
|
||||||
@ -476,7 +476,7 @@ impl FormatOp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
priv fn format(val: Param, op: FormatOp, flags: Flags) -> Result<~[u8],~str> {
|
fn format(val: Param, op: FormatOp, flags: Flags) -> Result<~[u8],~str> {
|
||||||
let mut s = match val {
|
let mut s = match val {
|
||||||
Number(d) => {
|
Number(d) => {
|
||||||
match op {
|
match op {
|
||||||
|
@ -254,7 +254,7 @@ impl Tm {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
priv fn do_strptime(s: &str, format: &str) -> Result<Tm, ~str> {
|
fn do_strptime(s: &str, format: &str) -> Result<Tm, ~str> {
|
||||||
fn match_str(s: &str, pos: uint, needle: &str) -> bool {
|
fn match_str(s: &str, pos: uint, needle: &str) -> bool {
|
||||||
let mut i = pos;
|
let mut i = pos;
|
||||||
for ch in needle.byte_iter() {
|
for ch in needle.byte_iter() {
|
||||||
@ -687,7 +687,7 @@ priv fn do_strptime(s: &str, format: &str) -> Result<Tm, ~str> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
priv fn do_strftime(format: &str, tm: &Tm) -> ~str {
|
fn do_strftime(format: &str, tm: &Tm) -> ~str {
|
||||||
fn parse_type(ch: char, tm: &Tm) -> ~str {
|
fn parse_type(ch: char, tm: &Tm) -> ~str {
|
||||||
//FIXME (#2350): Implement missing types.
|
//FIXME (#2350): Implement missing types.
|
||||||
let die = || fmt!("strftime: can't understand this format %c ", ch);
|
let die = || fmt!("strftime: can't understand this format %c ", ch);
|
||||||
|
@ -215,7 +215,7 @@ impl region_scope for MethodRscope {
|
|||||||
pub struct type_rscope(Option<RegionParameterization>);
|
pub struct type_rscope(Option<RegionParameterization>);
|
||||||
|
|
||||||
impl type_rscope {
|
impl type_rscope {
|
||||||
priv fn replacement(&self) -> ty::Region {
|
fn replacement(&self) -> ty::Region {
|
||||||
if self.is_some() {
|
if self.is_some() {
|
||||||
ty::re_bound(ty::br_self)
|
ty::re_bound(ty::br_self)
|
||||||
} else {
|
} else {
|
||||||
|
@ -314,7 +314,7 @@ mod pipesy {
|
|||||||
|
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
pub mod oneshot {
|
pub mod oneshot {
|
||||||
priv use std::kinds::Send;
|
use std::kinds::Send;
|
||||||
use ptr::to_mut_unsafe_ptr;
|
use ptr::to_mut_unsafe_ptr;
|
||||||
|
|
||||||
pub fn init<T: Send>() -> (server::Oneshot<T>, client::Oneshot<T>) {
|
pub fn init<T: Send>() -> (server::Oneshot<T>, client::Oneshot<T>) {
|
||||||
@ -341,7 +341,7 @@ mod pipesy {
|
|||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
pub mod client {
|
pub mod client {
|
||||||
|
|
||||||
priv use std::kinds::Send;
|
use std::kinds::Send;
|
||||||
|
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
pub fn try_send<T: Send>(pipe: Oneshot<T>, x_0: T) ->
|
pub fn try_send<T: Send>(pipe: Oneshot<T>, x_0: T) ->
|
||||||
@ -489,7 +489,7 @@ mod pipesy {
|
|||||||
|
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
pub mod streamp {
|
pub mod streamp {
|
||||||
priv use std::kinds::Send;
|
use std::kinds::Send;
|
||||||
|
|
||||||
pub fn init<T: Send>() -> (server::Open<T>, client::Open<T>) {
|
pub fn init<T: Send>() -> (server::Open<T>, client::Open<T>) {
|
||||||
pub use std::pipes::HasBuffer;
|
pub use std::pipes::HasBuffer;
|
||||||
@ -501,7 +501,7 @@ mod pipesy {
|
|||||||
|
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
pub mod client {
|
pub mod client {
|
||||||
priv use std::kinds::Send;
|
use std::kinds::Send;
|
||||||
|
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
pub fn try_data<T: Send>(pipe: Open<T>, x_0: T) ->
|
pub fn try_data<T: Send>(pipe: Open<T>, x_0: T) ->
|
||||||
|
@ -422,9 +422,9 @@ pub fn float_to_str_common<T:NumCast+Zero+One+Eq+Ord+NumStrConv+Float+Round+
|
|||||||
|
|
||||||
// Some constants for from_str_bytes_common's input validation,
|
// Some constants for from_str_bytes_common's input validation,
|
||||||
// they define minimum radix values for which the character is a valid digit.
|
// they define minimum radix values for which the character is a valid digit.
|
||||||
priv static DIGIT_P_RADIX: uint = ('p' as uint) - ('a' as uint) + 11u;
|
static DIGIT_P_RADIX: uint = ('p' as uint) - ('a' as uint) + 11u;
|
||||||
priv static DIGIT_I_RADIX: uint = ('i' as uint) - ('a' as uint) + 11u;
|
static DIGIT_I_RADIX: uint = ('i' as uint) - ('a' as uint) + 11u;
|
||||||
priv static DIGIT_E_RADIX: uint = ('e' as uint) - ('a' as uint) + 11u;
|
static DIGIT_E_RADIX: uint = ('e' as uint) - ('a' as uint) + 11u;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses a byte slice as a number. This is meant to
|
* Parses a byte slice as a number. This is meant to
|
||||||
|
@ -763,14 +763,14 @@ fn with_dirp<T>(d: Option<&Path>,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
priv fn free_handle(handle: *()) {
|
fn free_handle(handle: *()) {
|
||||||
unsafe {
|
unsafe {
|
||||||
libc::funcs::extra::kernel32::CloseHandle(cast::transmute(handle));
|
libc::funcs::extra::kernel32::CloseHandle(cast::transmute(handle));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
priv fn free_handle(_handle: *()) {
|
fn free_handle(_handle: *()) {
|
||||||
// unix has no process handle object, just a pid
|
// unix has no process handle object, just a pid
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -825,7 +825,7 @@ pub fn process_output(prog: &str, args: &[~str]) -> ProcessOutput {
|
|||||||
* operate on a none-existant process or, even worse, on a newer process
|
* operate on a none-existant process or, even worse, on a newer process
|
||||||
* with the same id.
|
* with the same id.
|
||||||
*/
|
*/
|
||||||
priv fn waitpid(pid: pid_t) -> int {
|
fn waitpid(pid: pid_t) -> int {
|
||||||
return waitpid_os(pid);
|
return waitpid_os(pid);
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
|
@ -738,7 +738,7 @@ pub fn count_bytes<'b>(s: &'b str, start: uint, n: uint) -> uint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// https://tools.ietf.org/html/rfc3629
|
// https://tools.ietf.org/html/rfc3629
|
||||||
priv static UTF8_CHAR_WIDTH: [u8, ..256] = [
|
static UTF8_CHAR_WIDTH: [u8, ..256] = [
|
||||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x1F
|
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, // 0x1F
|
||||||
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
|
||||||
@ -781,15 +781,15 @@ macro_rules! utf8_acc_cont_byte(
|
|||||||
)
|
)
|
||||||
|
|
||||||
// UTF-8 tags and ranges
|
// UTF-8 tags and ranges
|
||||||
priv static TAG_CONT_U8: u8 = 128u8;
|
static TAG_CONT_U8: u8 = 128u8;
|
||||||
priv static TAG_CONT: uint = 128u;
|
static TAG_CONT: uint = 128u;
|
||||||
priv static MAX_ONE_B: uint = 128u;
|
static MAX_ONE_B: uint = 128u;
|
||||||
priv static TAG_TWO_B: uint = 192u;
|
static TAG_TWO_B: uint = 192u;
|
||||||
priv static MAX_TWO_B: uint = 2048u;
|
static MAX_TWO_B: uint = 2048u;
|
||||||
priv static TAG_THREE_B: uint = 224u;
|
static TAG_THREE_B: uint = 224u;
|
||||||
priv static MAX_THREE_B: uint = 65536u;
|
static MAX_THREE_B: uint = 65536u;
|
||||||
priv static TAG_FOUR_B: uint = 240u;
|
static TAG_FOUR_B: uint = 240u;
|
||||||
priv static MAX_UNICODE: uint = 1114112u;
|
static MAX_UNICODE: uint = 1114112u;
|
||||||
|
|
||||||
/// Unsafe operations
|
/// Unsafe operations
|
||||||
pub mod raw {
|
pub mod raw {
|
||||||
|
@ -274,7 +274,7 @@ pub fn to_ascii_lower(string: &str) -> ~str {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
priv fn map_bytes(string: &str, map: &'static [u8]) -> ~str {
|
fn map_bytes(string: &str, map: &'static [u8]) -> ~str {
|
||||||
let len = string.len();
|
let len = string.len();
|
||||||
let mut result = str::with_capacity(len);
|
let mut result = str::with_capacity(len);
|
||||||
unsafe {
|
unsafe {
|
||||||
@ -298,7 +298,7 @@ pub fn eq_ignore_ascii_case(a: &str, b: &str) -> bool {
|
|||||||
|(byte_a, byte_b)| ASCII_LOWER_MAP[*byte_a] == ASCII_LOWER_MAP[*byte_b])
|
|(byte_a, byte_b)| ASCII_LOWER_MAP[*byte_a] == ASCII_LOWER_MAP[*byte_b])
|
||||||
}
|
}
|
||||||
|
|
||||||
priv static ASCII_LOWER_MAP: &'static [u8] = &[
|
static ASCII_LOWER_MAP: &'static [u8] = &[
|
||||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||||
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
|
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
|
||||||
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
|
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
|
||||||
@ -333,7 +333,7 @@ priv static ASCII_LOWER_MAP: &'static [u8] = &[
|
|||||||
0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
|
0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
|
||||||
];
|
];
|
||||||
|
|
||||||
priv static ASCII_UPPER_MAP: &'static [u8] = &[
|
static ASCII_UPPER_MAP: &'static [u8] = &[
|
||||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||||
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
|
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
|
||||||
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
|
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
|
||||||
|
@ -64,6 +64,7 @@ pub enum ObsoleteSyntax {
|
|||||||
ObsoleteMutWithMultipleBindings,
|
ObsoleteMutWithMultipleBindings,
|
||||||
ObsoleteExternVisibility,
|
ObsoleteExternVisibility,
|
||||||
ObsoleteUnsafeExternFn,
|
ObsoleteUnsafeExternFn,
|
||||||
|
ObsoletePrivVisibility,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl to_bytes::IterBytes for ObsoleteSyntax {
|
impl to_bytes::IterBytes for ObsoleteSyntax {
|
||||||
@ -253,6 +254,10 @@ impl ParserObsoleteMethods for Parser {
|
|||||||
"external functions are always unsafe; remove the `unsafe` \
|
"external functions are always unsafe; remove the `unsafe` \
|
||||||
keyword"
|
keyword"
|
||||||
),
|
),
|
||||||
|
ObsoletePrivVisibility => (
|
||||||
|
"`priv` not necessary",
|
||||||
|
"an item without a visibility qualifier is private by default"
|
||||||
|
),
|
||||||
};
|
};
|
||||||
|
|
||||||
self.report(sp, kind, kind_str, desc);
|
self.report(sp, kind, kind_str, desc);
|
||||||
|
@ -85,7 +85,7 @@ use parse::obsolete::{ObsoleteConstItem, ObsoleteFixedLengthVectorType};
|
|||||||
use parse::obsolete::{ObsoleteNamedExternModule, ObsoleteMultipleLocalDecl};
|
use parse::obsolete::{ObsoleteNamedExternModule, ObsoleteMultipleLocalDecl};
|
||||||
use parse::obsolete::{ObsoleteMutWithMultipleBindings};
|
use parse::obsolete::{ObsoleteMutWithMultipleBindings};
|
||||||
use parse::obsolete::{ObsoleteExternVisibility, ObsoleteUnsafeExternFn};
|
use parse::obsolete::{ObsoleteExternVisibility, ObsoleteUnsafeExternFn};
|
||||||
use parse::obsolete::{ParserObsoleteMethods};
|
use parse::obsolete::{ParserObsoleteMethods, ObsoletePrivVisibility};
|
||||||
use parse::token::{can_begin_expr, get_ident_interner, ident_to_str, is_ident};
|
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_ident_or_path};
|
||||||
use parse::token::{is_plain_ident, INTERPOLATED, keywords, special_idents};
|
use parse::token::{is_plain_ident, INTERPOLATED, keywords, special_idents};
|
||||||
@ -814,7 +814,7 @@ impl Parser {
|
|||||||
let attrs = p.parse_outer_attributes();
|
let attrs = p.parse_outer_attributes();
|
||||||
let lo = p.span.lo;
|
let lo = p.span.lo;
|
||||||
|
|
||||||
let vis = p.parse_visibility();
|
let vis = p.parse_non_priv_visibility();
|
||||||
let pur = p.parse_fn_purity();
|
let pur = p.parse_fn_purity();
|
||||||
// NB: at the moment, trait methods are public by default; this
|
// NB: at the moment, trait methods are public by default; this
|
||||||
// could change.
|
// could change.
|
||||||
@ -3608,7 +3608,7 @@ impl Parser {
|
|||||||
let attrs = self.parse_outer_attributes();
|
let attrs = self.parse_outer_attributes();
|
||||||
let lo = self.span.lo;
|
let lo = self.span.lo;
|
||||||
|
|
||||||
let visa = self.parse_visibility();
|
let visa = self.parse_non_priv_visibility();
|
||||||
let pur = self.parse_fn_purity();
|
let pur = self.parse_fn_purity();
|
||||||
let ident = self.parse_ident();
|
let ident = self.parse_ident();
|
||||||
let generics = self.parse_generics();
|
let generics = self.parse_generics();
|
||||||
@ -3871,6 +3871,18 @@ impl Parser {
|
|||||||
else { inherited }
|
else { inherited }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// parse visibility, but emits an obsolete error if it's private
|
||||||
|
fn parse_non_priv_visibility(&self) -> visibility {
|
||||||
|
match self.parse_visibility() {
|
||||||
|
public => public,
|
||||||
|
inherited => inherited,
|
||||||
|
private => {
|
||||||
|
self.obsolete(*self.last_span, ObsoletePrivVisibility);
|
||||||
|
inherited
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn parse_staticness(&self) -> bool {
|
fn parse_staticness(&self) -> bool {
|
||||||
if self.eat_keyword(keywords::Static) {
|
if self.eat_keyword(keywords::Static) {
|
||||||
self.obsolete(*self.last_span, ObsoleteStaticMethod);
|
self.obsolete(*self.last_span, ObsoleteStaticMethod);
|
||||||
@ -4063,7 +4075,7 @@ impl Parser {
|
|||||||
// parse a function declaration from a foreign module
|
// parse a function declaration from a foreign module
|
||||||
fn parse_item_foreign_fn(&self, attrs: ~[Attribute]) -> @foreign_item {
|
fn parse_item_foreign_fn(&self, attrs: ~[Attribute]) -> @foreign_item {
|
||||||
let lo = self.span.lo;
|
let lo = self.span.lo;
|
||||||
let vis = self.parse_visibility();
|
let vis = self.parse_non_priv_visibility();
|
||||||
|
|
||||||
// Parse obsolete purity.
|
// Parse obsolete purity.
|
||||||
let purity = self.parse_fn_purity();
|
let purity = self.parse_fn_purity();
|
||||||
@ -4443,7 +4455,7 @@ impl Parser {
|
|||||||
maybe_whole!(iovi self, nt_item);
|
maybe_whole!(iovi self, nt_item);
|
||||||
let lo = self.span.lo;
|
let lo = self.span.lo;
|
||||||
|
|
||||||
let visibility = self.parse_visibility();
|
let visibility = self.parse_non_priv_visibility();
|
||||||
|
|
||||||
// must be a view item:
|
// must be a view item:
|
||||||
if self.eat_keyword(keywords::Use) {
|
if self.eat_keyword(keywords::Use) {
|
||||||
@ -4575,7 +4587,7 @@ impl Parser {
|
|||||||
maybe_whole!(iovi self, nt_item);
|
maybe_whole!(iovi self, nt_item);
|
||||||
let lo = self.span.lo;
|
let lo = self.span.lo;
|
||||||
|
|
||||||
let visibility = self.parse_visibility();
|
let visibility = self.parse_non_priv_visibility();
|
||||||
|
|
||||||
if (self.is_keyword(keywords::Const) || self.is_keyword(keywords::Static)) {
|
if (self.is_keyword(keywords::Const) || self.is_keyword(keywords::Static)) {
|
||||||
// FOREIGN CONST ITEM
|
// FOREIGN CONST ITEM
|
||||||
|
@ -21,7 +21,7 @@ struct dog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl dog {
|
impl dog {
|
||||||
priv fn bark(&self) -> int {
|
fn bark(&self) -> int {
|
||||||
info!("Woof %u %d", *self.barks, *self.volume);
|
info!("Woof %u %d", *self.barks, *self.volume);
|
||||||
*self.barks += 1u;
|
*self.barks += 1u;
|
||||||
if *self.barks % 3u == 0u {
|
if *self.barks % 3u == 0u {
|
||||||
|
Loading…
Reference in New Issue
Block a user