This is everywhere except struct fields and enum variants.
`Some(path)` is the file represented by `path`, `None` is
`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
starting and after reading everything.
*/
- priv current_reader: Option<@io::Reader>,
- priv state: FileInputState,
+ current_reader: Option<@io::Reader>,
+ state: FileInputState,
/**
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
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
// "self.fi." -> "self." and renaming FileInput_. Documentation above
// will likely have to be updated to use `let mut in = ...`.
pub struct FileInput {
- priv fi: @mut FileInput_
+ fi: @mut FileInput_
}
impl FileInput {
FileInput::from_vec(pathed)
}
- priv fn current_file_eof(&self) -> bool {
+ fn current_file_eof(&self) -> bool {
match self.fi.current_reader {
None => false,
Some(r) => r.eof()
Returns `true` if it had to move to the next file and did
so successfully.
*/
- priv fn next_file_if_eof(&self) -> bool {
+ fn next_file_if_eof(&self) -> bool {
match self.fi.current_reader {
None => self.next_file(),
Some(r) => {
fn drop(&self) {}
}
-priv enum FutureState<A> {
+enum FutureState<A> {
Pending(~fn() -> A),
Evaluating,
Forced(A)
* Fails during iteration if the string contains a non-whitespace
* sequence longer than the limit.
*/
- priv fn each_split_within<'a>(ss: &'a str,
- lim: uint,
- it: &fn(&'a str) -> bool) -> bool {
+ fn each_split_within<'a>(ss: &'a str,
+ lim: uint,
+ it: &fn(&'a str) -> bool) -> bool {
// Just for fun, let's write this as an state machine:
enum SplitWithinState {
}
#[test]
- priv fn test_split_within() {
+ fn test_split_within() {
fn t(s: &str, i: uint, u: &[~str]) {
let mut v = ~[];
do each_split_within(s, i) |s| { v.push(s.to_owned()); true };
pub static bits: uint = 32;
pub static base: uint = 1 << bits;
- priv static hi_mask: uint = (-1 as uint) << bits;
- priv static lo_mask: uint = (-1 as uint) >> bits;
+ static hi_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.
}
- 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(); }
return BigUint::new(vec::from_elem(n_unit, ZERO_BIG_DIGIT)
}
- 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(); }
let mut carry = 0;
}
- 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 self.data.len() < n_unit { return Zero::zero(); }
return BigUint::from_slice(
}
- 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(); }
let mut borrow = 0;
#[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);
match radix {
2 => (4294967296, 32),
#[cfg(target_arch = "x86")]
#[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);
match radix {
2 => (65536, 16),
// 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.
-priv fn percentile_of_sorted(sorted_samples: &[f64],
+fn percentile_of_sorted(sorted_samples: &[f64],
pct: f64) -> f64 {
assert!(sorted_samples.len() != 0);
if sorted_samples.len() == 1 {
}
#[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 {
attr::Bold => "bold",
attr::Dim => "dim",
}
}
- 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 {
color-8
} else { color }
}
#[deriving(Eq)]
-priv struct Flags {
+struct Flags {
width: uint,
precision: uint,
alternate: bool,
}
impl Flags {
- priv fn new() -> Flags {
+ fn new() -> Flags {
Flags{ width: 0, precision: 0, alternate: false,
left: false, sign: false, space: false }
}
}
-priv enum FormatOp {
+enum FormatOp {
FormatDigit,
FormatOctal,
FormatHex,
}
impl FormatOp {
- priv fn from_char(c: char) -> FormatOp {
+ fn from_char(c: char) -> FormatOp {
match c {
'd' => FormatDigit,
'o' => FormatOctal,
_ => fail!("bad FormatOp char")
}
}
- priv fn to_char(self) -> char {
+ fn to_char(self) -> char {
match self {
FormatDigit => 'd',
FormatOctal => 'o',
}
}
-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 {
Number(d) => {
match op {
}
}
-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 {
let mut i = pos;
for ch in needle.byte_iter() {
}
}
-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 {
//FIXME (#2350): Implement missing types.
let die = || fmt!("strftime: can't understand this format %c ", ch);
pub struct type_rscope(Option<RegionParameterization>);
impl type_rscope {
- priv fn replacement(&self) -> ty::Region {
+ fn replacement(&self) -> ty::Region {
if self.is_some() {
ty::re_bound(ty::br_self)
} else {
#[allow(non_camel_case_types)]
pub mod oneshot {
- priv use std::kinds::Send;
+ use std::kinds::Send;
use ptr::to_mut_unsafe_ptr;
pub fn init<T: Send>() -> (server::Oneshot<T>, client::Oneshot<T>) {
#[allow(non_camel_case_types)]
pub mod client {
- priv use std::kinds::Send;
+ use std::kinds::Send;
#[allow(non_camel_case_types)]
pub fn try_send<T: Send>(pipe: Oneshot<T>, x_0: T) ->
#[allow(non_camel_case_types)]
pub mod streamp {
- priv use std::kinds::Send;
+ use std::kinds::Send;
pub fn init<T: Send>() -> (server::Open<T>, client::Open<T>) {
pub use std::pipes::HasBuffer;
#[allow(non_camel_case_types)]
pub mod client {
- priv use std::kinds::Send;
+ use std::kinds::Send;
#[allow(non_camel_case_types)]
pub fn try_data<T: Send>(pipe: Open<T>, x_0: T) ->
// Some constants for from_str_bytes_common's input validation,
// 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;
-priv 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_P_RADIX: uint = ('p' as uint) - ('a' as uint) + 11u;
+static DIGIT_I_RADIX: uint = ('i' 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
}
#[cfg(windows)]
-priv fn free_handle(handle: *()) {
+fn free_handle(handle: *()) {
unsafe {
libc::funcs::extra::kernel32::CloseHandle(cast::transmute(handle));
}
}
#[cfg(unix)]
-priv fn free_handle(_handle: *()) {
+fn free_handle(_handle: *()) {
// unix has no process handle object, just a pid
}
* operate on a none-existant process or, even worse, on a newer process
* with the same id.
*/
-priv fn waitpid(pid: pid_t) -> int {
+fn waitpid(pid: pid_t) -> int {
return waitpid_os(pid);
#[cfg(windows)]
}
// 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, // 0x1F
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
)
// UTF-8 tags and ranges
-priv static TAG_CONT_U8: u8 = 128u8;
-priv static TAG_CONT: uint = 128u;
-priv static MAX_ONE_B: uint = 128u;
-priv static TAG_TWO_B: uint = 192u;
-priv static MAX_TWO_B: uint = 2048u;
-priv static TAG_THREE_B: uint = 224u;
-priv static MAX_THREE_B: uint = 65536u;
-priv static TAG_FOUR_B: uint = 240u;
-priv static MAX_UNICODE: uint = 1114112u;
+static TAG_CONT_U8: u8 = 128u8;
+static TAG_CONT: uint = 128u;
+static MAX_ONE_B: uint = 128u;
+static TAG_TWO_B: uint = 192u;
+static MAX_TWO_B: uint = 2048u;
+static TAG_THREE_B: uint = 224u;
+static MAX_THREE_B: uint = 65536u;
+static TAG_FOUR_B: uint = 240u;
+static MAX_UNICODE: uint = 1114112u;
/// Unsafe operations
pub mod raw {
}
#[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 mut result = str::with_capacity(len);
unsafe {
|(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,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
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,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
ObsoleteMutWithMultipleBindings,
ObsoleteExternVisibility,
ObsoleteUnsafeExternFn,
+ ObsoletePrivVisibility,
}
impl to_bytes::IterBytes for ObsoleteSyntax {
"external functions are always unsafe; remove the `unsafe` \
keyword"
),
+ ObsoletePrivVisibility => (
+ "`priv` not necessary",
+ "an item without a visibility qualifier is private by default"
+ ),
};
self.report(sp, kind, kind_str, desc);
use parse::obsolete::{ObsoleteNamedExternModule, ObsoleteMultipleLocalDecl};
use parse::obsolete::{ObsoleteMutWithMultipleBindings};
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::{is_ident_or_path};
use parse::token::{is_plain_ident, INTERPOLATED, keywords, special_idents};
let attrs = p.parse_outer_attributes();
let lo = p.span.lo;
- let vis = p.parse_visibility();
+ let vis = p.parse_non_priv_visibility();
let pur = p.parse_fn_purity();
// NB: at the moment, trait methods are public by default; this
// could change.
let attrs = self.parse_outer_attributes();
let lo = self.span.lo;
- let visa = self.parse_visibility();
+ let visa = self.parse_non_priv_visibility();
let pur = self.parse_fn_purity();
let ident = self.parse_ident();
let generics = self.parse_generics();
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 {
if self.eat_keyword(keywords::Static) {
self.obsolete(*self.last_span, ObsoleteStaticMethod);
// parse a function declaration from a foreign module
fn parse_item_foreign_fn(&self, attrs: ~[Attribute]) -> @foreign_item {
let lo = self.span.lo;
- let vis = self.parse_visibility();
+ let vis = self.parse_non_priv_visibility();
// Parse obsolete purity.
let purity = self.parse_fn_purity();
maybe_whole!(iovi self, nt_item);
let lo = self.span.lo;
- let visibility = self.parse_visibility();
+ let visibility = self.parse_non_priv_visibility();
// must be a view item:
if self.eat_keyword(keywords::Use) {
maybe_whole!(iovi self, nt_item);
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)) {
// FOREIGN CONST ITEM
}
impl dog {
- priv fn bark(&self) -> int {
+ fn bark(&self) -> int {
info!("Woof %u %d", *self.barks, *self.volume);
*self.barks += 1u;
if *self.barks % 3u == 0u {