auto merge of #13184 : alexcrichton/rust/priv-fields, r=brson

This is an implementation of a portion of [RFC #4](https://github.com/rust-lang/rfcs/blob/master/active/0004-private-fields.md). This PR makes named struct fields private by default (as opposed to inherited by default).

The only real meaty change is the first commit to `rustc`, all other commits are just fallout of that change.

Summary of changes made:

* Named fields are private by default *everywhere*
* The `priv` keyword is now default-deny on named fields (done in a "lint" pass in privacy)

Changes yet to be done (before the RFC is closed)

* Change tuple structs to have private fields by default
* Remove `priv` enum variants
* Make `priv` a reserved keyword
This commit is contained in:
bors 2014-03-31 15:51:33 -07:00
commit b8ef9fd9c9
278 changed files with 2638 additions and 2663 deletions

View File

@ -21,87 +21,87 @@ pub enum mode {
#[deriving(Clone)]
pub struct config {
// The library paths required for running the compiler
compile_lib_path: ~str,
pub compile_lib_path: ~str,
// The library paths required for running compiled programs
run_lib_path: ~str,
pub run_lib_path: ~str,
// The rustc executable
rustc_path: Path,
pub rustc_path: Path,
// The clang executable
clang_path: Option<Path>,
pub clang_path: Option<Path>,
// The llvm binaries path
llvm_bin_path: Option<Path>,
pub llvm_bin_path: Option<Path>,
// The directory containing the tests to run
src_base: Path,
pub src_base: Path,
// The directory where programs should be built
build_base: Path,
pub build_base: Path,
// Directory for auxiliary libraries
aux_base: Path,
pub aux_base: Path,
// The name of the stage being built (stage1, etc)
stage_id: ~str,
pub stage_id: ~str,
// The test mode, compile-fail, run-fail, run-pass
mode: mode,
pub mode: mode,
// Run ignored tests
run_ignored: bool,
pub run_ignored: bool,
// Only run tests that match this filter
filter: Option<~str>,
pub filter: Option<~str>,
// Write out a parseable log of tests that were run
logfile: Option<Path>,
pub logfile: Option<Path>,
// Write out a json file containing any metrics of the run
save_metrics: Option<Path>,
pub save_metrics: Option<Path>,
// Write and ratchet a metrics file
ratchet_metrics: Option<Path>,
pub ratchet_metrics: Option<Path>,
// Percent change in metrics to consider noise
ratchet_noise_percent: Option<f64>,
pub ratchet_noise_percent: Option<f64>,
// "Shard" of the testsuite to run: this has the form of
// "Shard" of the testsuite to pub run: this has the form of
// two numbers (a,b), and causes only those tests with
// positional order equal to a mod b to run.
test_shard: Option<(uint,uint)>,
pub test_shard: Option<(uint,uint)>,
// A command line to prefix program execution with,
// for running under valgrind
runtool: Option<~str>,
pub runtool: Option<~str>,
// Flags to pass to the compiler when building for the host
host_rustcflags: Option<~str>,
pub host_rustcflags: Option<~str>,
// Flags to pass to the compiler when building for the target
target_rustcflags: Option<~str>,
pub target_rustcflags: Option<~str>,
// Run tests using the JIT
jit: bool,
pub jit: bool,
// Target system to be tested
target: ~str,
pub target: ~str,
// Host triple for the compiler being invoked
host: ~str,
pub host: ~str,
// Extra parameter to run adb on arm-linux-androideabi
adb_path: ~str,
pub adb_path: ~str,
// Extra parameter to run test sute on arm-linux-androideabi
adb_test_dir: ~str,
pub adb_test_dir: ~str,
// status whether android device available or not
adb_device_status: bool,
pub adb_device_status: bool,
// Explain what's going on
verbose: bool
pub verbose: bool
}

View File

@ -10,7 +10,11 @@
use std::io::{BufferedReader, File};
pub struct ExpectedError { line: uint, kind: ~str, msg: ~str }
pub struct ExpectedError {
pub line: uint,
pub kind: ~str,
pub msg: ~str,
}
// Load any test directives embedded in the file
pub fn load_errors(testfile: &Path) -> Vec<ExpectedError> {

View File

@ -14,26 +14,26 @@ use util;
pub struct TestProps {
// Lines that should be expected, in order, on standard out
error_patterns: Vec<~str> ,
pub error_patterns: Vec<~str> ,
// Extra flags to pass to the compiler
compile_flags: Option<~str>,
pub compile_flags: Option<~str>,
// If present, the name of a file that this test should match when
// pretty-printed
pp_exact: Option<Path>,
pub pp_exact: Option<Path>,
// Modules from aux directory that should be compiled
aux_builds: Vec<~str> ,
pub aux_builds: Vec<~str> ,
// Environment settings to use during execution
exec_env: Vec<(~str,~str)> ,
pub exec_env: Vec<(~str,~str)> ,
// Commands to be given to the debugger, when testing debug info
debugger_cmds: Vec<~str> ,
pub debugger_cmds: Vec<~str> ,
// Lines to check if they appear in the expected debugger output
check_lines: Vec<~str> ,
pub check_lines: Vec<~str> ,
// Flag to force a crate to be built with the host architecture
force_host: bool,
pub force_host: bool,
// Check stdout for error-pattern output as well as stderr
check_stdout: bool,
pub check_stdout: bool,
// Don't force a --crate-type=dylib flag on the command line
no_prefer_dynamic: bool,
pub no_prefer_dynamic: bool,
}
// Load any test directives embedded in the file

View File

@ -57,7 +57,7 @@ fn target_env(lib_path: &str, prog: &str) -> Vec<(~str,~str)> {
return env;
}
pub struct Result {status: ProcessExit, out: ~str, err: ~str}
pub struct Result {pub status: ProcessExit, pub out: ~str, pub err: ~str}
pub fn run(lib_path: &str,
prog: &str,

View File

@ -200,7 +200,7 @@ use std::ptr;
// Unique<T> has the same semantics as ~T
pub struct Unique<T> {
// It contains a single raw, mutable pointer to the object in question.
priv ptr: *mut T
ptr: *mut T
}
// Implement methods for creating and using the values in the box.

View File

@ -1527,12 +1527,9 @@ of an item to see whether it should be allowed or not. This is where privacy
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 two exceptions. The first
exception is that struct fields are public by default (but the struct itself is
still private by default), and the remaining exception is that enum variants in
a `pub` enum are the default visibility of the enum container itself.. You are
allowed to alter this default visibility with the `pub` keyword (or `priv`
keyword for struct fields and enum variants). When an item is declared as `pub`,
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`,
it can be thought of as being accessible to the outside world. For example:
~~~~
@ -1542,7 +1539,7 @@ struct Foo;
// Declare a public struct with a private field
pub struct Bar {
priv field: int
field: int
}
// Declare a public enum with public and private variants
@ -2354,7 +2351,7 @@ The following are examples of structure expressions:
~~~~
# struct Point { x: f64, y: f64 }
# struct TuplePoint(f64, f64);
# mod game { pub struct User<'a> { name: &'a str, age: uint, score: uint } }
# mod game { pub struct User<'a> { pub name: &'a str, pub age: uint, pub score: uint } }
# struct Cookie; fn some_fn<T>(t: T) {}
Point {x: 10.0, y: 20.0};
TuplePoint(10.0, 20.0);
@ -3140,7 +3137,7 @@ The types `char` and `str` hold textual data.
A value of type `char` is a [Unicode scalar value](
http://www.unicode.org/glossary/#unicode_scalar_value)
(ie. a code point that is not a surrogate),
represented as a 32-bit unsigned word in the 0x0000 to 0xD7FF
represented as a 32-bit unsigned word in the 0x0000 to 0xD7FF
or 0xE000 to 0x10FFFF range.
A `[char]` vector is effectively an UCS-4 / UTF-32 string.

View File

@ -2657,8 +2657,8 @@ Rust doesn't support encapsulation: both struct fields and methods can
be private. But this encapsulation is at the module level, not the
struct level.
For convenience, fields are _public_ by default, and can be made _private_ with
the `priv` keyword:
Fields are _private_ by default, and can be made _public_ with
the `pub` keyword:
~~~
mod farm {
@ -2667,8 +2667,8 @@ mod farm {
# impl Human { pub fn rest(&self) { } }
# pub fn make_me_a_farm() -> Farm { Farm { chickens: ~[], farmer: Human(0) } }
pub struct Farm {
priv chickens: ~[Chicken],
farmer: Human
chickens: ~[Chicken],
pub farmer: Human
}
impl Farm {

View File

@ -25,6 +25,8 @@
#![allow(missing_doc)]
#![feature(managed_boxes)]
#![allow(visible_private_types)] // NOTE: remove after a stage0 snap
extern crate collections;
use std::cast::{transmute, transmute_mut, transmute_mut_region};
@ -83,9 +85,9 @@ pub struct Arena {
// The head is separated out from the list as a unbenchmarked
// microoptimization, to avoid needing to case on the list to
// access the head.
priv head: Chunk,
priv copy_head: Chunk,
priv chunks: RefCell<Vec<Chunk>>,
head: Chunk,
copy_head: Chunk,
chunks: RefCell<Vec<Chunk>>,
}
impl Arena {
@ -333,14 +335,14 @@ fn test_arena_destructors_fail() {
/// run again for these objects.
pub struct TypedArena<T> {
/// A pointer to the next object to be allocated.
priv ptr: *T,
ptr: *T,
/// A pointer to the end of the allocated area. When this pointer is
/// reached, a new chunk is allocated.
priv end: *T,
end: *T,
/// A pointer to the first arena segment.
priv first: Option<~TypedArenaChunk<T>>,
first: Option<~TypedArenaChunk<T>>,
}
struct TypedArenaChunk<T> {

View File

@ -227,9 +227,9 @@ enum Op {Union, Intersect, Assign, Difference}
#[deriving(Clone)]
pub struct Bitv {
/// Internal representation of the bit vector (small or large)
priv rep: BitvVariant,
rep: BitvVariant,
/// The number of valid bits in the internal representation
priv nbits: uint
nbits: uint
}
fn die() -> ! {
@ -587,9 +587,9 @@ fn iterate_bits(base: uint, bits: uint, f: |uint| -> bool) -> bool {
/// An iterator for `Bitv`.
pub struct Bits<'a> {
priv bitv: &'a Bitv,
priv next_idx: uint,
priv end_idx: uint,
bitv: &'a Bitv,
next_idx: uint,
end_idx: uint,
}
impl<'a> Iterator<bool> for Bits<'a> {
@ -648,12 +648,12 @@ impl<'a> RandomAccessIterator<bool> for Bits<'a> {
/// as a `uint`.
#[deriving(Clone)]
pub struct BitvSet {
priv size: uint,
size: uint,
// In theory this is a `Bitv` instead of always a `BigBitv`, but knowing that
// there's an array of storage makes our lives a whole lot easier when
// performing union/intersection/etc operations
priv bitv: BigBitv
bitv: BigBitv
}
impl BitvSet {
@ -912,8 +912,8 @@ impl BitvSet {
}
pub struct BitPositions<'a> {
priv set: &'a BitvSet,
priv next_idx: uint
set: &'a BitvSet,
next_idx: uint
}
impl<'a> Iterator<uint> for BitPositions<'a> {

View File

@ -23,10 +23,10 @@ use std::fmt::Show;
#[allow(missing_doc)]
pub struct BTree<K, V> {
priv root: Node<K, V>,
priv len: uint,
priv lower_bound: uint,
priv upper_bound: uint
root: Node<K, V>,
len: uint,
lower_bound: uint,
upper_bound: uint
}
impl<K: TotalOrd, V> BTree<K, V> {

View File

@ -32,9 +32,9 @@ use deque::Deque;
/// A doubly-linked list.
pub struct DList<T> {
priv length: uint,
priv list_head: Link<T>,
priv list_tail: Rawlink<Node<T>>,
length: uint,
list_head: Link<T>,
list_tail: Rawlink<Node<T>>,
}
type Link<T> = Option<~Node<T>>;
@ -48,9 +48,9 @@ struct Node<T> {
/// Double-ended DList iterator
pub struct Items<'a, T> {
priv head: &'a Link<T>,
priv tail: Rawlink<Node<T>>,
priv nelem: uint,
head: &'a Link<T>,
tail: Rawlink<Node<T>>,
nelem: uint,
}
// FIXME #11820: the &'a Option<> of the Link stops clone working.
@ -60,16 +60,16 @@ impl<'a, T> Clone for Items<'a, T> {
/// Double-ended mutable DList iterator
pub struct MutItems<'a, T> {
priv list: &'a mut DList<T>,
priv head: Rawlink<Node<T>>,
priv tail: Rawlink<Node<T>>,
priv nelem: uint,
list: &'a mut DList<T>,
head: Rawlink<Node<T>>,
tail: Rawlink<Node<T>>,
nelem: uint,
}
/// DList consuming iterator
#[deriving(Clone)]
pub struct MoveItems<T> {
priv list: DList<T>
list: DList<T>
}
/// Rawlink is a type like Option<T> but for holding a raw pointer

View File

@ -20,7 +20,7 @@ use std::num::Bitwise;
pub struct EnumSet<E> {
// We must maintain the invariant that no bits are set
// for which no variant exists
priv bits: uint
bits: uint
}
/// An interface for casting C-like enum to uint and back.
@ -102,8 +102,8 @@ impl<E:CLike> BitAnd<EnumSet<E>, EnumSet<E>> for EnumSet<E> {
/// An iterator over an EnumSet
pub struct Items<E> {
priv index: uint,
priv bits: uint,
index: uint,
bits: uint,
}
impl<E:CLike> Items<E> {

View File

@ -100,25 +100,25 @@ mod table {
/// this and going "what? of course there are debug-only asserts!", then
/// please make this use them!
pub struct RawTable<K, V> {
priv capacity: uint,
priv size: uint,
priv hashes: *mut u64,
priv keys: *mut K,
priv vals: *mut V,
capacity: uint,
size: uint,
hashes: *mut u64,
keys: *mut K,
vals: *mut V,
}
/// Represents an index into a `RawTable` with no key or value in it.
pub struct EmptyIndex {
priv idx: int,
priv nocopy: marker::NoCopy,
idx: int,
nocopy: marker::NoCopy,
}
/// Represents an index into a `RawTable` with a key, value, and hash
/// in it.
pub struct FullIndex {
priv idx: int,
priv hash: SafeHash,
priv nocopy: marker::NoCopy,
idx: int,
hash: SafeHash,
nocopy: marker::NoCopy,
}
impl FullIndex {
@ -142,7 +142,7 @@ mod table {
/// A hash that is not zero, since we use that to represent empty buckets.
#[deriving(Eq)]
pub struct SafeHash {
priv hash: u64,
hash: u64,
}
impl SafeHash {
@ -376,18 +376,18 @@ mod table {
}
pub struct Entries<'a, K, V> {
priv table: &'a RawTable<K, V>,
priv idx: uint,
table: &'a RawTable<K, V>,
idx: uint,
}
pub struct MutEntries<'a, K, V> {
priv table: &'a mut RawTable<K, V>,
priv idx: uint,
table: &'a mut RawTable<K, V>,
idx: uint,
}
pub struct MoveEntries<K, V> {
priv table: RawTable<K, V>,
priv idx: uint,
table: RawTable<K, V>,
idx: uint,
}
impl<'a, K, V> Iterator<(&'a K, &'a V)> for Entries<'a, K, V> {
@ -675,19 +675,19 @@ static INITIAL_LOAD_FACTOR: Fraction = (9, 10);
#[deriving(Clone)]
pub struct HashMap<K, V, H = sip::SipHasher> {
// All hashes are keyed on these values, to prevent hash collision attacks.
priv hasher: H,
hasher: H,
// When size == grow_at, we double the capacity.
priv grow_at: uint,
grow_at: uint,
// The capacity must never drop below this.
priv minimum_capacity: uint,
minimum_capacity: uint,
priv table: table::RawTable<K, V>,
table: table::RawTable<K, V>,
// We keep this at the end since it's 4-bytes, unlike everything else
// in this struct. Might as well save a word of padding!
priv load_factor: Fraction,
load_factor: Fraction,
}
/// Get the number of elements which will force the capacity to grow.
@ -1385,7 +1385,7 @@ pub type SetMoveItems<K> =
/// requires that the elements implement the `Eq` and `Hash` traits.
#[deriving(Clone)]
pub struct HashSet<T, H = sip::SipHasher> {
priv map: HashMap<T, (), H>
map: HashMap<T, (), H>
}
impl<T: TotalEq + Hash<S>, S, H: Hasher<S>> Eq for HashSet<T, H> {

View File

@ -22,6 +22,8 @@
#![feature(macro_rules, managed_boxes, default_type_params, phase)]
#![allow(visible_private_types)] // NOTE: remove after a stage0 snap
extern crate rand;
#[cfg(test)] extern crate test;

View File

@ -56,10 +56,10 @@ struct LruEntry<K, V> {
/// An LRU Cache.
pub struct LruCache<K, V> {
priv map: HashMap<KeyRef<K>, ~LruEntry<K, V>>,
priv max_size: uint,
priv head: *mut LruEntry<K, V>,
priv tail: *mut LruEntry<K, V>,
map: HashMap<KeyRef<K>, ~LruEntry<K, V>>,
max_size: uint,
head: *mut LruEntry<K, V>,
tail: *mut LruEntry<K, V>,
}
impl<S, K: Hash<S>> Hash<S> for KeyRef<K> {

View File

@ -19,7 +19,7 @@ use std::slice;
/// A priority queue implemented with a binary heap
#[deriving(Clone)]
pub struct PriorityQueue<T> {
priv data: ~[T],
data: ~[T],
}
impl<T:Ord> Container for PriorityQueue<T> {
@ -181,7 +181,7 @@ impl<T:Ord> PriorityQueue<T> {
/// PriorityQueue iterator
pub struct Items <'a, T> {
priv iter: slice::Items<'a, T>,
iter: slice::Items<'a, T>,
}
impl<'a, T> Iterator<&'a T> for Items<'a, T> {

View File

@ -25,9 +25,9 @@ static MINIMUM_CAPACITY: uint = 2u;
/// RingBuf is a circular buffer that implements Deque.
#[deriving(Clone)]
pub struct RingBuf<T> {
priv nelts: uint,
priv lo: uint,
priv elts: ~[Option<T>]
nelts: uint,
lo: uint,
elts: ~[Option<T>]
}
impl<T> Container for RingBuf<T> {
@ -230,10 +230,10 @@ impl<T> RingBuf<T> {
/// RingBuf iterator
pub struct Items<'a, T> {
priv lo: uint,
priv index: uint,
priv rindex: uint,
priv elts: &'a [Option<T>],
lo: uint,
index: uint,
rindex: uint,
elts: &'a [Option<T>],
}
impl<'a, T> Iterator<&'a T> for Items<'a, T> {
@ -285,9 +285,9 @@ impl<'a, T> RandomAccessIterator<&'a T> for Items<'a, T> {
/// RingBuf mutable iterator
pub struct MutItems<'a, T> {
priv remaining1: &'a mut [Option<T>],
priv remaining2: &'a mut [Option<T>],
priv nelts: uint,
remaining1: &'a mut [Option<T>],
remaining2: &'a mut [Option<T>],
nelts: uint,
}
impl<'a, T> Iterator<&'a mut T> for MutItems<'a, T> {

View File

@ -21,7 +21,7 @@ use std::slice;
#[allow(missing_doc)]
pub struct SmallIntMap<T> {
priv v: ~[Option<T>],
v: ~[Option<T>],
}
impl<V> Container for SmallIntMap<V> {
@ -234,9 +234,9 @@ macro_rules! double_ended_iterator {
}
pub struct Entries<'a, T> {
priv front: uint,
priv back: uint,
priv iter: slice::Items<'a, Option<T>>
front: uint,
back: uint,
iter: slice::Items<'a, Option<T>>
}
iterator!(impl Entries -> (uint, &'a T), get_ref)
@ -244,9 +244,9 @@ double_ended_iterator!(impl Entries -> (uint, &'a T), get_ref)
pub type RevEntries<'a, T> = Rev<Entries<'a, T>>;
pub struct MutEntries<'a, T> {
priv front: uint,
priv back: uint,
priv iter: slice::MutItems<'a, Option<T>>
front: uint,
back: uint,
iter: slice::MutItems<'a, Option<T>>
}
iterator!(impl MutEntries -> (uint, &'a mut T), get_mut_ref)

View File

@ -36,8 +36,8 @@ use std::ptr;
#[allow(missing_doc)]
#[deriving(Clone)]
pub struct TreeMap<K, V> {
priv root: Option<~TreeNode<K, V>>,
priv length: uint
root: Option<~TreeNode<K, V>>,
length: uint
}
impl<K: Eq + TotalOrd, V: Eq> Eq for TreeMap<K, V> {
@ -273,24 +273,24 @@ impl<K: TotalOrd, V> TreeMap<K, V> {
/// Lazy forward iterator over a map
pub struct Entries<'a, K, V> {
priv stack: ~[&'a TreeNode<K, V>],
stack: ~[&'a TreeNode<K, V>],
// See the comment on MutEntries; this is just to allow
// code-sharing (for this immutable-values iterator it *could* very
// well be Option<&'a TreeNode<K,V>>).
priv node: *TreeNode<K, V>,
priv remaining_min: uint,
priv remaining_max: uint
node: *TreeNode<K, V>,
remaining_min: uint,
remaining_max: uint
}
/// Lazy backward iterator over a map
pub struct RevEntries<'a, K, V> {
priv iter: Entries<'a, K, V>,
iter: Entries<'a, K, V>,
}
/// Lazy forward iterator over a map that allows for the mutation of
/// the values.
pub struct MutEntries<'a, K, V> {
priv stack: ~[&'a mut TreeNode<K, V>],
stack: ~[&'a mut TreeNode<K, V>],
// Unfortunately, we require some unsafe-ness to get around the
// fact that we would be storing a reference *into* one of the
// nodes in the stack.
@ -310,14 +310,14 @@ pub struct MutEntries<'a, K, V> {
// it under control.
//
// (This field can legitimately be null.)
priv node: *mut TreeNode<K, V>,
priv remaining_min: uint,
priv remaining_max: uint
node: *mut TreeNode<K, V>,
remaining_min: uint,
remaining_max: uint
}
/// Lazy backward iterator over a map
pub struct RevMutEntries<'a, K, V> {
priv iter: MutEntries<'a, K, V>,
iter: MutEntries<'a, K, V>,
}
@ -482,8 +482,8 @@ fn mut_deref<K, V>(x: &mut Option<~TreeNode<K, V>>) -> *mut TreeNode<K, V> {
/// Lazy forward iterator over a map that consumes the map while iterating
pub struct MoveEntries<K, V> {
priv stack: ~[TreeNode<K, V>],
priv remaining: uint
stack: ~[TreeNode<K, V>],
remaining: uint
}
impl<K, V> Iterator<(K, V)> for MoveEntries<K,V> {
@ -551,7 +551,7 @@ impl<'a, T> Iterator<&'a T> for RevSetItems<'a, T> {
/// `TotalOrd` trait.
#[deriving(Clone)]
pub struct TreeSet<T> {
priv map: TreeMap<T, ()>
map: TreeMap<T, ()>
}
impl<T: Eq + TotalOrd> Eq for TreeSet<T> {
@ -703,36 +703,36 @@ impl<T: TotalOrd> TreeSet<T> {
/// Lazy forward iterator over a set
pub struct SetItems<'a, T> {
priv iter: Entries<'a, T, ()>
iter: Entries<'a, T, ()>
}
/// Lazy backward iterator over a set
pub struct RevSetItems<'a, T> {
priv iter: RevEntries<'a, T, ()>
iter: RevEntries<'a, T, ()>
}
/// Lazy iterator producing elements in the set difference (in-order)
pub struct DifferenceItems<'a, T> {
priv a: Peekable<&'a T, SetItems<'a, T>>,
priv b: Peekable<&'a T, SetItems<'a, T>>,
a: Peekable<&'a T, SetItems<'a, T>>,
b: Peekable<&'a T, SetItems<'a, T>>,
}
/// Lazy iterator producing elements in the set symmetric difference (in-order)
pub struct SymDifferenceItems<'a, T> {
priv a: Peekable<&'a T, SetItems<'a, T>>,
priv b: Peekable<&'a T, SetItems<'a, T>>,
a: Peekable<&'a T, SetItems<'a, T>>,
b: Peekable<&'a T, SetItems<'a, T>>,
}
/// Lazy iterator producing elements in the set intersection (in-order)
pub struct IntersectionItems<'a, T> {
priv a: Peekable<&'a T, SetItems<'a, T>>,
priv b: Peekable<&'a T, SetItems<'a, T>>,
a: Peekable<&'a T, SetItems<'a, T>>,
b: Peekable<&'a T, SetItems<'a, T>>,
}
/// Lazy iterator producing elements in the set intersection (in-order)
pub struct UnionItems<'a, T> {
priv a: Peekable<&'a T, SetItems<'a, T>>,
priv b: Peekable<&'a T, SetItems<'a, T>>,
a: Peekable<&'a T, SetItems<'a, T>>,
b: Peekable<&'a T, SetItems<'a, T>>,
}
/// Compare `x` and `y`, but return `short` if x is None and `long` if y is None

View File

@ -30,8 +30,8 @@ enum Child<T> {
#[allow(missing_doc)]
pub struct TrieMap<T> {
priv root: TrieNode<T>,
priv length: uint
root: TrieNode<T>,
length: uint
}
impl<T> Container for TrieMap<T> {
@ -278,7 +278,7 @@ impl<T> Extendable<(uint, T)> for TrieMap<T> {
#[allow(missing_doc)]
pub struct TrieSet {
priv map: TrieMap<()>
map: TrieMap<()>
}
impl Container for TrieSet {
@ -474,19 +474,19 @@ fn remove<T>(count: &mut uint, child: &mut Child<T>, key: uint,
/// Forward iterator over a map
pub struct Entries<'a, T> {
priv stack: [slice::Items<'a, Child<T>>, .. NUM_CHUNKS],
priv length: uint,
priv remaining_min: uint,
priv remaining_max: uint
stack: [slice::Items<'a, Child<T>>, .. NUM_CHUNKS],
length: uint,
remaining_min: uint,
remaining_max: uint
}
/// Forward iterator over the key-value pairs of a map, with the
/// values being mutable.
pub struct MutEntries<'a, T> {
priv stack: [slice::MutItems<'a, Child<T>>, .. NUM_CHUNKS],
priv length: uint,
priv remaining_min: uint,
priv remaining_max: uint
stack: [slice::MutItems<'a, Child<T>>, .. NUM_CHUNKS],
length: uint,
remaining_min: uint,
remaining_max: uint
}
// FIXME #5846: see `addr!` above.
@ -605,7 +605,7 @@ iterator_impl! { MutEntries, iter = mut_iter, mutability = mut }
/// Forward iterator over a set
pub struct SetItems<'a> {
priv iter: Entries<'a, ()>
iter: Entries<'a, ()>
}
impl<'a> Iterator<uint> for SetItems<'a> {

View File

@ -87,6 +87,8 @@
#![deny(missing_doc)]
#![deny(deprecated_owned_vector)]
#![allow(visible_private_types)] // NOTE: remove after a stage0 snap
#[cfg(test)] #[phase(syntax, link)] extern crate log;
use std::cmp::Eq;
@ -130,13 +132,13 @@ pub enum Occur {
#[deriving(Clone, Eq)]
pub struct Opt {
/// Name of the option
name: Name,
pub name: Name,
/// Whether it has an argument
hasarg: HasArg,
pub hasarg: HasArg,
/// How often it can occur
occur: Occur,
pub occur: Occur,
/// Which options it aliases
priv aliases: Vec<Opt> ,
pub aliases: Vec<Opt> ,
}
/// One group of options, e.g., both -h and --help, along with
@ -144,17 +146,17 @@ pub struct Opt {
#[deriving(Clone, Eq)]
pub struct OptGroup {
/// Short Name of the `OptGroup`
short_name: ~str,
pub short_name: ~str,
/// Long Name of the `OptGroup`
long_name: ~str,
pub long_name: ~str,
/// Hint
hint: ~str,
pub hint: ~str,
/// Description
desc: ~str,
pub desc: ~str,
/// Whether it has an argument
hasarg: HasArg,
pub hasarg: HasArg,
/// How often it can occur
occur: Occur
pub occur: Occur
}
/// Describes wether an option is given at all or has a value.
@ -169,11 +171,12 @@ enum Optval {
#[deriving(Clone, Eq)]
pub struct Matches {
/// Options that matched
priv opts: Vec<Opt> ,
opts: Vec<Opt> ,
/// Values of the Options that matched
priv vals: Vec<Vec<Optval> > ,
vals: Vec<Vec<Optval> > ,
/// Free string fragments
free: Vec<~str> }
pub free: Vec<~str>,
}
/// The type returned when the command line does not conform to the
/// expected format. Call the `to_err_msg` method to retrieve the

View File

@ -41,10 +41,11 @@ use std::path::is_sep;
* pattern - see the `glob` function for more details.
*/
pub struct Paths {
priv root: Path,
priv dir_patterns: Vec<Pattern> ,
priv options: MatchOptions,
priv todo: Vec<(Path,uint)> }
root: Path,
dir_patterns: Vec<Pattern>,
options: MatchOptions,
todo: Vec<(Path,uint)>,
}
///
/// Return an iterator that produces all the Paths that match the given pattern,
@ -176,7 +177,8 @@ fn list_dir_sorted(path: &Path) -> Vec<Path> {
*/
#[deriving(Clone, Eq, TotalEq, Ord, TotalOrd, Hash, Default)]
pub struct Pattern {
priv tokens: Vec<PatternToken> }
tokens: Vec<PatternToken>,
}
#[deriving(Clone, Eq, TotalEq, Ord, TotalOrd, Hash)]
enum PatternToken {
@ -513,13 +515,13 @@ pub struct MatchOptions {
* currently only considers upper/lower case relationships between ASCII characters,
* but in future this might be extended to work with Unicode.
*/
priv case_sensitive: bool,
case_sensitive: bool,
/**
* If this is true then path-component separator characters (e.g. `/` on Posix)
* must be matched by a literal `/`, rather than by `*` or `?` or `[...]`
*/
priv require_literal_separator: bool,
require_literal_separator: bool,
/**
* If this is true then paths that contain components that start with a `.` will
@ -527,7 +529,7 @@ pub struct MatchOptions {
* will not match. This is useful because such files are conventionally considered
* hidden on Unix systems and it might be desirable to skip them when listing files.
*/
priv require_literal_leading_dot: bool
require_literal_leading_dot: bool
}
impl MatchOptions {

View File

@ -22,9 +22,9 @@ use std::raw;
// then misalign the regs again.
pub struct Context {
/// Hold the registers while the task or scheduler is suspended
priv regs: ~Registers,
regs: ~Registers,
/// Lower bound and upper bound for the stack
priv stack_bounds: Option<(uint, uint)>,
stack_bounds: Option<(uint, uint)>,
}
pub type InitFn = extern "C" fn(uint, *(), *()) -> !;

View File

@ -22,10 +22,10 @@ pub struct Coroutine {
///
/// Servo needs this to be public in order to tell SpiderMonkey
/// about the stack bounds.
current_stack_segment: Stack,
pub current_stack_segment: Stack,
/// Always valid if the task is alive and not running.
saved_context: Context
pub saved_context: Context
}
impl Coroutine {

View File

@ -296,10 +296,10 @@ pub fn run(event_loop_factory: fn() -> ~rtio::EventLoop:Send,
/// Configuration of how an M:N pool of schedulers is spawned.
pub struct PoolConfig {
/// The number of schedulers (OS threads) to spawn into this M:N pool.
threads: uint,
pub threads: uint,
/// A factory function used to create new event loops. If this is not
/// specified then the default event loop factory is used.
event_loop_factory: fn() -> ~rtio::EventLoop:Send,
pub event_loop_factory: fn() -> ~rtio::EventLoop:Send,
}
impl PoolConfig {
@ -316,17 +316,17 @@ impl PoolConfig {
/// A structure representing a handle to a pool of schedulers. This handle is
/// used to keep the pool alive and also reap the status from the pool.
pub struct SchedPool {
priv id: uint,
priv threads: ~[Thread<()>],
priv handles: ~[SchedHandle],
priv stealers: ~[deque::Stealer<~task::GreenTask>],
priv next_friend: uint,
priv stack_pool: StackPool,
priv deque_pool: deque::BufferPool<~task::GreenTask>,
priv sleepers: SleeperList,
priv factory: fn() -> ~rtio::EventLoop:Send,
priv task_state: TaskState,
priv tasks_done: Receiver<()>,
id: uint,
threads: ~[Thread<()>],
handles: ~[SchedHandle],
stealers: ~[deque::Stealer<~task::GreenTask>],
next_friend: uint,
stack_pool: StackPool,
deque_pool: deque::BufferPool<~task::GreenTask>,
sleepers: SleeperList,
factory: fn() -> ~rtio::EventLoop:Send,
task_state: TaskState,
tasks_done: Receiver<()>,
}
/// This is an internal state shared among a pool of schedulers. This is used to

View File

@ -23,11 +23,11 @@ pub fn queue<T: Send>() -> (Consumer<T>, Producer<T>) {
}
pub struct Producer<T> {
priv inner: UnsafeArc<mpsc::Queue<T>>,
inner: UnsafeArc<mpsc::Queue<T>>,
}
pub struct Consumer<T> {
priv inner: UnsafeArc<mpsc::Queue<T>>,
inner: UnsafeArc<mpsc::Queue<T>>,
}
impl<T: Send> Consumer<T> {

View File

@ -39,7 +39,12 @@ pub struct Scheduler {
/// ID number of the pool that this scheduler is a member of. When
/// reawakening green tasks, this is used to ensure that tasks aren't
/// reawoken on the wrong pool of schedulers.
pool_id: uint,
pub pool_id: uint,
/// The pool of stacks that this scheduler has cached
pub stack_pool: StackPool,
/// Bookkeeping for the number of tasks which are currently running around
/// inside this pool of schedulers
pub task_state: TaskState,
/// There are N work queues, one per scheduler.
work_queue: deque::Worker<~GreenTask>,
/// Work queues for the other schedulers. These are created by
@ -64,7 +69,6 @@ pub struct Scheduler {
/// A flag to indicate we've received the shutdown message and should
/// no longer try to go to sleep, but exit instead.
no_sleep: bool,
stack_pool: StackPool,
/// The scheduler runs on a special task. When it is not running
/// it is stored here instead of the work queue.
sched_task: Option<~GreenTask>,
@ -87,9 +91,6 @@ pub struct Scheduler {
/// A flag to tell the scheduler loop it needs to do some stealing
/// in order to introduce randomness as part of a yield
steal_for_yield: bool,
/// Bookkeeping for the number of tasks which are currently running around
/// inside this pool of schedulers
task_state: TaskState,
// n.b. currently destructors of an object are run in top-to-bottom in order
// of field declaration. Due to its nature, the pausable idle callback
@ -99,7 +100,7 @@ pub struct Scheduler {
// destroyed before it's actually destroyed.
/// The event loop used to drive the scheduler and perform I/O
event_loop: ~EventLoop:Send,
pub event_loop: ~EventLoop:Send,
}
/// An indication of how hard to work on a given operation, the difference
@ -893,9 +894,9 @@ pub enum SchedMessage {
}
pub struct SchedHandle {
priv remote: ~RemoteCallback:Send,
priv queue: msgq::Producer<SchedMessage>,
sched_id: uint
remote: ~RemoteCallback:Send,
queue: msgq::Producer<SchedMessage>,
pub sched_id: uint
}
impl SchedHandle {

View File

@ -16,7 +16,7 @@ use std::sync::mpmc_bounded_queue::Queue;
use sched::SchedHandle;
pub struct SleeperList {
priv q: Queue<SchedHandle>,
q: Queue<SchedHandle>,
}
impl SleeperList {

View File

@ -15,9 +15,9 @@ use std::libc;
/// A task's stack. The name "Stack" is a vestige of segmented stacks.
pub struct Stack {
priv buf: MemoryMap,
priv min_size: uint,
priv valgrind_id: libc::c_uint,
buf: MemoryMap,
min_size: uint,
valgrind_id: libc::c_uint,
}
// Try to use MAP_STACK on platforms that support it (it's what we're doing
@ -126,7 +126,7 @@ impl Drop for Stack {
pub struct StackPool {
// Ideally this would be some datastructure that preserved ordering on
// Stack.min_size.
priv stacks: ~[Stack],
stacks: ~[Stack],
}
impl StackPool {

View File

@ -42,32 +42,32 @@ pub struct GreenTask {
/// context and the stack that this task owns. This field is optional to
/// relinquish ownership back to a scheduler to recycle stacks at a later
/// date.
coroutine: Option<Coroutine>,
pub coroutine: Option<Coroutine>,
/// Optional handle back into the home sched pool of this task. This field
/// is lazily initialized.
handle: Option<SchedHandle>,
pub handle: Option<SchedHandle>,
/// Slot for maintaining ownership of a scheduler. If a task is running,
/// this value will be Some(sched) where the task is running on "sched".
sched: Option<~Scheduler>,
pub sched: Option<~Scheduler>,
/// Temporary ownership slot of a std::rt::task::Task object. This is used
/// to squirrel that libstd task away while we're performing green task
/// operations.
task: Option<~Task>,
pub task: Option<~Task>,
/// Dictates whether this is a sched task or a normal green task
task_type: TaskType,
pub task_type: TaskType,
/// Home pool that this task was spawned into. This field is lazily
/// initialized until when the task is initially scheduled, and is used to
/// make sure that tasks are always woken up in the correct pool of
/// schedulers.
pool_id: uint,
pub pool_id: uint,
// See the comments in the scheduler about why this is necessary
nasty_deschedule_lock: NativeMutex,
pub nasty_deschedule_lock: NativeMutex,
}
pub enum TaskType {

View File

@ -12,8 +12,8 @@ use std::cmp;
#[deriving(Show, Clone)]
pub struct LogDirective {
name: Option<~str>,
level: u32,
pub name: Option<~str>,
pub level: u32,
}
static LOG_LEVEL_NAMES: [&'static str, ..4] = ["error", "warn", "info",

View File

@ -30,7 +30,7 @@ struct Inner {
}
pub struct FileDesc {
priv inner: UnsafeArc<Inner>
inner: UnsafeArc<Inner>
}
impl FileDesc {
@ -216,8 +216,8 @@ impl Drop for Inner {
}
pub struct CFile {
priv file: *libc::FILE,
priv fd: FileDesc,
file: *libc::FILE,
fd: FileDesc,
}
impl CFile {

View File

@ -34,7 +34,7 @@ struct Inner {
}
pub struct FileDesc {
priv inner: UnsafeArc<Inner>
inner: UnsafeArc<Inner>
}
impl FileDesc {

View File

@ -215,7 +215,7 @@ fn keep_going(data: &[u8], f: |*u8, uint| -> i64) -> i64 {
/// Implementation of rt::rtio's IoFactory trait to generate handles to the
/// native I/O functionality.
pub struct IoFactory {
priv cannot_construct_outside_of_this_module: ()
cannot_construct_outside_of_this_module: ()
}
impl IoFactory {

View File

@ -237,7 +237,7 @@ pub fn init() {
////////////////////////////////////////////////////////////////////////////////
pub struct TcpStream {
priv inner: UnsafeArc<Inner>,
inner: UnsafeArc<Inner>,
}
struct Inner {
@ -373,7 +373,7 @@ impl Drop for Inner {
////////////////////////////////////////////////////////////////////////////////
pub struct TcpListener {
priv inner: UnsafeArc<Inner>,
inner: UnsafeArc<Inner>,
}
impl TcpListener {
@ -430,7 +430,7 @@ impl rtio::RtioSocket for TcpListener {
}
pub struct TcpAcceptor {
priv listener: TcpListener,
listener: TcpListener,
}
impl TcpAcceptor {
@ -474,7 +474,7 @@ impl rtio::RtioTcpAcceptor for TcpAcceptor {
////////////////////////////////////////////////////////////////////////////////
pub struct UdpSocket {
priv inner: UnsafeArc<Inner>,
inner: UnsafeArc<Inner>,
}
impl UdpSocket {

View File

@ -106,7 +106,7 @@ fn bind(addr: &CString, ty: libc::c_int) -> IoResult<Inner> {
////////////////////////////////////////////////////////////////////////////////
pub struct UnixStream {
priv inner: UnsafeArc<Inner>,
inner: UnsafeArc<Inner>,
}
impl UnixStream {
@ -160,7 +160,7 @@ impl rtio::RtioPipe for UnixStream {
////////////////////////////////////////////////////////////////////////////////
pub struct UnixDatagram {
priv inner: UnsafeArc<Inner>,
inner: UnsafeArc<Inner>,
}
impl UnixDatagram {
@ -231,7 +231,7 @@ impl UnixDatagram {
////////////////////////////////////////////////////////////////////////////////
pub struct UnixListener {
priv inner: Inner,
inner: Inner,
}
impl UnixListener {
@ -256,7 +256,7 @@ impl rtio::RtioUnixListener for UnixListener {
}
pub struct UnixAcceptor {
priv listener: UnixListener,
listener: UnixListener,
}
impl UnixAcceptor {

View File

@ -154,9 +154,9 @@ unsafe fn pipe(name: *u16, init: bool) -> libc::HANDLE {
////////////////////////////////////////////////////////////////////////////////
pub struct UnixStream {
priv inner: UnsafeArc<Inner>,
priv write: Option<Event>,
priv read: Option<Event>,
inner: UnsafeArc<Inner>,
write: Option<Event>,
read: Option<Event>,
}
impl UnixStream {
@ -349,8 +349,8 @@ impl rtio::RtioPipe for UnixStream {
////////////////////////////////////////////////////////////////////////////////
pub struct UnixListener {
priv handle: libc::HANDLE,
priv name: CString,
handle: libc::HANDLE,
name: CString,
}
impl UnixListener {
@ -389,8 +389,8 @@ impl rtio::RtioUnixListener for UnixListener {
}
pub struct UnixAcceptor {
priv listener: UnixListener,
priv event: Event,
listener: UnixListener,
event: Event,
}
impl UnixAcceptor {

View File

@ -31,15 +31,15 @@ use super::file;
*/
pub struct Process {
/// The unique id of the process (this should never be negative).
priv pid: pid_t,
pid: pid_t,
/// A handle to the process - on unix this will always be NULL, but on
/// windows it will be a HANDLE to the process, which will prevent the
/// pid being re-used until the handle is closed.
priv handle: *(),
handle: *(),
/// None until finish() is called.
priv exit_code: Option<p::ProcessExit>,
exit_code: Option<p::ProcessExit>,
}
impl Process {

View File

@ -59,8 +59,8 @@ use io::IoResult;
use io::timer_helper;
pub struct Timer {
priv id: uint,
priv inner: Option<~Inner>,
id: uint,
inner: Option<~Inner>,
}
struct Inner {

View File

@ -40,8 +40,8 @@ use io::IoResult;
use io::timer_helper;
pub struct Timer {
priv fd: FileDesc,
priv on_worker: bool,
fd: FileDesc,
on_worker: bool,
}
#[allow(visible_private_types)]
@ -285,24 +285,24 @@ mod imp {
#[cfg(target_arch = "x86_64")]
#[packed]
pub struct epoll_event {
events: u32,
data: i64,
pub events: u32,
pub data: i64,
}
#[cfg(not(target_arch = "x86_64"))]
pub struct epoll_event {
events: u32,
data: i64,
pub events: u32,
pub data: i64,
}
pub struct timespec {
tv_sec: libc::time_t,
tv_nsec: libc::c_long,
pub tv_sec: libc::time_t,
pub tv_nsec: libc::c_long,
}
pub struct itimerspec {
it_interval: timespec,
it_value: timespec,
pub it_interval: timespec,
pub it_value: timespec,
}
extern {

View File

@ -29,8 +29,8 @@ use io::timer_helper;
use io::IoResult;
pub struct Timer {
priv obj: libc::HANDLE,
priv on_worker: bool,
obj: libc::HANDLE,
on_worker: bool,
}
pub enum Req {

View File

@ -51,6 +51,8 @@
#![deny(unused_result, unused_must_use)]
#![allow(non_camel_case_types)]
#![allow(visible_private_types)] // NOTE: remove after a stage0 snap
// NB this crate explicitly does *not* allow glob imports, please seriously
// consider whether they're needed before adding that feature here (the
// answer is that you don't need them)

View File

@ -86,7 +86,7 @@ A `BigUint`-typed value `BigUint { data: ~[a, b, c] }` represents a number
*/
#[deriving(Clone)]
pub struct BigUint {
priv data: Vec<BigDigit>
data: Vec<BigDigit>
}
impl Eq for BigUint {
@ -863,8 +863,8 @@ impl Neg<Sign> for Sign {
/// A big signed integer type.
#[deriving(Clone)]
pub struct BigInt {
priv sign: Sign,
priv data: BigUint
sign: Sign,
data: BigUint
}
impl Eq for BigInt {

View File

@ -22,8 +22,8 @@ use bigint::{BigInt, BigUint, Sign, Plus, Minus};
#[deriving(Clone)]
#[allow(missing_doc)]
pub struct Ratio<T> {
priv numer: T,
priv denom: T
numer: T,
denom: T
}
/// Alias for a `Ratio` of machine-sized integers.

View File

@ -66,7 +66,7 @@ impl Rand for Exp1 {
/// ```
pub struct Exp {
/// `lambda` stored as `1/lambda`, since this is what we scale by.
priv lambda_inverse: f64
lambda_inverse: f64
}
impl Exp {

View File

@ -236,11 +236,11 @@ impl IndependentSample<f64> for ChiSquared {
/// println!("{} is from an F(2, 32) distribution", v)
/// ```
pub struct FisherF {
priv numer: ChiSquared,
priv denom: ChiSquared,
numer: ChiSquared,
denom: ChiSquared,
// denom_dof / numer_dof so that this can just be a straight
// multiplication, rather than a division.
priv dof_ratio: f64,
dof_ratio: f64,
}
impl FisherF {
@ -279,8 +279,8 @@ impl IndependentSample<f64> for FisherF {
/// println!("{} is from a t(11) distribution", v)
/// ```
pub struct StudentT {
priv chi: ChiSquared,
priv dof: f64
chi: ChiSquared,
dof: f64
}
impl StudentT {

View File

@ -71,9 +71,9 @@ impl<Sup: Rand> IndependentSample<Sup> for RandSample<Sup> {
/// A value with a particular weight for use with `WeightedChoice`.
pub struct Weighted<T> {
/// The numerical weight of this item
weight: uint,
pub weight: uint,
/// The actual item which is being weighted
item: T,
pub item: T,
}
/// A distribution that selects from a finite collection of weighted items.
@ -101,8 +101,8 @@ pub struct Weighted<T> {
/// }
/// ```
pub struct WeightedChoice<T> {
priv items: ~[Weighted<T>],
priv weight_range: Range<uint>
pub items: ~[Weighted<T>],
pub weight_range: Range<uint>
}
impl<T: Clone> WeightedChoice<T> {

View File

@ -82,8 +82,8 @@ impl Rand for StandardNormal {
/// println!("{} is from a N(2, 9) distribution", v)
/// ```
pub struct Normal {
priv mean: f64,
priv std_dev: f64
mean: f64,
std_dev: f64,
}
impl Normal {
@ -124,7 +124,7 @@ impl IndependentSample<f64> for Normal {
/// println!("{} is from an ln N(2, 9) distribution", v)
/// ```
pub struct LogNormal {
priv norm: Normal
norm: Normal
}
impl LogNormal {

View File

@ -46,9 +46,9 @@ use distributions::{Sample, IndependentSample};
/// }
/// ```
pub struct Range<X> {
priv low: X,
priv range: X,
priv accept_zone: X
low: X,
range: X,
accept_zone: X
}
impl<X: SampleRange + Ord> Range<X> {

View File

@ -28,12 +28,12 @@ static RAND_SIZE: u32 = 1 << RAND_SIZE_LEN;
/// [1]: Bob Jenkins, [*ISAAC: A fast cryptographic random number
/// generator*](http://www.burtleburtle.net/bob/rand/isaacafa.html)
pub struct IsaacRng {
priv cnt: u32,
priv rsl: [u32, .. RAND_SIZE],
priv mem: [u32, .. RAND_SIZE],
priv a: u32,
priv b: u32,
priv c: u32
cnt: u32,
rsl: [u32, .. RAND_SIZE],
mem: [u32, .. RAND_SIZE],
a: u32,
b: u32,
c: u32
}
static EMPTY: IsaacRng = IsaacRng {
cnt: 0,
@ -231,12 +231,12 @@ static RAND_SIZE_64: uint = 1 << RAND_SIZE_64_LEN;
/// [1]: Bob Jenkins, [*ISAAC: A fast cryptographic random number
/// generator*](http://www.burtleburtle.net/bob/rand/isaacafa.html)
pub struct Isaac64Rng {
priv cnt: uint,
priv rsl: [u64, .. RAND_SIZE_64],
priv mem: [u64, .. RAND_SIZE_64],
priv a: u64,
priv b: u64,
priv c: u64,
cnt: uint,
rsl: [u64, .. RAND_SIZE_64],
mem: [u64, .. RAND_SIZE_64],
a: u64,
b: u64,
c: u64,
}
static EMPTY_64: Isaac64Rng = Isaac64Rng {

View File

@ -72,6 +72,8 @@ println!("{:?}", tuple_ptr)
#![feature(macro_rules, managed_boxes, phase)]
#![allow(visible_private_types)] // NOTE: remove after a stage0 snap
#[cfg(test)]
#[phase(syntax, link)] extern crate log;
@ -407,12 +409,12 @@ pub fn rng() -> StdRng {
/// The standard RNG. This is designed to be efficient on the current
/// platform.
#[cfg(not(target_word_size="64"))]
pub struct StdRng { priv rng: IsaacRng }
pub struct StdRng { rng: IsaacRng }
/// The standard RNG. This is designed to be efficient on the current
/// platform.
#[cfg(target_word_size="64")]
pub struct StdRng { priv rng: Isaac64Rng }
pub struct StdRng { rng: Isaac64Rng }
impl StdRng {
/// Create a randomly seeded instance of `StdRng`.
@ -489,10 +491,10 @@ pub fn weak_rng() -> XorShiftRng {
/// RNGs"](http://www.jstatsoft.org/v08/i14/paper). *Journal of
/// Statistical Software*. Vol. 8 (Issue 14).
pub struct XorShiftRng {
priv x: u32,
priv y: u32,
priv z: u32,
priv w: u32,
x: u32,
y: u32,
z: u32,
w: u32,
}
impl Rng for XorShiftRng {
@ -573,8 +575,8 @@ pub struct TaskRng {
// The use of unsafe code here is OK if the invariants above are
// satisfied; and it allows us to avoid (unnecessarily) using a
// GC'd or RC'd pointer.
priv rng: *mut TaskRngInner,
priv marker: marker::NoSend,
rng: *mut TaskRngInner,
marker: marker::NoSend,
}
// used to make space in TLS for a random number generator

View File

@ -30,7 +30,7 @@ mod imp {
/// This does not block.
#[cfg(unix)]
pub struct OSRng {
priv inner: ReaderRng<File>
inner: ReaderRng<File>
}
impl OSRng {
@ -77,7 +77,7 @@ mod imp {
///
/// This does not block.
pub struct OSRng {
priv hcryptprov: HCRYPTPROV
hcryptprov: HCRYPTPROV
}
static PROV_RSA_FULL: DWORD = 1;

View File

@ -27,7 +27,7 @@ use Rng;
/// println!("{:x}", rng.gen::<uint>());
/// ```
pub struct ReaderRng<R> {
priv reader: R
reader: R
}
impl<R: Reader> ReaderRng<R> {

View File

@ -21,11 +21,11 @@ static DEFAULT_GENERATION_THRESHOLD: uint = 32 * 1024;
/// A wrapper around any RNG which reseeds the underlying RNG after it
/// has generated a certain number of random bytes.
pub struct ReseedingRng<R, Rsdr> {
priv rng: R,
priv generation_threshold: uint,
priv bytes_generated: uint,
rng: R,
generation_threshold: uint,
bytes_generated: uint,
/// Controls the behaviour when reseeding the RNG.
reseeder: Rsdr
pub reseeder: Rsdr,
}
impl<R: Rng, Rsdr: Reseeder<R>> ReseedingRng<R, Rsdr> {

View File

@ -28,12 +28,12 @@ use syntax::abi;
pub static METADATA_FILENAME: &'static str = "rust.metadata.bin";
pub struct Archive<'a> {
priv sess: &'a Session,
priv dst: Path,
sess: &'a Session,
dst: Path,
}
pub struct ArchiveRO {
priv ptr: ArchiveRef,
ptr: ArchiveRef,
}
fn run_ar(sess: &Session, args: &str, cwd: Option<&Path>,

View File

@ -54,7 +54,7 @@ use syntax::ast;
#[deriving(Clone, Eq)]
pub struct Svh {
priv hash: ~str,
hash: ~str,
}
impl Svh {

View File

@ -11,9 +11,9 @@
#![allow(non_camel_case_types)]
pub struct t {
module_asm: ~str,
meta_sect_name: ~str,
data_layout: ~str,
target_triple: ~str,
cc_args: Vec<~str> ,
pub module_asm: ~str,
pub meta_sect_name: ~str,
pub data_layout: ~str,
pub target_triple: ~str,
pub cc_args: Vec<~str> ,
}

View File

@ -270,12 +270,12 @@ pub fn phase_2_configure_and_expand(sess: &Session,
}
pub struct CrateAnalysis {
exp_map2: middle::resolve::ExportMap2,
exported_items: middle::privacy::ExportedItems,
public_items: middle::privacy::PublicItems,
ty_cx: ty::ctxt,
maps: astencode::Maps,
reachable: NodeSet,
pub exp_map2: middle::resolve::ExportMap2,
pub exported_items: middle::privacy::ExportedItems,
pub public_items: middle::privacy::PublicItems,
pub ty_cx: ty::ctxt,
pub maps: astencode::Maps,
pub reachable: NodeSet,
}
/// Run the resolution, typechecking, region checking and other
@ -409,12 +409,12 @@ pub fn phase_3_run_analysis_passes(sess: Session,
}
pub struct CrateTranslation {
context: ContextRef,
module: ModuleRef,
metadata_module: ModuleRef,
link: LinkMeta,
metadata: Vec<u8> ,
reachable: Vec<~str> ,
pub context: ContextRef,
pub module: ModuleRef,
pub metadata_module: ModuleRef,
pub link: LinkMeta,
pub metadata: Vec<u8>,
pub reachable: Vec<~str>,
}
/// Run the translation phase to LLVM, after which the AST and analysis can
@ -1124,9 +1124,9 @@ pub fn optgroups() -> Vec<getopts::OptGroup> {
}
pub struct OutputFilenames {
out_directory: Path,
out_filestem: ~str,
single_output_file: Option<Path>,
pub out_directory: Path,
pub out_filestem: ~str,
pub single_output_file: Option<Path>,
}
impl OutputFilenames {

View File

@ -31,11 +31,11 @@ use std::cell::{Cell, RefCell};
use collections::HashSet;
pub struct Config {
os: abi::Os,
arch: abi::Architecture,
target_strs: target_strs::t,
int_type: IntTy,
uint_type: UintTy,
pub os: abi::Os,
pub arch: abi::Architecture,
pub target_strs: target_strs::t,
pub int_type: IntTy,
pub uint_type: UintTy,
}
macro_rules! debugging_opts(
@ -124,34 +124,34 @@ pub enum DebugInfoLevel {
pub struct Options {
// The crate config requested for the session, which may be combined
// with additional crate configurations during the compile process
crate_types: Vec<CrateType> ,
pub crate_types: Vec<CrateType> ,
gc: bool,
optimize: OptLevel,
debuginfo: DebugInfoLevel,
lint_opts: Vec<(lint::Lint, lint::level)> ,
output_types: Vec<back::link::OutputType> ,
pub gc: bool,
pub optimize: OptLevel,
pub debuginfo: DebugInfoLevel,
pub lint_opts: Vec<(lint::Lint, lint::level)> ,
pub output_types: Vec<back::link::OutputType> ,
// This was mutable for rustpkg, which updates search paths based on the
// parsed code. It remains mutable in case its replacements wants to use
// this.
addl_lib_search_paths: RefCell<HashSet<Path>>,
maybe_sysroot: Option<Path>,
target_triple: ~str,
pub addl_lib_search_paths: RefCell<HashSet<Path>>,
pub maybe_sysroot: Option<Path>,
pub target_triple: ~str,
// User-specified cfg meta items. The compiler itself will add additional
// items to the crate config, and during parsing the entire crate config
// will be added to the crate AST node. This should not be used for
// anything except building the full crate config prior to parsing.
cfg: ast::CrateConfig,
test: bool,
parse_only: bool,
no_trans: bool,
no_analysis: bool,
debugging_opts: u64,
pub cfg: ast::CrateConfig,
pub test: bool,
pub parse_only: bool,
pub no_trans: bool,
pub no_analysis: bool,
pub debugging_opts: u64,
/// Whether to write dependency files. It's (enabled, optional filename).
write_dependency_info: (bool, Option<Path>),
pub write_dependency_info: (bool, Option<Path>),
/// Crate id-related things to maybe print. It's (crate_id, crate_name, crate_file_name).
print_metas: (bool, bool, bool),
cg: CodegenOptions,
pub print_metas: (bool, bool, bool),
pub cg: CodegenOptions,
}
// The type of entry function, so
@ -174,28 +174,28 @@ pub enum CrateType {
}
pub struct Session {
targ_cfg: Config,
opts: Options,
cstore: metadata::cstore::CStore,
parse_sess: ParseSess,
pub targ_cfg: Config,
pub opts: Options,
pub cstore: metadata::cstore::CStore,
pub parse_sess: ParseSess,
// For a library crate, this is always none
entry_fn: RefCell<Option<(NodeId, codemap::Span)>>,
entry_type: Cell<Option<EntryFnType>>,
macro_registrar_fn: RefCell<Option<ast::DefId>>,
default_sysroot: Option<Path>,
building_library: Cell<bool>,
pub entry_fn: RefCell<Option<(NodeId, codemap::Span)>>,
pub entry_type: Cell<Option<EntryFnType>>,
pub macro_registrar_fn: RefCell<Option<ast::DefId>>,
pub default_sysroot: Option<Path>,
pub building_library: Cell<bool>,
// The name of the root source file of the crate, in the local file system. The path is always
// expected to be absolute. `None` means that there is no source file.
local_crate_source_file: Option<Path>,
working_dir: Path,
lints: RefCell<NodeMap<Vec<(lint::Lint, codemap::Span, ~str)>>>,
node_id: Cell<ast::NodeId>,
crate_types: RefCell<Vec<CrateType>>,
features: front::feature_gate::Features,
pub local_crate_source_file: Option<Path>,
pub working_dir: Path,
pub lints: RefCell<NodeMap<Vec<(lint::Lint, codemap::Span, ~str)>>>,
pub node_id: Cell<ast::NodeId>,
pub crate_types: RefCell<Vec<CrateType>>,
pub features: front::feature_gate::Features,
/// The maximum recursion limit for potentially infinitely recursive
/// operations such as auto-dereference and monomorphization.
recursion_limit: Cell<uint>,
pub recursion_limit: Cell<uint>,
}
impl Session {
@ -365,7 +365,7 @@ macro_rules! cgoptions(
($($opt:ident : $t:ty = ($init:expr, $parse:ident, $desc:expr)),* ,) =>
(
#[deriving(Clone)]
pub struct CodegenOptions { $($opt: $t),* }
pub struct CodegenOptions { $(pub $opt: $t),* }
pub fn basic_codegen_options() -> CodegenOptions {
CodegenOptions { $($opt: $init),* }

View File

@ -74,7 +74,7 @@ enum Status {
/// A set of features to be used by later passes.
pub struct Features {
default_type_params: Cell<bool>
pub default_type_params: Cell<bool>
}
impl Features {

View File

@ -31,6 +31,9 @@ This API is completely unstable and subject to change.
#![feature(macro_rules, globs, struct_variant, managed_boxes, quote,
default_type_params, phase)]
#![allow(visible_private_types)] // NOTE: remove after a stage0 snap
#![allow(unrecognized_lint)] // NOTE: remove after a stage0 snap
extern crate flate;
extern crate arena;
extern crate syntax;

View File

@ -1878,7 +1878,7 @@ impl TypeNames {
/* Memory-managed interface to target data. */
pub struct target_data_res {
td: TargetDataRef,
pub td: TargetDataRef,
}
impl Drop for target_data_res {
@ -1896,7 +1896,7 @@ pub fn target_data_res(td: TargetDataRef) -> target_data_res {
}
pub struct TargetData {
lltd: TargetDataRef,
pub lltd: TargetDataRef,
dtor: @target_data_res
}
@ -1914,7 +1914,7 @@ pub fn mk_target_data(string_rep: &str) -> TargetData {
/* Memory-managed interface to pass managers. */
pub struct pass_manager_res {
pm: PassManagerRef,
pub pm: PassManagerRef,
}
impl Drop for pass_manager_res {
@ -1932,7 +1932,7 @@ pub fn pass_manager_res(pm: PassManagerRef) -> pass_manager_res {
}
pub struct PassManager {
llpm: PassManagerRef,
pub llpm: PassManagerRef,
dtor: @pass_manager_res
}
@ -1950,7 +1950,7 @@ pub fn mk_pass_manager() -> PassManager {
/* Memory-managed interface to object files. */
pub struct ObjectFile {
llof: ObjectFileRef,
pub llof: ObjectFileRef,
}
impl ObjectFile {
@ -1981,7 +1981,7 @@ impl Drop for ObjectFile {
/* Memory-managed interface to section iterators. */
pub struct section_iter_res {
si: SectionIteratorRef,
pub si: SectionIteratorRef,
}
impl Drop for section_iter_res {
@ -1999,7 +1999,7 @@ pub fn section_iter_res(si: SectionIteratorRef) -> section_iter_res {
}
pub struct SectionIter {
llsi: SectionIteratorRef,
pub llsi: SectionIteratorRef,
dtor: @section_iter_res
}

View File

@ -210,6 +210,6 @@ pub static tag_macro_def: uint = 0x65;
#[deriving(Clone, Show)]
pub struct LinkMeta {
crateid: CrateId,
crate_hash: Svh,
pub crateid: CrateId,
pub crate_hash: Svh,
}

View File

@ -371,7 +371,7 @@ fn resolve_crate_deps(e: &mut Env,
}
pub struct Loader<'a> {
priv env: Env<'a>,
env: Env<'a>,
}
impl<'a> Loader<'a> {

View File

@ -26,10 +26,10 @@ use syntax::diagnostic::expect;
use syntax::parse::token;
pub struct StaticMethodInfo {
ident: ast::Ident,
def_id: ast::DefId,
purity: ast::Purity,
vis: ast::Visibility,
pub ident: ast::Ident,
pub def_id: ast::DefId,
pub purity: ast::Purity,
pub vis: ast::Visibility,
}
pub fn get_symbol(cstore: &cstore::CStore, def: ast::DefId) -> ~str {

View File

@ -37,10 +37,10 @@ pub enum MetadataBlob {
}
pub struct crate_metadata {
name: ~str,
data: MetadataBlob,
cnum_map: cnum_map,
cnum: ast::CrateNum
pub name: ~str,
pub data: MetadataBlob,
pub cnum_map: cnum_map,
pub cnum: ast::CrateNum,
}
#[deriving(Eq)]
@ -60,18 +60,18 @@ pub enum NativeLibaryKind {
// must be non-None.
#[deriving(Eq, Clone)]
pub struct CrateSource {
dylib: Option<Path>,
rlib: Option<Path>,
cnum: ast::CrateNum,
pub dylib: Option<Path>,
pub rlib: Option<Path>,
pub cnum: ast::CrateNum,
}
pub struct CStore {
priv metas: RefCell<HashMap<ast::CrateNum, @crate_metadata>>,
priv extern_mod_crate_map: RefCell<extern_mod_crate_map>,
priv used_crate_sources: RefCell<Vec<CrateSource> >,
priv used_libraries: RefCell<Vec<(~str, NativeLibaryKind)> >,
priv used_link_args: RefCell<Vec<~str> >,
intr: Rc<IdentInterner>
metas: RefCell<HashMap<ast::CrateNum, @crate_metadata>>,
extern_mod_crate_map: RefCell<extern_mod_crate_map>,
used_crate_sources: RefCell<Vec<CrateSource>>,
used_libraries: RefCell<Vec<(~str, NativeLibaryKind)>>,
used_link_args: RefCell<Vec<~str>>,
pub intr: Rc<IdentInterner>,
}
// Map from NodeId's of local extern crate statements to crate numbers

View File

@ -1108,9 +1108,9 @@ pub fn get_crate_attributes(data: &[u8]) -> Vec<ast::Attribute> {
#[deriving(Clone)]
pub struct CrateDep {
cnum: ast::CrateNum,
crate_id: CrateId,
hash: Svh,
pub cnum: ast::CrateNum,
pub crate_id: CrateId,
pub hash: Svh,
}
pub fn get_crate_deps(data: &[u8]) -> Vec<CrateDep> {

View File

@ -69,14 +69,14 @@ pub type EncodeInlinedItem<'a> = 'a |ecx: &EncodeContext,
ii: InlinedItemRef|;
pub struct EncodeParams<'a> {
diag: &'a SpanHandler,
tcx: &'a ty::ctxt,
reexports2: middle::resolve::ExportMap2,
item_symbols: &'a RefCell<NodeMap<~str>>,
non_inlineable_statics: &'a RefCell<NodeSet>,
link_meta: &'a LinkMeta,
cstore: &'a cstore::CStore,
encode_inlined_item: EncodeInlinedItem<'a>,
pub diag: &'a SpanHandler,
pub tcx: &'a ty::ctxt,
pub reexports2: middle::resolve::ExportMap2,
pub item_symbols: &'a RefCell<NodeMap<~str>>,
pub non_inlineable_statics: &'a RefCell<NodeSet>,
pub link_meta: &'a LinkMeta,
pub cstore: &'a cstore::CStore,
pub encode_inlined_item: EncodeInlinedItem<'a>,
}
pub struct Stats {
@ -96,16 +96,16 @@ pub struct Stats {
}
pub struct EncodeContext<'a> {
diag: &'a SpanHandler,
tcx: &'a ty::ctxt,
stats: @Stats,
reexports2: middle::resolve::ExportMap2,
item_symbols: &'a RefCell<NodeMap<~str>>,
non_inlineable_statics: &'a RefCell<NodeSet>,
link_meta: &'a LinkMeta,
cstore: &'a cstore::CStore,
encode_inlined_item: EncodeInlinedItem<'a>,
type_abbrevs: abbrev_map,
pub diag: &'a SpanHandler,
pub tcx: &'a ty::ctxt,
pub stats: @Stats,
pub reexports2: middle::resolve::ExportMap2,
pub item_symbols: &'a RefCell<NodeMap<~str>>,
pub non_inlineable_statics: &'a RefCell<NodeSet>,
pub link_meta: &'a LinkMeta,
pub cstore: &'a cstore::CStore,
pub encode_inlined_item: EncodeInlinedItem<'a>,
pub type_abbrevs: abbrev_map,
}
fn encode_name(ebml_w: &mut Encoder, name: Name) {

View File

@ -26,9 +26,9 @@ pub enum FileMatch { FileMatches, FileDoesntMatch }
pub type pick<'a> = 'a |path: &Path| -> FileMatch;
pub struct FileSearch<'a> {
sysroot: &'a Path,
addl_lib_search_paths: &'a RefCell<HashSet<Path>>,
target_triple: &'a str
pub sysroot: &'a Path,
pub addl_lib_search_paths: &'a RefCell<HashSet<Path>>,
pub target_triple: &'a str
}
impl<'a> FileSearch<'a> {

View File

@ -46,27 +46,27 @@ pub enum Os {
}
pub struct Context<'a> {
sess: &'a Session,
span: Span,
ident: &'a str,
crate_id: &'a CrateId,
id_hash: &'a str,
hash: Option<&'a Svh>,
os: Os,
intr: Rc<IdentInterner>,
rejected_via_hash: bool,
pub sess: &'a Session,
pub span: Span,
pub ident: &'a str,
pub crate_id: &'a CrateId,
pub id_hash: &'a str,
pub hash: Option<&'a Svh>,
pub os: Os,
pub intr: Rc<IdentInterner>,
pub rejected_via_hash: bool,
}
pub struct Library {
dylib: Option<Path>,
rlib: Option<Path>,
metadata: MetadataBlob,
pub dylib: Option<Path>,
pub rlib: Option<Path>,
pub metadata: MetadataBlob,
}
pub struct ArchiveMetadata {
priv archive: ArchiveRO,
archive: ArchiveRO,
// See comments in ArchiveMetadata::new for why this is static
priv data: &'static [u8],
data: &'static [u8],
}
// FIXME(#11857) this should be a "real" realpath

View File

@ -34,12 +34,12 @@ macro_rules! mywrite( ($wr:expr, $($arg:tt)*) => (
) )
pub struct ctxt<'a> {
diag: &'a SpanHandler,
pub diag: &'a SpanHandler,
// Def -> str Callback:
ds: fn(DefId) -> ~str,
pub ds: fn(DefId) -> ~str,
// The type context.
tcx: &'a ty::ctxt,
abbrevs: abbrev_ctxt
pub tcx: &'a ty::ctxt,
pub abbrevs: abbrev_ctxt
}
// Compact string representation for ty.t values. API ty_str & parse_from_str.

View File

@ -53,10 +53,10 @@ use writer = serialize::ebml::writer;
// Auxiliary maps of things to be encoded
pub struct Maps {
root_map: middle::borrowck::root_map,
method_map: middle::typeck::MethodMap,
vtable_map: middle::typeck::vtable_map,
capture_map: RefCell<middle::moves::CaptureMap>,
pub root_map: middle::borrowck::root_map,
pub method_map: middle::typeck::MethodMap,
pub vtable_map: middle::typeck::vtable_map,
pub capture_map: RefCell<middle::moves::CaptureMap>,
}
struct DecodeContext<'a> {

View File

@ -207,8 +207,8 @@ pub struct BorrowStats {
// is T, which is not a box.
#[deriving(Eq, TotalEq, Hash)]
pub struct root_map_key {
id: ast::NodeId,
derefs: uint
pub id: ast::NodeId,
pub derefs: uint
}
pub type BckResult<T> = Result<T, BckError>;
@ -378,7 +378,7 @@ impl Repr for RestrictionSet {
// uncovered after a certain number of auto-derefs.
pub struct RootInfo {
scope: ast::NodeId,
pub scope: ast::NodeId,
}
pub type root_map = @RefCell<HashMap<root_map_key, RootInfo>>;

View File

@ -30,37 +30,37 @@ use util::ppaux::Repr;
pub struct MoveData {
/// Move paths. See section "Move paths" in `doc.rs`.
paths: RefCell<Vec<MovePath>>,
pub paths: RefCell<Vec<MovePath>>,
/// Cache of loan path to move path index, for easy lookup.
path_map: RefCell<HashMap<@LoanPath, MovePathIndex>>,
pub path_map: RefCell<HashMap<@LoanPath, MovePathIndex>>,
/// Each move or uninitialized variable gets an entry here.
moves: RefCell<Vec<Move>>,
pub moves: RefCell<Vec<Move>>,
/// Assignments to a variable, like `x = foo`. These are assigned
/// bits for dataflow, since we must track them to ensure that
/// immutable variables are assigned at most once along each path.
var_assignments: RefCell<Vec<Assignment>>,
pub var_assignments: RefCell<Vec<Assignment>>,
/// Assignments to a path, like `x.f = foo`. These are not
/// assigned dataflow bits, but we track them because they still
/// kill move bits.
path_assignments: RefCell<Vec<Assignment>>,
pub path_assignments: RefCell<Vec<Assignment>>,
/// Assignments to a variable or path, like `x = foo`, but not `x += foo`.
assignee_ids: RefCell<HashSet<ast::NodeId>>,
pub assignee_ids: RefCell<HashSet<ast::NodeId>>,
}
pub struct FlowedMoveData<'a> {
move_data: MoveData,
pub move_data: MoveData,
dfcx_moves: MoveDataFlow<'a>,
pub dfcx_moves: MoveDataFlow<'a>,
// We could (and maybe should, for efficiency) combine both move
// and assign data flow into one, but this way it's easier to
// distinguish the bits that correspond to moves and assignments.
dfcx_assign: AssignDataFlow<'a>
pub dfcx_assign: AssignDataFlow<'a>
}
/// Index into `MoveData.paths`, used like a pointer
@ -97,21 +97,21 @@ static InvalidMoveIndex: MoveIndex =
pub struct MovePath {
/// Loan path corresponding to this move path
loan_path: @LoanPath,
pub loan_path: @LoanPath,
/// Parent pointer, `InvalidMovePathIndex` if root
parent: MovePathIndex,
pub parent: MovePathIndex,
/// Head of linked list of moves to this path,
/// `InvalidMoveIndex` if not moved
first_move: MoveIndex,
pub first_move: MoveIndex,
/// First node in linked list of children, `InvalidMovePathIndex` if leaf
first_child: MovePathIndex,
pub first_child: MovePathIndex,
/// Next node in linked list of parent's children (siblings),
/// `InvalidMovePathIndex` if none.
next_sibling: MovePathIndex,
pub next_sibling: MovePathIndex,
}
pub enum MoveKind {
@ -123,27 +123,27 @@ pub enum MoveKind {
pub struct Move {
/// Path being moved.
path: MovePathIndex,
pub path: MovePathIndex,
/// id of node that is doing the move.
id: ast::NodeId,
pub id: ast::NodeId,
/// Kind of move, for error messages.
kind: MoveKind,
pub kind: MoveKind,
/// Next node in linked list of moves from `path`, or `InvalidMoveIndex`
next_move: MoveIndex
pub next_move: MoveIndex
}
pub struct Assignment {
/// Path being assigned.
path: MovePathIndex,
pub path: MovePathIndex,
/// id where assignment occurs
id: ast::NodeId,
pub id: ast::NodeId,
/// span of node where assignment occurs
span: Span,
pub span: Span,
}
pub struct MoveDataFlowOperator;

View File

@ -31,21 +31,21 @@ use util::nodemap::NodeMap;
#[deriving(Clone)]
pub struct DataFlowContext<'a, O> {
priv tcx: &'a ty::ctxt,
priv method_map: typeck::MethodMap,
tcx: &'a ty::ctxt,
method_map: typeck::MethodMap,
/// the data flow operator
priv oper: O,
oper: O,
/// number of bits to propagate per id
priv bits_per_id: uint,
bits_per_id: uint,
/// number of words we will use to store bits_per_id.
/// equal to bits_per_id/uint::BITS rounded up.
priv words_per_id: uint,
words_per_id: uint,
// mapping from node to bitset index.
priv nodeid_to_bitset: NodeMap<uint>,
nodeid_to_bitset: NodeMap<uint>,
// Bit sets per id. The following three fields (`gens`, `kills`,
// and `on_entry`) all have the same structure. For each id in
@ -54,14 +54,15 @@ pub struct DataFlowContext<'a, O> {
// the full vector (see the method `compute_id_range()`).
/// bits generated as we exit the scope `id`. Updated by `add_gen()`.
priv gens: Vec<uint> ,
gens: Vec<uint>,
/// bits killed as we exit the scope `id`. Updated by `add_kill()`.
priv kills: Vec<uint> ,
kills: Vec<uint>,
/// bits that are valid on entry to the scope `id`. Updated by
/// `propagate()`.
priv on_entry: Vec<uint> }
on_entry: Vec<uint>,
}
/// Parameterization for the precise form of data flow that is used.
pub trait DataFlowOperator {

View File

@ -26,8 +26,8 @@ use syntax::visit::Visitor;
// (The def_upvar will already have been stripped).
#[deriving(Encodable, Decodable)]
pub struct freevar_entry {
def: ast::Def, //< The variable being accessed free.
span: Span //< First span where it is accessed (there can be multiple)
pub def: ast::Def, //< The variable being accessed free.
pub span: Span //< First span where it is accessed (there can be multiple)
}
pub type freevar_info = @Vec<@freevar_entry> ;
pub type freevar_map = NodeMap<freevar_info>;

View File

@ -37,20 +37,20 @@ be indexed by the direction (see the type `Direction`).
use std::uint;
pub struct Graph<N,E> {
priv nodes: Vec<Node<N>> ,
priv edges: Vec<Edge<E>> ,
nodes: Vec<Node<N>> ,
edges: Vec<Edge<E>> ,
}
pub struct Node<N> {
priv first_edge: [EdgeIndex, ..2], // see module comment
data: N,
first_edge: [EdgeIndex, ..2], // see module comment
pub data: N,
}
pub struct Edge<E> {
priv next_edge: [EdgeIndex, ..2], // see module comment
priv source: NodeIndex,
priv target: NodeIndex,
data: E,
next_edge: [EdgeIndex, ..2], // see module comment
source: NodeIndex,
target: NodeIndex,
pub data: E,
}
#[deriving(Eq)]
@ -62,7 +62,7 @@ pub struct EdgeIndex(uint);
pub static InvalidEdgeIndex: EdgeIndex = EdgeIndex(uint::MAX);
// Use a private field here to guarantee no more instances are created:
pub struct Direction { priv repr: uint }
pub struct Direction { repr: uint }
pub static Outgoing: Direction = Direction { repr: 0 };
pub static Incoming: Direction = Direction { repr: 1 };

View File

@ -47,7 +47,7 @@ pub enum LangItem {
}
pub struct LanguageItems {
items: Vec<Option<ast::DefId>> ,
pub items: Vec<Option<ast::DefId>> ,
}
impl LanguageItems {

View File

@ -135,9 +135,9 @@ pub enum level {
#[deriving(Clone, Eq, Ord, TotalEq, TotalOrd)]
pub struct LintSpec {
default: level,
lint: Lint,
desc: &'static str,
pub default: level,
pub lint: Lint,
pub desc: &'static str,
}
pub type LintDict = HashMap<&'static str, LintSpec>;
@ -1506,7 +1506,7 @@ fn check_missing_doc_ty_method(cx: &Context, tm: &ast::TypeMethod) {
fn check_missing_doc_struct_field(cx: &Context, sf: &ast::StructField) {
match sf.node.kind {
ast::NamedField(_, vis) if vis != ast::Private =>
ast::NamedField(_, vis) if vis == ast::Public =>
check_missing_doc_attrs(cx,
Some(cx.cur_struct_def_id),
sf.node.attrs.as_slice(),

View File

@ -90,8 +90,8 @@ pub enum categorization {
#[deriving(Eq)]
pub struct CopiedUpvar {
upvar_id: ast::NodeId,
onceness: ast::Onceness,
pub upvar_id: ast::NodeId,
pub onceness: ast::Onceness,
}
// different kinds of pointers:
@ -147,11 +147,11 @@ pub enum MutabilityCategory {
// fashion. For more details, see the method `cat_pattern`
#[deriving(Eq)]
pub struct cmt_ {
id: ast::NodeId, // id of expr/pat producing this value
span: Span, // span of same expr/pat
cat: categorization, // categorization of expr
mutbl: MutabilityCategory, // mutability of expr as lvalue
ty: ty::t // type of the expr (*see WARNING above*)
pub id: ast::NodeId, // id of expr/pat producing this value
pub span: Span, // span of same expr/pat
pub cat: categorization, // categorization of expr
pub mutbl: MutabilityCategory, // mutability of expr as lvalue
pub ty: ty::t // type of the expr (*see WARNING above*)
}
pub type cmt = @cmt_;
@ -242,7 +242,7 @@ impl ast_node for ast::Pat {
}
pub struct MemCategorizationContext<TYPER> {
typer: TYPER
pub typer: TYPER
}
pub type McResult<T> = Result<T, ()>;

View File

@ -153,9 +153,9 @@ pub enum CaptureMode {
#[deriving(Encodable, Decodable)]
pub struct CaptureVar {
def: Def, // Variable being accessed free
span: Span, // Location of an access to this variable
mode: CaptureMode // How variable is being accessed
pub def: Def, // Variable being accessed free
pub span: Span, // Location of an access to this variable
pub mode: CaptureMode // How variable is being accessed
}
pub type CaptureMap = NodeMap<Rc<Vec<CaptureVar>>>;
@ -163,15 +163,15 @@ pub type CaptureMap = NodeMap<Rc<Vec<CaptureVar>>>;
/** See the section Output on the module comment for explanation. */
#[deriving(Clone)]
pub struct MoveMaps {
moves_map: NodeSet,
pub moves_map: NodeSet,
/**
* Set of variable node-ids that are moved.
*
* Note: The `moves_map` stores expression ids that are moves,
* pub Note: The `moves_map` stores expression ids that are moves,
* whereas this set stores the ids of the variables that are
* moved at some point */
moved_variables_set: NodeSet,
capture_map: CaptureMap
pub moved_variables_set: NodeSet,
pub capture_map: CaptureMap
}
#[deriving(Clone)]

View File

@ -14,7 +14,6 @@
use std::mem::replace;
use metadata::csearch;
use middle::lint;
use middle::resolve;
use middle::ty;
@ -562,53 +561,10 @@ impl<'a> PrivacyVisitor<'a> {
// Checks that a field is in scope.
// FIXME #6993: change type (and name) from Ident to Name
fn check_field(&mut self, span: Span, id: ast::DefId, ident: ast::Ident,
enum_id: Option<ast::DefId>) {
let fields = ty::lookup_struct_fields(self.tcx, id);
let struct_vis = if is_local(id) {
match self.tcx.map.get(id.node) {
ast_map::NodeItem(ref it) => it.vis,
ast_map::NodeVariant(ref v) => {
if v.node.vis == ast::Inherited {
let parent = self.tcx.map.get_parent(id.node);
self.tcx.map.expect_item(parent).vis
} else {
v.node.vis
}
}
_ => {
self.tcx.sess.span_bug(span,
format!("not an item or variant def"));
}
}
} else {
let cstore = &self.tcx.sess.cstore;
match enum_id {
Some(enum_id) => {
let v = csearch::get_enum_variants(self.tcx, enum_id);
match v.iter().find(|v| v.id == id) {
Some(variant) => {
if variant.vis == ast::Inherited {
csearch::get_item_visibility(cstore, enum_id)
} else {
variant.vis
}
}
None => {
self.tcx.sess.span_bug(span, "no xcrate variant");
}
}
}
None => csearch::get_item_visibility(cstore, id)
}
};
for field in fields.iter() {
fn check_field(&mut self, span: Span, id: ast::DefId, ident: ast::Ident) {
for field in ty::lookup_struct_fields(self.tcx, id).iter() {
if field.name != ident.name { continue; }
// public structs have public fields by default, and private structs
// have private fields by default.
if struct_vis == ast::Public && field.vis != ast::Private { break }
if struct_vis != ast::Public && field.vis == ast::Public { break }
if field.vis == ast::Public { break }
if !is_local(field.id) ||
!self.private_accessible(field.id.node) {
self.tcx.sess.span_err(span,
@ -770,7 +726,7 @@ impl<'a> Visitor<()> for PrivacyVisitor<'a> {
match ty::get(ty::expr_ty_adjusted(self.tcx, base,
&*self.method_map.borrow())).sty {
ty::ty_struct(id, _) => {
self.check_field(expr.span, id, ident, None);
self.check_field(expr.span, id, ident);
}
_ => {}
}
@ -793,17 +749,15 @@ impl<'a> Visitor<()> for PrivacyVisitor<'a> {
match ty::get(ty::expr_ty(self.tcx, expr)).sty {
ty::ty_struct(id, _) => {
for field in (*fields).iter() {
self.check_field(expr.span, id, field.ident.node,
None);
self.check_field(expr.span, id, field.ident.node);
}
}
ty::ty_enum(_, _) => {
match self.tcx.def_map.borrow().get_copy(&expr.id) {
ast::DefVariant(enum_id, variant_id, _) => {
ast::DefVariant(_, variant_id, _) => {
for field in fields.iter() {
self.check_field(expr.span, variant_id,
field.ident.node,
Some(enum_id));
field.ident.node);
}
}
_ => self.tcx.sess.span_bug(expr.span,
@ -867,16 +821,15 @@ impl<'a> Visitor<()> for PrivacyVisitor<'a> {
match ty::get(ty::pat_ty(self.tcx, pattern)).sty {
ty::ty_struct(id, _) => {
for field in fields.iter() {
self.check_field(pattern.span, id, field.ident,
None);
self.check_field(pattern.span, id, field.ident);
}
}
ty::ty_enum(_, _) => {
match self.tcx.def_map.borrow().find(&pattern.id) {
Some(&ast::DefVariant(enum_id, variant_id, _)) => {
Some(&ast::DefVariant(_, variant_id, _)) => {
for field in fields.iter() {
self.check_field(pattern.span, variant_id,
field.ident, Some(enum_id));
field.ident);
}
}
_ => self.tcx.sess.span_bug(pattern.span,
@ -992,16 +945,10 @@ impl<'a> SanePrivacyVisitor<'a> {
}
}
};
let check_struct = |def: &@ast::StructDef,
vis: ast::Visibility,
parent_vis: Option<ast::Visibility>| {
let public_def = match vis {
ast::Public => true,
ast::Inherited | ast::Private => parent_vis == Some(ast::Public),
};
let check_struct = |def: &@ast::StructDef| {
for f in def.fields.iter() {
match f.node.kind {
ast::NamedField(_, ast::Private) if !public_def => {
match f.node.kind {
ast::NamedField(_, ast::Private) => {
tcx.sess.span_err(f.span, "unnecessary `priv` \
visibility");
}
@ -1058,15 +1005,13 @@ impl<'a> SanePrivacyVisitor<'a> {
}
match v.node.kind {
ast::StructVariantKind(ref s) => {
check_struct(s, v.node.vis, Some(item.vis));
}
ast::StructVariantKind(ref s) => check_struct(s),
ast::TupleVariantKind(..) => {}
}
}
}
ast::ItemStruct(ref def, _) => check_struct(def, item.vis, None),
ast::ItemStruct(ref def, _) => check_struct(def),
ast::ItemTrait(_, _, ref methods) => {
for m in methods.iter() {
@ -1372,12 +1317,10 @@ impl<'a> Visitor<()> for VisiblePrivateTypesVisitor<'a> {
fn visit_struct_field(&mut self, s: &ast::StructField, _: ()) {
match s.node.kind {
// the only way to get here is by being inside a public
// struct/enum variant, so the only way to have a private
// field is with an explicit `priv`.
ast::NamedField(_, ast::Private) => {}
_ => visit::walk_struct_field(self, s, ())
ast::NamedField(_, ast::Public) => {
visit::walk_struct_field(self, s, ());
}
_ => {}
}
}

View File

@ -75,11 +75,11 @@ The region maps encode information about region relationships.
for dynamic checks and/or arbitrary amounts of stack space.
*/
pub struct RegionMaps {
priv scope_map: RefCell<NodeMap<ast::NodeId>>,
priv var_map: RefCell<NodeMap<ast::NodeId>>,
priv free_region_map: RefCell<HashMap<FreeRegion, Vec<FreeRegion> >>,
priv rvalue_scopes: RefCell<NodeMap<ast::NodeId>>,
priv terminating_scopes: RefCell<HashSet<ast::NodeId>>,
scope_map: RefCell<NodeMap<ast::NodeId>>,
var_map: RefCell<NodeMap<ast::NodeId>>,
free_region_map: RefCell<HashMap<FreeRegion, Vec<FreeRegion> >>,
rvalue_scopes: RefCell<NodeMap<ast::NodeId>>,
terminating_scopes: RefCell<HashSet<ast::NodeId>>,
}
#[deriving(Clone)]

View File

@ -55,8 +55,8 @@ pub type TraitMap = NodeMap<Vec<DefId> >;
pub type ExportMap2 = @RefCell<NodeMap<Vec<Export2> >>;
pub struct Export2 {
name: ~str, // The name of the target.
def_id: DefId, // The definition of the target.
pub name: ~str, // The name of the target.
pub def_id: DefId, // The definition of the target.
}
// This set contains all exported definitions from external crates. The set does
@ -73,10 +73,10 @@ pub enum LastPrivate {
// and whether the import is in fact used for each.
// If the Option<PrivateDep> fields are None, it means there is no defintion
// in that namespace.
LastImport{value_priv: Option<PrivateDep>,
value_used: ImportUse,
type_priv: Option<PrivateDep>,
type_used: ImportUse},
LastImport{pub value_priv: Option<PrivateDep>,
pub value_used: ImportUse,
pub type_priv: Option<PrivateDep>,
pub type_used: ImportUse},
}
pub enum PrivateDep {
@ -5408,11 +5408,11 @@ impl<'a> Resolver<'a> {
}
pub struct CrateMap {
def_map: DefMap,
exp_map2: ExportMap2,
trait_map: TraitMap,
external_exports: ExternalExports,
last_private_map: LastPrivateMap,
pub def_map: DefMap,
pub exp_map2: ExportMap2,
pub trait_map: TraitMap,
pub external_exports: ExternalExports,
pub last_private_map: LastPrivateMap,
}
/// Entry point to crate resolution.

View File

@ -82,7 +82,7 @@ pub enum Repr {
* General-case enums: for each case there is a struct, and they
* all start with a field for the discriminant.
*/
General(IntType, Vec<Struct> ),
General(IntType, Vec<Struct>),
/**
* Two cases distinguished by a nullable pointer: the case with discriminant
* `nndiscr` is represented by the struct `nonnull`, where the `ptrfield`th
@ -94,16 +94,21 @@ pub enum Repr {
* is represented such that `None` is a null pointer and `Some` is the
* identity function.
*/
NullablePointer{ nonnull: Struct, nndiscr: Disr, ptrfield: uint,
nullfields: Vec<ty::t> }
NullablePointer {
pub nonnull: Struct,
pub nndiscr: Disr,
pub ptrfield: uint,
pub nullfields: Vec<ty::t>,
}
}
/// For structs, and struct-like parts of anything fancier.
pub struct Struct {
size: u64,
align: u64,
packed: bool,
fields: Vec<ty::t> }
pub size: u64,
pub align: u64,
pub packed: bool,
pub fields: Vec<ty::t>,
}
/**
* Convenience for `represent_type`. There should probably be more or

View File

@ -413,9 +413,9 @@ pub fn malloc_raw<'a>(bcx: &'a Block<'a>, t: ty::t, heap: heap)
}
pub struct MallocResult<'a> {
bcx: &'a Block<'a>,
smart_ptr: ValueRef,
body: ValueRef
pub bcx: &'a Block<'a>,
pub smart_ptr: ValueRef,
pub body: ValueRef
}
// malloc_general_dyn: usefully wraps malloc_raw_dyn; allocates a smart
@ -1647,7 +1647,7 @@ pub fn trans_enum_def(ccx: &CrateContext, enum_definition: &ast::EnumDef,
}
pub struct TransItemVisitor<'a> {
ccx: &'a CrateContext,
pub ccx: &'a CrateContext,
}
impl<'a> Visitor<()> for TransItemVisitor<'a> {

View File

@ -23,8 +23,8 @@ use std::libc::{c_uint, c_ulonglong, c_char};
use syntax::codemap::Span;
pub struct Builder<'a> {
llbuilder: BuilderRef,
ccx: &'a CrateContext,
pub llbuilder: BuilderRef,
pub ccx: &'a CrateContext,
}
// This is a really awful way to get a zero-length c-string, but better (and a

View File

@ -35,15 +35,15 @@ pub enum ArgKind {
/// This is borrowed from clang's ABIInfo.h
#[deriving(Clone)]
pub struct ArgType {
kind: ArgKind,
pub kind: ArgKind,
/// Original LLVM type
ty: Type,
pub ty: Type,
/// Coerced LLVM Type
cast: option::Option<Type>,
pub cast: option::Option<Type>,
/// Dummy argument, which is emitted before the real argument
pad: option::Option<Type>,
pub pad: option::Option<Type>,
/// LLVM attribute of argument
attr: option::Option<Attribute>
pub attr: option::Option<Attribute>
}
impl ArgType {
@ -99,10 +99,10 @@ impl ArgType {
/// comments are reverse-engineered and may be inaccurate. -NDM
pub struct FnType {
/// The LLVM types of each argument.
arg_tys: Vec<ArgType> ,
pub arg_tys: Vec<ArgType> ,
/// LLVM return type.
ret_ty: ArgType,
pub ret_ty: ArgType,
}
pub fn compute_abi_info(ccx: &CrateContext,

View File

@ -54,8 +54,8 @@ use syntax::abi::AbiSet;
use syntax::ast_map;
pub struct MethodData {
llfn: ValueRef,
llself: ValueRef,
pub llfn: ValueRef,
pub llself: ValueRef,
}
pub enum CalleeData {
@ -70,8 +70,8 @@ pub enum CalleeData {
}
pub struct Callee<'a> {
bcx: &'a Block<'a>,
data: CalleeData
pub bcx: &'a Block<'a>,
pub data: CalleeData
}
fn trans<'a>(bcx: &'a Block<'a>, expr: &ast::Expr) -> Callee<'a> {

View File

@ -42,7 +42,7 @@ pub struct CleanupScope<'a> {
}
pub struct CustomScopeIndex {
priv index: uint
index: uint
}
pub static EXIT_BREAK: uint = 0;

View File

@ -111,12 +111,12 @@ pub fn gensym_name(name: &str) -> PathElem {
}
pub struct tydesc_info {
ty: ty::t,
tydesc: ValueRef,
size: ValueRef,
align: ValueRef,
name: ValueRef,
visit_glue: Cell<Option<ValueRef>>,
pub ty: ty::t,
pub tydesc: ValueRef,
pub size: ValueRef,
pub align: ValueRef,
pub name: ValueRef,
pub visit_glue: Cell<Option<ValueRef>>,
}
/*
@ -146,8 +146,8 @@ pub struct tydesc_info {
*/
pub struct NodeInfo {
id: ast::NodeId,
span: Span,
pub id: ast::NodeId,
pub span: Span,
}
pub fn expr_info(expr: &ast::Expr) -> NodeInfo {
@ -155,22 +155,22 @@ pub fn expr_info(expr: &ast::Expr) -> NodeInfo {
}
pub struct Stats {
n_static_tydescs: Cell<uint>,
n_glues_created: Cell<uint>,
n_null_glues: Cell<uint>,
n_real_glues: Cell<uint>,
n_fns: Cell<uint>,
n_monos: Cell<uint>,
n_inlines: Cell<uint>,
n_closures: Cell<uint>,
n_llvm_insns: Cell<uint>,
llvm_insns: RefCell<HashMap<~str, uint>>,
pub n_static_tydescs: Cell<uint>,
pub n_glues_created: Cell<uint>,
pub n_null_glues: Cell<uint>,
pub n_real_glues: Cell<uint>,
pub n_fns: Cell<uint>,
pub n_monos: Cell<uint>,
pub n_inlines: Cell<uint>,
pub n_closures: Cell<uint>,
pub n_llvm_insns: Cell<uint>,
pub llvm_insns: RefCell<HashMap<~str, uint>>,
// (ident, time-in-ms, llvm-instructions)
fn_stats: RefCell<Vec<(~str, uint, uint)> >,
pub fn_stats: RefCell<Vec<(~str, uint, uint)> >,
}
pub struct BuilderRef_res {
b: BuilderRef,
pub b: BuilderRef,
}
impl Drop for BuilderRef_res {
@ -192,10 +192,10 @@ pub type ExternMap = HashMap<~str, ValueRef>;
// Here `self_ty` is the real type of the self parameter to this method. It
// will only be set in the case of default methods.
pub struct param_substs {
tys: Vec<ty::t> ,
self_ty: Option<ty::t>,
vtables: Option<typeck::vtable_res>,
self_vtables: Option<typeck::vtable_param_res>
pub tys: Vec<ty::t> ,
pub self_ty: Option<ty::t>,
pub vtables: Option<typeck::vtable_res>,
pub self_vtables: Option<typeck::vtable_param_res>
}
impl param_substs {
@ -228,69 +228,69 @@ pub struct FunctionContext<'a> {
// address of the first instruction in the sequence of
// instructions for this function that will go in the .text
// section of the executable we're generating.
llfn: ValueRef,
pub llfn: ValueRef,
// The environment argument in a closure.
llenv: Option<ValueRef>,
pub llenv: Option<ValueRef>,
// The place to store the return value. If the return type is immediate,
// this is an alloca in the function. Otherwise, it's the hidden first
// parameter to the function. After function construction, this should
// always be Some.
llretptr: Cell<Option<ValueRef>>,
pub llretptr: Cell<Option<ValueRef>>,
entry_bcx: RefCell<Option<&'a Block<'a>>>,
pub entry_bcx: RefCell<Option<&'a Block<'a>>>,
// These elements: "hoisted basic blocks" containing
// These pub elements: "hoisted basic blocks" containing
// administrative activities that have to happen in only one place in
// the function, due to LLVM's quirks.
// A marker for the place where we want to insert the function's static
// allocas, so that LLVM will coalesce them into a single alloca call.
alloca_insert_pt: Cell<Option<ValueRef>>,
llreturn: Cell<Option<BasicBlockRef>>,
pub alloca_insert_pt: Cell<Option<ValueRef>>,
pub llreturn: Cell<Option<BasicBlockRef>>,
// The a value alloca'd for calls to upcalls.rust_personality. Used when
// outputting the resume instruction.
personality: Cell<Option<ValueRef>>,
pub personality: Cell<Option<ValueRef>>,
// True if the caller expects this fn to use the out pointer to
// return. Either way, your code should write into llretptr, but if
// this value is false, llretptr will be a local alloca.
caller_expects_out_pointer: bool,
pub caller_expects_out_pointer: bool,
// Maps arguments to allocas created for them in llallocas.
llargs: RefCell<NodeMap<LvalueDatum>>,
pub llargs: RefCell<NodeMap<LvalueDatum>>,
// Maps the def_ids for local variables to the allocas created for
// them in llallocas.
lllocals: RefCell<NodeMap<LvalueDatum>>,
pub lllocals: RefCell<NodeMap<LvalueDatum>>,
// Same as above, but for closure upvars
llupvars: RefCell<NodeMap<ValueRef>>,
pub llupvars: RefCell<NodeMap<ValueRef>>,
// The NodeId of the function, or -1 if it doesn't correspond to
// a user-defined function.
id: ast::NodeId,
pub id: ast::NodeId,
// If this function is being monomorphized, this contains the type
// substitutions used.
param_substs: Option<@param_substs>,
pub param_substs: Option<@param_substs>,
// The source span and nesting context where this function comes from, for
// error reporting and symbol generation.
span: Option<Span>,
pub span: Option<Span>,
// The arena that blocks are allocated from.
block_arena: &'a TypedArena<Block<'a>>,
pub block_arena: &'a TypedArena<Block<'a>>,
// This function's enclosing crate context.
ccx: &'a CrateContext,
pub ccx: &'a CrateContext,
// Used and maintained by the debuginfo module.
debug_context: debuginfo::FunctionDebugContext,
pub debug_context: debuginfo::FunctionDebugContext,
// Cleanup scopes.
scopes: RefCell<Vec<cleanup::CleanupScope<'a>> >,
pub scopes: RefCell<Vec<cleanup::CleanupScope<'a>> >,
}
impl<'a> FunctionContext<'a> {
@ -405,20 +405,20 @@ pub struct Block<'a> {
// block to the function pointed to by llfn. We insert
// instructions into that block by way of this block context.
// The block pointing to this one in the function's digraph.
llbb: BasicBlockRef,
terminated: Cell<bool>,
unreachable: Cell<bool>,
pub llbb: BasicBlockRef,
pub terminated: Cell<bool>,
pub unreachable: Cell<bool>,
// Is this block part of a landing pad?
is_lpad: bool,
pub is_lpad: bool,
// AST node-id associated with this block, if any. Used for
// debugging purposes only.
opt_node_id: Option<ast::NodeId>,
pub opt_node_id: Option<ast::NodeId>,
// The function context for the function to which this block is
// attached.
fcx: &'a FunctionContext<'a>,
pub fcx: &'a FunctionContext<'a>,
}
impl<'a> Block<'a> {
@ -493,8 +493,8 @@ impl<'a> Block<'a> {
}
pub struct Result<'a> {
bcx: &'a Block<'a>,
val: ValueRef
pub bcx: &'a Block<'a>,
pub val: ValueRef
}
pub fn rslt<'a>(bcx: &'a Block<'a>, val: ValueRef) -> Result<'a> {
@ -744,8 +744,8 @@ pub fn mono_data_classify(t: ty::t) -> MonoDataClass {
#[deriving(Eq, TotalEq, Hash)]
pub struct mono_id_ {
def: ast::DefId,
params: Vec<mono_param_id> }
pub def: ast::DefId,
pub params: Vec<mono_param_id> }
pub type mono_id = @mono_id_;

View File

@ -37,39 +37,39 @@ use syntax::ast;
use syntax::parse::token::InternedString;
pub struct CrateContext {
llmod: ModuleRef,
llcx: ContextRef,
metadata_llmod: ModuleRef,
td: TargetData,
tn: TypeNames,
externs: RefCell<ExternMap>,
intrinsics: HashMap<&'static str, ValueRef>,
item_vals: RefCell<NodeMap<ValueRef>>,
exp_map2: resolve::ExportMap2,
reachable: NodeSet,
item_symbols: RefCell<NodeMap<~str>>,
link_meta: LinkMeta,
drop_glues: RefCell<HashMap<ty::t, ValueRef>>,
tydescs: RefCell<HashMap<ty::t, @tydesc_info>>,
pub llmod: ModuleRef,
pub llcx: ContextRef,
pub metadata_llmod: ModuleRef,
pub td: TargetData,
pub tn: TypeNames,
pub externs: RefCell<ExternMap>,
pub intrinsics: HashMap<&'static str, ValueRef>,
pub item_vals: RefCell<NodeMap<ValueRef>>,
pub exp_map2: resolve::ExportMap2,
pub reachable: NodeSet,
pub item_symbols: RefCell<NodeMap<~str>>,
pub link_meta: LinkMeta,
pub drop_glues: RefCell<HashMap<ty::t, ValueRef>>,
pub tydescs: RefCell<HashMap<ty::t, @tydesc_info>>,
// Set when running emit_tydescs to enforce that no more tydescs are
// created.
finished_tydescs: Cell<bool>,
pub finished_tydescs: Cell<bool>,
// Track mapping of external ids to local items imported for inlining
external: RefCell<DefIdMap<Option<ast::NodeId>>>,
pub external: RefCell<DefIdMap<Option<ast::NodeId>>>,
// Backwards version of the `external` map (inlined items to where they
// came from)
external_srcs: RefCell<NodeMap<ast::DefId>>,
pub external_srcs: RefCell<NodeMap<ast::DefId>>,
// A set of static items which cannot be inlined into other crates. This
// will pevent in IIItem() structures from being encoded into the metadata
// that is generated
non_inlineable_statics: RefCell<NodeSet>,
pub non_inlineable_statics: RefCell<NodeSet>,
// Cache instances of monomorphized functions
monomorphized: RefCell<HashMap<mono_id, ValueRef>>,
monomorphizing: RefCell<DefIdMap<uint>>,
pub monomorphized: RefCell<HashMap<mono_id, ValueRef>>,
pub monomorphizing: RefCell<DefIdMap<uint>>,
// Cache generated vtables
vtables: RefCell<HashMap<(ty::t, mono_id), ValueRef>>,
pub vtables: RefCell<HashMap<(ty::t, mono_id), ValueRef>>,
// Cache of constant strings,
const_cstr_cache: RefCell<HashMap<InternedString, ValueRef>>,
pub const_cstr_cache: RefCell<HashMap<InternedString, ValueRef>>,
// Reverse-direction for const ptrs cast from globals.
// Key is an int, cast from a ValueRef holding a *T,
@ -79,36 +79,36 @@ pub struct CrateContext {
// when we ptrcast, and we have to ptrcast during translation
// of a [T] const because we form a slice, a [*T,int] pair, not
// a pointer to an LLVM array type.
const_globals: RefCell<HashMap<int, ValueRef>>,
pub const_globals: RefCell<HashMap<int, ValueRef>>,
// Cache of emitted const values
const_values: RefCell<NodeMap<ValueRef>>,
pub const_values: RefCell<NodeMap<ValueRef>>,
// Cache of external const values
extern_const_values: RefCell<DefIdMap<ValueRef>>,
pub extern_const_values: RefCell<DefIdMap<ValueRef>>,
impl_method_cache: RefCell<HashMap<(ast::DefId, ast::Name), ast::DefId>>,
pub impl_method_cache: RefCell<HashMap<(ast::DefId, ast::Name), ast::DefId>>,
// Cache of closure wrappers for bare fn's.
closure_bare_wrapper_cache: RefCell<HashMap<ValueRef, ValueRef>>,
pub closure_bare_wrapper_cache: RefCell<HashMap<ValueRef, ValueRef>>,
lltypes: RefCell<HashMap<ty::t, Type>>,
llsizingtypes: RefCell<HashMap<ty::t, Type>>,
adt_reprs: RefCell<HashMap<ty::t, @adt::Repr>>,
symbol_hasher: RefCell<Sha256>,
type_hashcodes: RefCell<HashMap<ty::t, ~str>>,
all_llvm_symbols: RefCell<HashSet<~str>>,
tcx: ty::ctxt,
maps: astencode::Maps,
stats: @Stats,
int_type: Type,
opaque_vec_type: Type,
builder: BuilderRef_res,
pub lltypes: RefCell<HashMap<ty::t, Type>>,
pub llsizingtypes: RefCell<HashMap<ty::t, Type>>,
pub adt_reprs: RefCell<HashMap<ty::t, @adt::Repr>>,
pub symbol_hasher: RefCell<Sha256>,
pub type_hashcodes: RefCell<HashMap<ty::t, ~str>>,
pub all_llvm_symbols: RefCell<HashSet<~str>>,
pub tcx: ty::ctxt,
pub maps: astencode::Maps,
pub stats: @Stats,
pub int_type: Type,
pub opaque_vec_type: Type,
pub builder: BuilderRef_res,
// Set when at least one function uses GC. Needed so that
// decl_gc_metadata knows whether to link to the module metadata, which
// is not emitted by LLVM's GC pass when no functions use GC.
uses_gc: bool,
dbg_cx: Option<debuginfo::CrateDebugContext>,
pub uses_gc: bool,
pub dbg_cx: Option<debuginfo::CrateDebugContext>,
}
impl CrateContext {

View File

@ -41,18 +41,18 @@ use syntax::codemap::Span;
pub struct Datum<K> {
/// The llvm value. This is either a pointer to the Rust value or
/// the value itself, depending on `kind` below.
val: ValueRef,
pub val: ValueRef,
/// The rust type of the value.
ty: ty::t,
pub ty: ty::t,
/// Indicates whether this is by-ref or by-value.
kind: K,
pub kind: K,
}
pub struct DatumBlock<'a, K> {
bcx: &'a Block<'a>,
datum: Datum<K>,
pub bcx: &'a Block<'a>,
pub datum: Datum<K>,
}
pub enum Expr {
@ -70,7 +70,7 @@ pub enum Expr {
pub struct Lvalue;
pub struct Rvalue {
mode: RvalueMode
pub mode: RvalueMode
}
pub fn Rvalue(m: RvalueMode) -> Rvalue {

View File

@ -173,15 +173,15 @@ static DW_ATE_unsigned_char: c_uint = 0x08;
/// A context object for maintaining all state needed by the debuginfo module.
pub struct CrateDebugContext {
priv llcontext: ContextRef,
priv builder: DIBuilderRef,
priv current_debug_location: Cell<DebugLocation>,
priv created_files: RefCell<HashMap<~str, DIFile>>,
priv created_types: RefCell<HashMap<uint, DIType>>,
priv namespace_map: RefCell<HashMap<Vec<ast::Name> , @NamespaceTreeNode>>,
llcontext: ContextRef,
builder: DIBuilderRef,
current_debug_location: Cell<DebugLocation>,
created_files: RefCell<HashMap<~str, DIFile>>,
created_types: RefCell<HashMap<uint, DIType>>,
namespace_map: RefCell<HashMap<Vec<ast::Name> , @NamespaceTreeNode>>,
// This collection is used to assert that composite types (structs, enums, ...) have their
// members only set once:
priv composite_types_completed: RefCell<HashSet<DIType>>,
composite_types_completed: RefCell<HashSet<DIType>>,
}
impl CrateDebugContext {

View File

@ -143,11 +143,11 @@ pub fn make_drop_glue_unboxed<'a>(
}
pub struct VecTypes {
vec_ty: ty::t,
unit_ty: ty::t,
llunit_ty: Type,
llunit_size: ValueRef,
llunit_alloc_size: u64
pub vec_ty: ty::t,
pub unit_ty: ty::t,
pub llunit_ty: Type,
pub llunit_size: ValueRef,
pub llunit_alloc_size: u64
}
impl VecTypes {

View File

@ -26,7 +26,7 @@ use std::libc::{c_uint};
#[deriving(Clone, Eq, Show)]
pub struct Type {
priv rf: TypeRef
rf: TypeRef
}
macro_rules! ty (

View File

@ -152,7 +152,7 @@ impl Use {
/// Iterator for the users of a value
pub struct Users {
priv next: Option<Use>
next: Option<Use>
}
impl Iterator<Value> for Users {

View File

@ -63,8 +63,8 @@ pub static INITIAL_DISCRIMINANT_VALUE: Disr = 0;
#[deriving(Eq, TotalEq, Hash)]
pub struct field {
ident: ast::Ident,
mt: mt
pub ident: ast::Ident,
pub mt: mt
}
#[deriving(Clone)]
@ -75,16 +75,16 @@ pub enum MethodContainer {
#[deriving(Clone)]
pub struct Method {
ident: ast::Ident,
generics: ty::Generics,
fty: BareFnTy,
explicit_self: ast::ExplicitSelf_,
vis: ast::Visibility,
def_id: ast::DefId,
container: MethodContainer,
pub ident: ast::Ident,
pub generics: ty::Generics,
pub fty: BareFnTy,
pub explicit_self: ast::ExplicitSelf_,
pub vis: ast::Visibility,
pub def_id: ast::DefId,
pub container: MethodContainer,
// If this method is provided, we need to know where it came from
provided_source: Option<ast::DefId>
pub provided_source: Option<ast::DefId>
}
impl Method {
@ -118,14 +118,15 @@ impl Method {
}
pub struct Impl {
did: DefId,
ident: Ident,
methods: Vec<@Method> }
pub did: DefId,
pub ident: Ident,
pub methods: Vec<@Method>,
}
#[deriving(Clone, Eq, TotalEq, Hash)]
pub struct mt {
ty: t,
mutbl: ast::Mutability,
pub ty: t,
pub mutbl: ast::Mutability,
}
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash, Show)]
@ -142,18 +143,18 @@ pub enum TraitStore {
}
pub struct field_ty {
name: Name,
id: DefId,
vis: ast::Visibility,
pub name: Name,
pub id: DefId,
pub vis: ast::Visibility,
}
// Contains information needed to resolve types and (in the future) look up
// the types of AST nodes.
#[deriving(Eq, TotalEq, Hash)]
pub struct creader_cache_key {
cnum: CrateNum,
pos: uint,
len: uint
pub cnum: CrateNum,
pub pos: uint,
pub len: uint
}
pub type creader_cache = RefCell<HashMap<creader_cache_key, t>>;
@ -191,9 +192,9 @@ pub enum ast_ty_to_ty_cache_entry {
#[deriving(Clone, Eq, Decodable, Encodable)]
pub struct ItemVariances {
self_param: Option<Variance>,
type_params: OwnedSlice<Variance>,
region_params: OwnedSlice<Variance>
pub self_param: Option<Variance>,
pub type_params: OwnedSlice<Variance>,
pub region_params: OwnedSlice<Variance>
}
#[deriving(Clone, Eq, Decodable, Encodable, Show)]
@ -216,8 +217,8 @@ pub enum AutoAdjustment {
#[deriving(Decodable, Encodable)]
pub struct AutoDerefRef {
autoderefs: uint,
autoref: Option<AutoRef>
pub autoderefs: uint,
pub autoref: Option<AutoRef>
}
#[deriving(Decodable, Encodable, Eq, Show)]
@ -247,112 +248,112 @@ pub enum AutoRef {
pub struct ctxt {
// Specifically use a speedy hash algorithm for this hash map, it's used
// quite often.
interner: RefCell<FnvHashMap<intern_key, ~t_box_>>,
next_id: Cell<uint>,
sess: Session,
def_map: resolve::DefMap,
pub interner: RefCell<FnvHashMap<intern_key, ~t_box_>>,
pub next_id: Cell<uint>,
pub sess: Session,
pub def_map: resolve::DefMap,
named_region_map: resolve_lifetime::NamedRegionMap,
pub named_region_map: resolve_lifetime::NamedRegionMap,
region_maps: middle::region::RegionMaps,
pub region_maps: middle::region::RegionMaps,
// Stores the types for various nodes in the AST. Note that this table
// is not guaranteed to be populated until after typeck. See
// typeck::check::fn_ctxt for details.
node_types: node_type_table,
pub node_types: node_type_table,
// Stores the type parameters which were substituted to obtain the type
// of this node. This only applies to nodes that refer to entities
// parameterized by type parameters, such as generic fns, types, or
// other items.
node_type_substs: RefCell<NodeMap<Vec<t>>>,
pub node_type_substs: RefCell<NodeMap<Vec<t>>>,
// Maps from a method to the method "descriptor"
methods: RefCell<DefIdMap<@Method>>,
pub methods: RefCell<DefIdMap<@Method>>,
// Maps from a trait def-id to a list of the def-ids of its methods
trait_method_def_ids: RefCell<DefIdMap<@Vec<DefId> >>,
pub trait_method_def_ids: RefCell<DefIdMap<@Vec<DefId> >>,
// A cache for the trait_methods() routine
trait_methods_cache: RefCell<DefIdMap<@Vec<@Method> >>,
pub trait_methods_cache: RefCell<DefIdMap<@Vec<@Method> >>,
impl_trait_cache: RefCell<DefIdMap<Option<@ty::TraitRef>>>,
pub impl_trait_cache: RefCell<DefIdMap<Option<@ty::TraitRef>>>,
trait_refs: RefCell<NodeMap<@TraitRef>>,
trait_defs: RefCell<DefIdMap<@TraitDef>>,
pub trait_refs: RefCell<NodeMap<@TraitRef>>,
pub trait_defs: RefCell<DefIdMap<@TraitDef>>,
map: ast_map::Map,
intrinsic_defs: RefCell<DefIdMap<t>>,
freevars: RefCell<freevars::freevar_map>,
tcache: type_cache,
rcache: creader_cache,
short_names_cache: RefCell<HashMap<t, ~str>>,
needs_unwind_cleanup_cache: RefCell<HashMap<t, bool>>,
tc_cache: RefCell<HashMap<uint, TypeContents>>,
ast_ty_to_ty_cache: RefCell<NodeMap<ast_ty_to_ty_cache_entry>>,
enum_var_cache: RefCell<DefIdMap<@Vec<@VariantInfo> >>,
ty_param_defs: RefCell<NodeMap<TypeParameterDef>>,
adjustments: RefCell<NodeMap<@AutoAdjustment>>,
normalized_cache: RefCell<HashMap<t, t>>,
lang_items: @middle::lang_items::LanguageItems,
pub map: ast_map::Map,
pub intrinsic_defs: RefCell<DefIdMap<t>>,
pub freevars: RefCell<freevars::freevar_map>,
pub tcache: type_cache,
pub rcache: creader_cache,
pub short_names_cache: RefCell<HashMap<t, ~str>>,
pub needs_unwind_cleanup_cache: RefCell<HashMap<t, bool>>,
pub tc_cache: RefCell<HashMap<uint, TypeContents>>,
pub ast_ty_to_ty_cache: RefCell<NodeMap<ast_ty_to_ty_cache_entry>>,
pub enum_var_cache: RefCell<DefIdMap<@Vec<@VariantInfo> >>,
pub ty_param_defs: RefCell<NodeMap<TypeParameterDef>>,
pub adjustments: RefCell<NodeMap<@AutoAdjustment>>,
pub normalized_cache: RefCell<HashMap<t, t>>,
pub lang_items: @middle::lang_items::LanguageItems,
// A mapping of fake provided method def_ids to the default implementation
provided_method_sources: RefCell<DefIdMap<ast::DefId>>,
supertraits: RefCell<DefIdMap<@Vec<@TraitRef> >>,
pub provided_method_sources: RefCell<DefIdMap<ast::DefId>>,
pub supertraits: RefCell<DefIdMap<@Vec<@TraitRef> >>,
// Maps from def-id of a type or region parameter to its
// (inferred) variance.
item_variance_map: RefCell<DefIdMap<@ItemVariances>>,
pub item_variance_map: RefCell<DefIdMap<@ItemVariances>>,
// A mapping from the def ID of an enum or struct type to the def ID
// of the method that implements its destructor. If the type is not
// present in this map, it does not have a destructor. This map is
// populated during the coherence phase of typechecking.
destructor_for_type: RefCell<DefIdMap<ast::DefId>>,
pub destructor_for_type: RefCell<DefIdMap<ast::DefId>>,
// A method will be in this list if and only if it is a destructor.
destructors: RefCell<DefIdSet>,
pub destructors: RefCell<DefIdSet>,
// Maps a trait onto a list of impls of that trait.
trait_impls: RefCell<DefIdMap<@RefCell<Vec<@Impl> >>>,
pub trait_impls: RefCell<DefIdMap<@RefCell<Vec<@Impl> >>>,
// Maps a def_id of a type to a list of its inherent impls.
// Contains implementations of methods that are inherent to a type.
// Methods in these implementations don't need to be exported.
inherent_impls: RefCell<DefIdMap<@RefCell<Vec<@Impl> >>>,
pub inherent_impls: RefCell<DefIdMap<@RefCell<Vec<@Impl> >>>,
// Maps a def_id of an impl to an Impl structure.
// Note that this contains all of the impls that we know about,
// including ones in other crates. It's not clear that this is the best
// way to do it.
impls: RefCell<DefIdMap<@Impl>>,
pub impls: RefCell<DefIdMap<@Impl>>,
// Set of used unsafe nodes (functions or blocks). Unsafe nodes not
// present in this set can be warned about.
used_unsafe: RefCell<NodeSet>,
pub used_unsafe: RefCell<NodeSet>,
// Set of nodes which mark locals as mutable which end up getting used at
// some point. Local variable definitions not in this set can be warned
// about.
used_mut_nodes: RefCell<NodeSet>,
pub used_mut_nodes: RefCell<NodeSet>,
// vtable resolution information for impl declarations
impl_vtables: typeck::impl_vtable_map,
pub impl_vtables: typeck::impl_vtable_map,
// The set of external nominal types whose implementations have been read.
// This is used for lazy resolution of methods.
populated_external_types: RefCell<DefIdSet>,
pub populated_external_types: RefCell<DefIdSet>,
// The set of external traits whose implementations have been read. This
// is used for lazy resolution of traits.
populated_external_traits: RefCell<DefIdSet>,
pub populated_external_traits: RefCell<DefIdSet>,
// Borrows
upvar_borrow_map: RefCell<UpvarBorrowMap>,
pub upvar_borrow_map: RefCell<UpvarBorrowMap>,
// These two caches are used by const_eval when decoding external statics
// and variants that are found.
extern_const_statics: RefCell<DefIdMap<Option<@ast::Expr>>>,
extern_const_variants: RefCell<DefIdMap<Option<@ast::Expr>>>,
pub extern_const_statics: RefCell<DefIdMap<Option<@ast::Expr>>>,
pub extern_const_variants: RefCell<DefIdMap<Option<@ast::Expr>>>,
}
pub enum tbox_flag {
@ -363,7 +364,7 @@ pub enum tbox_flag {
has_ty_err = 16,
has_ty_bot = 32,
// a meta-flag: subst may be required if the type has parameters, a self
// a meta-pub flag: subst may be required if the type has parameters, a self
// type, or references bound regions
needs_subst = 1 | 2 | 8
}
@ -371,9 +372,9 @@ pub enum tbox_flag {
pub type t_box = &'static t_box_;
pub struct t_box_ {
sty: sty,
id: uint,
flags: uint,
pub sty: sty,
pub id: uint,
pub flags: uint,
}
// To reduce refcounting cost, we're representing types as unsafe pointers
@ -385,7 +386,7 @@ enum t_opaque {}
#[allow(raw_pointer_deriving)]
#[deriving(Clone, Eq, TotalEq, Hash)]
pub struct t { priv inner: *t_opaque }
pub struct t { inner: *t_opaque }
impl fmt::Show for t {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
@ -417,19 +418,19 @@ pub fn type_id(t: t) -> uint { get(t).id }
#[deriving(Clone, Eq, TotalEq, Hash)]
pub struct BareFnTy {
purity: ast::Purity,
abis: AbiSet,
sig: FnSig
pub purity: ast::Purity,
pub abis: AbiSet,
pub sig: FnSig
}
#[deriving(Clone, Eq, TotalEq, Hash)]
pub struct ClosureTy {
purity: ast::Purity,
sigil: ast::Sigil,
onceness: ast::Onceness,
region: Region,
bounds: BuiltinBounds,
sig: FnSig,
pub purity: ast::Purity,
pub sigil: ast::Sigil,
pub onceness: ast::Onceness,
pub region: Region,
pub bounds: BuiltinBounds,
pub sig: FnSig,
}
/**
@ -446,16 +447,16 @@ pub struct ClosureTy {
*/
#[deriving(Clone, Eq, TotalEq, Hash)]
pub struct FnSig {
binder_id: ast::NodeId,
inputs: Vec<t>,
output: t,
variadic: bool
pub binder_id: ast::NodeId,
pub inputs: Vec<t>,
pub output: t,
pub variadic: bool
}
#[deriving(Clone, Eq, TotalEq, Hash)]
pub struct param_ty {
idx: uint,
def_id: DefId
pub idx: uint,
pub def_id: DefId
}
/// Representation of regions:
@ -502,8 +503,8 @@ pub enum Region {
*/
#[deriving(Clone, Eq, TotalEq, Hash)]
pub struct UpvarId {
var_id: ast::NodeId,
closure_expr_id: ast::NodeId,
pub var_id: ast::NodeId,
pub closure_expr_id: ast::NodeId,
}
#[deriving(Clone, Eq, TotalEq, Hash)]
@ -603,8 +604,8 @@ pub enum BorrowKind {
*/
#[deriving(Eq, Clone)]
pub struct UpvarBorrow {
kind: BorrowKind,
region: ty::Region,
pub kind: BorrowKind,
pub region: ty::Region,
}
pub type UpvarBorrowMap = HashMap<UpvarId, UpvarBorrow>;
@ -621,8 +622,8 @@ impl Region {
#[deriving(Clone, Eq, Ord, TotalEq, TotalOrd, Hash, Encodable, Decodable, Show)]
pub struct FreeRegion {
scope_id: NodeId,
bound_region: BoundRegion
pub scope_id: NodeId,
pub bound_region: BoundRegion
}
#[deriving(Clone, Eq, Ord, TotalEq, TotalOrd, Hash, Encodable, Decodable, Show)]
@ -669,9 +670,9 @@ pub enum RegionSubsts {
* always substituted away to the implementing type for a trait. */
#[deriving(Clone, Eq, TotalEq, Hash)]
pub struct substs {
self_ty: Option<ty::t>,
tps: Vec<t>,
regions: RegionSubsts,
pub self_ty: Option<ty::t>,
pub tps: Vec<t>,
pub regions: RegionSubsts,
}
mod primitives {
@ -759,17 +760,17 @@ pub enum sty {
#[deriving(Clone, Eq, TotalEq, Hash)]
pub struct TyTrait {
def_id: DefId,
substs: substs,
store: TraitStore,
mutability: ast::Mutability,
bounds: BuiltinBounds
pub def_id: DefId,
pub substs: substs,
pub store: TraitStore,
pub mutability: ast::Mutability,
pub bounds: BuiltinBounds
}
#[deriving(Eq, TotalEq, Hash)]
pub struct TraitRef {
def_id: DefId,
substs: substs
pub def_id: DefId,
pub substs: substs
}
#[deriving(Clone, Eq)]
@ -788,8 +789,8 @@ pub enum terr_vstore_kind {
#[deriving(Clone, Show)]
pub struct expected_found<T> {
expected: T,
found: T
pub expected: T,
pub found: T
}
// Data structures used in type unification
@ -830,8 +831,8 @@ pub enum type_err {
#[deriving(Eq, TotalEq, Hash)]
pub struct ParamBounds {
builtin_bounds: BuiltinBounds,
trait_bounds: Vec<@TraitRef> }
pub builtin_bounds: BuiltinBounds,
pub trait_bounds: Vec<@TraitRef> }
pub type BuiltinBounds = EnumSet<BuiltinBound>;
@ -878,7 +879,7 @@ pub struct FloatVid(uint);
#[deriving(Clone, Eq, TotalEq, Encodable, Decodable, Hash)]
pub struct RegionVid {
id: uint
pub id: uint
}
#[deriving(Clone, Eq, TotalEq, Hash)]
@ -983,16 +984,16 @@ impl fmt::Show for IntVarValue {
#[deriving(Clone)]
pub struct TypeParameterDef {
ident: ast::Ident,
def_id: ast::DefId,
bounds: @ParamBounds,
default: Option<ty::t>
pub ident: ast::Ident,
pub def_id: ast::DefId,
pub bounds: @ParamBounds,
pub default: Option<ty::t>
}
#[deriving(Encodable, Decodable, Clone)]
pub struct RegionParameterDef {
name: ast::Name,
def_id: ast::DefId,
pub name: ast::Name,
pub def_id: ast::DefId,
}
/// Information about the type/lifetime parameters associated with an item.
@ -1000,11 +1001,11 @@ pub struct RegionParameterDef {
#[deriving(Clone)]
pub struct Generics {
/// List of type parameters declared on the item.
type_param_defs: Rc<Vec<TypeParameterDef> >,
pub type_param_defs: Rc<Vec<TypeParameterDef>>,
/// List of region parameters declared on the item.
/// For a fn or method, only includes *early-bound* lifetimes.
region_param_defs: Rc<Vec<RegionParameterDef> >,
pub region_param_defs: Rc<Vec<RegionParameterDef>>,
}
impl Generics {
@ -1037,13 +1038,13 @@ pub struct ParameterEnvironment {
/// In general, this means converting from bound parameters to
/// free parameters. Since we currently represent bound/free type
/// parameters in the same way, this only has an affect on regions.
free_substs: ty::substs,
pub free_substs: ty::substs,
/// Bound on the Self parameter
self_param_bound: Option<@TraitRef>,
pub self_param_bound: Option<@TraitRef>,
/// Bounds on each numbered type parameter
type_param_bounds: Vec<ParamBounds> ,
pub type_param_bounds: Vec<ParamBounds> ,
}
/// A polytype.
@ -1058,20 +1059,20 @@ pub struct ParameterEnvironment {
/// region `&self` or to (unsubstituted) ty_param types
#[deriving(Clone)]
pub struct ty_param_bounds_and_ty {
generics: Generics,
ty: t
pub generics: Generics,
pub ty: t
}
/// As `ty_param_bounds_and_ty` but for a trait ref.
pub struct TraitDef {
generics: Generics,
bounds: BuiltinBounds,
trait_ref: @ty::TraitRef,
pub generics: Generics,
pub bounds: BuiltinBounds,
pub trait_ref: @ty::TraitRef,
}
pub struct ty_param_substs_and_ty {
substs: ty::substs,
ty: ty::t
pub substs: ty::substs,
pub ty: ty::t
}
pub type type_cache = RefCell<DefIdMap<ty_param_bounds_and_ty>>;
@ -1841,7 +1842,7 @@ fn type_needs_unwind_cleanup_(cx: &ctxt, ty: t,
* a type than to think about what is *not* contained within a type.
*/
pub struct TypeContents {
bits: u64
pub bits: u64
}
macro_rules! def_type_content_sets(
@ -3175,8 +3176,8 @@ impl AutoRef {
}
pub struct ParamsTy {
params: Vec<t>,
ty: t
pub params: Vec<t>,
pub ty: t
}
pub fn expr_ty_params_and_ty(cx: &ctxt,
@ -3850,13 +3851,13 @@ pub fn ty_to_def_id(ty: t) -> Option<ast::DefId> {
// Enum information
#[deriving(Clone)]
pub struct VariantInfo {
args: Vec<t>,
arg_names: Option<Vec<ast::Ident> >,
ctor_ty: t,
name: ast::Ident,
id: ast::DefId,
disr_val: Disr,
vis: Visibility
pub args: Vec<t>,
pub arg_names: Option<Vec<ast::Ident> >,
pub ctor_ty: t,
pub name: ast::Ident,
pub id: ast::DefId,
pub disr_val: Disr,
pub vis: Visibility
}
impl VariantInfo {

View File

@ -219,8 +219,8 @@ pub fn super_fold_trait_store<T:TypeFolder>(this: &mut T,
// Some sample folders
pub struct BottomUpFolder<'a> {
tcx: &'a ty::ctxt,
fldop: 'a |ty::t| -> ty::t,
pub tcx: &'a ty::ctxt,
pub fldop: 'a |ty::t| -> ty::t,
}
impl<'a> TypeFolder for BottomUpFolder<'a> {

View File

@ -103,8 +103,8 @@ pub fn check_match(fcx: &FnCtxt,
}
pub struct pat_ctxt<'a> {
fcx: &'a FnCtxt<'a>,
map: PatIdMap,
pub fcx: &'a FnCtxt<'a>,
pub map: PatIdMap,
}
pub fn check_pat_variant(pcx: &pat_ctxt, pat: &ast::Pat, path: &ast::Path,

Some files were not shown because too many files have changed in this diff Show More