Skip to content

Commit 81ba2c8

Browse files
committed
---
yaml --- r: 149385 b: refs/heads/try2 c: cb3a419 h: refs/heads/master i: 149383: 64760cc v: v3
1 parent 09a8661 commit 81ba2c8

Some content is hidden

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

51 files changed

+274
-629
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: 0cc8ba0c2030720750c6166ad898ca192c695ffc
8+
refs/heads/try2: cb3a419d979faaa9bda7315a1a3d19ba581fefe1
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libextra/test.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -315,15 +315,12 @@ pub fn opt_shard(maybestr: Option<~str>) -> Option<(uint,uint)> {
315315
match maybestr {
316316
None => None,
317317
Some(s) => {
318-
let vector = s.split('.').to_owned_vec();
319-
if vector.len() == 2 {
320-
match (from_str::<uint>(vector[0]),
321-
from_str::<uint>(vector[1])) {
322-
(Some(a), Some(b)) => Some((a, b)),
318+
match s.split('.').to_owned_vec() {
319+
[a, b] => match (from_str::<uint>(a), from_str::<uint>(b)) {
320+
(Some(a), Some(b)) => Some((a,b)),
323321
_ => None
324-
}
325-
} else {
326-
None
322+
},
323+
_ => None
327324
}
328325
}
329326
}
@@ -558,7 +555,7 @@ impl<T: Writer> ConsoleTestState<T> {
558555
}
559556
}
560557
}
561-
if_ok!(self.write_plain(format!("result of ratchet: {} metrics added, \
558+
if_ok!(self.write_plain(format!("result of ratchet: {} matrics added, \
562559
{} removed, {} improved, {} regressed, \
563560
{} noise\n",
564561
added, removed, improved, regressed,

branches/try2/src/libextra/url.rs

Lines changed: 0 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,6 @@ pub struct Url {
5555
fragment: Option<~str>
5656
}
5757

58-
#[deriving(Clone, Eq)]
59-
pub struct Path {
60-
/// The path component of a URL, for example `/foo/bar`.
61-
path: ~str,
62-
/// The query component of a URL. `~[(~"baz", ~"qux")]` represents the
63-
/// fragment `baz=qux` in the above example.
64-
query: Query,
65-
/// The fragment component, such as `quz`. Doesn't include the leading `#` character.
66-
fragment: Option<~str>
67-
}
68-
6958
/// An optional subcomponent of a URI authority component.
7059
#[deriving(Clone, Eq)]
7160
pub struct UserInfo {
@@ -99,19 +88,6 @@ impl Url {
9988
}
10089
}
10190

102-
impl Path {
103-
pub fn new(path: ~str,
104-
query: Query,
105-
fragment: Option<~str>)
106-
-> Path {
107-
Path {
108-
path: path,
109-
query: query,
110-
fragment: fragment,
111-
}
112-
}
113-
}
114-
11591
impl UserInfo {
11692
#[inline]
11793
pub fn new(user: ~str, pass: Option<~str>) -> UserInfo {
@@ -751,21 +727,6 @@ pub fn from_str(rawurl: &str) -> Result<Url, ~str> {
751727
Ok(Url::new(scheme, userinfo, host, port, path, query, fragment))
752728
}
753729

754-
pub fn path_from_str(rawpath: &str) -> Result<Path, ~str> {
755-
let (path, rest) = match get_path(rawpath, false) {
756-
Ok(val) => val,
757-
Err(e) => return Err(e)
758-
};
759-
760-
// query and fragment
761-
let (query, fragment) = match get_query_fragment(rest) {
762-
Ok(val) => val,
763-
Err(e) => return Err(e),
764-
};
765-
766-
Ok(Path{ path: path, query: query, fragment: fragment })
767-
}
768-
769730
impl FromStr for Url {
770731
fn from_str(s: &str) -> Option<Url> {
771732
match from_str(s) {
@@ -775,15 +736,6 @@ impl FromStr for Url {
775736
}
776737
}
777738

778-
impl FromStr for Path {
779-
fn from_str(s: &str) -> Option<Path> {
780-
match path_from_str(s) {
781-
Ok(path) => Some(path),
782-
Err(_) => None
783-
}
784-
}
785-
}
786-
787739
/**
788740
* Converts a URL from `Url` to string representation.
789741
*
@@ -828,45 +780,18 @@ pub fn to_str(url: &Url) -> ~str {
828780
format!("{}:{}{}{}{}", url.scheme, authority, url.path, query, fragment)
829781
}
830782

831-
pub fn path_to_str(path: &Path) -> ~str {
832-
let query = if path.query.is_empty() {
833-
~""
834-
} else {
835-
format!("?{}", query_to_str(&path.query))
836-
};
837-
838-
let fragment = match path.fragment {
839-
Some(ref fragment) => format!("\\#{}", encode_component(*fragment)),
840-
None => ~"",
841-
};
842-
843-
format!("{}{}{}", path.path, query, fragment)
844-
}
845-
846783
impl ToStr for Url {
847784
fn to_str(&self) -> ~str {
848785
to_str(self)
849786
}
850787
}
851788

852-
impl ToStr for Path {
853-
fn to_str(&self) -> ~str {
854-
path_to_str(self)
855-
}
856-
}
857-
858789
impl IterBytes for Url {
859790
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) -> bool {
860791
self.to_str().iter_bytes(lsb0, f)
861792
}
862793
}
863794

864-
impl IterBytes for Path {
865-
fn iter_bytes(&self, lsb0: bool, f: to_bytes::Cb) -> bool {
866-
self.to_str().iter_bytes(lsb0, f)
867-
}
868-
}
869-
870795
// Put a few tests outside of the 'test' module so they can test the internal
871796
// functions and those functions don't need 'pub'
872797

@@ -974,17 +899,6 @@ mod tests {
974899
assert_eq!(&u.fragment, &Some(~"something"));
975900
}
976901
977-
#[test]
978-
fn test_path_parse() {
979-
let path = ~"/doc/~u?s=v#something";
980-
981-
let up = path_from_str(path);
982-
let u = up.unwrap();
983-
assert_eq!(&u.path, &~"/doc/~u");
984-
assert_eq!(&u.query, &~[(~"s", ~"v")]);
985-
assert_eq!(&u.fragment, &Some(~"something"));
986-
}
987-
988902
#[test]
989903
fn test_url_parse_host_slash() {
990904
let urlstr = ~"http://0.42.42.42/";
@@ -993,13 +907,6 @@ mod tests {
993907
assert!(url.path == ~"/");
994908
}
995909
996-
#[test]
997-
fn test_path_parse_host_slash() {
998-
let pathstr = ~"/";
999-
let path = path_from_str(pathstr).unwrap();
1000-
assert!(path.path == ~"/");
1001-
}
1002-
1003910
#[test]
1004911
fn test_url_host_with_port() {
1005912
let urlstr = ~"scheme://host:1234";
@@ -1023,27 +930,13 @@ mod tests {
1023930
assert!(url.path == ~"/file_name.html");
1024931
}
1025932
1026-
#[test]
1027-
fn test_path_with_underscores() {
1028-
let pathstr = ~"/file_name.html";
1029-
let path = path_from_str(pathstr).unwrap();
1030-
assert!(path.path == ~"/file_name.html");
1031-
}
1032-
1033933
#[test]
1034934
fn test_url_with_dashes() {
1035935
let urlstr = ~"http://dotcom.com/file-name.html";
1036936
let url = from_str(urlstr).unwrap();
1037937
assert!(url.path == ~"/file-name.html");
1038938
}
1039939
1040-
#[test]
1041-
fn test_path_with_dashes() {
1042-
let pathstr = ~"/file-name.html";
1043-
let path = path_from_str(pathstr).unwrap();
1044-
assert!(path.path == ~"/file-name.html");
1045-
}
1046-
1047940
#[test]
1048941
fn test_no_scheme() {
1049942
assert!(get_scheme("noschemehere.html").is_err());
@@ -1124,14 +1017,6 @@ mod tests {
11241017
assert!(u.query == ~[(~"ba%d ", ~"#&+")]);
11251018
}
11261019
1127-
#[test]
1128-
fn test_path_component_encoding() {
1129-
let path = ~"/doc%20uments?ba%25d%20=%23%26%2B";
1130-
let p = path_from_str(path).unwrap();
1131-
assert!(p.path == ~"/doc uments");
1132-
assert!(p.query == ~[(~"ba%d ", ~"#&+")]);
1133-
}
1134-
11351020
#[test]
11361021
fn test_url_without_authority() {
11371022
let url = ~"mailto:test@email.com";

branches/try2/src/libnative/io/timer_other.rs

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -130,25 +130,27 @@ fn helper(input: libc::c_int, messages: Port<Req>) {
130130
}
131131

132132
'outer: loop {
133-
let timeout = if active.len() == 0 {
133+
let timeout = match active {
134134
// Empty array? no timeout (wait forever for the next request)
135-
ptr::null()
136-
} else {
137-
let now = now();
138-
// If this request has already expired, then signal it and go
139-
// through another iteration
140-
if active[0].target <= now {
141-
signal(&mut active, &mut dead);
142-
continue;
143-
}
135+
[] => ptr::null(),
136+
137+
[~Inner { target, .. }, ..] => {
138+
let now = now();
139+
// If this request has already expired, then signal it and go
140+
// through another iteration
141+
if target <= now {
142+
signal(&mut active, &mut dead);
143+
continue;
144+
}
144145

145-
// The actual timeout listed in the requests array is an
146-
// absolute date, so here we translate the absolute time to a
147-
// relative time.
148-
let tm = active[0].target - now;
149-
timeout.tv_sec = (tm / 1000) as libc::time_t;
150-
timeout.tv_usec = ((tm % 1000) * 1000) as libc::suseconds_t;
151-
&timeout as *libc::timeval
146+
// The actual timeout listed in the requests array is an
147+
// absolute date, so here we translate the absolute time to a
148+
// relative time.
149+
let tm = target - now;
150+
timeout.tv_sec = (tm / 1000) as libc::time_t;
151+
timeout.tv_usec = ((tm % 1000) * 1000) as libc::suseconds_t;
152+
&timeout as *libc::timeval
153+
}
152154
};
153155

154156
imp::fd_set(&mut set, input);

branches/try2/src/libnum/bigint.rs

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -495,23 +495,24 @@ impl ToPrimitive for BigUint {
495495
#[cfg(target_word_size = "32")]
496496
#[inline]
497497
fn to_u64(&self) -> Option<u64> {
498-
match self.data.len() {
499-
0 => Some(0),
500-
1 => Some(self.data[0] as u64),
501-
2 => {
502-
Some(BigDigit::to_uint(self.data[1], self.data[0]) as u64)
498+
match self.data {
499+
[] => {
500+
Some(0)
503501
}
504-
3 => {
505-
let n_lo = BigDigit::to_uint(self.data[1], self.data[0]) as
506-
u64;
507-
let n_hi = self.data[2] as u64;
502+
[n0] => {
503+
Some(n0 as u64)
504+
}
505+
[n0, n1] => {
506+
Some(BigDigit::to_uint(n1, n0) as u64)
507+
}
508+
[n0, n1, n2] => {
509+
let n_lo = BigDigit::to_uint(n1, n0) as u64;
510+
let n_hi = n2 as u64;
508511
Some((n_hi << 32) + n_lo)
509512
}
510-
4 => {
511-
let n_lo = BigDigit::to_uint(self.data[1], self.data[0])
512-
as u64;
513-
let n_hi = BigDigit::to_uint(self.data[3], self.data[2])
514-
as u64;
513+
[n0, n1, n2, n3] => {
514+
let n_lo = BigDigit::to_uint(n1, n0) as u64;
515+
let n_hi = BigDigit::to_uint(n3, n2) as u64;
515516
Some((n_hi << 32) + n_lo)
516517
}
517518
_ => None
@@ -521,10 +522,16 @@ impl ToPrimitive for BigUint {
521522
#[cfg(target_word_size = "64")]
522523
#[inline]
523524
fn to_u64(&self) -> Option<u64> {
524-
match self.data.len() {
525-
0 => Some(0),
526-
1 => Some(self.data[0] as u64),
527-
2 => Some(BigDigit::to_uint(self.data[1], self.data[0]) as u64),
525+
match self.data {
526+
[] => {
527+
Some(0)
528+
}
529+
[n0] => {
530+
Some(n0 as u64)
531+
}
532+
[n0, n1] => {
533+
Some(BigDigit::to_uint(n1, n0) as u64)
534+
}
528535
_ => None
529536
}
530537
}
@@ -1254,7 +1261,7 @@ impl FromStrRadix for BigInt {
12541261
}
12551262
}
12561263
1257-
trait RandBigInt {
1264+
pub trait RandBigInt {
12581265
/// Generate a random `BigUint` of the given bit size.
12591266
fn gen_biguint(&mut self, bit_size: uint) -> BigUint;
12601267

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,6 @@ impl Archive {
173173
if_ok!(fs::rename(file, &new_filename));
174174
inputs.push(new_filename);
175175
}
176-
if inputs.len() == 0 { return Ok(()) }
177176

178177
// Finally, add all the renamed files to this archive
179178
let mut args = ~[&self.dst];

0 commit comments

Comments
 (0)