Skip to content

Commit 32605e8

Browse files
committed
---
yaml --- r: 148335 b: refs/heads/try2 c: 8f4edf9 h: refs/heads/master i: 148333: b110d4a 148331: 6d38a33 148327: a9b56e7 148319: c42340e v: v3
1 parent 7594c53 commit 32605e8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+572
-1222
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 93fb12e3d0644f6a8ddfa2ac1d6b0a1d8341e287
8+
refs/heads/try2: 8f4edf9bf889bbb1f7bfb5bac4d0c825d2d5374d
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/doc/rust.md

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -806,9 +806,7 @@ path_glob : ident [ "::" path_glob ] ?
806806

807807
A _use declaration_ creates one or more local name bindings synonymous
808808
with some other [path](#paths).
809-
Usually a `use` declaration is used to shorten the path required to refer to a
810-
module item. These declarations may appear at the top of [modules](#modules) and
811-
[blocks](#blocks).
809+
Usually a `use` declaration is used to shorten the path required to refer to a module item.
812810

813811
*Note*: Unlike in many languages,
814812
`use` declarations in Rust do *not* declare linkage dependency with external crates.
@@ -2320,24 +2318,14 @@ let base = Point3d {x: 1, y: 2, z: 3};
23202318
Point3d {y: 0, z: 10, .. base};
23212319
~~~~
23222320

2323-
### Block expressions
2321+
### Record expressions
23242322

23252323
~~~~ {.ebnf .gram}
2326-
block_expr : '{' [ view_item ] *
2327-
[ stmt ';' | item ] *
2328-
[ expr ] '}'
2324+
rec_expr : '{' ident ':' expr
2325+
[ ',' ident ':' expr ] *
2326+
[ ".." expr ] '}'
23292327
~~~~
23302328

2331-
A _block expression_ is similar to a module in terms of the declarations that
2332-
are possible. Each block conceptually introduces a new namespace scope. View
2333-
items can bring new names into scopes and declared items are in scope for only
2334-
the block itself.
2335-
2336-
A block will execute each statement sequentially, and then execute the
2337-
expression (if given). If the final expression is omitted, the type and return
2338-
value of the block are `()`, but if it is provided, the type and return value
2339-
of the block are that of the expression itself.
2340-
23412329
### Method-call expressions
23422330

23432331
~~~~ {.ebnf .gram}

branches/try2/src/compiletest/header.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,10 @@ pub fn is_test_ignored(config: &config, testfile: &Path) -> bool {
9090
fn xfail_target(config: &config) -> ~str {
9191
~"xfail-" + util::get_os(config.target)
9292
}
93-
fn xfail_stage(config: &config) -> ~str {
94-
~"xfail-" + config.stage_id.split('-').next().unwrap()
95-
}
9693
9794
let val = iter_header(testfile, |ln| {
9895
if parse_name_directive(ln, "xfail-test") { false }
9996
else if parse_name_directive(ln, xfail_target(config)) { false }
100-
else if parse_name_directive(ln, xfail_stage(config)) { false }
10197
else if config.mode == common::mode_pretty &&
10298
parse_name_directive(ln, "xfail-pretty") { false }
10399
else { true }

branches/try2/src/etc/check-summary.py

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,30 @@
77
summaries = []
88
def summarise(fname):
99
summary = {}
10-
fd = open(fname)
11-
for line in fd:
12-
status, test = line.strip().split(' ', 1)
13-
if not summary.has_key(status):
14-
summary[status] = []
15-
summary[status].append(test)
16-
summaries.append((fname, summary))
10+
with open(fname) as fd:
11+
for line in fd:
12+
splitline = line.strip().split(' ')
13+
if len(splitline) == 1:
14+
continue
15+
status = splitline[0]
16+
test = splitline[-1]
17+
# track bench runs
18+
if splitline[1] == 'ns/iter':
19+
status = 'bench'
20+
if not summary.has_key(status):
21+
summary[status] = []
22+
summary[status].append(test)
23+
summaries.append((fname, summary))
1724
def count(t):
1825
return sum(map(lambda (f, s): len(s.get(t, [])), summaries))
1926
logfiles = sys.argv[1:]
2027
map(summarise, logfiles)
2128
ok = count('ok')
2229
failed = count('failed')
2330
ignored = count('ignored')
24-
print "summary of %d test runs: %d passed; %d failed; %d ignored" % \
25-
(len(logfiles), ok, failed, ignored)
31+
measured = count('bench')
32+
print "summary of %d test runs: %d passed; %d failed; %d ignored; %d measured" % \
33+
(len(logfiles), ok, failed, ignored, measured)
2634
print ""
2735
if failed > 0:
2836
print "failed tests:"

branches/try2/src/libextra/base64.rs

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -154,25 +154,7 @@ impl<'a> ToBase64 for &'a [u8] {
154154
pub trait FromBase64 {
155155
/// Converts the value of `self`, interpreted as base64 encoded data, into
156156
/// an owned vector of bytes, returning the vector.
157-
fn from_base64(&self) -> Result<~[u8], FromBase64Error>;
158-
}
159-
160-
/// Errors that can occur when decoding a base64 encoded string
161-
pub enum FromBase64Error {
162-
/// The input contained a character not part of the base64 format
163-
InvalidBase64Character(char, uint),
164-
/// The input had an invalid length
165-
InvalidBase64Length,
166-
}
167-
168-
impl ToStr for FromBase64Error {
169-
fn to_str(&self) -> ~str {
170-
match *self {
171-
InvalidBase64Character(ch, idx) =>
172-
format!("Invalid character '{}' at position {}", ch, idx),
173-
InvalidBase64Length => ~"Invalid length",
174-
}
175-
}
157+
fn from_base64(&self) -> Result<~[u8], ~str>;
176158
}
177159

178160
impl<'a> FromBase64 for &'a str {
@@ -206,7 +188,7 @@ impl<'a> FromBase64 for &'a str {
206188
* }
207189
* ```
208190
*/
209-
fn from_base64(&self) -> Result<~[u8], FromBase64Error> {
191+
fn from_base64(&self) -> Result<~[u8], ~str> {
210192
let mut r = ~[];
211193
let mut buf: u32 = 0;
212194
let mut modulus = 0;
@@ -223,7 +205,8 @@ impl<'a> FromBase64 for &'a str {
223205
'/'|'_' => buf |= 0x3F,
224206
'\r'|'\n' => continue,
225207
'=' => break,
226-
_ => return Err(InvalidBase64Character(self.char_at(idx), idx)),
208+
_ => return Err(format!("Invalid character '{}' at position {}",
209+
self.char_at(idx), idx))
227210
}
228211

229212
buf <<= 6;
@@ -238,7 +221,8 @@ impl<'a> FromBase64 for &'a str {
238221

239222
for (idx, byte) in it {
240223
if (byte as char) != '=' {
241-
return Err(InvalidBase64Character(self.char_at(idx), idx));
224+
return Err(format!("Invalid character '{}' at position {}",
225+
self.char_at(idx), idx));
242226
}
243227
}
244228

@@ -251,7 +235,7 @@ impl<'a> FromBase64 for &'a str {
251235
r.push((buf >> 8 ) as u8);
252236
}
253237
0 => (),
254-
_ => return Err(InvalidBase64Length),
238+
_ => return Err(~"Invalid Base64 length")
255239
}
256240

257241
Ok(r)

branches/try2/src/libextra/comm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,9 @@ mod test {
127127
// Rendezvous streams should be able to handle any number of messages being sent
128128
let (port, chan) = rendezvous();
129129
do spawn {
130-
10000.times(|| { chan.send(()) })
130+
1000000.times(|| { chan.send(()) })
131131
}
132-
10000.times(|| { port.recv() })
132+
1000000.times(|| { port.recv() })
133133
}
134134

135135
#[test]

branches/try2/src/libextra/ebml.rs

Lines changed: 23 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ pub mod reader {
9090

9191
// ebml reading
9292

93-
pub struct Res {
93+
struct Res {
9494
val: uint,
9595
next: uint
9696
}
@@ -130,40 +130,32 @@ pub mod reader {
130130
return vuint_at_slow(data, start);
131131
}
132132

133-
// Lookup table for parsing EBML Element IDs as per http://ebml.sourceforge.net/specs/
134-
// The Element IDs are parsed by reading a big endian u32 positioned at data[start].
135-
// Using the four most significant bits of the u32 we lookup in the table below how the
136-
// element ID should be derived from it.
137-
//
138-
// The table stores tuples (shift, mask) where shift is the number the u32 should be right
139-
// shifted with and mask is the value the right shifted value should be masked with.
140-
// If for example the most significant bit is set this means it's a class A ID and the u32
141-
// should be right shifted with 24 and masked with 0x7f. Therefore we store (24, 0x7f) at
142-
// index 0x8 - 0xF (four bit numbers where the most significant bit is set).
143-
//
144-
// By storing the number of shifts and masks in a table instead of checking in order if
145-
// the most significant bit is set, the second most significant bit is set etc. we can
146-
// replace up to three "and+branch" with a single table lookup which gives us a measured
147-
// speedup of around 2x on x86_64.
148-
static SHIFT_MASK_TABLE: [(u32, u32), ..16] = [
149-
(0, 0x0), (0, 0x0fffffff),
150-
(8, 0x1fffff), (8, 0x1fffff),
151-
(16, 0x3fff), (16, 0x3fff), (16, 0x3fff), (16, 0x3fff),
152-
(24, 0x7f), (24, 0x7f), (24, 0x7f), (24, 0x7f),
153-
(24, 0x7f), (24, 0x7f), (24, 0x7f), (24, 0x7f)
154-
];
155-
156133
unsafe {
157134
let (ptr, _): (*u8, uint) = transmute(data);
158135
let ptr = offset(ptr, start as int);
159136
let ptr: *i32 = transmute(ptr);
160-
let val = from_be32(*ptr) as u32;
161-
162-
let i = (val >> 28u) as uint;
163-
let (shift, mask) = SHIFT_MASK_TABLE[i];
164-
Res {
165-
val: ((val >> shift) & mask) as uint,
166-
next: start + (((32 - shift) >> 3) as uint)
137+
let val = from_be32(*ptr);
138+
let val: u32 = transmute(val);
139+
if (val & 0x80000000) != 0 {
140+
Res {
141+
val: ((val >> 24) & 0x7f) as uint,
142+
next: start + 1
143+
}
144+
} else if (val & 0x40000000) != 0 {
145+
Res {
146+
val: ((val >> 16) & 0x3fff) as uint,
147+
next: start + 2
148+
}
149+
} else if (val & 0x20000000) != 0 {
150+
Res {
151+
val: ((val >> 8) & 0x1fffff) as uint,
152+
next: start + 3
153+
}
154+
} else {
155+
Res {
156+
val: (val & 0x0fffffff) as uint,
157+
next: start + 4
158+
}
167159
}
168160
}
169161
}
@@ -946,54 +938,6 @@ mod tests {
946938
use std::io::mem::MemWriter;
947939
use std::option::{None, Option, Some};
948940

949-
#[test]
950-
fn test_vuint_at() {
951-
let data = [
952-
0x80,
953-
0xff,
954-
0x40, 0x00,
955-
0x7f, 0xff,
956-
0x20, 0x00, 0x00,
957-
0x3f, 0xff, 0xff,
958-
0x10, 0x00, 0x00, 0x00,
959-
0x1f, 0xff, 0xff, 0xff
960-
];
961-
962-
let mut res: reader::Res;
963-
964-
// Class A
965-
res = reader::vuint_at(data, 0);
966-
assert_eq!(res.val, 0);
967-
assert_eq!(res.next, 1);
968-
res = reader::vuint_at(data, res.next);
969-
assert_eq!(res.val, (1 << 7) - 1);
970-
assert_eq!(res.next, 2);
971-
972-
// Class B
973-
res = reader::vuint_at(data, res.next);
974-
assert_eq!(res.val, 0);
975-
assert_eq!(res.next, 4);
976-
res = reader::vuint_at(data, res.next);
977-
assert_eq!(res.val, (1 << 14) - 1);
978-
assert_eq!(res.next, 6);
979-
980-
// Class C
981-
res = reader::vuint_at(data, res.next);
982-
assert_eq!(res.val, 0);
983-
assert_eq!(res.next, 9);
984-
res = reader::vuint_at(data, res.next);
985-
assert_eq!(res.val, (1 << 21) - 1);
986-
assert_eq!(res.next, 12);
987-
988-
// Class D
989-
res = reader::vuint_at(data, res.next);
990-
assert_eq!(res.val, 0);
991-
assert_eq!(res.next, 16);
992-
res = reader::vuint_at(data, res.next);
993-
assert_eq!(res.val, (1 << 28) - 1);
994-
assert_eq!(res.next, 20);
995-
}
996-
997941
#[test]
998942
fn test_option_int() {
999943
fn test_v(v: Option<int>) {

branches/try2/src/libextra/hex.rs

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -53,25 +53,7 @@ impl<'a> ToHex for &'a [u8] {
5353
pub trait FromHex {
5454
/// Converts the value of `self`, interpreted as hexadecimal encoded data,
5555
/// into an owned vector of bytes, returning the vector.
56-
fn from_hex(&self) -> Result<~[u8], FromHexError>;
57-
}
58-
59-
/// Errors that can occur when decoding a hex encoded string
60-
pub enum FromHexError {
61-
/// The input contained a character not part of the hex format
62-
InvalidHexCharacter(char, uint),
63-
/// The input had a invalid length
64-
InvalidHexLength,
65-
}
66-
67-
impl ToStr for FromHexError {
68-
fn to_str(&self) -> ~str {
69-
match *self {
70-
InvalidHexCharacter(ch, idx) =>
71-
format!("Invalid character '{}' at position {}", ch, idx),
72-
InvalidHexLength => ~"Invalid input length",
73-
}
74-
}
56+
fn from_hex(&self) -> Result<~[u8], ~str>;
7557
}
7658

7759
impl<'a> FromHex for &'a str {
@@ -101,7 +83,7 @@ impl<'a> FromHex for &'a str {
10183
* }
10284
* ```
10385
*/
104-
fn from_hex(&self) -> Result<~[u8], FromHexError> {
86+
fn from_hex(&self) -> Result<~[u8], ~str> {
10587
// This may be an overestimate if there is any whitespace
10688
let mut b = vec::with_capacity(self.len() / 2);
10789
let mut modulus = 0;
@@ -118,7 +100,8 @@ impl<'a> FromHex for &'a str {
118100
buf >>= 4;
119101
continue
120102
}
121-
_ => return Err(InvalidHexCharacter(self.char_at(idx), idx)),
103+
_ => return Err(format!("Invalid character '{}' at position {}",
104+
self.char_at(idx), idx))
122105
}
123106

124107
modulus += 1;
@@ -130,7 +113,7 @@ impl<'a> FromHex for &'a str {
130113

131114
match modulus {
132115
0 => Ok(b),
133-
_ => Err(InvalidHexLength),
116+
_ => Err(~"Invalid input length")
134117
}
135118
}
136119
}

branches/try2/src/libextra/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ impl<T: Writer> ConsoleTestState<T> {
474474
match self.log_out {
475475
None => (),
476476
Some(ref mut o) => {
477-
let s = format!("{} {}", match *result {
477+
let s = format!("{} {}\n", match *result {
478478
TrOk => ~"ok",
479479
TrFailed => ~"failed",
480480
TrIgnored => ~"ignored",

branches/try2/src/librustc/back/link.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1166,7 +1166,7 @@ fn add_local_native_libraries(args: &mut ~[~str], sess: Session) {
11661166
fn add_upstream_rust_crates(args: &mut ~[~str], sess: Session,
11671167
dylib: bool, tmpdir: &Path) {
11681168
// Converts a library file-stem into a cc -l argument
1169-
fn unlib(config: @session::Config, stem: &str) -> ~str {
1169+
fn unlib(config: @session::config, stem: &str) -> ~str {
11701170
if stem.starts_with("lib") &&
11711171
config.os != abi::OsWin32 {
11721172
stem.slice(3, stem.len()).to_owned()

branches/try2/src/librustc/back/rpath.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub fn get_rpath_flags(sess: session::Session, out_filename: &Path) -> ~[~str] {
3939

4040
debug!("preparing the RPATH!");
4141

42-
let sysroot = sess.filesearch.sysroot;
42+
let sysroot = sess.filesearch.sysroot();
4343
let output = out_filename;
4444
let libs = sess.cstore.get_used_crates(cstore::RequireDynamic);
4545
let libs = libs.move_iter().filter_map(|(_, l)| l.map(|p| p.clone())).collect();
@@ -55,7 +55,7 @@ pub fn get_rpath_flags(sess: session::Session, out_filename: &Path) -> ~[~str] {
5555

5656
fn get_sysroot_absolute_rt_lib(sess: session::Session) -> Path {
5757
let r = filesearch::relative_target_lib_path(sess.opts.target_triple);
58-
let mut p = sess.filesearch.sysroot.join(&r);
58+
let mut p = sess.filesearch.sysroot().join(&r);
5959
p.push(os::dll_filename("rustrt"));
6060
p
6161
}

0 commit comments

Comments
 (0)