diff --git a/src/libcore/at_vec.rs b/src/libcore/at_vec.rs index 060015c26cf..59ed352e1ee 100644 --- a/src/libcore/at_vec.rs +++ b/src/libcore/at_vec.rs @@ -15,7 +15,7 @@ export unsafe; #[abi = "cdecl"] extern mod rustrt { fn vec_reserve_shared_actual(++t: *sys::TypeDesc, - ++v: **vec::unsafe::vec_repr, + ++v: **vec::unsafe::VecRepr, ++n: libc::size_t); } @@ -25,13 +25,13 @@ extern mod rusti { } /// A function used to initialize the elements of a vector -type init_op = fn(uint) -> T; +type InitOp = fn(uint) -> T; /// Returns the number of elements the vector can hold without reallocating #[inline(always)] pure fn capacity(&&v: @[const T]) -> uint { unsafe { - let repr: **unsafe::vec_repr = + let repr: **unsafe::VecRepr = ::unsafe::reinterpret_cast(addr_of(v)); (**repr).alloc / sys::size_of::() } @@ -103,7 +103,7 @@ pure fn map(v: &[T], f: fn(T) -> U) -> @[U] { * Creates an immutable vector of size `n_elts` and initializes the elements * to the value returned by the function `op`. */ -pure fn from_fn(n_elts: uint, op: init_op) -> @[T] { +pure fn from_fn(n_elts: uint, op: InitOp) -> @[T] { do build_sized(n_elts) |push| { let mut i: uint = 0u; while i < n_elts { push(op(i)); i += 1u; } @@ -133,8 +133,8 @@ impl @[T]: add<&[const T],@[T]> { mod unsafe { - type vec_repr = vec::unsafe::vec_repr; - type slice_repr = vec::unsafe::slice_repr; + type VecRepr = vec::unsafe::VecRepr; + type SliceRepr = vec::unsafe::SliceRepr; /** * Sets the length of a vector @@ -145,13 +145,13 @@ mod unsafe { */ #[inline(always)] unsafe fn set_len(&&v: @[const T], new_len: uint) { - let repr: **vec_repr = ::unsafe::reinterpret_cast(addr_of(v)); + let repr: **VecRepr = ::unsafe::reinterpret_cast(addr_of(v)); (**repr).fill = new_len * sys::size_of::(); } #[inline(always)] unsafe fn push(&v: @[const T], +initval: T) { - let repr: **vec_repr = ::unsafe::reinterpret_cast(addr_of(v)); + let repr: **VecRepr = ::unsafe::reinterpret_cast(addr_of(v)); let fill = (**repr).fill; if (**repr).alloc > fill { push_fast(v, initval); @@ -163,7 +163,7 @@ mod unsafe { // This doesn't bother to make sure we have space. #[inline(always)] // really pretty please unsafe fn push_fast(&v: @[const T], +initval: T) { - let repr: **vec_repr = ::unsafe::reinterpret_cast(addr_of(v)); + let repr: **VecRepr = ::unsafe::reinterpret_cast(addr_of(v)); let fill = (**repr).fill; (**repr).fill += sys::size_of::(); let p = ptr::addr_of((**repr).data); @@ -190,7 +190,7 @@ mod unsafe { unsafe fn reserve(&v: @[const T], n: uint) { // Only make the (slow) call into the runtime if we have to if capacity(v) < n { - let ptr = addr_of(v) as **vec_repr; + let ptr = addr_of(v) as **VecRepr; rustrt::vec_reserve_shared_actual(sys::get_type_desc::(), ptr, n as libc::size_t); } diff --git a/src/libcore/comm.rs b/src/libcore/comm.rs index b4cf0ef1002..eb19a12c254 100644 --- a/src/libcore/comm.rs +++ b/src/libcore/comm.rs @@ -27,7 +27,7 @@ * ~~~ */ -import either::either; +import either::Either; import libc::size_t; export port; @@ -222,7 +222,7 @@ fn peek_(p: *rust_port) -> bool { /// Receive on one of two ports fn select2(p_a: port, p_b: port) - -> either { + -> Either { let ports = ~[(**p_a).po, (**p_b).po]; let yield = 0u, yieldp = ptr::addr_of(yield); @@ -246,9 +246,9 @@ fn select2(p_a: port, p_b: port) assert resport != ptr::null(); if resport == (**p_a).po { - either::left(recv(p_a)) + either::Left(recv(p_a)) } else if resport == (**p_b).po { - either::right(recv(p_b)) + either::Right(recv(p_b)) } else { fail ~"unexpected result from rust_port_select"; } @@ -355,11 +355,11 @@ fn test_select2_available() { send(ch_a, ~"a"); - assert select2(po_a, po_b) == either::left(~"a"); + assert select2(po_a, po_b) == either::Left(~"a"); send(ch_b, ~"b"); - assert select2(po_a, po_b) == either::right(~"b"); + assert select2(po_a, po_b) == either::Right(~"b"); } #[test] @@ -375,14 +375,14 @@ fn test_select2_rendezvous() { send(ch_a, ~"a"); }; - assert select2(po_a, po_b) == either::left(~"a"); + assert select2(po_a, po_b) == either::Left(~"a"); do task::spawn { for iter::repeat(10u) { task::yield() } send(ch_b, ~"b"); }; - assert select2(po_a, po_b) == either::right(~"b"); + assert select2(po_a, po_b) == either::Right(~"b"); } } @@ -413,8 +413,8 @@ fn test_select2_stress() { let mut bs = 0; for iter::repeat(msgs * times * 2u) { match select2(po_a, po_b) { - either::left(~"a") => as += 1, - either::right(~"b") => bs += 1, + either::Left(~"a") => as += 1, + either::Right(~"b") => bs += 1, _ => fail ~"test_select_2_stress failed" } } diff --git a/src/libcore/core.rc b/src/libcore/core.rc index f5c9039ad25..3c54e077cc3 100644 --- a/src/libcore/core.rc +++ b/src/libcore/core.rc @@ -68,6 +68,7 @@ export priv; // Built-in-type support modules /// Operations and constants for `int` +#[warn(non_camel_case_types)] #[path = "int-template"] mod int { import inst::{ hash, pow }; @@ -77,6 +78,7 @@ mod int { } /// Operations and constants for `i8` +#[warn(non_camel_case_types)] #[path = "int-template"] mod i8 { #[path = "i8.rs"] @@ -84,6 +86,7 @@ mod i8 { } /// Operations and constants for `i16` +#[warn(non_camel_case_types)] #[path = "int-template"] mod i16 { #[path = "i16.rs"] @@ -91,6 +94,7 @@ mod i16 { } /// Operations and constants for `i32` +#[warn(non_camel_case_types)] #[path = "int-template"] mod i32 { #[path = "i32.rs"] @@ -98,6 +102,7 @@ mod i32 { } /// Operations and constants for `i64` +#[warn(non_camel_case_types)] #[path = "int-template"] mod i64 { #[path = "i64.rs"] @@ -105,6 +110,7 @@ mod i64 { } /// Operations and constants for `uint` +#[warn(non_camel_case_types)] #[path = "uint-template"] mod uint { import inst::{ @@ -119,6 +125,7 @@ mod uint { } /// Operations and constants for `u8` +#[warn(non_camel_case_types)] #[path = "uint-template"] mod u8 { import inst::is_ascii; @@ -129,6 +136,7 @@ mod u8 { } /// Operations and constants for `u16` +#[warn(non_camel_case_types)] #[path = "uint-template"] mod u16 { #[path = "u16.rs"] @@ -136,6 +144,7 @@ mod u16 { } /// Operations and constants for `u32` +#[warn(non_camel_case_types)] #[path = "uint-template"] mod u32 { #[path = "u32.rs"] @@ -143,6 +152,7 @@ mod u32 { } /// Operations and constants for `u64` +#[warn(non_camel_case_types)] #[path = "uint-template"] mod u64 { #[path = "u64.rs"] @@ -150,15 +160,25 @@ mod u64 { } +#[warn(non_camel_case_types)] mod box; +#[warn(non_camel_case_types)] mod char; +#[warn(non_camel_case_types)] mod float; +#[warn(non_camel_case_types)] mod f32; +#[warn(non_camel_case_types)] mod f64; +#[warn(non_camel_case_types)] mod str; +#[warn(non_camel_case_types)] mod ptr; +#[warn(non_camel_case_types)] mod vec; +#[warn(non_camel_case_types)] mod at_vec; +#[warn(non_camel_case_types)] mod bool; #[warn(non_camel_case_types)] mod tuple; @@ -173,7 +193,9 @@ mod cmp; mod num; #[warn(non_camel_case_types)] mod hash; +#[warn(non_camel_case_types)] mod either; +#[warn(non_camel_case_types)] mod iter; #[warn(non_camel_case_types)] mod logging; @@ -193,18 +215,23 @@ mod util; // Data structure modules +#[warn(non_camel_case_types)] mod dvec; #[path="iter-trait"] +#[warn(non_camel_case_types)] mod dvec_iter { #[path = "dvec.rs"] mod inst; } +#[warn(non_camel_case_types)] mod dlist; #[path="iter-trait"] +#[warn(non_camel_case_types)] mod dlist_iter { #[path ="dlist.rs"] mod inst; } +#[warn(non_camel_case_types)] mod send_map; // Concurrency diff --git a/src/libcore/core.rs b/src/libcore/core.rs index f6a721d102a..1fb831b46fa 100644 --- a/src/libcore/core.rs +++ b/src/libcore/core.rs @@ -6,25 +6,25 @@ import option::{some, none}; import option = option::option; import Path = path::Path; import tuple::{TupleOps, ExtendedTupleOps}; -import str::{str_slice, unique_str}; -import vec::{const_vector, copyable_vector, immutable_vector}; -import vec::{immutable_copyable_vector, iter_trait_extensions}; -import iter::{base_iter, extended_iter, copyable_iter, times, timesi}; +import str::{StrSlice, UniqueStr}; +import vec::{ConstVector, CopyableVector, ImmutableVector}; +import vec::{ImmutableCopyableVector, IterTraitExtensions}; +import iter::{BaseIter, ExtendedIter, CopyableIter, Times, TimesIx}; import num::Num; -import ptr::ptr; +import ptr::Ptr; import to_str::ToStr; export Path, option, some, none, unreachable; export extensions; // The following exports are the extension impls for numeric types -export Num, times, timesi; +export Num, Times, TimesIx; // The following exports are the common traits -export str_slice, unique_str; -export const_vector, copyable_vector, immutable_vector; -export immutable_copyable_vector, iter_trait_extensions; -export base_iter, copyable_iter, extended_iter; +export StrSlice, UniqueStr; +export ConstVector, CopyableVector, ImmutableVector; +export ImmutableCopyableVector, IterTraitExtensions; +export BaseIter, CopyableIter, ExtendedIter; export TupleOps, ExtendedTupleOps; -export ptr; +export Ptr; export ToStr; // The following exports are the core operators and kinds diff --git a/src/libcore/dlist.rs b/src/libcore/dlist.rs index b3f56109ee4..f835344f2d1 100644 --- a/src/libcore/dlist.rs +++ b/src/libcore/dlist.rs @@ -8,25 +8,25 @@ * Do not use ==, !=, <, etc on doubly-linked lists -- it may not terminate. */ -export dlist, dlist_node; +export DList, dlist, dlist_node; export new_dlist, from_elem, from_vec, extensions; -type dlist_link = option>; +type DListLink = option>; -enum dlist_node = @{ +enum DListNode = @{ data: T, mut linked: bool, // for assertions - mut prev: dlist_link, - mut next: dlist_link + mut prev: DListLink, + mut next: DListLink }; -enum dlist = @{ +enum DList = @{ mut size: uint, - mut hd: dlist_link, - mut tl: dlist_link, + mut hd: DListLink, + mut tl: DListLink, }; -priv impl dlist_node { +priv impl DListNode { pure fn assert_links() { match self.next { some(neighbour) => match neighbour.prev { @@ -49,26 +49,26 @@ priv impl dlist_node { } } -impl dlist_node { +impl DListNode { /// Get the next node in the list, if there is one. - pure fn next_link() -> option> { + pure fn next_link() -> option> { self.assert_links(); self.next } /// Get the next node in the list, failing if there isn't one. - pure fn next_node() -> dlist_node { + pure fn next_node() -> DListNode { match self.next_link() { some(nobe) => nobe, none => fail ~"This dlist node has no next neighbour." } } /// Get the previous node in the list, if there is one. - pure fn prev_link() -> option> { + pure fn prev_link() -> option> { self.assert_links(); self.prev } /// Get the previous node in the list, failing if there isn't one. - pure fn prev_node() -> dlist_node { + pure fn prev_node() -> DListNode { match self.prev_link() { some(nobe) => nobe, none => fail ~"This dlist node has no previous neighbour." @@ -77,24 +77,24 @@ impl dlist_node { } /// Creates a new dlist node with the given data. -pure fn new_dlist_node(+data: T) -> dlist_node { - dlist_node(@{data: data, mut linked: false, +pure fn new_dlist_node(+data: T) -> DListNode { + DListNode(@{data: data, mut linked: false, mut prev: none, mut next: none}) } /// Creates a new, empty dlist. -pure fn new_dlist() -> dlist { - dlist(@{mut size: 0, mut hd: none, mut tl: none}) +pure fn new_dlist() -> DList { + DList(@{mut size: 0, mut hd: none, mut tl: none}) } /// Creates a new dlist with a single element -pure fn from_elem(+data: T) -> dlist { +pure fn from_elem(+data: T) -> DList { let list = new_dlist(); unchecked { list.push(data); } list } -fn from_vec(+vec: &[T]) -> dlist { +fn from_vec(+vec: &[T]) -> DList { do vec::foldl(new_dlist(), vec) |list,data| { list.push(data); // Iterating left-to-right -- add newly to the tail. list @@ -103,7 +103,7 @@ fn from_vec(+vec: &[T]) -> dlist { /// Produce a list from a list of lists, leaving no elements behind in the /// input. O(number of sub-lists). -fn concat(lists: dlist>) -> dlist { +fn concat(lists: DList>) -> DList { let result = new_dlist(); while !lists.is_empty() { result.append(lists.pop().get()); @@ -111,12 +111,12 @@ fn concat(lists: dlist>) -> dlist { result } -priv impl dlist { - pure fn new_link(-data: T) -> dlist_link { - some(dlist_node(@{data: data, mut linked: true, +priv impl DList { + pure fn new_link(-data: T) -> DListLink { + some(DListNode(@{data: data, mut linked: true, mut prev: none, mut next: none})) } - pure fn assert_mine(nobe: dlist_node) { + pure fn assert_mine(nobe: DListNode) { // These asserts could be stronger if we had node-root back-pointers, // but those wouldn't allow for O(1) append. if self.size == 0 { @@ -130,7 +130,7 @@ priv impl dlist { fail ~"That node isn't on this dlist." } } - fn make_mine(nobe: dlist_node) { + fn make_mine(nobe: DListNode) { if nobe.prev.is_some() || nobe.next.is_some() || nobe.linked { fail ~"Cannot insert node that's already on a dlist!" } @@ -139,7 +139,7 @@ priv impl dlist { // Link two nodes together. If either of them are 'none', also sets // the head and/or tail pointers appropriately. #[inline(always)] - fn link(+before: dlist_link, +after: dlist_link) { + fn link(+before: DListLink, +after: DListLink) { match before { some(neighbour) => neighbour.next = after, none => self.hd = after @@ -150,7 +150,7 @@ priv impl dlist { } } // Remove a node from the list. - fn unlink(nobe: dlist_node) { + fn unlink(nobe: DListNode) { self.assert_mine(nobe); assert self.size > 0; self.link(nobe.prev, nobe.next); @@ -160,24 +160,24 @@ priv impl dlist { self.size -= 1; } - fn add_head(+nobe: dlist_link) { + fn add_head(+nobe: DListLink) { self.link(nobe, self.hd); // Might set tail too. self.hd = nobe; self.size += 1; } - fn add_tail(+nobe: dlist_link) { + fn add_tail(+nobe: DListLink) { self.link(self.tl, nobe); // Might set head too. self.tl = nobe; self.size += 1; } - fn insert_left(nobe: dlist_link, neighbour: dlist_node) { + fn insert_left(nobe: DListLink, neighbour: DListNode) { self.assert_mine(neighbour); assert self.size > 0; self.link(neighbour.prev, nobe); self.link(nobe, some(neighbour)); self.size += 1; } - fn insert_right(neighbour: dlist_node, nobe: dlist_link) { + fn insert_right(neighbour: DListNode, nobe: DListLink) { self.assert_mine(neighbour); assert self.size > 0; self.link(nobe, neighbour.next); @@ -186,7 +186,7 @@ priv impl dlist { } } -impl dlist { +impl DList { /// Get the size of the list. O(1). pure fn len() -> uint { self.size } /// Returns true if the list is empty. O(1). @@ -202,7 +202,7 @@ impl dlist { * Add data to the head of the list, and get the new containing * node. O(1). */ - fn push_head_n(+data: T) -> dlist_node { + fn push_head_n(+data: T) -> DListNode { let mut nobe = self.new_link(data); self.add_head(nobe); option::get(nobe) @@ -215,7 +215,7 @@ impl dlist { * Add data to the tail of the list, and get the new containing * node. O(1). */ - fn push_n(+data: T) -> dlist_node { + fn push_n(+data: T) -> DListNode { let mut nobe = self.new_link(data); self.add_tail(nobe); option::get(nobe) @@ -224,14 +224,14 @@ impl dlist { * Insert data into the middle of the list, left of the given node. * O(1). */ - fn insert_before(+data: T, neighbour: dlist_node) { + fn insert_before(+data: T, neighbour: DListNode) { self.insert_left(self.new_link(data), neighbour); } /** * Insert an existing node in the middle of the list, left of the * given node. O(1). */ - fn insert_n_before(nobe: dlist_node, neighbour: dlist_node) { + fn insert_n_before(nobe: DListNode, neighbour: DListNode) { self.make_mine(nobe); self.insert_left(some(nobe), neighbour); } @@ -239,7 +239,7 @@ impl dlist { * Insert data in the middle of the list, left of the given node, * and get its containing node. O(1). */ - fn insert_before_n(+data: T, neighbour: dlist_node) -> dlist_node { + fn insert_before_n(+data: T, neighbour: DListNode) -> DListNode { let mut nobe = self.new_link(data); self.insert_left(nobe, neighbour); option::get(nobe) @@ -248,14 +248,14 @@ impl dlist { * Insert data into the middle of the list, right of the given node. * O(1). */ - fn insert_after(+data: T, neighbour: dlist_node) { + fn insert_after(+data: T, neighbour: DListNode) { self.insert_right(neighbour, self.new_link(data)); } /** * Insert an existing node in the middle of the list, right of the * given node. O(1). */ - fn insert_n_after(nobe: dlist_node, neighbour: dlist_node) { + fn insert_n_after(nobe: DListNode, neighbour: DListNode) { self.make_mine(nobe); self.insert_right(neighbour, some(nobe)); } @@ -263,38 +263,38 @@ impl dlist { * Insert data in the middle of the list, right of the given node, * and get its containing node. O(1). */ - fn insert_after_n(+data: T, neighbour: dlist_node) -> dlist_node { + fn insert_after_n(+data: T, neighbour: DListNode) -> DListNode { let mut nobe = self.new_link(data); self.insert_right(neighbour, nobe); option::get(nobe) } /// Remove a node from the head of the list. O(1). - fn pop_n() -> option> { + fn pop_n() -> option> { let hd = self.peek_n(); hd.map(|nobe| self.unlink(nobe)); hd } /// Remove a node from the tail of the list. O(1). - fn pop_tail_n() -> option> { + fn pop_tail_n() -> option> { let tl = self.peek_tail_n(); tl.map(|nobe| self.unlink(nobe)); tl } /// Get the node at the list's head. O(1). - pure fn peek_n() -> option> { self.hd } + pure fn peek_n() -> option> { self.hd } /// Get the node at the list's tail. O(1). - pure fn peek_tail_n() -> option> { self.tl } + pure fn peek_tail_n() -> option> { self.tl } /// Get the node at the list's head, failing if empty. O(1). - pure fn head_n() -> dlist_node { + pure fn head_n() -> DListNode { match self.hd { some(nobe) => nobe, none => fail ~"Attempted to get the head of an empty dlist." } } /// Get the node at the list's tail, failing if empty. O(1). - pure fn tail_n() -> dlist_node { + pure fn tail_n() -> DListNode { match self.tl { some(nobe) => nobe, none => fail ~"Attempted to get the tail of an empty dlist." @@ -302,13 +302,13 @@ impl dlist { } /// Remove a node from anywhere in the list. O(1). - fn remove(nobe: dlist_node) { self.unlink(nobe); } + fn remove(nobe: DListNode) { self.unlink(nobe); } /** * Empty another list onto the end of this list, joining this list's tail * to the other list's head. O(1). */ - fn append(them: dlist) { + fn append(them: DList) { if box::ptr_eq(*self, *them) { fail ~"Cannot append a dlist to itself!" } @@ -325,7 +325,7 @@ impl dlist { * Empty another list onto the start of this list, joining the other * list's tail to this list's head. O(1). */ - fn prepend(them: dlist) { + fn prepend(them: DList) { if box::ptr_eq(*self, *them) { fail ~"Cannot prepend a dlist to itself!" } @@ -363,7 +363,7 @@ impl dlist { } /// Iterate over nodes. - pure fn each_node(f: fn(dlist_node) -> bool) { + pure fn each_node(f: fn(DListNode) -> bool) { let mut link = self.peek_n(); while link.is_some() { let nobe = link.get(); @@ -415,7 +415,7 @@ impl dlist { } } -impl dlist { +impl DList { /// Remove data from the head of the list. O(1). fn pop() -> option { self.pop_n().map (|nobe| nobe.data) } /// Remove data from the tail of the list. O(1). diff --git a/src/libcore/dvec.rs b/src/libcore/dvec.rs index 1f349b67002..ecbff6f12df 100644 --- a/src/libcore/dvec.rs +++ b/src/libcore/dvec.rs @@ -12,6 +12,7 @@ import unsafe::reinterpret_cast; import ptr::null; +export DVec; export dvec; export from_elem; export from_vec; @@ -49,36 +50,36 @@ export unwrap; * pointers achieved about 103 million pushes/second. Using an option * type could only produce 47 million pushes/second. */ -type dvec_ = { +type DVec_ = { mut data: ~[mut A] }; -enum dvec { - dvec_(dvec_) +enum DVec { + DVec_(DVec_) } /// Creates a new, empty dvec -fn dvec() -> dvec { - dvec_({mut data: ~[mut]}) +fn dvec() -> DVec { + DVec_({mut data: ~[mut]}) } /// Creates a new dvec with a single element -fn from_elem(+e: A) -> dvec { - dvec_({mut data: ~[mut e]}) +fn from_elem(+e: A) -> DVec { + DVec_({mut data: ~[mut e]}) } /// Creates a new dvec with the contents of a vector -fn from_vec(+v: ~[mut A]) -> dvec { - dvec_({mut data: v}) +fn from_vec(+v: ~[mut A]) -> DVec { + DVec_({mut data: v}) } /// Consumes the vector and returns its contents -fn unwrap(+d: dvec) -> ~[mut A] { - let dvec_({data: v}) <- d; +fn unwrap(+d: DVec) -> ~[mut A] { + let DVec_({data: v}) <- d; return v; } -priv impl dvec { +priv impl DVec { pure fn check_not_borrowed() { unsafe { let data: *() = unsafe::reinterpret_cast(self.data); @@ -110,7 +111,7 @@ priv impl dvec { // In theory, most everything should work with any A, but in practice // almost nothing works without the copy bound due to limitations // around closures. -impl dvec { +impl DVec { /// Reserves space for N elements fn reserve(count: uint) { vec::reserve(self.data, count) @@ -191,7 +192,7 @@ impl dvec { } } -impl dvec { +impl DVec { /** * Append all elements of a vector to the end of the list * @@ -308,7 +309,7 @@ impl dvec { } } -impl dvec: index { +impl DVec: index { pure fn index(&&idx: uint) -> A { self.get_elt(idx) } diff --git a/src/libcore/either.rs b/src/libcore/either.rs index 6b9c1846c37..6e2698ce8ab 100644 --- a/src/libcore/either.rs +++ b/src/libcore/either.rs @@ -7,13 +7,13 @@ import result::result; /// The either type -enum either { - left(T), - right(U) +enum Either { + Left(T), + Right(U) } fn either(f_left: fn((&T)) -> V, - f_right: fn((&U)) -> V, value: &either) -> V { + f_right: fn((&U)) -> V, value: &Either) -> V { /*! * Applies a function based on the given either value * @@ -23,38 +23,38 @@ fn either(f_left: fn((&T)) -> V, */ match *value { - left(ref l) => f_left(l), - right(ref r) => f_right(r) + Left(ref l) => f_left(l), + Right(ref r) => f_right(r) } } -fn lefts(eithers: &[either]) -> ~[T] { +fn lefts(eithers: &[Either]) -> ~[T] { //! Extracts from a vector of either all the left values let mut result: ~[T] = ~[]; for vec::each(eithers) |elt| { match elt { - left(l) => vec::push(result, l), + Left(l) => vec::push(result, l), _ => { /* fallthrough */ } } } return result; } -fn rights(eithers: &[either]) -> ~[U] { +fn rights(eithers: &[Either]) -> ~[U] { //! Extracts from a vector of either all the right values let mut result: ~[U] = ~[]; for vec::each(eithers) |elt| { match elt { - right(r) => vec::push(result, r), + Right(r) => vec::push(result, r), _ => { /* fallthrough */ } } } return result; } -fn partition(eithers: &[either]) +fn partition(eithers: &[Either]) -> {lefts: ~[T], rights: ~[U]} { /*! * Extracts from a vector of either all the left values and right values @@ -67,23 +67,23 @@ fn partition(eithers: &[either]) let mut rights: ~[U] = ~[]; for vec::each(eithers) |elt| { match elt { - left(l) => vec::push(lefts, l), - right(r) => vec::push(rights, r) + Left(l) => vec::push(lefts, l), + Right(r) => vec::push(rights, r) } } return {lefts: lefts, rights: rights}; } -pure fn flip(eith: &either) -> either { +pure fn flip(eith: &Either) -> Either { //! Flips between left and right of a given either match *eith { - right(r) => left(r), - left(l) => right(l) + Right(r) => Left(r), + Left(l) => Right(l) } } -pure fn to_result(eith: &either) -> result { +pure fn to_result(eith: &Either) -> result { /*! * Converts either::t to a result::t * @@ -92,26 +92,26 @@ pure fn to_result(eith: &either) -> result { */ match *eith { - right(r) => result::ok(r), - left(l) => result::err(l) + Right(r) => result::ok(r), + Left(l) => result::err(l) } } -pure fn is_left(eith: &either) -> bool { +pure fn is_left(eith: &Either) -> bool { //! Checks whether the given value is a left - match *eith { left(_) => true, _ => false } + match *eith { Left(_) => true, _ => false } } -pure fn is_right(eith: &either) -> bool { +pure fn is_right(eith: &Either) -> bool { //! Checks whether the given value is a right - match *eith { right(_) => true, _ => false } + match *eith { Right(_) => true, _ => false } } #[test] fn test_either_left() { - let val = left(10); + let val = Left(10); fn f_left(x: &int) -> bool { *x == 10 } fn f_right(_x: &uint) -> bool { false } assert (either(f_left, f_right, &val)); @@ -119,7 +119,7 @@ fn test_either_left() { #[test] fn test_either_right() { - let val = right(10u); + let val = Right(10u); fn f_left(_x: &int) -> bool { false } fn f_right(x: &uint) -> bool { *x == 10u } assert (either(f_left, f_right, &val)); @@ -127,49 +127,49 @@ fn test_either_right() { #[test] fn test_lefts() { - let input = ~[left(10), right(11), left(12), right(13), left(14)]; + let input = ~[Left(10), Right(11), Left(12), Right(13), Left(14)]; let result = lefts(input); assert (result == ~[10, 12, 14]); } #[test] fn test_lefts_none() { - let input: ~[either] = ~[right(10), right(10)]; + let input: ~[Either] = ~[Right(10), Right(10)]; let result = lefts(input); assert (vec::len(result) == 0u); } #[test] fn test_lefts_empty() { - let input: ~[either] = ~[]; + let input: ~[Either] = ~[]; let result = lefts(input); assert (vec::len(result) == 0u); } #[test] fn test_rights() { - let input = ~[left(10), right(11), left(12), right(13), left(14)]; + let input = ~[Left(10), Right(11), Left(12), Right(13), Left(14)]; let result = rights(input); assert (result == ~[11, 13]); } #[test] fn test_rights_none() { - let input: ~[either] = ~[left(10), left(10)]; + let input: ~[Either] = ~[Left(10), Left(10)]; let result = rights(input); assert (vec::len(result) == 0u); } #[test] fn test_rights_empty() { - let input: ~[either] = ~[]; + let input: ~[Either] = ~[]; let result = rights(input); assert (vec::len(result) == 0u); } #[test] fn test_partition() { - let input = ~[left(10), right(11), left(12), right(13), left(14)]; + let input = ~[Left(10), Right(11), Left(12), Right(13), Left(14)]; let result = partition(input); assert (result.lefts[0] == 10); assert (result.lefts[1] == 12); @@ -180,7 +180,7 @@ fn test_partition() { #[test] fn test_partition_no_lefts() { - let input: ~[either] = ~[right(10), right(11)]; + let input: ~[Either] = ~[Right(10), Right(11)]; let result = partition(input); assert (vec::len(result.lefts) == 0u); assert (vec::len(result.rights) == 2u); @@ -188,7 +188,7 @@ fn test_partition_no_lefts() { #[test] fn test_partition_no_rights() { - let input: ~[either] = ~[left(10), left(11)]; + let input: ~[Either] = ~[Left(10), Left(11)]; let result = partition(input); assert (vec::len(result.lefts) == 2u); assert (vec::len(result.rights) == 0u); @@ -196,7 +196,7 @@ fn test_partition_no_rights() { #[test] fn test_partition_empty() { - let input: ~[either] = ~[]; + let input: ~[Either] = ~[]; let result = partition(input); assert (vec::len(result.lefts) == 0u); assert (vec::len(result.rights) == 0u); diff --git a/src/libcore/future.rs b/src/libcore/future.rs index 79259c785fe..a935a50ddb6 100644 --- a/src/libcore/future.rs +++ b/src/libcore/future.rs @@ -15,7 +15,7 @@ * ~~~ */ -import either::either; +import either::Either; import pipes::recv; export future; @@ -32,7 +32,7 @@ export future_pipe; #[doc = "The future type"] enum future = { - mut v: either<@A, fn@() -> A> + mut v: Either<@A, fn@() -> A> }; /// Methods on the `future` type @@ -60,7 +60,7 @@ fn from_value(+val: A) -> future { */ future({ - mut v: either::left(@val) + mut v: either::Left(@val) }) } @@ -97,7 +97,7 @@ fn from_fn(f: fn@() -> A) -> future { */ future({ - mut v: either::right(f) + mut v: either::Right(f) }) } @@ -124,10 +124,10 @@ fn with(future: &future, blk: fn((&A)) -> B) -> B { //! Work with the value without copying it let v = match copy future.v { - either::left(v) => v, - either::right(f) => { + either::Left(v) => v, + either::Right(f) => { let v = @f(); - future.v = either::left(v); + future.v = either::Left(v); v } }; diff --git a/src/libcore/int-template.rs b/src/libcore/int-template.rs index 0819d702456..9ebfec47c7c 100644 --- a/src/libcore/int-template.rs +++ b/src/libcore/int-template.rs @@ -88,7 +88,7 @@ impl T: num::Num { static pure fn from_int(n: int) -> T { return n as T; } } -impl T: iter::times { +impl T: iter::Times { #[inline(always)] #[doc = "A convenience form for basic iteration. Given a variable `x` \ of any numeric type, the expression `for x.times { /* anything */ }` \ @@ -108,7 +108,7 @@ impl T: iter::times { } } -impl T: iter::timesi { +impl T: iter::TimesIx { #[inline(always)] /// Like `times`, but provides an index fn timesi(it: fn(uint) -> bool) { @@ -255,7 +255,7 @@ fn test_interfaces() { #[test] fn test_times() { - import iter::times; + import iter::Times; let ten = 10 as T; let mut accum = 0; for ten.times { accum += 1; } @@ -266,6 +266,6 @@ fn test_times() { #[should_fail] #[ignore(cfg(windows))] fn test_times_negative() { - import iter::times; + import iter::Times; for (-10).times { log(error, ~"nope!"); } } diff --git a/src/libcore/io.rs b/src/libcore/io.rs index c01672b5c73..d85ffb4981d 100644 --- a/src/libcore/io.rs +++ b/src/libcore/io.rs @@ -6,7 +6,7 @@ Basic input/output import result::result; -import dvec::dvec; +import dvec::{DVec, dvec}; import libc::{c_int, c_long, c_uint, c_void, size_t, ssize_t}; import libc::consts::os::posix88::*; import libc::consts::os::extra::*; @@ -657,7 +657,7 @@ fn stderr() -> Writer { fd_writer(libc::STDERR_FILENO as c_int, false) } fn print(s: &str) { stdout().write_str(s); } fn println(s: &str) { stdout().write_line(s); } -type MemBuffer = @{buf: dvec, mut pos: uint}; +type MemBuffer = @{buf: DVec, mut pos: uint}; impl MemBuffer: Writer { fn write(v: &[const u8]) { diff --git a/src/libcore/iter-trait.rs b/src/libcore/iter-trait.rs index d448292b1aa..5aeb958f5b2 100644 --- a/src/libcore/iter-trait.rs +++ b/src/libcore/iter-trait.rs @@ -5,12 +5,12 @@ import inst::{IMPL_T, EACH, SIZE_HINT}; export extensions; -impl IMPL_T: iter::base_iter { +impl IMPL_T: iter::BaseIter { fn each(blk: fn(A) -> bool) { EACH(self, blk) } fn size_hint() -> option { SIZE_HINT(self) } } -impl IMPL_T: iter::extended_iter { +impl IMPL_T: iter::ExtendedIter { fn eachi(blk: fn(uint, A) -> bool) { iter::eachi(self, blk) } fn all(blk: fn(A) -> bool) -> bool { iter::all(self, blk) } fn any(blk: fn(A) -> bool) -> bool { iter::any(self, blk) } @@ -24,7 +24,7 @@ impl IMPL_T: iter::extended_iter { } } -impl IMPL_T: iter::copyable_iter { +impl IMPL_T: iter::CopyableIter { fn filter_to_vec(pred: fn(A) -> bool) -> ~[A] { iter::filter_to_vec(self, pred) } diff --git a/src/libcore/iter-trait/dlist.rs b/src/libcore/iter-trait/dlist.rs index 9d8d147ffd7..91d6ffa765a 100644 --- a/src/libcore/iter-trait/dlist.rs +++ b/src/libcore/iter-trait/dlist.rs @@ -1,4 +1,5 @@ -type IMPL_T = dlist::dlist; +#[allow(non_camel_case_types)] +type IMPL_T = dlist::DList; /** * Iterates through the current contents. diff --git a/src/libcore/iter-trait/dvec.rs b/src/libcore/iter-trait/dvec.rs index d40eead14ff..5c02f8b5dea 100644 --- a/src/libcore/iter-trait/dvec.rs +++ b/src/libcore/iter-trait/dvec.rs @@ -1,4 +1,5 @@ -type IMPL_T = dvec::dvec; +#[allow(non_camel_case_types)] +type IMPL_T = dvec::DVec; /** * Iterates through the current contents. diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index 2cb3369dbc7..06a1c6c9fba 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -1,9 +1,9 @@ -trait base_iter { +trait BaseIter { fn each(blk: fn(A) -> bool); fn size_hint() -> option; } -trait extended_iter { +trait ExtendedIter { fn eachi(blk: fn(uint, A) -> bool); fn all(blk: fn(A) -> bool) -> bool; fn any(blk: fn(A) -> bool) -> bool; @@ -13,14 +13,14 @@ trait extended_iter { fn position(f: fn(A) -> bool) -> option; } -trait times { +trait Times { fn times(it: fn() -> bool); } -trait timesi{ +trait TimesIx{ fn timesi(it: fn(uint) -> bool); } -trait copyable_iter { +trait CopyableIter { fn filter_to_vec(pred: fn(A) -> bool) -> ~[A]; fn map_to_vec(op: fn(A) -> B) -> ~[B]; fn to_vec() -> ~[A]; @@ -29,7 +29,7 @@ trait copyable_iter { fn find(p: fn(A) -> bool) -> option; } -fn eachi>(self: IA, blk: fn(uint, A) -> bool) { +fn eachi>(self: IA, blk: fn(uint, A) -> bool) { let mut i = 0u; for self.each |a| { if !blk(i, a) { break; } @@ -37,21 +37,21 @@ fn eachi>(self: IA, blk: fn(uint, A) -> bool) { } } -fn all>(self: IA, blk: fn(A) -> bool) -> bool { +fn all>(self: IA, blk: fn(A) -> bool) -> bool { for self.each |a| { if !blk(a) { return false; } } return true; } -fn any>(self: IA, blk: fn(A) -> bool) -> bool { +fn any>(self: IA, blk: fn(A) -> bool) -> bool { for self.each |a| { if blk(a) { return true; } } return false; } -fn filter_to_vec>(self: IA, +fn filter_to_vec>(self: IA, prd: fn(A) -> bool) -> ~[A] { let mut result = ~[]; self.size_hint().iter(|hint| vec::reserve(result, hint)); @@ -61,7 +61,7 @@ fn filter_to_vec>(self: IA, return result; } -fn map_to_vec>(self: IA, op: fn(A) -> B) -> ~[B] { +fn map_to_vec>(self: IA, op: fn(A) -> B) -> ~[B] { let mut result = ~[]; self.size_hint().iter(|hint| vec::reserve(result, hint)); for self.each |a| { @@ -70,7 +70,7 @@ fn map_to_vec>(self: IA, op: fn(A) -> B) -> ~[B] { return result; } -fn flat_map_to_vec,IB:base_iter>( +fn flat_map_to_vec,IB:BaseIter>( self: IA, op: fn(A) -> IB) -> ~[B] { let mut result = ~[]; @@ -82,7 +82,7 @@ fn flat_map_to_vec,IB:base_iter>( return result; } -fn foldl>(self: IA, +b0: B, blk: fn(B, A) -> B) -> B { +fn foldl>(self: IA, +b0: B, blk: fn(B, A) -> B) -> B { let mut b <- b0; for self.each |a| { b = blk(b, a); @@ -90,18 +90,18 @@ fn foldl>(self: IA, +b0: B, blk: fn(B, A) -> B) -> B { return b; } -fn to_vec>(self: IA) -> ~[A] { +fn to_vec>(self: IA) -> ~[A] { foldl::(self, ~[], |r, a| vec::append(r, ~[a])) } -fn contains>(self: IA, x: A) -> bool { +fn contains>(self: IA, x: A) -> bool { for self.each |a| { if a == x { return true; } } return false; } -fn count>(self: IA, x: A) -> uint { +fn count>(self: IA, x: A) -> uint { do foldl(self, 0u) |count, value| { if value == x { count + 1u @@ -111,7 +111,7 @@ fn count>(self: IA, x: A) -> uint { } } -fn position>(self: IA, f: fn(A) -> bool) +fn position>(self: IA, f: fn(A) -> bool) -> option { let mut i = 0; for self.each |a| { @@ -133,7 +133,7 @@ fn repeat(times: uint, blk: fn() -> bool) { } } -fn min>(self: IA) -> A { +fn min>(self: IA) -> A { match do foldl::,IA>(self, none) |a, b| { match a { some(a_) if a_ < b => { @@ -149,7 +149,7 @@ fn min>(self: IA) -> A { } } -fn max>(self: IA) -> A { +fn max>(self: IA) -> A { match do foldl::,IA>(self, none) |a, b| { match a { some(a_) if a_ > b => { diff --git a/src/libcore/os.rs b/src/libcore/os.rs index ec4485bb123..7d5e98c08bd 100644 --- a/src/libcore/os.rs +++ b/src/libcore/os.rs @@ -177,16 +177,16 @@ mod global_env { do priv::weaken_task |weak_po| { loop { match comm::select2(msg_po, weak_po) { - either::left(MsgGetEnv(n, resp_ch)) => { + either::Left(MsgGetEnv(n, resp_ch)) => { comm::send(resp_ch, impl::getenv(n)) } - either::left(MsgSetEnv(n, v, resp_ch)) => { + either::Left(MsgSetEnv(n, v, resp_ch)) => { comm::send(resp_ch, impl::setenv(n, v)) } - either::left(MsgEnv(resp_ch)) => { + either::Left(MsgEnv(resp_ch)) => { comm::send(resp_ch, impl::env()) } - either::right(_) => break + either::Right(_) => break } } } diff --git a/src/libcore/pipes.rs b/src/libcore/pipes.rs index ba8ac5cae87..6de2059d2de 100644 --- a/src/libcore/pipes.rs +++ b/src/libcore/pipes.rs @@ -77,7 +77,7 @@ bounded and unbounded protocols allows for less code duplication. #[forbid(deprecated_pattern)]; import unsafe::{forget, reinterpret_cast, transmute}; -import either::{either, left, right}; +import either::{Either, Left, Right}; import option::unwrap; // Things used by code generated by the pipe compiler. @@ -658,15 +658,15 @@ this case, `select2` may return either `left` or `right`. fn select2( +a: recv_packet_buffered, +b: recv_packet_buffered) - -> either<(option, recv_packet_buffered), + -> Either<(option, recv_packet_buffered), (recv_packet_buffered, option)> { let i = wait_many([a.header(), b.header()]/_); unsafe { match i { - 0 => left((try_recv(a), b)), - 1 => right((a, try_recv(b))), + 0 => Left((try_recv(a), b)), + 1 => Right((a, try_recv(b))), _ => fail ~"select2 return an invalid packet" } } @@ -687,10 +687,10 @@ fn selecti(endpoints: &[T]) -> uint { } /// Returns 0 or 1 depending on which endpoint is ready to receive -fn select2i(a: &A, b: &B) -> either<(), ()> { +fn select2i(a: &A, b: &B) -> Either<(), ()> { match wait_many([a.header(), b.header()]/_) { - 0 => left(()), - 1 => right(()), + 0 => Left(()), + 1 => Right(()), _ => fail ~"wait returned unexpected index" } } @@ -1117,28 +1117,28 @@ fn shared_chan(+c: chan) -> shared_chan { /// Receive a message from one of two endpoints. trait select2 { /// Receive a message or return `none` if a connection closes. - fn try_select() -> either, option>; + fn try_select() -> Either, option>; /// Receive a message or fail if a connection closes. - fn select() -> either; + fn select() -> Either; } impl, Right: selectable recv> (Left, Right): select2 { - fn select() -> either { + fn select() -> Either { match self { (lp, rp) => match select2i(&lp, &rp) { - left(()) => left (lp.recv()), - right(()) => right(rp.recv()) + Left(()) => Left (lp.recv()), + Right(()) => Right(rp.recv()) } } } - fn try_select() -> either, option> { + fn try_select() -> Either, option> { match self { (lp, rp) => match select2i(&lp, &rp) { - left(()) => left (lp.try_recv()), - right(()) => right(rp.try_recv()) + Left(()) => Left (lp.try_recv()), + Right(()) => Right(rp.try_recv()) } } } @@ -1204,7 +1204,7 @@ mod test { c1.send(~"abc"); match (p1, p2).select() { - right(_) => fail, + Right(_) => fail, _ => () } diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index b7b63af0afb..2c3ff0121ba 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -16,7 +16,7 @@ export to_uint; export ref_eq; export buf_len; export position; -export ptr; +export Ptr; import libc::{c_void, size_t}; @@ -156,13 +156,13 @@ fn ref_eq(thing: &a/T, other: &b/T) -> bool { to_uint(thing) == to_uint(other) } -trait ptr { +trait Ptr { pure fn is_null() -> bool; pure fn is_not_null() -> bool; } /// Extension methods for pointers -impl *T: ptr { +impl *T: Ptr { /// Returns true if the pointer is equal to the null pointer. pure fn is_null() -> bool { is_null(self) } diff --git a/src/libcore/result.rs b/src/libcore/result.rs index 762191842b8..341d28e67e8 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -1,6 +1,6 @@ //! A type representing either success or failure -import either::either; +import either::Either; /// The result type enum result { @@ -59,10 +59,10 @@ pure fn is_err(res: result) -> bool { * `ok` result variants are converted to `either::right` variants, `err` * result variants are converted to `either::left`. */ -pure fn to_either(res: result) -> either { +pure fn to_either(res: result) -> Either { match res { - ok(res) => either::right(res), - err(fail_) => either::left(fail_) + ok(res) => either::Right(res), + err(fail_) => either::Left(fail_) } } diff --git a/src/libcore/send_map.rs b/src/libcore/send_map.rs index 1a130e0e273..cb8d596cf88 100644 --- a/src/libcore/send_map.rs +++ b/src/libcore/send_map.rs @@ -10,28 +10,28 @@ Sendable hash maps. Very much a work in progress. * * The hash should concentrate entropy in the lower bits. */ -type hashfn = pure fn~(K) -> uint; -type eqfn = pure fn~(K, K) -> bool; +type HashFn = pure fn~(K) -> uint; +type EqFn = pure fn~(K, K) -> bool; /// Open addressing with linear probing. mod linear { - export linear_map, linear_map_with_capacity, public_methods; + export LinearMap, linear_map, linear_map_with_capacity, public_methods; const initial_capacity: uint = 32u; // 2^5 - type bucket = {hash: uint, key: K, value: V}; - enum linear_map { - linear_map_({ + type Bucket = {hash: uint, key: K, value: V}; + enum LinearMap { + LinearMap_({ hashfn: pure fn~(x: &K) -> uint, eqfn: pure fn~(x: &K, y: &K) -> bool, resize_at: uint, size: uint, - buckets: ~[option>]}) + buckets: ~[option>]}) } // FIXME(#2979) -- with #2979 we could rewrite found_entry // to have type option<&bucket> which would be nifty - enum search_result { - found_entry(uint), found_hole(uint), table_full + enum SearchResult { + FoundEntry(uint), FoundHole(uint), TableFull } fn resize_at(capacity: uint) -> uint { @@ -40,7 +40,7 @@ mod linear { fn linear_map( +hashfn: pure fn~(x: &K) -> uint, - +eqfn: pure fn~(x: &K, y: &K) -> bool) -> linear_map { + +eqfn: pure fn~(x: &K, y: &K) -> bool) -> LinearMap { linear_map_with_capacity(hashfn, eqfn, 32) } @@ -48,9 +48,9 @@ mod linear { fn linear_map_with_capacity( +hashfn: pure fn~(x: &K) -> uint, +eqfn: pure fn~(x: &K, y: &K) -> bool, - initial_capacity: uint) -> linear_map { + initial_capacity: uint) -> LinearMap { - linear_map_({ + LinearMap_({ hashfn: hashfn, eqfn: eqfn, resize_at: resize_at(initial_capacity), @@ -64,7 +64,7 @@ mod linear { unsafe::reinterpret_cast(p) } - priv impl &const linear_map { + priv impl &const LinearMap { #[inline(always)] pure fn to_bucket(h: uint) -> uint { // FIXME(#3041) borrow a more sophisticated technique here from @@ -101,8 +101,8 @@ mod linear { #[inline(always)] pure fn bucket_for_key( - buckets: &[option>], - k: &K) -> search_result { + buckets: &[option>], + k: &K) -> SearchResult { let hash = self.hashfn(k); self.bucket_for_key_with_hash(buckets, hash, k) @@ -110,23 +110,23 @@ mod linear { #[inline(always)] pure fn bucket_for_key_with_hash( - buckets: &[option>], + buckets: &[option>], hash: uint, - k: &K) -> search_result { + k: &K) -> SearchResult { let _ = for self.bucket_sequence(hash) |i| { match buckets[i] { some(bkt) => if bkt.hash == hash && self.eqfn(k, &bkt.key) { - return found_entry(i); + return FoundEntry(i); }, - none => return found_hole(i) + none => return FoundHole(i) } }; - return table_full; + return TableFull; } } - priv impl &mut linear_map { + priv impl &mut LinearMap { /// Expands the capacity of the array and re-inserts each /// of the existing buckets. fn expand() { @@ -146,7 +146,7 @@ mod linear { } } - fn insert_bucket(+bucket: option>) { + fn insert_bucket(+bucket: option>) { let {hash, key, value} <- option::unwrap(bucket); let _ = self.insert_internal(hash, key, value); } @@ -157,15 +157,15 @@ mod linear { fn insert_internal(hash: uint, +k: K, +v: V) -> bool { match self.bucket_for_key_with_hash(self.buckets, hash, unsafe{borrow(k)}) { - table_full => {fail ~"Internal logic error";} - found_hole(idx) => { + TableFull => {fail ~"Internal logic error";} + FoundHole(idx) => { debug!{"insert fresh (%?->%?) at idx %?, hash %?", k, v, idx, hash}; self.buckets[idx] = some({hash: hash, key: k, value: v}); self.size += 1; return true; } - found_entry(idx) => { + FoundEntry(idx) => { debug!{"insert overwrite (%?->%?) at idx %?, hash %?", k, v, idx, hash}; self.buckets[idx] = some({hash: hash, key: k, value: v}); @@ -175,7 +175,7 @@ mod linear { } } - impl &mut linear_map { + impl &mut LinearMap { fn insert(+k: K, +v: V) -> bool { if self.size >= self.resize_at { // n.b.: We could also do this after searching, so @@ -208,10 +208,10 @@ mod linear { // http://www.maths.lse.ac.uk/Courses/MA407/del-hash.pdf let mut idx = match self.bucket_for_key(self.buckets, k) { - table_full | found_hole(_) => { + TableFull | FoundHole(_) => { return false; } - found_entry(idx) => { + FoundEntry(idx) => { idx } }; @@ -230,13 +230,13 @@ mod linear { } } - priv impl &linear_map { - fn search(hash: uint, op: fn(x: &option>) -> bool) { + priv impl &LinearMap { + fn search(hash: uint, op: fn(x: &option>) -> bool) { let _ = self.bucket_sequence(hash, |i| op(&self.buckets[i])); } } - impl &const linear_map { + impl &const LinearMap { pure fn len() -> uint { self.size } @@ -247,21 +247,21 @@ mod linear { fn contains_key(k: &K) -> bool { match self.bucket_for_key(self.buckets, k) { - found_entry(_) => {true} - table_full | found_hole(_) => {false} + FoundEntry(_) => {true} + TableFull | FoundHole(_) => {false} } } } - impl &const linear_map { + impl &const LinearMap { fn find(k: &K) -> option { match self.bucket_for_key(self.buckets, k) { - found_entry(idx) => { + FoundEntry(idx) => { match check self.buckets[idx] { some(bkt) => {some(copy bkt.value)} } } - table_full | found_hole(_) => { + TableFull | FoundHole(_) => { none } } @@ -277,7 +277,7 @@ mod linear { } - impl &linear_map { + impl &LinearMap { /* FIXME --- #2979 must be fixed to typecheck this fn find_ptr(k: K) -> option<&V> { @@ -306,17 +306,17 @@ mod linear { } } - impl &linear_map { + impl &LinearMap { fn each(blk: fn(+K,+V) -> bool) { self.each_ref(|k,v| blk(copy *k, copy *v)); } } - impl &linear_map { + impl &LinearMap { fn each_key(blk: fn(+K) -> bool) { self.each_key_ref(|k| blk(copy *k)); } } - impl &linear_map { + impl &LinearMap { fn each_value(blk: fn(+V) -> bool) { self.each_value_ref(|v| blk(copy *v)); } @@ -326,12 +326,12 @@ mod linear { #[test] mod test { - import linear::linear_map; + import linear::{LinearMap, linear_map}; pure fn uint_hash(x: &uint) -> uint { *x } pure fn uint_eq(x: &uint, y: &uint) -> bool { *x == *y } - fn int_linear_map() -> linear_map { + fn int_linear_map() -> LinearMap { return linear_map(uint_hash, uint_eq); } diff --git a/src/libcore/str.rs b/src/libcore/str.rs index 9a1e32a6711..d73c71c510a 100644 --- a/src/libcore/str.rs +++ b/src/libcore/str.rs @@ -108,8 +108,8 @@ export unsafe, extensions, - str_slice, - unique_str; + StrSlice, + UniqueStr; #[abi = "cdecl"] extern mod rustrt { @@ -1877,7 +1877,7 @@ mod unsafe { /// Sets the length of the string and adds the null terminator unsafe fn set_len(&v: ~str, new_len: uint) { - let repr: *vec::unsafe::vec_repr = ::unsafe::reinterpret_cast(v); + let repr: *vec::unsafe::VecRepr = ::unsafe::reinterpret_cast(v); (*repr).fill = new_len + 1u; let null = ptr::mut_offset(ptr::mut_addr_of((*repr).data), new_len); *null = 0u8; @@ -1895,14 +1895,14 @@ mod unsafe { } -trait unique_str { +trait UniqueStr { fn trim() -> self; fn trim_left() -> self; fn trim_right() -> self; } /// Extension methods for strings -impl ~str: unique_str { +impl ~str: UniqueStr { /// Returns a string with leading and trailing whitespace removed #[inline] fn trim() -> ~str { trim(self) } @@ -1922,7 +1922,7 @@ impl ~str: add<&str,~str> { } } -trait str_slice { +trait StrSlice { fn all(it: fn(char) -> bool) -> bool; fn any(it: fn(char) -> bool) -> bool; fn contains(needle: &a/str) -> bool; @@ -1951,7 +1951,7 @@ trait str_slice { } /// Extension methods for strings -impl &str: str_slice { +impl &str: StrSlice { /** * Return true if a predicate matches all characters or if the string * contains no characters diff --git a/src/libcore/task.rs b/src/libcore/task.rs index 2748b53fb54..678cda32404 100644 --- a/src/libcore/task.rs +++ b/src/libcore/task.rs @@ -693,7 +693,7 @@ type task_id = int; type rust_task = libc::c_void; type rust_closure = libc::c_void; -type taskset = send_map::linear::linear_map<*rust_task,()>; +type taskset = send_map::linear::LinearMap<*rust_task,()>; fn new_taskset() -> taskset { pure fn task_hash(t: &*rust_task) -> uint { @@ -1271,7 +1271,7 @@ impl @T: local_data { } // heavily in future, this could be made more efficient with a proper map. type task_local_element = (*libc::c_void, *libc::c_void, local_data); // Has to be a pointer at outermost layer; the foreign call returns void *. -type task_local_map = @dvec::dvec>; +type task_local_map = @dvec::DVec>; extern fn cleanup_task_local_map(map_ptr: *libc::c_void) unsafe { assert !map_ptr.is_null(); diff --git a/src/libcore/uint-template.rs b/src/libcore/uint-template.rs index 0fc35156f3a..4f27e8cea8f 100644 --- a/src/libcore/uint-template.rs +++ b/src/libcore/uint-template.rs @@ -80,7 +80,7 @@ impl T: num::Num { static pure fn from_int(n: int) -> T { return n as T; } } -impl T: iter::times { +impl T: iter::Times { #[inline(always)] #[doc = "A convenience form for basic iteration. Given a variable `x` \ of any numeric type, the expression `for x.times { /* anything */ }` \ @@ -96,7 +96,7 @@ impl T: iter::times { } } -impl T: iter::timesi { +impl T: iter::TimesIx { #[inline(always)] /// Like `times`, but with an index, `eachi`-style. fn timesi(it: fn(uint) -> bool) { @@ -295,7 +295,7 @@ fn to_str_radix17() { #[test] fn test_times() { - import iter::times; + import iter::Times; let ten = 10 as T; let mut accum = 0; for ten.times { accum += 1; } diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs index 6bd0e8c8cd2..e53cd1ddccf 100644 --- a/src/libcore/vec.rs +++ b/src/libcore/vec.rs @@ -86,21 +86,21 @@ export as_const_buf; export unsafe; export u8; export extensions; -export const_vector; -export copyable_vector; -export immutable_vector; -export immutable_copyable_vector; -export iter_trait_extensions; +export ConstVector; +export CopyableVector; +export ImmutableVector; +export ImmutableCopyableVector; +export IterTraitExtensions; export vec_concat; #[abi = "cdecl"] extern mod rustrt { fn vec_reserve_shared(++t: *sys::TypeDesc, - ++v: **unsafe::vec_repr, + ++v: **unsafe::VecRepr, ++n: libc::size_t); fn vec_from_buf_shared(++t: *sys::TypeDesc, ++ptr: *(), - ++count: libc::size_t) -> *unsafe::vec_repr; + ++count: libc::size_t) -> *unsafe::VecRepr; } #[abi = "rust-intrinsic"] @@ -109,7 +109,7 @@ extern mod rusti { } /// A function used to initialize the elements of a vector -type init_op/& = fn(uint) -> T; +type InitOp/& = fn(uint) -> T; /// Returns true if a vector contains no elements pure fn is_empty(v: &[const T]) -> bool { @@ -140,7 +140,7 @@ pure fn same_length(xs: &[const T], ys: &[const U]) -> bool { fn reserve(&v: ~[const T], n: uint) { // Only make the (slow) call into the runtime if we have to if capacity(v) < n { - let ptr = ptr::addr_of(v) as **unsafe::vec_repr; + let ptr = ptr::addr_of(v) as **unsafe::VecRepr; rustrt::vec_reserve_shared(sys::get_type_desc::(), ptr, n as size_t); } @@ -169,7 +169,7 @@ fn reserve_at_least(&v: ~[const T], n: uint) { #[inline(always)] pure fn capacity(&&v: ~[const T]) -> uint { unsafe { - let repr: **unsafe::vec_repr = ::unsafe::reinterpret_cast(addr_of(v)); + let repr: **unsafe::VecRepr = ::unsafe::reinterpret_cast(addr_of(v)); (**repr).alloc / sys::size_of::() } } @@ -186,7 +186,7 @@ pure fn len(&&v: &[const T]) -> uint { * Creates an immutable vector of size `n_elts` and initializes the elements * to the value returned by the function `op`. */ -pure fn from_fn(n_elts: uint, op: init_op) -> ~[T] { +pure fn from_fn(n_elts: uint, op: InitOp) -> ~[T] { let mut v = ~[]; unchecked{reserve(v, n_elts);} let mut i: uint = 0u; @@ -523,7 +523,7 @@ fn pop(&v: ~[const T]) -> T { #[inline(always)] fn push(&v: ~[const T], +initval: T) { unsafe { - let repr: **unsafe::vec_repr = ::unsafe::reinterpret_cast(addr_of(v)); + let repr: **unsafe::VecRepr = ::unsafe::reinterpret_cast(addr_of(v)); let fill = (**repr).fill; if (**repr).alloc > fill { push_fast(v, initval); @@ -537,7 +537,7 @@ fn push(&v: ~[const T], +initval: T) { // This doesn't bother to make sure we have space. #[inline(always)] // really pretty please unsafe fn push_fast(&v: ~[const T], +initval: T) { - let repr: **unsafe::vec_repr = ::unsafe::reinterpret_cast(addr_of(v)); + let repr: **unsafe::VecRepr = ::unsafe::reinterpret_cast(addr_of(v)); let fill = (**repr).fill; (**repr).fill += sys::size_of::(); let p = ptr::addr_of((**repr).data); @@ -640,7 +640,7 @@ fn grow(&v: ~[const T], n: uint, initval: T) { * * init_op - A function to call to retreive each appended element's * value */ -fn grow_fn(&v: ~[const T], n: uint, op: init_op) { +fn grow_fn(&v: ~[const T], n: uint, op: InitOp) { reserve_at_least(v, len(v) + n); let mut i: uint = 0u; while i < n { push(v, op(i)); i += 1u; } @@ -1304,14 +1304,14 @@ impl ~[mut T]: add<&[const T],~[mut T]> { } } -trait const_vector { +trait ConstVector { pure fn is_empty() -> bool; pure fn is_not_empty() -> bool; pure fn len() -> uint; } /// Extension methods for vectors -impl &[const T]: const_vector { +impl &[const T]: ConstVector { /// Returns true if a vector contains no elements #[inline] pure fn is_empty() -> bool { is_empty(self) } @@ -1323,7 +1323,7 @@ impl &[const T]: const_vector { pure fn len() -> uint { len(self) } } -trait copyable_vector { +trait CopyableVector { pure fn head() -> T; pure fn init() -> ~[T]; pure fn last() -> T; @@ -1332,7 +1332,7 @@ trait copyable_vector { } /// Extension methods for vectors -impl &[const T]: copyable_vector { +impl &[const T]: CopyableVector { /// Returns the first element of a vector #[inline] pure fn head() -> T { head(self) } @@ -1350,7 +1350,7 @@ impl &[const T]: copyable_vector { pure fn tail() -> ~[T] { tail(self) } } -trait immutable_vector { +trait ImmutableVector { pure fn foldr(z: U, p: fn(T, U) -> U) -> U; pure fn iter(f: fn(T)); pure fn iteri(f: fn(uint, T)); @@ -1369,7 +1369,7 @@ trait immutable_vector { } /// Extension methods for vectors -impl &[T]: immutable_vector { +impl &[T]: ImmutableVector { /// Reduce a vector from right to left #[inline] pure fn foldr(z: U, p: fn(T, U) -> U) -> U { foldr(self, z, p) } @@ -1477,14 +1477,14 @@ impl &[T]: immutable_vector { } } -trait immutable_copyable_vector { +trait ImmutableCopyableVector { pure fn filter(f: fn(T) -> bool) -> ~[T]; pure fn find(f: fn(T) -> bool) -> option; pure fn rfind(f: fn(T) -> bool) -> option; } /// Extension methods for vectors -impl &[T]: immutable_copyable_vector { +impl &[T]: ImmutableCopyableVector { /** * Construct a new vector from the elements of a vector for which some * predicate holds. @@ -1518,14 +1518,14 @@ impl &[T]: immutable_copyable_vector { mod unsafe { // FIXME: This should have crate visibility (#1893 blocks that) /// The internal representation of a vector - type vec_repr = { + type VecRepr = { box_header: (uint, uint, uint, uint), mut fill: uint, mut alloc: uint, data: u8 }; - type slice_repr = { + type SliceRepr = { mut data: *u8, mut len: uint }; @@ -1555,7 +1555,7 @@ mod unsafe { */ #[inline(always)] unsafe fn set_len(&&v: ~[const T], new_len: uint) { - let repr: **vec_repr = ::unsafe::reinterpret_cast(addr_of(v)); + let repr: **VecRepr = ::unsafe::reinterpret_cast(addr_of(v)); (**repr).fill = new_len * sys::size_of::(); } @@ -1570,14 +1570,14 @@ mod unsafe { */ #[inline(always)] unsafe fn to_ptr(v: ~[const T]) -> *T { - let repr: **vec_repr = ::unsafe::reinterpret_cast(addr_of(v)); + let repr: **VecRepr = ::unsafe::reinterpret_cast(addr_of(v)); return ::unsafe::reinterpret_cast(addr_of((**repr).data)); } #[inline(always)] unsafe fn to_ptr_slice(v: &[const T]) -> *T { - let repr: **slice_repr = ::unsafe::reinterpret_cast(addr_of(v)); + let repr: **SliceRepr = ::unsafe::reinterpret_cast(addr_of(v)); return ::unsafe::reinterpret_cast(addr_of((**repr).data)); } @@ -1729,12 +1729,12 @@ mod u8 { // This cannot be used with iter-trait.rs because of the region pointer // required in the slice. -impl &[A]: iter::base_iter { +impl &[A]: iter::BaseIter { fn each(blk: fn(A) -> bool) { each(self, blk) } fn size_hint() -> option { some(len(self)) } } -impl &[A]: iter::extended_iter { +impl &[A]: iter::ExtendedIter { fn eachi(blk: fn(uint, A) -> bool) { iter::eachi(self, blk) } fn all(blk: fn(A) -> bool) -> bool { iter::all(self, blk) } fn any(blk: fn(A) -> bool) -> bool { iter::any(self, blk) } @@ -1746,7 +1746,7 @@ impl &[A]: iter::extended_iter { fn position(f: fn(A) -> bool) -> option { iter::position(self, f) } } -trait iter_trait_extensions { +trait IterTraitExtensions { fn filter_to_vec(pred: fn(A) -> bool) -> ~[A]; fn map_to_vec(op: fn(A) -> B) -> ~[B]; fn to_vec() -> ~[A]; @@ -1754,7 +1754,7 @@ trait iter_trait_extensions { fn max() -> A; } -impl &[A]: iter_trait_extensions { +impl &[A]: IterTraitExtensions { fn filter_to_vec(pred: fn(A) -> bool) -> ~[A] { iter::filter_to_vec(self, pred) } diff --git a/src/libstd/deque.rs b/src/libstd/deque.rs index 8bb7ae64825..7b8c0e9fcad 100644 --- a/src/libstd/deque.rs +++ b/src/libstd/deque.rs @@ -1,7 +1,7 @@ //! A deque. Untested as of yet. Likely buggy import option::{some, none}; -import dvec::dvec; +import dvec::{DVec, dvec}; trait t { fn size() -> uint; @@ -40,14 +40,14 @@ fn create() -> t { return rv; } - fn get(elts: dvec>, i: uint) -> T { + fn get(elts: DVec>, i: uint) -> T { match elts.get_elt(i) { some(t) => t, _ => fail } } type repr = {mut nelts: uint, mut lo: uint, mut hi: uint, - elts: dvec>}; + elts: DVec>}; impl repr: t { fn size() -> uint { return self.nelts; } diff --git a/src/libstd/net_url.rs b/src/libstd/net_url.rs index 927fe75b1a9..0c8d974a6d7 100644 --- a/src/libstd/net_url.rs +++ b/src/libstd/net_url.rs @@ -3,7 +3,7 @@ import map; import map::{hashmap, str_hash}; import io::Reader; -import dvec::dvec; +import dvec::{DVec, dvec}; export url, userinfo, query; export from_str, to_str; @@ -176,7 +176,7 @@ fn encode_plus(s: ~str) -> ~str { /** * Encode a hashmap to the 'application/x-www-form-urlencoded' media type. */ -fn encode_form_urlencoded(m: hashmap<~str, @dvec<@~str>>) -> ~str { +fn encode_form_urlencoded(m: hashmap<~str, @DVec<@~str>>) -> ~str { let mut out = ~""; let mut first = true; @@ -203,7 +203,7 @@ fn encode_form_urlencoded(m: hashmap<~str, @dvec<@~str>>) -> ~str { * type into a hashmap. */ fn decode_form_urlencoded(s: ~[u8]) -> - map::hashmap<~str, @dvec::dvec<@~str>> { + map::hashmap<~str, @dvec::DVec<@~str>> { do io::with_bytes_reader(s) |rdr| { let m = str_hash(); let mut key = ~""; diff --git a/src/libstd/smallintmap.rs b/src/libstd/smallintmap.rs index 4248cec854f..a7b40bbb0f9 100644 --- a/src/libstd/smallintmap.rs +++ b/src/libstd/smallintmap.rs @@ -4,12 +4,12 @@ */ import core::option; import core::option::{some, none}; -import dvec::dvec; +import dvec::{DVec, dvec}; import map::map; // FIXME (#2347): Should not be @; there's a bug somewhere in rustc that // requires this to be. -type smallintmap_ = {v: dvec>}; +type smallintmap_ = {v: DVec>}; enum smallintmap { smallintmap_(@smallintmap_) diff --git a/src/libstd/test.rs b/src/libstd/test.rs index 9d33431f000..6b78fa9b032 100644 --- a/src/libstd/test.rs +++ b/src/libstd/test.rs @@ -5,7 +5,7 @@ // simplest interface possible for representing and running tests // while providing a base that other test frameworks may build off of. -import either::either; +import either::Either; import result::{ok, err}; import io::WriterUtil; import libc::size_t; @@ -53,8 +53,8 @@ type test_desc = { fn test_main(args: ~[~str], tests: ~[test_desc]) { let opts = match parse_opts(args) { - either::left(o) => o, - either::right(m) => fail m + either::Left(o) => o, + either::Right(m) => fail m }; if !run_tests_console(opts, tests) { fail ~"Some tests failed"; } } @@ -62,7 +62,7 @@ fn test_main(args: ~[~str], tests: ~[test_desc]) { type test_opts = {filter: option<~str>, run_ignored: bool, logfile: option<~str>}; -type opt_res = either; +type opt_res = Either; // Parses command line arguments into test options fn parse_opts(args: ~[~str]) -> opt_res { @@ -71,7 +71,7 @@ fn parse_opts(args: ~[~str]) -> opt_res { let matches = match getopts::getopts(args_, opts) { ok(m) => m, - err(f) => return either::right(getopts::fail_str(f)) + err(f) => return either::Right(getopts::fail_str(f)) }; let filter = @@ -85,7 +85,7 @@ fn parse_opts(args: ~[~str]) -> opt_res { let test_opts = {filter: filter, run_ignored: run_ignored, logfile: logfile}; - return either::left(test_opts); + return either::Left(test_opts); } enum test_result { tr_ok, tr_failed, tr_ignored, } @@ -479,7 +479,7 @@ mod tests { fn first_free_arg_should_be_a_filter() { let args = ~[~"progname", ~"filter"]; let opts = match parse_opts(args) { - either::left(o) => o, + either::Left(o) => o, _ => fail ~"Malformed arg in first_free_arg_should_be_a_filter" }; assert ~"filter" == option::get(opts.filter); @@ -489,7 +489,7 @@ mod tests { fn parse_ignored_flag() { let args = ~[~"progname", ~"filter", ~"--ignored"]; let opts = match parse_opts(args) { - either::left(o) => o, + either::Left(o) => o, _ => fail ~"Malformed arg in parse_ignored_flag" }; assert (opts.run_ignored); diff --git a/src/libstd/uv_global_loop.rs b/src/libstd/uv_global_loop.rs index 14db589db8e..96b7e46dabf 100644 --- a/src/libstd/uv_global_loop.rs +++ b/src/libstd/uv_global_loop.rs @@ -9,7 +9,7 @@ import iotask::{iotask, spawn_iotask}; import priv::{chan_from_global_ptr, weaken_task}; import comm::{port, chan, select2, listen}; import task::task_builder; -import either::{left, right}; +import either::{Left, Right}; extern mod rustrt { fn rust_uv_get_kernel_global_chan_ptr() -> *libc::uintptr_t; @@ -58,14 +58,14 @@ fn get_monitor_task_gl() -> iotask unsafe { loop { debug!{"in outer_loop..."}; match select2(weak_exit_po, msg_po) { - left(weak_exit) => { + Left(weak_exit) => { // all normal tasks have ended, tell the // libuv loop to tear_down, then exit debug!{"weak_exit_po recv'd msg: %?", weak_exit}; iotask::exit(hl_loop); break; } - right(fetch_ch) => { + Right(fetch_ch) => { debug!{"hl_loop req recv'd: %?", fetch_ch}; fetch_ch.send(hl_loop); } diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs index 241a212c2ac..5b2b4fb0561 100644 --- a/src/libsyntax/ast_map.rs +++ b/src/libsyntax/ast_map.rs @@ -205,8 +205,8 @@ fn map_item(i: @item, cx: ctx, v: vt) { } item_foreign_mod(nm) => { let abi = match attr::foreign_abi(i.attrs) { - either::left(msg) => cx.diag.span_fatal(i.span, msg), - either::right(abi) => abi + either::Left(msg) => cx.diag.span_fatal(i.span, msg), + either::Right(abi) => abi }; for nm.items.each |nitem| { cx.map.insert(nitem.id, diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs index 65c2e00faca..7c04d6e4570 100644 --- a/src/libsyntax/attr.rs +++ b/src/libsyntax/attr.rs @@ -2,7 +2,7 @@ import std::map; import std::map::hashmap; -import either::either; +import either::Either; import diagnostic::span_handler; import ast_util::{spanned, dummy_spanned}; import parse::comments::{doc_comment_style, strip_doc_comment_decoration}; @@ -330,22 +330,22 @@ fn find_linkage_metas(attrs: ~[ast::attribute]) -> ~[@ast::meta_item] { } } -fn foreign_abi(attrs: ~[ast::attribute]) -> either<~str, ast::foreign_abi> { +fn foreign_abi(attrs: ~[ast::attribute]) -> Either<~str, ast::foreign_abi> { return match attr::first_attr_value_str_by_name(attrs, ~"abi") { option::none => { - either::right(ast::foreign_abi_cdecl) + either::Right(ast::foreign_abi_cdecl) } option::some(@~"rust-intrinsic") => { - either::right(ast::foreign_abi_rust_intrinsic) + either::Right(ast::foreign_abi_rust_intrinsic) } option::some(@~"cdecl") => { - either::right(ast::foreign_abi_cdecl) + either::Right(ast::foreign_abi_cdecl) } option::some(@~"stdcall") => { - either::right(ast::foreign_abi_stdcall) + either::Right(ast::foreign_abi_stdcall) } option::some(t) => { - either::left(~"unsupported abi: " + *t) + either::Left(~"unsupported abi: " + *t) } }; } diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index 0d8566ae42c..e0e93b1eda5 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -1,4 +1,4 @@ -import dvec::dvec; +import dvec::{DVec, dvec}; export filename; export filemap; @@ -48,7 +48,7 @@ type filemap = @{name: filename, substr: file_substr, src: @~str, start_pos: file_pos, mut lines: ~[file_pos]}; -type codemap = @{files: dvec}; +type codemap = @{files: DVec}; type loc = {file: filemap, line: uint, col: uint}; diff --git a/src/libsyntax/ext/pipes/proto.rs b/src/libsyntax/ext/pipes/proto.rs index 5fba31ed6e7..100f248a7ad 100644 --- a/src/libsyntax/ext/pipes/proto.rs +++ b/src/libsyntax/ext/pipes/proto.rs @@ -1,5 +1,5 @@ import to_str::ToStr; -import dvec::dvec; +import dvec::{DVec, dvec}; import ast::{ident}; @@ -62,7 +62,7 @@ enum state { span: span, dir: direction, ty_params: ~[ast::ty_param], - messages: dvec, + messages: DVec, proto: protocol, }), } @@ -112,7 +112,7 @@ fn protocol(name: ident, +span: span) -> protocol { class protocol_ { let name: ident; let span: span; - let states: dvec; + let states: DVec; let mut bounded: option; diff --git a/src/libsyntax/ext/qquote.rs b/src/libsyntax/ext/qquote.rs index c5af28bc0b3..6b5dce312d6 100644 --- a/src/libsyntax/ext/qquote.rs +++ b/src/libsyntax/ext/qquote.rs @@ -2,7 +2,7 @@ import ast::{crate, expr_, mac_invoc, mac_aq, mac_var}; import parse::parser; import parse::parser::parse_from_source_str; -import dvec::dvec; +import dvec::{DVec, dvec}; import fold::*; import visit::*; @@ -20,7 +20,7 @@ struct gather_item { constr: ~str; } -type aq_ctxt = @{lo: uint, gather: dvec}; +type aq_ctxt = @{lo: uint, gather: DVec}; enum fragment { from_expr(@ast::expr), from_ty(@ast::ty) diff --git a/src/libsyntax/ext/simplext.rs b/src/libsyntax/ext/simplext.rs index 98289152d33..e8899a2e541 100644 --- a/src/libsyntax/ext/simplext.rs +++ b/src/libsyntax/ext/simplext.rs @@ -1,6 +1,6 @@ import codemap::span; import std::map::{hashmap, str_hash, box_str_hash}; -import dvec::dvec; +import dvec::{DVec, dvec}; import base::*; @@ -124,7 +124,7 @@ fn compose_sels(s1: selector, s2: selector) -> selector { type binders = {real_binders: hashmap, - literal_ast_matchers: dvec}; + literal_ast_matchers: DVec}; type bindings = hashmap>; fn acumm_bindings(_cx: ext_ctxt, _b_dest: bindings, _b_src: bindings) { } diff --git a/src/libsyntax/ext/tt/earley_parser.rs b/src/libsyntax/ext/tt/earley_parser.rs index 7cc9b0e1dc2..b6dc1c05a2c 100644 --- a/src/libsyntax/ext/tt/earley_parser.rs +++ b/src/libsyntax/ext/tt/earley_parser.rs @@ -7,7 +7,7 @@ import parse::parser::{parser,SOURCE_FILE}; //import parse::common::parser_common; import parse::common::*; //resolve bug? import parse::parse_sess; -import dvec::dvec; +import dvec::{DVec, dvec}; import ast::{matcher, match_tok, match_seq, match_nonterminal, ident}; import ast_util::mk_sp; import std::map::{hashmap, box_str_hash}; @@ -42,7 +42,7 @@ type matcher_pos = ~{ sep: option, mut idx: uint, mut up: matcher_pos_up, // mutable for swapping only - matches: ~[dvec<@named_match>], + matches: ~[DVec<@named_match>], match_lo: uint, match_hi: uint, sp_lo: uint, }; diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs index a93d25ced00..cbb6709d9c8 100644 --- a/src/libsyntax/parse/attr.rs +++ b/src/libsyntax/parse/attr.rs @@ -1,4 +1,4 @@ -import either::{either, left, right}; +import either::{Either, Left, Right}; import ast_util::spanned; import common::*; //resolve bug? @@ -7,7 +7,7 @@ export parser_attr; // A type to distingush between the parsing of item attributes or syntax // extensions, which both begin with token.POUND -type attr_or_ext = option>; +type attr_or_ext = option>; trait parser_attr { fn parse_outer_attrs_or_ext(first_item_attrs: ~[ast::attribute]) @@ -36,18 +36,18 @@ impl parser: parser_attr { self.bump(); let first_attr = self.parse_attribute_naked(ast::attr_outer, lo); - return some(left(vec::append(~[first_attr], + return some(Left(vec::append(~[first_attr], self.parse_outer_attributes()))); } else if !(self.look_ahead(1u) == token::LT || self.look_ahead(1u) == token::LBRACKET || self.look_ahead(1u) == token::POUND || expect_item_next) { self.bump(); - return some(right(self.parse_syntax_ext_naked(lo))); + return some(Right(self.parse_syntax_ext_naked(lo))); } else { return none; } } token::DOC_COMMENT(_) => { - return some(left(self.parse_outer_attributes())); + return some(Left(self.parse_outer_attributes())); } _ => return none } diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index 23f5eac07df..99768d558ab 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -340,40 +340,40 @@ fn scan_number(c: char, rdr: string_reader) -> token::token { if c == 'u' || c == 'i' { let signed = c == 'i'; let mut tp = { - if signed { either::left(ast::ty_i) } - else { either::right(ast::ty_u) } + if signed { either::Left(ast::ty_i) } + else { either::Right(ast::ty_u) } }; bump(rdr); c = rdr.curr; if c == '8' { bump(rdr); - tp = if signed { either::left(ast::ty_i8) } - else { either::right(ast::ty_u8) }; + tp = if signed { either::Left(ast::ty_i8) } + else { either::Right(ast::ty_u8) }; } n = nextch(rdr); if c == '1' && n == '6' { bump(rdr); bump(rdr); - tp = if signed { either::left(ast::ty_i16) } - else { either::right(ast::ty_u16) }; + tp = if signed { either::Left(ast::ty_i16) } + else { either::Right(ast::ty_u16) }; } else if c == '3' && n == '2' { bump(rdr); bump(rdr); - tp = if signed { either::left(ast::ty_i32) } - else { either::right(ast::ty_u32) }; + tp = if signed { either::Left(ast::ty_i32) } + else { either::Right(ast::ty_u32) }; } else if c == '6' && n == '4' { bump(rdr); bump(rdr); - tp = if signed { either::left(ast::ty_i64) } - else { either::right(ast::ty_u64) }; + tp = if signed { either::Left(ast::ty_i64) } + else { either::Right(ast::ty_u64) }; } if str::len(num_str) == 0u { rdr.fatal(~"no valid digits found for number"); } let parsed = option::get(u64::from_str_radix(num_str, base as u64)); match tp { - either::left(t) => return token::LIT_INT(parsed as i64, t), - either::right(t) => return token::LIT_UINT(parsed, t) + either::Left(t) => return token::LIT_INT(parsed as i64, t), + either::Right(t) => return token::LIT_UINT(parsed, t) } } let mut is_float = false; diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index feb19d6780c..f894f6fae82 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -1,7 +1,7 @@ import print::pprust::expr_to_str; import result::result; -import either::{either, left, right}; +import either::{Either, Left, Right}; import std::map::{hashmap, str_hash}; import token::{can_begin_expr, is_ident, is_ident_or_path, is_plain_ident, INTERPOLATED}; @@ -102,7 +102,7 @@ enum class_contents { ctor_decl(fn_decl, ~[attribute], blk, codemap::span), dtor_decl(blk, ~[attribute], codemap::span), members(~[@class_member]) } -type arg_or_capture_item = either; +type arg_or_capture_item = Either; type item_info = (ident, item_, option<~[attribute]>); enum item_or_view_item { @@ -557,9 +557,9 @@ class parser { } if self.eat_keyword(~"move") { - either::right(parse_capture_item(self, true)) + either::Right(parse_capture_item(self, true)) } else if self.eat_keyword(~"copy") { - either::right(parse_capture_item(self, false)) + either::Right(parse_capture_item(self, false)) } else { parse_arg_fn(self) } @@ -570,7 +570,7 @@ class parser { let i = self.parse_value_ident(); self.expect(token::COLON); let t = self.parse_ty(false); - either::left({mode: m, ty: t, ident: i, id: self.get_id()}) + either::Left({mode: m, ty: t, ident: i, id: self.get_id()}) } fn parse_arg_or_capture_item() -> arg_or_capture_item { @@ -588,7 +588,7 @@ class parser { node: ty_infer, span: mk_sp(p.span.lo, p.span.hi)} }; - either::left({mode: m, ty: t, ident: i, id: p.get_id()}) + either::Left({mode: m, ty: t, ident: i, id: p.get_id()}) } } @@ -2051,8 +2051,8 @@ class parser { let mut item_attrs; match self.parse_outer_attrs_or_ext(first_item_attrs) { none => item_attrs = ~[], - some(left(attrs)) => item_attrs = attrs, - some(right(ext)) => { + some(Left(attrs)) => item_attrs = attrs, + some(Right(ext)) => { return @spanned(lo, ext.span.hi, stmt_expr(ext, self.get_id())); } diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs index 0d81d40ca8c..7282eaafb79 100644 --- a/src/libsyntax/print/pp.rs +++ b/src/libsyntax/print/pp.rs @@ -1,5 +1,5 @@ import io::WriterUtil; -import dvec::dvec; +import dvec::{DVec, dvec}; /* * This pretty-printer is a direct reimplementation of Philip Karlton's @@ -222,7 +222,7 @@ type printer_ = { mut top: uint, // index of top of scan_stack mut bottom: uint, // index of bottom of scan_stack // stack of blocks-in-progress being flushed by print - print_stack: dvec, + print_stack: DVec, // buffered indentation to avoid writing trailing whitespace mut pending_indentation: int, mut token_tree_last_was_ident: bool diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 05b6ca8c504..de1cd2c3df0 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -7,7 +7,7 @@ import pp::{break_offset, word, printer, import diagnostic; import ast::{required, provided}; import ast_util::{operator_prec}; -import dvec::dvec; +import dvec::{DVec, dvec}; import parse::classify::*; import util::interner; @@ -35,7 +35,7 @@ type ps = literals: option<~[comments::lit]>, mut cur_cmnt: uint, mut cur_lit: uint, - boxes: dvec, + boxes: DVec, ann: pp_ann}; fn ibox(s: ps, u: uint) { diff --git a/src/libsyntax/util/interner.rs b/src/libsyntax/util/interner.rs index e003408f3fd..9b7398d16c7 100644 --- a/src/libsyntax/util/interner.rs +++ b/src/libsyntax/util/interner.rs @@ -3,11 +3,11 @@ // type, and vice versa. import std::map; import std::map::{hashmap, hashfn, eqfn}; -import dvec::dvec; +import dvec::{DVec, dvec}; type hash_interner = {map: hashmap, - vect: dvec, + vect: DVec, hasher: hashfn, eqer: eqfn}; diff --git a/src/rustc/front/test.rs b/src/rustc/front/test.rs index 2f892c9ba9d..90de6a4335f 100644 --- a/src/rustc/front/test.rs +++ b/src/rustc/front/test.rs @@ -9,7 +9,7 @@ import syntax::codemap::span; import driver::session; import session::session; import syntax::attr; -import dvec::dvec; +import dvec::{DVec, dvec}; export modify_for_testing; @@ -22,7 +22,7 @@ type test_ctxt = @{sess: session::session, crate: @ast::crate, mut path: ~[ast::ident], - testfns: dvec}; + testfns: DVec}; // Traverse the crate, collecting all the test functions, eliding any // existing main functions, and synthesizing a main test harness diff --git a/src/rustc/metadata/creader.rs b/src/rustc/metadata/creader.rs index 13c85d02b73..744ee50da8b 100644 --- a/src/rustc/metadata/creader.rs +++ b/src/rustc/metadata/creader.rs @@ -9,7 +9,7 @@ import std::map::{hashmap, int_hash}; import syntax::print::pprust; import filesearch::filesearch; import common::*; -import dvec::dvec; +import dvec::{DVec, dvec}; export read_crates; @@ -42,7 +42,7 @@ type cache_entry = { metas: @~[@ast::meta_item] }; -fn dump_crates(crate_cache: dvec) { +fn dump_crates(crate_cache: DVec) { debug!{"resolved crates:"}; for crate_cache.each |entry| { debug!{"cnum: %?", entry.cnum}; @@ -67,9 +67,9 @@ fn warn_if_multiple_versions(diag: span_handler, partition(crate_cache.map_to_vec(|entry| { let othername = loader::crate_name_from_metas(*entry.metas); if name == othername { - left(entry) + Left(entry) } else { - right(entry) + Right(entry) } })); @@ -96,7 +96,7 @@ type env = @{diag: span_handler, cstore: cstore::cstore, os: loader::os, static: bool, - crate_cache: dvec, + crate_cache: DVec, mut next_crate_num: ast::crate_num}; fn visit_view_item(e: env, i: @ast::view_item) { @@ -114,11 +114,11 @@ fn visit_item(e: env, i: @ast::item) { match i.node { ast::item_foreign_mod(m) => { match attr::foreign_abi(i.attrs) { - either::right(abi) => { + either::Right(abi) => { if abi != ast::foreign_abi_cdecl && abi != ast::foreign_abi_stdcall { return; } } - either::left(msg) => e.diag.span_fatal(i.span, msg) + either::Left(msg) => e.diag.span_fatal(i.span, msg) } let cstore = e.cstore; diff --git a/src/rustc/metadata/csearch.rs b/src/rustc/metadata/csearch.rs index 985cdd9c2d1..69c76e40417 100644 --- a/src/rustc/metadata/csearch.rs +++ b/src/rustc/metadata/csearch.rs @@ -10,7 +10,7 @@ import syntax::diagnostic::span_handler; import syntax::diagnostic::expect; import common::*; import std::map::hashmap; -import dvec::dvec; +import dvec::{DVec, dvec}; export class_dtor; export get_symbol; @@ -144,7 +144,7 @@ fn get_trait_methods(tcx: ty::ctxt, def: ast::def_id) -> @~[ty::method] { } fn get_method_names_if_trait(cstore: cstore::cstore, def: ast::def_id) - -> option<@dvec<(@~str, ast::self_ty_)>> { + -> option<@DVec<(@~str, ast::self_ty_)>> { let cdata = cstore::get_crate_data(cstore, def.crate); return decoder::get_method_names_if_trait(cdata, def.node); diff --git a/src/rustc/metadata/decoder.rs b/src/rustc/metadata/decoder.rs index d6d9b2701e4..70754ccdd82 100644 --- a/src/rustc/metadata/decoder.rs +++ b/src/rustc/metadata/decoder.rs @@ -2,8 +2,8 @@ import std::{ebml, map}; import std::map::{hashmap, str_hash}; -import dvec::dvec; import io::WriterUtil; +import dvec::{DVec, dvec}; import syntax::{ast, ast_util}; import syntax::attr; import middle::ty; @@ -684,7 +684,7 @@ fn get_trait_methods(cdata: cmd, id: ast::node_id, tcx: ty::ctxt) // their self types. Otherwise, returns none. This overlaps in an // annoying way with get_trait_methods. fn get_method_names_if_trait(cdata: cmd, node_id: ast::node_id) - -> option<@dvec<(@~str, ast::self_ty_)>> { + -> option<@DVec<(@~str, ast::self_ty_)>> { let item = lookup_item(node_id, cdata.data); if item_family(item) != 'I' { diff --git a/src/rustc/middle/borrowck.rs b/src/rustc/middle/borrowck.rs index 61caf4a2509..83b8666f7c4 100644 --- a/src/rustc/middle/borrowck.rs +++ b/src/rustc/middle/borrowck.rs @@ -229,7 +229,7 @@ import syntax::print::pprust; import util::common::indenter; import ty::to_str; import driver::session::session; -import dvec::dvec; +import dvec::{DVec, dvec}; import mem_categorization::*; export check_crate, root_map, mutbl_map; @@ -339,7 +339,7 @@ type loan = {lp: @loan_path, cmt: cmt, mutbl: ast::mutability}; /// - `pure_map`: map from block/expr that must be pure to the error message /// that should be reported if they are not pure type req_maps = { - req_loan_map: hashmap>>, + req_loan_map: hashmap>>, pure_map: hashmap }; diff --git a/src/rustc/middle/borrowck/gather_loans.rs b/src/rustc/middle/borrowck/gather_loans.rs index bcf36b4cb1a..3541ddad626 100644 --- a/src/rustc/middle/borrowck/gather_loans.rs +++ b/src/rustc/middle/borrowck/gather_loans.rs @@ -393,7 +393,7 @@ impl gather_loan_ctxt { } } - fn add_loans(scope_id: ast::node_id, loans: @dvec) { + fn add_loans(scope_id: ast::node_id, loans: @DVec) { match self.req_maps.req_loan_map.find(scope_id) { some(l) => { (*l).push(loans); diff --git a/src/rustc/middle/borrowck/loan.rs b/src/rustc/middle/borrowck/loan.rs index ea917ec60d2..66b786ca791 100644 --- a/src/rustc/middle/borrowck/loan.rs +++ b/src/rustc/middle/borrowck/loan.rs @@ -8,7 +8,7 @@ import result::{result, ok, err}; impl borrowck_ctxt { fn loan(cmt: cmt, scope_region: ty::region, - mutbl: ast::mutability) -> bckres<@dvec> { + mutbl: ast::mutability) -> bckres<@DVec> { let lc = loan_ctxt_(@{bccx: self, scope_region: scope_region, loans: @dvec()}); @@ -26,7 +26,7 @@ type loan_ctxt_ = { scope_region: ty::region, // accumulated list of loans that will be required - loans: @dvec + loans: @DVec }; enum loan_ctxt { diff --git a/src/rustc/middle/check_const.rs b/src/rustc/middle/check_const.rs index 545cc049f48..3dc016e021d 100644 --- a/src/rustc/middle/check_const.rs +++ b/src/rustc/middle/check_const.rs @@ -2,7 +2,7 @@ import syntax::ast::*; import syntax::{visit, ast_util, ast_map}; import driver::session::session; import std::map::hashmap; -import dvec::dvec; +import dvec::{DVec, dvec}; fn check_crate(sess: session, crate: @crate, ast_map: ast_map::map, def_map: resolve3::DefMap, @@ -150,7 +150,7 @@ fn check_item_recursion(sess: session, ast_map: ast_map::map, sess: session, ast_map: ast_map::map, def_map: resolve3::DefMap, - idstack: @dvec, + idstack: @DVec, }; let env = { diff --git a/src/rustc/middle/lint.rs b/src/rustc/middle/lint.rs index ca4a5866a0a..31bb20a47d0 100644 --- a/src/rustc/middle/lint.rs +++ b/src/rustc/middle/lint.rs @@ -415,7 +415,7 @@ fn check_item_ctypes(cx: ty::ctxt, it: @ast::item) { match it.node { ast::item_foreign_mod(nmod) if attr::foreign_abi(it.attrs) != - either::right(ast::foreign_abi_rust_intrinsic) => { + either::Right(ast::foreign_abi_rust_intrinsic) => { for nmod.items.each |ni| { match ni.node { ast::foreign_item_fn(decl, tps) => { diff --git a/src/rustc/middle/liveness.rs b/src/rustc/middle/liveness.rs index 61feb22f1b4..f8983f2bebb 100644 --- a/src/rustc/middle/liveness.rs +++ b/src/rustc/middle/liveness.rs @@ -100,7 +100,7 @@ * - `self_var`: a variable representing 'self' */ -import dvec::dvec; +import dvec::{DVec, dvec}; import std::map::{hashmap, int_hash, str_hash, box_str_hash}; import syntax::{visit, ast_util}; import syntax::print::pprust::{expr_to_str}; @@ -122,7 +122,7 @@ export last_use_map; // // Very subtle (#2633): borrowck will remove entries from this table // if it detects an outstanding loan (that is, the addr is taken). -type last_use_map = hashmap>; +type last_use_map = hashmap>; enum variable = uint; enum live_node = uint; diff --git a/src/rustc/middle/region.rs b/src/rustc/middle/region.rs index c4ab394aca0..e226e0ef9c5 100644 --- a/src/rustc/middle/region.rs +++ b/src/rustc/middle/region.rs @@ -14,7 +14,7 @@ import syntax::codemap::span; import syntax::print::pprust; import syntax::ast_util::new_def_hash; import syntax::ast_map; -import dvec::dvec; +import dvec::{DVec, dvec}; import metadata::csearch; import std::list; @@ -343,7 +343,7 @@ fn resolve_crate(sess: session, def_map: resolve3::DefMap, // dependencies until a fixed point is reached. type region_paramd_items = hashmap; -type dep_map = hashmap>; +type dep_map = hashmap>; type determine_rp_ctxt_ = { sess: session, @@ -351,7 +351,7 @@ type determine_rp_ctxt_ = { def_map: resolve3::DefMap, region_paramd_items: region_paramd_items, dep_map: dep_map, - worklist: dvec, + worklist: DVec, // the innermost enclosing item id mut item_id: ast::node_id, diff --git a/src/rustc/middle/resolve3.rs b/src/rustc/middle/resolve3.rs index 6212b79e1e5..a06e6ea1dba 100644 --- a/src/rustc/middle/resolve3.rs +++ b/src/rustc/middle/resolve3.rs @@ -52,7 +52,7 @@ import syntax::visit::{visit_foreign_item, visit_item, visit_method_helper}; import syntax::visit::{visit_mod, visit_ty, vt}; import box::ptr_eq; -import dvec::dvec; +import dvec::{DVec, dvec}; import option::{get, is_some}; import str::{connect, split_str}; import vec::pop; @@ -89,7 +89,7 @@ type ImplScopes = @list; type ImplMap = hashmap; // Trait method resolution -type TraitMap = @hashmap>; +type TraitMap = @hashmap>; // Export mapping type Export = { reexp: bool, id: def_id }; @@ -116,7 +116,7 @@ enum NamespaceResult { enum ImplNamespaceResult { UnknownImplResult, UnboundImplResult, - BoundImplResult(@dvec<@Target>) + BoundImplResult(@DVec<@Target>) } enum NameDefinition { @@ -250,7 +250,7 @@ fn Atom(n: uint) -> Atom { class AtomTable { let atoms: hashmap<@~str,Atom>; - let strings: dvec<@~str>; + let strings: DVec<@~str>; let mut atom_count: uint; new() { @@ -326,11 +326,11 @@ class Rib { /// One import directive. class ImportDirective { - let module_path: @dvec; + let module_path: @DVec; let subclass: @ImportDirectiveSubclass; let span: span; - new(module_path: @dvec, + new(module_path: @DVec, subclass: @ImportDirectiveSubclass, span: span) { @@ -363,7 +363,7 @@ class ImportResolution { let mut module_target: option; let mut value_target: option; let mut type_target: option; - let mut impl_target: @dvec<@Target>; + let mut impl_target: @DVec<@Target>; let mut used: bool; @@ -409,7 +409,7 @@ class Module { let mut def_id: option; let children: hashmap; - let imports: dvec<@ImportDirective>; + let imports: DVec<@ImportDirective>; // The anonymous children of this node. Anonymous children are pseudo- // modules that are implicitly created around items contained within @@ -677,17 +677,17 @@ class Resolver { // The current set of local scopes, for values. // XXX: Reuse ribs to avoid allocation. - let value_ribs: @dvec<@Rib>; + let value_ribs: @DVec<@Rib>; // The current set of local scopes, for types. - let type_ribs: @dvec<@Rib>; + let type_ribs: @DVec<@Rib>; // Whether the current context is an X-ray context. An X-ray context is // allowed to access private names of any module. let mut xray_context: XrayFlag; // The trait that the current context can refer to. - let mut current_trait_refs: option<@dvec>; + let mut current_trait_refs: option<@DVec>; // The atom for the keyword "self". let self_atom: Atom; @@ -1571,7 +1571,7 @@ class Resolver { /// Creates and adds an import directive to the given module. fn build_import_directive(module_: @Module, - module_path: @dvec, + module_path: @DVec, subclass: @ImportDirectiveSubclass, span: span) { @@ -2181,7 +2181,7 @@ class Resolver { } fn resolve_module_path_from_root(module_: @Module, - module_path: @dvec, + module_path: @DVec, index: uint, xray: XrayFlag, span: span) @@ -2238,7 +2238,7 @@ class Resolver { * the given module. */ fn resolve_module_path_for_import(module_: @Module, - module_path: @dvec, + module_path: @DVec, xray: XrayFlag, span: span) -> ResolveResult<@Module> { @@ -2932,7 +2932,7 @@ class Resolver { // Wraps the given definition in the appropriate number of `def_upvar` // wrappers. - fn upvarify(ribs: @dvec<@Rib>, rib_index: uint, def_like: def_like, + fn upvarify(ribs: @DVec<@Rib>, rib_index: uint, def_like: def_like, span: span, allow_capturing_self: AllowCapturingSelfFlag) -> option { @@ -3031,7 +3031,7 @@ class Resolver { return some(dl_def(def)); } - fn search_ribs(ribs: @dvec<@Rib>, name: Atom, span: span, + fn search_ribs(ribs: @DVec<@Rib>, name: Atom, span: span, allow_capturing_self: AllowCapturingSelfFlag) -> option { @@ -4150,7 +4150,7 @@ class Resolver { } } - fn intern_module_part_of_path(path: @path) -> @dvec { + fn intern_module_part_of_path(path: @path) -> @DVec { let module_path_atoms = @dvec(); for path.idents.eachi |index, ident| { if index == path.idents.len() - 1u { @@ -4508,7 +4508,7 @@ class Resolver { } } - fn search_for_traits_containing_method(name: Atom) -> @dvec { + fn search_for_traits_containing_method(name: Atom) -> @DVec { let found_traits = @dvec(); let mut search_module = self.current_module; loop { @@ -4577,7 +4577,7 @@ class Resolver { return found_traits; } - fn add_trait_info_if_containing_method(found_traits: @dvec, + fn add_trait_info_if_containing_method(found_traits: @DVec, trait_def_id: def_id, name: Atom) { diff --git a/src/rustc/middle/trans/alt.rs b/src/rustc/middle/trans/alt.rs index eaf1011f181..e12070e265d 100644 --- a/src/rustc/middle/trans/alt.rs +++ b/src/rustc/middle/trans/alt.rs @@ -13,7 +13,7 @@ import syntax::print::pprust::pat_to_str; import middle::resolve3::DefMap; import back::abi; import std::map::hashmap; -import dvec::dvec; +import dvec::{DVec, dvec}; import common::*; @@ -277,7 +277,7 @@ fn enter_uniq(bcx: block, dm: DefMap, m: match_, col: uint, val: ValueRef) } fn get_options(ccx: @crate_ctxt, m: match_, col: uint) -> ~[opt] { - fn add_to_set(tcx: ty::ctxt, &&set: dvec, val: opt) { + fn add_to_set(tcx: ty::ctxt, &&set: DVec, val: opt) { if set.any(|l| opt_eq(tcx, l, val)) {return;} set.push(val); } diff --git a/src/rustc/middle/trans/base.rs b/src/rustc/middle/trans/base.rs index 7b901ae9739..23f5c69caa1 100644 --- a/src/rustc/middle/trans/base.rs +++ b/src/rustc/middle/trans/base.rs @@ -5015,8 +5015,8 @@ fn trans_item(ccx: @crate_ctxt, item: ast::item) { ast::item_const(_, expr) => consts::trans_const(ccx, expr, item.id), ast::item_foreign_mod(foreign_mod) => { let abi = match attr::foreign_abi(item.attrs) { - either::right(abi_) => abi_, - either::left(msg) => ccx.sess.span_fatal(item.span, msg) + either::Right(abi_) => abi_, + either::Left(msg) => ccx.sess.span_fatal(item.span, msg) }; foreign::trans_foreign_mod(ccx, foreign_mod, abi); } diff --git a/src/rustc/middle/trans/foreign.rs b/src/rustc/middle/trans/foreign.rs index 6df5a00f21d..fdde26d6718 100644 --- a/src/rustc/middle/trans/foreign.rs +++ b/src/rustc/middle/trans/foreign.rs @@ -1168,8 +1168,8 @@ fn abi_of_foreign_fn(ccx: @crate_ctxt, i: @ast::foreign_item) ast_map::node_foreign_item(_, abi, _) => abi }, some(_) => match attr::foreign_abi(i.attrs) { - either::right(abi) => abi, - either::left(msg) => ccx.sess.span_fatal(i.span, msg) + either::Right(abi) => abi, + either::Left(msg) => ccx.sess.span_fatal(i.span, msg) } } } diff --git a/src/rustc/middle/trans/shape.rs b/src/rustc/middle/trans/shape.rs index 68bddb8d151..78eb527b785 100644 --- a/src/rustc/middle/trans/shape.rs +++ b/src/rustc/middle/trans/shape.rs @@ -15,7 +15,7 @@ import syntax::ast_util::{dummy_sp, new_def_hash}; import syntax::util::interner; import util::ppaux::ty_to_str; import syntax::codemap::span; -import dvec::dvec; +import dvec::{DVec, dvec}; import std::map::hashmap; import option::is_some; @@ -65,7 +65,7 @@ type ctxt = {mut next_tag_id: u16, pad: u16, tag_id_to_index: hashmap, - tag_order: dvec, + tag_order: DVec, resources: interner::interner, llshapetablesty: TypeRef, llshapetables: ValueRef}; diff --git a/src/rustc/middle/typeck/check.rs b/src/rustc/middle/typeck/check.rs index 5cb886a36f0..3bc4e578c74 100644 --- a/src/rustc/middle/typeck/check.rs +++ b/src/rustc/middle/typeck/check.rs @@ -501,7 +501,7 @@ fn check_item(ccx: @crate_ctxt, it: @ast::item) { } ast::item_foreign_mod(m) => { if syntax::attr::foreign_abi(it.attrs) == - either::right(ast::foreign_abi_rust_intrinsic) { + either::Right(ast::foreign_abi_rust_intrinsic) { for m.items.each |item| { check_intrinsic_type(ccx, item); } diff --git a/src/rustc/middle/typeck/check/method.rs b/src/rustc/middle/typeck/check/method.rs index c5d3dd765ab..9de5aa98e5f 100644 --- a/src/rustc/middle/typeck/check/method.rs +++ b/src/rustc/middle/typeck/check/method.rs @@ -9,7 +9,7 @@ import syntax::ast::{sty_value}; import syntax::ast_map; import syntax::ast_map::node_id_to_str; import syntax::ast_util::{dummy_sp, new_def_hash}; -import dvec::dvec; +import dvec::{DVec, dvec}; type candidate = { self_ty: ty::t, // type of a in a.b() @@ -57,7 +57,7 @@ class lookup { let m_name: ast::ident; let mut self_ty: ty::t; let mut derefs: uint; - let candidates: dvec; + let candidates: DVec; let candidate_impls: hashmap; let supplied_tps: ~[ty::t]; let include_private: bool; @@ -435,7 +435,7 @@ class lookup { } fn add_inherent_and_extension_candidates(optional_inherent_methods: - option<@dvec<@Impl>>, + option<@DVec<@Impl>>, use_assignability: bool) { // Add inherent methods. diff --git a/src/rustc/middle/typeck/coherence.rs b/src/rustc/middle/typeck/coherence.rs index e54238e6c69..bc6342dbce1 100644 --- a/src/rustc/middle/typeck/coherence.rs +++ b/src/rustc/middle/typeck/coherence.rs @@ -30,7 +30,7 @@ import syntax::visit::{mk_simple_visitor, mk_vt, visit_crate, visit_item}; import syntax::visit::{visit_mod}; import util::ppaux::ty_to_str; -import dvec::dvec; +import dvec::{DVec, dvec}; import result::ok; import std::map::{hashmap, int_hash}; import uint::range; @@ -121,11 +121,11 @@ fn method_to_MethodInfo(ast_method: @method) -> @MethodInfo { class CoherenceInfo { // Contains implementations of methods that are inherent to a type. // Methods in these implementations don't need to be exported. - let inherent_methods: hashmap>; + let inherent_methods: hashmap>; // Contains implementations of methods associated with a trait. For these, // the associated trait must be imported at the call site. - let extension_methods: hashmap>; + let extension_methods: hashmap>; new() { self.inherent_methods = new_def_hash(); @@ -356,7 +356,7 @@ class CoherenceChecker { } fn check_implementation_coherence(_trait_def_id: def_id, - implementations: @dvec<@Impl>) { + implementations: @DVec<@Impl>) { // Unify pairs of polytypes. for range(0, implementations.len()) |i| { @@ -540,7 +540,7 @@ class CoherenceChecker { return trait_id; } - fn gather_privileged_types(items: ~[@item]) -> @dvec { + fn gather_privileged_types(items: ~[@item]) -> @DVec { let results = @dvec(); for items.each |item| { match item.node { diff --git a/src/rustc/middle/typeck/infer.rs b/src/rustc/middle/typeck/infer.rs index cc0ed23ac72..36461b44b75 100644 --- a/src/rustc/middle/typeck/infer.rs +++ b/src/rustc/middle/typeck/infer.rs @@ -262,7 +262,7 @@ import driver::session::session; import util::common::{indent, indenter}; import ast::{unsafe_fn, impure_fn, pure_fn, extern_fn}; import ast::{m_const, m_imm, m_mutbl}; -import dvec::dvec; +import dvec::{DVec, dvec}; export infer_ctxt; export new_infer_ctxt; @@ -402,7 +402,7 @@ enum infer_ctxt = @{ ty_var_integral_counter: @mut uint, region_var_counter: @mut uint, - borrowings: dvec<{expr_id: ast::node_id, + borrowings: DVec<{expr_id: ast::node_id, span: span, scope: ty::region, mutbl: ast::mutability}> diff --git a/src/test/auxiliary/cci_nested_lib.rs b/src/test/auxiliary/cci_nested_lib.rs index 38bc20f637b..b96745890f9 100644 --- a/src/test/auxiliary/cci_nested_lib.rs +++ b/src/test/auxiliary/cci_nested_lib.rs @@ -1,7 +1,7 @@ -import dvec::dvec; +import dvec::{DVec, dvec}; type entry = {key: A, value: B}; -type alist = { eq_fn: fn@(A,A) -> bool, data: dvec> }; +type alist = { eq_fn: fn@(A,A) -> bool, data: DVec> }; fn alist_add(lst: alist, k: A, v: B) { lst.data.push({key:k, value:v}); diff --git a/src/test/auxiliary/issue-2631-a.rs b/src/test/auxiliary/issue-2631-a.rs index dd8ace9ee74..9d69cf15562 100644 --- a/src/test/auxiliary/issue-2631-a.rs +++ b/src/test/auxiliary/issue-2631-a.rs @@ -4,10 +4,10 @@ use std; import dvec::*; -import dvec::dvec; +import dvec::DVec; import std::map::hashmap; -type header_map = hashmap<~str, @dvec<@~str>>; +type header_map = hashmap<~str, @DVec<@~str>>; // the unused ty param is necessary so this gets monomorphized fn request(req: header_map) { diff --git a/src/test/compile-fail/issue-2590.rs b/src/test/compile-fail/issue-2590.rs index c0a378491f9..ffbc7a3018b 100644 --- a/src/test/compile-fail/issue-2590.rs +++ b/src/test/compile-fail/issue-2590.rs @@ -1,7 +1,7 @@ -import dvec::dvec; +import dvec::DVec; type parser = { - tokens: dvec, + tokens: DVec, }; trait parse { diff --git a/src/test/compile-fail/regions-glb-free-free.rs b/src/test/compile-fail/regions-glb-free-free.rs index 94cf76330a9..08c4286a011 100644 --- a/src/test/compile-fail/regions-glb-free-free.rs +++ b/src/test/compile-fail/regions-glb-free-free.rs @@ -2,7 +2,7 @@ mod argparse { use std; import std::map; - import either::{either, left, right}; + import either::{Either, Left, Right}; struct Flag { name: &str; diff --git a/src/test/run-pass/pipe-select.rs b/src/test/run-pass/pipe-select.rs index 6c315123f53..209dc515bd0 100644 --- a/src/test/run-pass/pipe-select.rs +++ b/src/test/run-pass/pipe-select.rs @@ -79,8 +79,8 @@ fn test_select2() { stream::client::send(ac, 42); match pipes::select2(ap, bp) { - either::left(*) => { } - either::right(*) => { fail } + either::Left(*) => { } + either::Right(*) => { fail } } stream::client::send(bc, ~"abc"); @@ -93,8 +93,8 @@ fn test_select2() { stream::client::send(bc, ~"abc"); match pipes::select2(ap, bp) { - either::left(*) => { fail } - either::right(*) => { } + either::Left(*) => { fail } + either::Right(*) => { } } stream::client::send(ac, 42); diff --git a/src/test/run-pass/static-method-test.rs b/src/test/run-pass/static-method-test.rs index 99c5776a5ac..c221b091acb 100644 --- a/src/test/run-pass/static-method-test.rs +++ b/src/test/run-pass/static-method-test.rs @@ -49,7 +49,7 @@ pure fn build>(builder: fn(push: pure fn(+A))) -> B { } /// Apply a function to each element of an iterable and return the results -fn map, U, BU: buildable> +fn map, U, BU: buildable> (v: IT, f: fn(T) -> U) -> BU { do build |push| { for v.each() |elem| {