Skip to content

Commit 33779d7

Browse files
committed
---
yaml --- r: 79291 b: refs/heads/auto c: 124eb21 h: refs/heads/master i: 79289: f6d6291 79287: 0d17cb6 v: v3
1 parent d4df3e7 commit 33779d7

File tree

22 files changed

+189
-160
lines changed

22 files changed

+189
-160
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: b6f3d3f24546a525d1eb80923692c1296eddc4dc
16+
refs/heads/auto: 124eb2119c78651cfaaa7a046a101fa2e20f83ca
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/.gitmodules

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,8 @@
44
branch = master
55
[submodule "src/libuv"]
66
path = src/libuv
7-
url = https://github.com/brson/libuv.git
7+
url = https://github.com/alexcrichton/libuv.git
88
branch = master
9+
[submodule "src/gyp"]
10+
path = src/gyp
11+
url = https://git.chromium.org/external/gyp.git

branches/auto/configure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@ do
823823
index2="${CFG_SRC_DIR}src/llvm/.git/index"
824824
for index in ${index1} ${index2}
825825
do
826-
config_status="${CFG_BUILD_DIR}llvm/$t/config.status"
826+
config_status="${LLVM_BUILD_DIR}/config.status"
827827
if test -e ${index} -a \
828828
-e ${config_status} -a \
829829
${config_status} -nt ${index}

branches/auto/mk/dist.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ PKG_ICO = $(S)src/etc/pkg/rust-logo.ico
1212
PKG_EXE = $(PKG_DIR)-install.exe
1313
endif
1414

15-
PKG_GITMODULES := $(S)src/libuv $(S)src/llvm
15+
PKG_GITMODULES := $(S)src/libuv $(S)src/llvm $(S)src/gyp
1616

1717
PKG_FILES := \
1818
$(S)COPYRIGHT \

branches/auto/mk/rt.mk

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -170,36 +170,51 @@ LIBUV_DEPS := $$(wildcard \
170170
$$(S)src/libuv/*/*/*/*)
171171
endif
172172

173+
LIBUV_MAKEFILE_$(1)_$(2) := $$(CFG_BUILD_DIR)$$(RT_BUILD_DIR_$(1)_$(2))/libuv/Makefile
174+
LIBUV_NO_LOAD = run-benchmarks.target.mk run-tests.target.mk \
175+
uv_dtrace_header.target.mk uv_dtrace_provider.target.mk
176+
177+
export PYTHONPATH := $(PYTHONPATH):$$(S)src/gyp/pylib
178+
179+
$$(LIBUV_MAKEFILE_$(1)_$(2)):
180+
(cd $(S)src/libuv/ && \
181+
./gyp_uv -f make -Dtarget_arch=$$(LIBUV_ARCH_$(1)) -D ninja \
182+
-Goutput_dir=$$(@D) --generator-output $$(@D))
183+
173184
# XXX: Shouldn't need platform-specific conditions here
174185
ifdef CFG_WINDOWSY_$(1)
175186
$$(LIBUV_LIB_$(1)_$(2)): $$(LIBUV_DEPS)
176-
$$(Q)$$(MAKE) -C $$(S)src/libuv/ \
177-
builddir_name="$$(CFG_BUILD_DIR)/$$(RT_BUILD_DIR_$(1)_$(2))/libuv" \
178-
OS=mingw \
187+
$$(Q)$$(MAKE) -C $$(S)src/libuv -f Makefile.mingw \
188+
CFLAGS="$$(CFG_GCCISH_CFLAGS) $$(LIBUV_FLAGS_$$(HOST_$(1))) $$(SNAP_DEFINES)" \
189+
AR="$$(AR_$(1))" \
179190
V=$$(VERBOSE)
191+
$$(Q)cp $$(S)src/libuv/libuv.a $$@
180192
else ifeq ($(OSTYPE_$(1)), linux-androideabi)
181-
$$(LIBUV_LIB_$(1)_$(2)): $$(LIBUV_DEPS)
182-
$$(Q)$$(MAKE) -C $$(S)src/libuv/ \
193+
$$(LIBUV_LIB_$(1)_$(2)): $$(LIBUV_DEPS) $$(LIBUV_MAKEFILE_$(1)_$(2))
194+
$$(Q)$$(MAKE) -C $$(@D) \
183195
CFLAGS="$$(CFG_GCCISH_CFLAGS) $$(LIBUV_FLAGS_$$(HOST_$(1))) $$(SNAP_DEFINES)" \
184196
LDFLAGS="$$(CFG_GCCISH_LINK_FLAGS) $$(LIBUV_FLAGS_$$(HOST_$(1)))" \
185197
CC="$$(CC_$(1))" \
186198
CXX="$$(CXX_$(1))" \
187199
LINK="$$(CXX_$(1))" \
188200
AR="$$(AR_$(1))" \
189201
PLATFORM=android \
190-
BUILDTYPE=Release \
191-
builddir_name="$$(CFG_BUILD_DIR)/$$(RT_BUILD_DIR_$(1)_$(2))/libuv" \
192202
host=android OS=linux \
203+
builddir="." \
204+
BUILDTYPE=Release \
205+
NO_LOAD="$$(LIBUV_NO_LOAD)" \
193206
V=$$(VERBOSE)
194207
else
195-
$$(LIBUV_LIB_$(1)_$(2)): $$(LIBUV_DEPS)
196-
$$(Q)$$(MAKE) -C $$(S)src/libuv/ \
208+
$$(LIBUV_LIB_$(1)_$(2)): $$(LIBUV_DEPS) $$(LIBUV_MAKEFILE_$(1)_$(2))
209+
$$(Q)$$(MAKE) -C $$(@D) \
197210
CFLAGS="$$(CFG_GCCISH_CFLAGS) $$(LIBUV_FLAGS_$$(HOST_$(1))) $$(SNAP_DEFINES)" \
198211
LDFLAGS="$$(CFG_GCCISH_LINK_FLAGS) $$(LIBUV_FLAGS_$$(HOST_$(1)))" \
199212
CC="$$(CC_$(1))" \
200213
CXX="$$(CXX_$(1))" \
201214
AR="$$(AR_$(1))" \
202-
builddir_name="$$(CFG_BUILD_DIR)/$$(RT_BUILD_DIR_$(1)_$(2))/libuv" \
215+
builddir="." \
216+
BUILDTYPE=Release \
217+
NO_LOAD="$$(LIBUV_NO_LOAD)" \
203218
V=$$(VERBOSE)
204219
endif
205220

branches/auto/src/gyp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit f407f09c94e00d2d570e8e42114e3f6848b2deb2

branches/auto/src/libextra/glob.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -304,11 +304,11 @@ impl Pattern {
304304
&& is_sep(prev_char.unwrap_or_default('/')))
305305
};
306306
307-
for ti in range(i, self.tokens.len()) {
308-
match self.tokens[ti] {
307+
for (ti, token) in self.tokens.slice_from(i).iter().enumerate() {
308+
match *token {
309309
AnySequence => {
310310
loop {
311-
match self.matches_from(prev_char, file, ti + 1, options) {
311+
match self.matches_from(prev_char, file, i + ti + 1, options) {
312312
SubPatternDoesntMatch => (), // keep trying
313313
m => return m,
314314
}
@@ -331,7 +331,7 @@ impl Pattern {
331331
}
332332
333333
let (c, next) = file.slice_shift_char();
334-
let matches = match self.tokens[ti] {
334+
let matches = match *token {
335335
AnyChar => {
336336
!require_literal(c)
337337
}

branches/auto/src/libextra/time.rs

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,33 @@ fn do_strptime(s: &str, format: &str) -> Result<Tm, ~str> {
321321
Some((value, pos))
322322
}
323323

324+
fn match_fractional_seconds(ss: &str, pos: uint) -> (i32, uint) {
325+
let len = ss.len();
326+
let mut value = 0_i32;
327+
let mut multiplier = NSEC_PER_SEC / 10;
328+
let mut pos = pos;
329+
330+
loop {
331+
if pos >= len {
332+
break;
333+
}
334+
let range = ss.char_range_at(pos);
335+
336+
match range.ch {
337+
'0' .. '9' => {
338+
pos = range.next;
339+
// This will drop digits after the nanoseconds place
340+
let digit = range.ch as i32 - '0' as i32;
341+
value += digit * multiplier;
342+
multiplier /= 10;
343+
}
344+
_ => break
345+
}
346+
}
347+
348+
(value, pos)
349+
}
350+
324351
fn match_digits_in_range(ss: &str, pos: uint, digits: uint, ws: bool,
325352
min: i32, max: i32) -> Option<(i32, uint)> {
326353
match match_digits(ss, pos, digits, ws) {
@@ -441,6 +468,11 @@ fn do_strptime(s: &str, format: &str) -> Result<Tm, ~str> {
441468
Some(item) => { let (v, pos) = item; tm.tm_mday = v; Ok(pos) }
442469
None => Err(~"Invalid day of the month")
443470
},
471+
'f' => {
472+
let (val, pos) = match_fractional_seconds(s, pos);
473+
tm.tm_nsec = val;
474+
Ok(pos)
475+
}
444476
'F' => {
445477
parse_type(s, pos, 'Y', &mut *tm)
446478
.chain(|pos| parse_char(s, pos, '-'))
@@ -773,6 +805,7 @@ fn do_strftime(format: &str, tm: &Tm) -> ~str {
773805
}
774806
'd' => fmt!("%02d", tm.tm_mday as int),
775807
'e' => fmt!("%2d", tm.tm_mday as int),
808+
'f' => fmt!("%09d", tm.tm_nsec as int),
776809
'F' => {
777810
fmt!("%s-%s-%s",
778811
parse_type('Y', tm),
@@ -1011,12 +1044,12 @@ mod tests {
10111044
Err(_) => ()
10121045
}
10131046
1014-
let format = "%a %b %e %T %Y";
1047+
let format = "%a %b %e %T.%f %Y";
10151048
assert_eq!(strptime("", format), Err(~"Invalid time"));
10161049
assert!(strptime("Fri Feb 13 15:31:30", format)
10171050
== Err(~"Invalid time"));
10181051
1019-
match strptime("Fri Feb 13 15:31:30 2009", format) {
1052+
match strptime("Fri Feb 13 15:31:30.01234 2009", format) {
10201053
Err(e) => fail!(e),
10211054
Ok(ref tm) => {
10221055
assert!(tm.tm_sec == 30_i32);
@@ -1030,7 +1063,7 @@ mod tests {
10301063
assert!(tm.tm_isdst == 0_i32);
10311064
assert!(tm.tm_gmtoff == 0_i32);
10321065
assert!(tm.tm_zone == ~"");
1033-
assert!(tm.tm_nsec == 0_i32);
1066+
assert!(tm.tm_nsec == 12340000_i32);
10341067
}
10351068
}
10361069
@@ -1187,6 +1220,7 @@ mod tests {
11871220
assert_eq!(local.strftime("%D"), ~"02/13/09");
11881221
assert_eq!(local.strftime("%d"), ~"13");
11891222
assert_eq!(local.strftime("%e"), ~"13");
1223+
assert_eq!(local.strftime("%f"), ~"000054321");
11901224
assert_eq!(local.strftime("%F"), ~"2009-02-13");
11911225
// assert!(local.strftime("%G") == "2009");
11921226
// assert!(local.strftime("%g") == "09");

branches/auto/src/libstd/num/strconv.rs

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -552,8 +552,18 @@ pub fn from_str_bytes_common<T:NumCast+Zero+One+Eq+Ord+Div<T,T>+
552552
// Detect overflow by comparing to last value, except
553553
// if we've not seen any non-zero digits.
554554
if last_accum != _0 {
555-
if accum_positive && accum <= last_accum { return None; }
556-
if !accum_positive && accum >= last_accum { return None; }
555+
if accum_positive && accum <= last_accum { return NumStrConv::inf(); }
556+
if !accum_positive && accum >= last_accum { return NumStrConv::neg_inf(); }
557+
558+
// Detect overflow by reversing the shift-and-add proccess
559+
if accum_positive &&
560+
(last_accum != ((accum - cast(digit as int))/radix_gen.clone())) {
561+
return NumStrConv::inf();
562+
}
563+
if !accum_positive &&
564+
(last_accum != ((accum + cast(digit as int))/radix_gen.clone())) {
565+
return NumStrConv::neg_inf();
566+
}
557567
}
558568
last_accum = accum.clone();
559569
}
@@ -597,8 +607,8 @@ pub fn from_str_bytes_common<T:NumCast+Zero+One+Eq+Ord+Div<T,T>+
597607
}
598608

599609
// Detect overflow by comparing to last value
600-
if accum_positive && accum < last_accum { return None; }
601-
if !accum_positive && accum > last_accum { return None; }
610+
if accum_positive && accum < last_accum { return NumStrConv::inf(); }
611+
if !accum_positive && accum > last_accum { return NumStrConv::neg_inf(); }
602612
last_accum = accum.clone();
603613
}
604614
None => match c {
@@ -702,6 +712,23 @@ mod test {
702712
ExpNone, false, false);
703713
assert_eq!(n, None);
704714
}
715+
716+
#[test]
717+
fn from_str_issue7588() {
718+
let u : Option<u8> = from_str_common("1000", 10, false, false, false,
719+
ExpNone, false, false);
720+
assert_eq!(u, None);
721+
let s : Option<i16> = from_str_common("80000", 10, false, false, false,
722+
ExpNone, false, false);
723+
assert_eq!(s, None);
724+
let f : Option<f32> = from_str_common(
725+
"10000000000000000000000000000000000000000", 10, false, false, false,
726+
ExpNone, false, false);
727+
assert_eq!(f, NumStrConv::inf())
728+
let fe : Option<f32> = from_str_common("1e40", 10, false, false, false,
729+
ExpDec, false, false);
730+
assert_eq!(fe, NumStrConv::inf())
731+
}
705732
}
706733

707734
#[cfg(test)]

branches/auto/src/libstd/rt/io/net/tcp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ mod test {
182182
do run_in_newsched_task {
183183
let mut called = false;
184184
do io_error::cond.trap(|e| {
185-
assert!(e.kind == ConnectionRefused);
185+
assert_eq!(e.kind, ConnectionRefused);
186186
called = true;
187187
}).inside {
188188
let addr = SocketAddr { ip: Ipv4Addr(0, 0, 0, 0), port: 1 };

branches/auto/src/libstd/rt/uv/addrinfo.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use ptr::null;
1717
use rt::uv::uvll;
1818
use rt::uv::uvll::UV_GETADDRINFO;
1919
use rt::uv::{Loop, UvError, NativeHandle};
20-
use rt::uv::status_to_maybe_uv_error_with_loop;
20+
use rt::uv::status_to_maybe_uv_error;
2121
use rt::uv::net::UvAddrInfo;
2222

2323
type GetAddrInfoCallback = ~fn(GetAddrInfoRequest, &UvAddrInfo, Option<UvError>);
@@ -90,8 +90,7 @@ impl GetAddrInfoRequest {
9090
status: c_int,
9191
res: *uvll::addrinfo) {
9292
let mut req: GetAddrInfoRequest = NativeHandle::from_native_handle(req);
93-
let loop_ = req.get_loop();
94-
let err = status_to_maybe_uv_error_with_loop(loop_.native_handle(), status);
93+
let err = status_to_maybe_uv_error(status);
9594
let addrinfo = UvAddrInfo(res);
9695
let data = req.get_req_data();
9796
(*data.getaddrinfo_cb.get_ref())(req, &addrinfo, err);

branches/auto/src/libstd/rt/uv/async.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ impl AsyncWatcher {
3434

3535
extern fn async_cb(handle: *uvll::uv_async_t, status: c_int) {
3636
let mut watcher: AsyncWatcher = NativeHandle::from_native_handle(handle);
37-
let status = status_to_maybe_uv_error(watcher, status);
37+
let status = status_to_maybe_uv_error(status);
3838
let data = watcher.get_watcher_data();
3939
let cb = data.async_cb.get_ref();
4040
(*cb)(watcher, status);

branches/auto/src/libstd/rt/uv/file.rs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use prelude::*;
1212
use ptr::null;
1313
use libc::c_void;
1414
use rt::uv::{Request, NativeHandle, Loop, FsCallback, Buf,
15-
status_to_maybe_uv_error_with_loop, UvError};
15+
status_to_maybe_uv_error, UvError};
1616
use rt::uv::uvll;
1717
use rt::uv::uvll::*;
1818
use super::super::io::support::PathLike;
@@ -62,7 +62,7 @@ impl FsRequest {
6262
pub fn open_sync<P: PathLike>(loop_: &Loop, path: &P, flags: int, mode: int)
6363
-> Result<int, UvError> {
6464
let result = FsRequest::open_common(loop_, path, flags, mode, None);
65-
sync_cleanup(loop_, result)
65+
sync_cleanup(result)
6666
}
6767

6868
fn unlink_common<P: PathLike>(loop_: &Loop, path: &P, cb: Option<FsCallback>) -> int {
@@ -83,11 +83,11 @@ impl FsRequest {
8383
}
8484
pub fn unlink<P: PathLike>(loop_: &Loop, path: &P, cb: FsCallback) {
8585
let result = FsRequest::unlink_common(loop_, path, Some(cb));
86-
sync_cleanup(loop_, result);
86+
sync_cleanup(result);
8787
}
8888
pub fn unlink_sync<P: PathLike>(loop_: &Loop, path: &P) -> Result<int, UvError> {
8989
let result = FsRequest::unlink_common(loop_, path, None);
90-
sync_cleanup(loop_, result)
90+
sync_cleanup(result)
9191
}
9292

9393
pub fn install_req_data(&self, cb: Option<FsCallback>) {
@@ -140,9 +140,9 @@ impl NativeHandle<*uvll::uv_fs_t> for FsRequest {
140140
}
141141
}
142142

143-
fn sync_cleanup(loop_: &Loop, result: int)
143+
fn sync_cleanup(result: int)
144144
-> Result<int, UvError> {
145-
match status_to_maybe_uv_error_with_loop(loop_.native_handle(), result as i32) {
145+
match status_to_maybe_uv_error(result as i32) {
146146
Some(err) => Err(err),
147147
None => Ok(result)
148148
}
@@ -186,7 +186,7 @@ impl FileDescriptor {
186186
pub fn write_sync(&mut self, loop_: &Loop, buf: Buf, offset: i64)
187187
-> Result<int, UvError> {
188188
let result = self.write_common(loop_, buf, offset, None);
189-
sync_cleanup(loop_, result)
189+
sync_cleanup(result)
190190
}
191191

192192
fn read_common(&mut self, loop_: &Loop, buf: Buf,
@@ -214,7 +214,7 @@ impl FileDescriptor {
214214
pub fn read_sync(&mut self, loop_: &Loop, buf: Buf, offset: i64)
215215
-> Result<int, UvError> {
216216
let result = self.read_common(loop_, buf, offset, None);
217-
sync_cleanup(loop_, result)
217+
sync_cleanup(result)
218218
}
219219

220220
fn close_common(self, loop_: &Loop, cb: Option<FsCallback>) -> int {
@@ -236,12 +236,11 @@ impl FileDescriptor {
236236
}
237237
pub fn close_sync(self, loop_: &Loop) -> Result<int, UvError> {
238238
let result = self.close_common(loop_, None);
239-
sync_cleanup(loop_, result)
239+
sync_cleanup(result)
240240
}
241241
}
242242
extern fn compl_cb(req: *uv_fs_t) {
243243
let mut req: FsRequest = NativeHandle::from_native_handle(req);
244-
let loop_ = req.get_loop();
245244
// pull the user cb out of the req data
246245
let cb = {
247246
let data = req.get_req_data();
@@ -252,8 +251,7 @@ extern fn compl_cb(req: *uv_fs_t) {
252251
// in uv_fs_open calls, the result will be the fd in the
253252
// case of success, otherwise it's -1 indicating an error
254253
let result = req.get_result();
255-
let status = status_to_maybe_uv_error_with_loop(
256-
loop_.native_handle(), result);
254+
let status = status_to_maybe_uv_error(result);
257255
// we have a req and status, call the user cb..
258256
// only giving the user a ref to the FsRequest, as we
259257
// have to clean it up, afterwards (and they aren't really

0 commit comments

Comments
 (0)