Skip to content

Commit ca132f2

Browse files
committed
---
yaml --- r: 41980 b: refs/heads/master c: e84576b h: refs/heads/master v: v3
1 parent eafbf88 commit ca132f2

File tree

14 files changed

+545
-419
lines changed

14 files changed

+545
-419
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: c15facb5c092f5d1e5b687111f4dbcd117d567d7
2+
refs/heads/master: e84576b888a6fbbac8de96206a3715dc80291acf
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 2f46b763da2c098913884f101b6d71d69af41b49
55
refs/heads/try: 3d5418789064fdb463e872a4e651af1c628a3650

trunk/src/compiletest/compiletest.rc

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -158,17 +158,10 @@ fn run_tests(config: config) {
158158
}
159159

160160
fn test_opts(config: config) -> test::TestOpts {
161-
{filter:
162-
match config.filter {
163-
option::Some(s) => option::Some(s),
164-
option::None => option::None
165-
},
166-
run_ignored: config.run_ignored,
167-
logfile:
168-
match config.logfile {
169-
option::Some(s) => option::Some(s.to_str()),
170-
option::None => option::None
171-
}
161+
test::TestOpts {
162+
filter: config.filter,
163+
run_ignored: config.run_ignored,
164+
logfile: config.logfile.map(|s| s.to_str()),
172165
}
173166
}
174167

trunk/src/librustc/middle/lint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ fn get_lint_settings_level(settings: lint_settings,
287287
// This is kind of unfortunate. It should be somewhere else, or we should use
288288
// a persistent data structure...
289289
fn clone_lint_modes(modes: lint_modes) -> lint_modes {
290-
smallintmap::SmallIntMap_(@{v: copy modes.v})
290+
smallintmap::SmallIntMap_(@smallintmap::SmallIntMap_ { v: copy modes.v })
291291
}
292292

293293
type ctxt_ = {dict: lint_dict,

trunk/src/libstd/arena.rs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,11 @@ const tydesc_drop_glue_index: size_t = 3 as size_t;
6868
// The way arena uses arrays is really deeply awful. The arrays are
6969
// allocated, and have capacities reserved, but the fill for the array
7070
// will always stay at 0.
71-
type Chunk = {data: @[u8], mut fill: uint, is_pod: bool};
71+
struct Chunk {
72+
data: @[u8],
73+
mut fill: uint,
74+
is_pod: bool,
75+
}
7276

7377
pub struct Arena {
7478
// The head is seperated out from the list as a unbenchmarked
@@ -93,13 +97,19 @@ impl Arena : Drop {
9397
fn chunk(size: uint, is_pod: bool) -> Chunk {
9498
let mut v: @[const u8] = @[];
9599
unsafe { at_vec::raw::reserve(&mut v, size); }
96-
{ data: unsafe { cast::transmute(v) }, mut fill: 0u, is_pod: is_pod }
100+
Chunk {
101+
data: unsafe { cast::transmute(v) },
102+
fill: 0u,
103+
is_pod: is_pod,
104+
}
97105
}
98106

99107
pub fn arena_with_size(initial_size: uint) -> Arena {
100-
return Arena {mut head: chunk(initial_size, false),
101-
mut pod_head: chunk(initial_size, true),
102-
mut chunks: @Nil};
108+
Arena {
109+
head: chunk(initial_size, false),
110+
pod_head: chunk(initial_size, true),
111+
chunks: @Nil,
112+
}
103113
}
104114

105115
pub fn Arena() -> Arena {

trunk/src/libstd/deque.rs

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,12 @@ pub fn create<T: Copy>() -> Deque<T> {
6161
match (*elts).get_elt(i) { Some(move t) => t, _ => fail }
6262
}
6363

64-
type Repr<T> = {mut nelts: uint,
65-
mut lo: uint,
66-
mut hi: uint,
67-
elts: DVec<Cell<T>>};
64+
struct Repr<T> {
65+
mut nelts: uint,
66+
mut lo: uint,
67+
mut hi: uint,
68+
elts: DVec<Cell<T>>,
69+
}
6870

6971
impl <T: Copy> Repr<T>: Deque<T> {
7072
fn size() -> uint { return self.nelts; }
@@ -119,15 +121,14 @@ pub fn create<T: Copy>() -> Deque<T> {
119121
}
120122
}
121123

122-
let repr: Repr<T> = {
123-
mut nelts: 0u,
124-
mut lo: 0u,
125-
mut hi: 0u,
126-
elts:
127-
dvec::from_vec(
128-
vec::from_elem(initial_capacity, None))
124+
let repr: Repr<T> = Repr {
125+
nelts: 0u,
126+
lo: 0u,
127+
hi: 0u,
128+
elts: dvec::from_vec(vec::from_elem(initial_capacity, None)),
129129
};
130-
(move repr) as Deque::<T>
130+
131+
repr as Deque::<T>
131132
}
132133

133134
#[cfg(test)]
@@ -254,7 +255,11 @@ mod tests {
254255
Onepar(int), Twopar(int, int), Threepar(int, int, int),
255256
}
256257

257-
type RecCy = {x: int, y: int, t: Taggy};
258+
struct RecCy {
259+
x: int,
260+
y: int,
261+
t: Taggy,
262+
}
258263

259264
impl Taggy : Eq {
260265
pure fn eq(&self, other: &Taggy) -> bool {
@@ -335,10 +340,10 @@ mod tests {
335340

336341
#[test]
337342
fn test_param_reccy() {
338-
let reccy1: RecCy = {x: 1, y: 2, t: One(1)};
339-
let reccy2: RecCy = {x: 345, y: 2, t: Two(1, 2)};
340-
let reccy3: RecCy = {x: 1, y: 777, t: Three(1, 2, 3)};
341-
let reccy4: RecCy = {x: 19, y: 252, t: Two(17, 42)};
343+
let reccy1 = RecCy { x: 1, y: 2, t: One(1) };
344+
let reccy2 = RecCy { x: 345, y: 2, t: Two(1, 2) };
345+
let reccy3 = RecCy { x: 1, y: 777, t: Three(1, 2, 3) };
346+
let reccy4 = RecCy { x: 19, y: 252, t: Two(17, 42) };
342347
test_parameterized::<RecCy>(reccy1, reccy2, reccy3, reccy4);
343348
}
344349
}

trunk/src/libstd/map.rs

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,11 @@ pub trait Map<K:Eq IterBytes Hash Copy, V: Copy> {
107107
}
108108

109109
pub mod util {
110-
pub type Rational = {num: int, den: int}; // : int::positive(*.den);
110+
pub struct Rational {
111+
// : int::positive(*.den);
112+
num: int,
113+
den: int,
114+
}
111115

112116
pub pure fn rational_leq(x: Rational, y: Rational) -> bool {
113117
// NB: Uses the fact that rationals have positive denominators WLOG:
@@ -265,9 +269,11 @@ pub mod chained {
265269

266270
// consider rehashing if more 3/4 full
267271
let nchains = vec::len(self.chains);
268-
let load = {num: (self.count + 1u) as int,
269-
den: nchains as int};
270-
if !util::rational_leq(load, {num:3, den:4}) {
272+
let load = util::Rational {
273+
num: (self.count + 1u) as int,
274+
den: nchains as int,
275+
};
276+
if !util::rational_leq(load, util::Rational {num:3, den:4}) {
271277
self.rehash();
272278
}
273279

@@ -324,9 +330,11 @@ pub mod chained {
324330

325331
// consider rehashing if more 3/4 full
326332
let nchains = vec::len(self.chains);
327-
let load = {num: (self.count + 1u) as int,
328-
den: nchains as int};
329-
if !util::rational_leq(load, {num:3, den:4}) {
333+
let load = util::Rational {
334+
num: (self.count + 1u) as int,
335+
den: nchains as int,
336+
};
337+
if !util::rational_leq(load, util::Rational {num:3, den:4}) {
330338
self.rehash();
331339
}
332340

trunk/src/libstd/net_ip.rs

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ pub enum IpAddr {
4848
}
4949

5050
/// Human-friendly feedback on why a parse_addr attempt failed
51-
pub type ParseAddrErr = {
52-
err_msg: ~str
53-
};
51+
pub struct ParseAddrErr {
52+
err_msg: ~str,
53+
}
5454

5555
/**
5656
* Convert a `IpAddr` to a str
@@ -122,7 +122,7 @@ pub fn get_addr(node: &str, iotask: iotask)
122122
log(debug, fmt!("slice len %?", len));
123123
let handle = create_uv_getaddrinfo_t();
124124
let handle_ptr = ptr::addr_of(&handle);
125-
let handle_data: GetAddrData = {
125+
let handle_data = GetAddrData {
126126
output_ch: output_ch
127127
};
128128
let handle_data_ptr = ptr::addr_of(&handle_data);
@@ -187,7 +187,7 @@ pub mod v4 {
187187
}
188188
// the simple, old style numberic representation of
189189
// ipv4
190-
pub type Ipv4Rep = { a: u8, b: u8, c: u8, d:u8 };
190+
pub struct Ipv4Rep { a: u8, b: u8, c: u8, d: u8 }
191191

192192
pub trait AsUnsafeU32 {
193193
unsafe fn as_u32() -> u32;
@@ -207,14 +207,14 @@ pub mod v4 {
207207
}
208208
});
209209
if parts.len() != 4 {
210-
result::Err(fmt!("'%s' doesn't have 4 parts", ip))
211-
}
212-
else if parts.contains(&256) {
213-
result::Err(fmt!("invalid octal in addr '%s'", ip))
214-
}
215-
else {
216-
result::Ok({a: parts[0] as u8, b: parts[1] as u8,
217-
c: parts[2] as u8, d: parts[3] as u8})
210+
Err(fmt!("'%s' doesn't have 4 parts", ip))
211+
} else if parts.contains(&256) {
212+
Err(fmt!("invalid octal in addr '%s'", ip))
213+
} else {
214+
Ok(Ipv4Rep {
215+
a: parts[0] as u8, b: parts[1] as u8,
216+
c: parts[2] as u8, d: parts[3] as u8,
217+
})
218218
}
219219
}
220220
pub fn try_parse_addr(ip: &str) -> result::Result<IpAddr,ParseAddrErr> {
@@ -223,7 +223,7 @@ pub mod v4 {
223223
let ip_rep_result = parse_to_ipv4_rep(ip);
224224
if result::is_err(&ip_rep_result) {
225225
let err_str = result::get_err(&ip_rep_result);
226-
return result::Err({err_msg: err_str})
226+
return result::Err(ParseAddrErr { err_msg: err_str })
227227
}
228228
// ipv4_rep.as_u32 is unsafe :/
229229
let input_is_inaddr_none =
@@ -236,15 +236,16 @@ pub mod v4 {
236236
let ref_ip_rep_result = parse_to_ipv4_rep(reformatted_name);
237237
if result::is_err(&ref_ip_rep_result) {
238238
let err_str = result::get_err(&ref_ip_rep_result);
239-
return result::Err({err_msg: err_str})
239+
return Err(ParseAddrErr { err_msg: err_str })
240240
}
241+
241242
if result::get(&ref_ip_rep_result).as_u32() == INADDR_NONE &&
242243
!input_is_inaddr_none {
243-
return result::Err(
244-
{err_msg: ~"uv_ip4_name produced invalid result."})
245-
}
246-
else {
247-
result::Ok(Ipv4(copy(new_addr)))
244+
Err(ParseAddrErr {
245+
err_msg: ~"uv_ip4_name produced invalid result.",
246+
})
247+
} else {
248+
Ok(Ipv4(copy(new_addr)))
248249
}
249250
}
250251
}
@@ -289,19 +290,18 @@ pub mod v6 {
289290
// '::' appears to be uv_ip6_name() returns for bogus
290291
// parses..
291292
if ip != &"::" && reparsed_name == ~"::" {
292-
result::Err({err_msg:fmt!("failed to parse '%s'",
293-
ip)})
293+
Err(ParseAddrErr { err_msg:fmt!("failed to parse '%s'", ip) })
294294
}
295295
else {
296-
result::Ok(Ipv6(new_addr))
296+
Ok(Ipv6(new_addr))
297297
}
298298
}
299299
}
300300
}
301301

302-
type GetAddrData = {
302+
struct GetAddrData {
303303
output_ch: oldcomm::Chan<result::Result<~[IpAddr],IpGetAddrErr>>
304-
};
304+
}
305305

306306
extern fn get_addr_cb(handle: *uv_getaddrinfo_t, status: libc::c_int,
307307
res: *addrinfo) {

0 commit comments

Comments
 (0)