Skip to content

Commit f60dfa7

Browse files
committed
---
yaml --- r: 30315 b: refs/heads/incoming c: 3764fe3 h: refs/heads/master i: 30313: f43e2e4 30311: f008956 v: v3
1 parent 7c2c5d7 commit f60dfa7

File tree

15 files changed

+89
-90
lines changed

15 files changed

+89
-90
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
9-
refs/heads/incoming: d3e75ea37546ad197cc5a1efa522a054a54d78b4
9+
refs/heads/incoming: 3764fe3f2a7d04d99d7c69137b7a7724a6546bcb
1010
refs/heads/dist-snap: 2f32a1581f522e524009138b33b1c7049ced668d
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/src/libstd/arena.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
export Arena, arena_with_size;
2626

27-
use list::{list, cons, nil};
27+
use list::{List, Cons, Nil};
2828
use unsafe::reinterpret_cast;
2929
use sys::TypeDesc;
3030
use libc::size_t;
@@ -53,7 +53,7 @@ struct Arena {
5353
// access the head.
5454
priv mut head: Chunk;
5555
priv mut pod_head: Chunk;
56-
priv mut chunks: @list<Chunk>;
56+
priv mut chunks: @List<Chunk>;
5757
drop {
5858
unsafe {
5959
destroy_chunk(self.head);
@@ -73,7 +73,7 @@ fn chunk(size: uint, is_pod: bool) -> Chunk {
7373
fn arena_with_size(initial_size: uint) -> Arena {
7474
return Arena {mut head: chunk(initial_size, false),
7575
mut pod_head: chunk(initial_size, true),
76-
mut chunks: @nil};
76+
mut chunks: @Nil};
7777
}
7878

7979
fn Arena() -> Arena {
@@ -134,7 +134,7 @@ impl &Arena {
134134
// Allocate a new chunk.
135135
let chunk_size = at_vec::capacity(self.pod_head.data);
136136
let new_min_chunk_size = uint::max(n_bytes, chunk_size);
137-
self.chunks = @cons(copy self.pod_head, self.chunks);
137+
self.chunks = @Cons(copy self.pod_head, self.chunks);
138138
self.pod_head =
139139
chunk(uint::next_power_of_two(new_min_chunk_size + 1u), true);
140140

@@ -176,7 +176,7 @@ impl &Arena {
176176
// Allocate a new chunk.
177177
let chunk_size = at_vec::capacity(self.head.data);
178178
let new_min_chunk_size = uint::max(n_bytes, chunk_size);
179-
self.chunks = @cons(copy self.head, self.chunks);
179+
self.chunks = @Cons(copy self.head, self.chunks);
180180
self.head =
181181
chunk(uint::next_power_of_two(new_min_chunk_size + 1u), false);
182182

branches/incoming/src/libstd/list.rs

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ use core::option;
77
use option::*;
88
use option::{Some, None};
99

10-
enum list<T> {
11-
cons(T, @list<T>),
12-
nil,
10+
enum List<T> {
11+
Cons(T, @List<T>),
12+
Nil,
1313
}
1414

15-
/// Create a list from a vector
16-
fn from_vec<T: copy>(v: &[T]) -> @list<T> {
17-
vec::foldr(v, @nil::<T>, |h, t| @cons(h, t))
15+
/// Cregate a list from a vector
16+
fn from_vec<T: copy>(v: &[T]) -> @List<T> {
17+
vec::foldr(v, @Nil::<T>, |h, t| @Cons(h, t))
1818
}
1919

2020
/**
@@ -30,7 +30,7 @@ fn from_vec<T: copy>(v: &[T]) -> @list<T> {
3030
* * z - The initial value
3131
* * f - The function to apply
3232
*/
33-
fn foldl<T: copy, U>(+z: T, ls: @list<U>, f: fn((&T), (&U)) -> T) -> T {
33+
fn foldl<T: copy, U>(+z: T, ls: @List<U>, f: fn((&T), (&U)) -> T) -> T {
3434
let mut accum: T = z;
3535
do iter(ls) |elt| { accum = f(&accum, &elt);}
3636
accum
@@ -43,71 +43,71 @@ fn foldl<T: copy, U>(+z: T, ls: @list<U>, f: fn((&T), (&U)) -> T) -> T {
4343
* When function `f` returns true then an option containing the element
4444
* is returned. If `f` matches no elements then none is returned.
4545
*/
46-
fn find<T: copy>(ls: @list<T>, f: fn((&T)) -> bool) -> Option<T> {
46+
fn find<T: copy>(ls: @List<T>, f: fn((&T)) -> bool) -> Option<T> {
4747
let mut ls = ls;
4848
loop {
4949
ls = match *ls {
50-
cons(hd, tl) => {
50+
Cons(hd, tl) => {
5151
if f(&hd) { return Some(hd); }
5252
tl
5353
}
54-
nil => return None
54+
Nil => return None
5555
}
5656
};
5757
}
5858

5959
/// Returns true if a list contains an element with the given value
60-
fn has<T: copy Eq>(ls: @list<T>, +elt: T) -> bool {
60+
fn has<T: copy Eq>(ls: @List<T>, +elt: T) -> bool {
6161
for each(ls) |e| {
6262
if e == elt { return true; }
6363
}
6464
return false;
6565
}
6666

6767
/// Returns true if the list is empty
68-
pure fn is_empty<T: copy>(ls: @list<T>) -> bool {
68+
pure fn is_empty<T: copy>(ls: @List<T>) -> bool {
6969
match *ls {
70-
nil => true,
70+
Nil => true,
7171
_ => false
7272
}
7373
}
7474

7575
/// Returns true if the list is not empty
76-
pure fn is_not_empty<T: copy>(ls: @list<T>) -> bool {
76+
pure fn is_not_empty<T: copy>(ls: @List<T>) -> bool {
7777
return !is_empty(ls);
7878
}
7979

8080
/// Returns the length of a list
81-
fn len<T>(ls: @list<T>) -> uint {
81+
fn len<T>(ls: @List<T>) -> uint {
8282
let mut count = 0u;
8383
iter(ls, |_e| count += 1u);
8484
count
8585
}
8686

8787
/// Returns all but the first element of a list
88-
pure fn tail<T: copy>(ls: @list<T>) -> @list<T> {
88+
pure fn tail<T: copy>(ls: @List<T>) -> @List<T> {
8989
match *ls {
90-
cons(_, tl) => return tl,
91-
nil => fail ~"list empty"
90+
Cons(_, tl) => return tl,
91+
Nil => fail ~"list empty"
9292
}
9393
}
9494

9595
/// Returns the first element of a list
96-
pure fn head<T: copy>(ls: @list<T>) -> T {
96+
pure fn head<T: copy>(ls: @List<T>) -> T {
9797
match *ls {
98-
cons(hd, _) => hd,
98+
Cons(hd, _) => hd,
9999
// makes me sad
100100
_ => fail ~"head invoked on empty list"
101101
}
102102
}
103103

104104
/// Appends one list to another
105-
pure fn append<T: copy>(l: @list<T>, m: @list<T>) -> @list<T> {
105+
pure fn append<T: copy>(l: @List<T>, m: @List<T>) -> @List<T> {
106106
match *l {
107-
nil => return m,
108-
cons(x, xs) => {
107+
Nil => return m,
108+
Cons(x, xs) => {
109109
let rest = append(xs, m);
110-
return @cons(x, rest);
110+
return @Cons(x, rest);
111111
}
112112
}
113113
}
@@ -121,45 +121,45 @@ pure fn push<T: copy>(ll: &mut @list<T>, +vv: T) {
121121
*/
122122

123123
/// Iterate over a list
124-
fn iter<T>(l: @list<T>, f: fn(T)) {
124+
fn iter<T>(l: @List<T>, f: fn(T)) {
125125
let mut cur = l;
126126
loop {
127127
cur = match *cur {
128-
cons(hd, tl) => {
128+
Cons(hd, tl) => {
129129
f(hd);
130130
tl
131131
}
132-
nil => break
132+
Nil => break
133133
}
134134
}
135135
}
136136

137137
/// Iterate over a list
138-
fn each<T>(l: @list<T>, f: fn(T) -> bool) {
138+
fn each<T>(l: @List<T>, f: fn(T) -> bool) {
139139
let mut cur = l;
140140
loop {
141141
cur = match *cur {
142-
cons(hd, tl) => {
142+
Cons(hd, tl) => {
143143
if !f(hd) { return; }
144144
tl
145145
}
146-
nil => break
146+
Nil => break
147147
}
148148
}
149149
}
150150

151-
impl<T:Eq> list<T> : Eq {
152-
pure fn eq(&&other: list<T>) -> bool {
151+
impl<T:Eq> List<T> : Eq {
152+
pure fn eq(&&other: List<T>) -> bool {
153153
match self {
154-
cons(e0a, e1a) => {
154+
Cons(e0a, e1a) => {
155155
match other {
156-
cons(e0b, e1b) => e0a == e0b && e1a == e1b,
156+
Cons(e0b, e1b) => e0a == e0b && e1a == e1b,
157157
_ => false
158158
}
159159
}
160-
nil => {
160+
Nil => {
161161
match other {
162-
nil => true,
162+
Nil => true,
163163
_ => false
164164
}
165165
}
@@ -172,7 +172,7 @@ mod tests {
172172

173173
#[test]
174174
fn test_is_empty() {
175-
let empty : @list::list<int> = from_vec(~[]);
175+
let empty : @list::List<int> = from_vec(~[]);
176176
let full1 = from_vec(~[1]);
177177
let full2 = from_vec(~['r', 'u']);
178178

@@ -200,15 +200,15 @@ mod tests {
200200

201201
#[test]
202202
fn test_from_vec_empty() {
203-
let empty : @list::list<int> = from_vec(~[]);
204-
assert (empty == @list::nil::<int>);
203+
let empty : @list::List<int> = from_vec(~[]);
204+
assert (empty == @list::Nil::<int>);
205205
}
206206

207207
#[test]
208208
fn test_foldl() {
209209
fn add(a: &uint, b: &int) -> uint { return *a + (*b as uint); }
210210
let l = from_vec(~[0, 1, 2, 3, 4]);
211-
let empty = @list::nil::<int>;
211+
let empty = @list::Nil::<int>;
212212
assert (list::foldl(0u, l, add) == 10u);
213213
assert (list::foldl(0u, empty, add) == 0u);
214214
}
@@ -233,15 +233,15 @@ mod tests {
233233
fn test_find_fail() {
234234
fn match_(_i: &int) -> bool { return false; }
235235
let l = from_vec(~[0, 1, 2]);
236-
let empty = @list::nil::<int>;
236+
let empty = @list::Nil::<int>;
237237
assert (list::find(l, match_) == option::None::<int>);
238238
assert (list::find(empty, match_) == option::None::<int>);
239239
}
240240

241241
#[test]
242242
fn test_has() {
243243
let l = from_vec(~[5, 8, 6]);
244-
let empty = @list::nil::<int>;
244+
let empty = @list::Nil::<int>;
245245
assert (list::has(l, 5));
246246
assert (!list::has(l, 7));
247247
assert (list::has(l, 8));
@@ -251,7 +251,7 @@ mod tests {
251251
#[test]
252252
fn test_len() {
253253
let l = from_vec(~[0, 1, 2]);
254-
let empty = @list::nil::<int>;
254+
let empty = @list::Nil::<int>;
255255
assert (list::len(l) == 3u);
256256
assert (list::len(empty) == 0u);
257257
}

branches/incoming/src/libstd/std.rc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ mod comm;
6161
mod bitv;
6262
mod deque;
6363
mod fun_treemap;
64-
#[allow(non_camel_case_types)] // XXX
6564
mod list;
6665
#[allow(non_camel_case_types)] // XXX
6766
mod map;

branches/incoming/src/rustc/middle/borrowck.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ use syntax::codemap::span;
223223
use util::ppaux::{ty_to_str, region_to_str, explain_region};
224224
use std::map::{int_hash, hashmap, set};
225225
use std::list;
226-
use std::list::{list, cons, nil};
226+
use std::list::{List, Cons, Nil};
227227
use result::{Result, Ok, Err};
228228
use syntax::print::pprust;
229229
use util::common::indenter;

branches/incoming/src/rustc/middle/resolve.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ use str::{connect, split_str};
5959
use vec::pop;
6060
use syntax::parse::token::ident_interner;
6161

62-
use std::list::{cons, list, nil};
62+
use std::list::{Cons, List, Nil};
6363
use std::map::{hashmap, int_hash, uint_hash};
6464
use str_eq = str::eq;
6565

branches/incoming/src/rustc/middle/trans/type_use.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
use std::map::hashmap;
2121
use std::list;
22-
use std::list::{list, cons, nil};
22+
use std::list::{List, Cons, Nil};
2323
use driver::session::session;
2424
use metadata::csearch;
2525
use syntax::ast::*, syntax::ast_util, syntax::visit;
@@ -122,14 +122,14 @@ fn type_needs(cx: ctx, use: uint, ty: ty::t) {
122122
// Optimization -- don't descend type if all params already have this use
123123
for vec::each_mut(cx.uses) |u| {
124124
if *u & use != use {
125-
type_needs_inner(cx, use, ty, @nil);
125+
type_needs_inner(cx, use, ty, @Nil);
126126
return;
127127
}
128128
}
129129
}
130130

131131
fn type_needs_inner(cx: ctx, use: uint, ty: ty::t,
132-
enums_seen: @list<def_id>) {
132+
enums_seen: @List<def_id>) {
133133
do ty::maybe_walk_ty(ty) |ty| {
134134
if ty::type_has_params(ty) {
135135
match ty::get(ty).struct {
@@ -143,7 +143,7 @@ fn type_needs_inner(cx: ctx, use: uint, ty: ty::t,
143143
| ty::ty_trait(_, _, _) => false,
144144
ty::ty_enum(did, substs) => {
145145
if option::is_none(list::find(enums_seen, |id| *id == did)) {
146-
let seen = @cons(did, enums_seen);
146+
let seen = @Cons(did, enums_seen);
147147
for vec::each(*ty::enum_variants(cx.ccx.tcx, did)) |v| {
148148
for vec::each(v.args) |aty| {
149149
let t = ty::subst(cx.ccx.tcx, &substs, aty);

branches/incoming/src/rustc/middle/typeck.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ use util::ppaux::{ty_to_str, tys_to_str, region_to_str,
6464
bound_region_to_str, vstore_to_str};
6565
use util::common::{indent, indenter};
6666
use std::list;
67-
use list::{list, nil, cons};
67+
use list::{List, Nil, Cons};
6868

6969
export check_crate;
7070
export infer;

0 commit comments

Comments
 (0)