Skip to content

Commit d168fa4

Browse files
committed
---
yaml --- r: 112431 b: refs/heads/try c: 70647cc h: refs/heads/master i: 112429: ce98aea 112427: a4f2937 112423: c894f41 112415: 7380e4a v: v3
1 parent 344b3ac commit d168fa4

File tree

131 files changed

+1376
-1009
lines changed

Some content is hidden

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

131 files changed

+1376
-1009
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: a72a6ec897e1b8d7e125be9bb4b60d89c79aa4c0
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: b5dd3f05fe95168b5569d0f519636149479eb6ac
5-
refs/heads/try: 899f22238669bade874f29f784cdffba28ff0982
5+
refs/heads/try: 70647ccc6de1c319de647a2b8d75b667e88fbfd0
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/mk/tests.mk

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -526,8 +526,6 @@ endif
526526
# triples). The associated message will be printed as a warning
527527
# during attempts to run those tests.
528528

529-
CTEST_DISABLE_NONSELFHOST_rpass-full = "run-pass-full suite is unavailable when cross-compiling."
530-
531529
define DEF_CTEST_VARS
532530

533531
# All the per-stage build rules you might want to call from the
@@ -573,7 +571,7 @@ CTEST_COMMON_ARGS$(1)-T-$(2)-H-$(3) := \
573571
$$(CTEST_TESTARGS)
574572

575573
CTEST_DEPS_rpass_$(1)-T-$(2)-H-$(3) = $$(RPASS_TESTS)
576-
CTEST_DEPS_rpass-full_$(1)-T-$(2)-H-$(3) = $$(RPASS_FULL_TESTS) $$(CSREQ$(1)_T_$(2)_H_$(3))
574+
CTEST_DEPS_rpass-full_$(1)-T-$(2)-H-$(3) = $$(RPASS_FULL_TESTS) $$(CSREQ$(1)_T_$(3)_H_$(3)) $$(SREQ$(1)_T_$(2)_H_$(3))
577575
CTEST_DEPS_rfail_$(1)-T-$(2)-H-$(3) = $$(RFAIL_TESTS)
578576
CTEST_DEPS_cfail_$(1)-T-$(2)-H-$(3) = $$(CFAIL_TESTS)
579577
CTEST_DEPS_bench_$(1)-T-$(2)-H-$(3) = $$(BENCH_TESTS)

branches/try/src/libcollections/bitv.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ impl<'a> RandomAccessIterator<bool> for Bits<'a> {
632632
}
633633

634634
#[inline]
635-
fn idx(&self, index: uint) -> Option<bool> {
635+
fn idx(&mut self, index: uint) -> Option<bool> {
636636
if index >= self.indexable() {
637637
None
638638
} else {

branches/try/src/libcollections/ringbuf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ impl<'a, T> RandomAccessIterator<&'a T> for Items<'a, T> {
272272
fn indexable(&self) -> uint { self.rindex - self.index }
273273

274274
#[inline]
275-
fn idx(&self, j: uint) -> Option<&'a T> {
275+
fn idx(&mut self, j: uint) -> Option<&'a T> {
276276
if j >= self.indexable() {
277277
None
278278
} else {

branches/try/src/libfourcc/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ pub fn expand_syntax_ext(cx: &mut ExtCtxt, sp: Span, tts: &[ast::TokenTree]) ->
9191

9292
let s = match expr.node {
9393
// expression is a literal
94-
ast::ExprLit(lit) => match lit.node {
94+
ast::ExprLit(ref lit) => match lit.node {
9595
// string literal
9696
ast::LitStr(ref s, _) => {
9797
if s.get().char_len() != 4 {

branches/try/src/libnative/io/c_win32.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ extern "system" {
5050
pub fn ioctlsocket(s: libc::SOCKET, cmd: libc::c_long,
5151
argp: *mut libc::c_ulong) -> libc::c_int;
5252
pub fn select(nfds: libc::c_int,
53-
readfds: *mut fd_set,
54-
writefds: *mut fd_set,
55-
exceptfds: *mut fd_set,
53+
readfds: *fd_set,
54+
writefds: *fd_set,
55+
exceptfds: *fd_set,
5656
timeout: *libc::timeval) -> libc::c_int;
5757
pub fn getsockopt(sockfd: libc::SOCKET,
5858
level: libc::c_int,

branches/try/src/libnative/io/net.rs

Lines changed: 56 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use std::cast;
1313
use std::io::net::ip;
1414
use std::io;
1515
use std::mem;
16+
use std::os;
1617
use std::ptr;
1718
use std::rt::rtio;
1819
use std::sync::arc::UnsafeArc;
@@ -144,6 +145,21 @@ fn last_error() -> io::IoError {
144145
super::last_error()
145146
}
146147

148+
fn ms_to_timeval(ms: u64) -> libc::timeval {
149+
libc::timeval {
150+
tv_sec: (ms / 1000) as libc::time_t,
151+
tv_usec: ((ms % 1000) * 1000) as libc::suseconds_t,
152+
}
153+
}
154+
155+
fn timeout(desc: &'static str) -> io::IoError {
156+
io::IoError {
157+
kind: io::TimedOut,
158+
desc: desc,
159+
detail: None,
160+
}
161+
}
162+
147163
#[cfg(windows)] unsafe fn close(sock: sock_t) { let _ = libc::closesocket(sock); }
148164
#[cfg(unix)] unsafe fn close(sock: sock_t) { let _ = libc::close(sock); }
149165

@@ -271,8 +287,7 @@ impl TcpStream {
271287
fn connect_timeout(fd: sock_t,
272288
addrp: *libc::sockaddr,
273289
len: libc::socklen_t,
274-
timeout: u64) -> IoResult<()> {
275-
use std::os;
290+
timeout_ms: u64) -> IoResult<()> {
276291
#[cfg(unix)] use INPROGRESS = libc::EINPROGRESS;
277292
#[cfg(windows)] use INPROGRESS = libc::WSAEINPROGRESS;
278293
#[cfg(unix)] use WOULDBLOCK = libc::EWOULDBLOCK;
@@ -289,12 +304,8 @@ impl TcpStream {
289304
os::errno() as int == WOULDBLOCK as int => {
290305
let mut set: c::fd_set = unsafe { mem::init() };
291306
c::fd_set(&mut set, fd);
292-
match await(fd, &mut set, timeout) {
293-
0 => Err(io::IoError {
294-
kind: io::TimedOut,
295-
desc: "connection timed out",
296-
detail: None,
297-
}),
307+
match await(fd, &mut set, timeout_ms) {
308+
0 => Err(timeout("connection timed out")),
298309
-1 => Err(last_error()),
299310
_ => {
300311
let err: libc::c_int = try!(
@@ -338,22 +349,14 @@ impl TcpStream {
338349
// Recalculate the timeout each iteration (it is generally
339350
// undefined what the value of the 'tv' is after select
340351
// returns EINTR).
341-
let timeout = timeout - (::io::timer::now() - start);
342-
let tv = libc::timeval {
343-
tv_sec: (timeout / 1000) as libc::time_t,
344-
tv_usec: ((timeout % 1000) * 1000) as libc::suseconds_t,
345-
};
346-
c::select(fd + 1, ptr::null(), set as *mut _ as *_,
347-
ptr::null(), &tv)
352+
let tv = ms_to_timeval(timeout - (::io::timer::now() - start));
353+
c::select(fd + 1, ptr::null(), &*set, ptr::null(), &tv)
348354
})
349355
}
350356
#[cfg(windows)]
351357
fn await(_fd: sock_t, set: &mut c::fd_set, timeout: u64) -> libc::c_int {
352-
let tv = libc::timeval {
353-
tv_sec: (timeout / 1000) as libc::time_t,
354-
tv_usec: ((timeout % 1000) * 1000) as libc::suseconds_t,
355-
};
356-
unsafe { c::select(1, ptr::mut_null(), set, ptr::mut_null(), &tv) }
358+
let tv = ms_to_timeval(timeout);
359+
unsafe { c::select(1, ptr::null(), &*set, ptr::null(), &tv) }
357360
}
358361
}
359362

@@ -467,7 +470,7 @@ impl Drop for Inner {
467470
////////////////////////////////////////////////////////////////////////////////
468471

469472
pub struct TcpListener {
470-
inner: UnsafeArc<Inner>,
473+
inner: Inner,
471474
}
472475

473476
impl TcpListener {
@@ -477,7 +480,7 @@ impl TcpListener {
477480
let (addr, len) = addr_to_sockaddr(addr);
478481
let addrp = &addr as *libc::sockaddr_storage;
479482
let inner = Inner { fd: fd };
480-
let ret = TcpListener { inner: UnsafeArc::new(inner) };
483+
let ret = TcpListener { inner: inner };
481484
// On platforms with Berkeley-derived sockets, this allows
482485
// to quickly rebind a socket, without needing to wait for
483486
// the OS to clean up the previous one.
@@ -498,15 +501,12 @@ impl TcpListener {
498501
}
499502
}
500503

501-
pub fn fd(&self) -> sock_t {
502-
// This is just a read-only arc so the unsafety is fine
503-
unsafe { (*self.inner.get()).fd }
504-
}
504+
pub fn fd(&self) -> sock_t { self.inner.fd }
505505

506506
pub fn native_listen(self, backlog: int) -> IoResult<TcpAcceptor> {
507507
match unsafe { libc::listen(self.fd(), backlog as libc::c_int) } {
508508
-1 => Err(last_error()),
509-
_ => Ok(TcpAcceptor { listener: self })
509+
_ => Ok(TcpAcceptor { listener: self, deadline: 0 })
510510
}
511511
}
512512
}
@@ -525,12 +525,16 @@ impl rtio::RtioSocket for TcpListener {
525525

526526
pub struct TcpAcceptor {
527527
listener: TcpListener,
528+
deadline: u64,
528529
}
529530

530531
impl TcpAcceptor {
531532
pub fn fd(&self) -> sock_t { self.listener.fd() }
532533

533534
pub fn native_accept(&mut self) -> IoResult<TcpStream> {
535+
if self.deadline != 0 {
536+
try!(self.accept_deadline());
537+
}
534538
unsafe {
535539
let mut storage: libc::sockaddr_storage = mem::init();
536540
let storagep = &mut storage as *mut libc::sockaddr_storage;
@@ -546,6 +550,25 @@ impl TcpAcceptor {
546550
}
547551
}
548552
}
553+
554+
fn accept_deadline(&mut self) -> IoResult<()> {
555+
let mut set: c::fd_set = unsafe { mem::init() };
556+
c::fd_set(&mut set, self.fd());
557+
558+
match retry(|| {
559+
// If we're past the deadline, then pass a 0 timeout to select() so
560+
// we can poll the status of the socket.
561+
let now = ::io::timer::now();
562+
let ms = if self.deadline > now {0} else {self.deadline - now};
563+
let tv = ms_to_timeval(ms);
564+
let n = if cfg!(windows) {1} else {self.fd() as libc::c_int + 1};
565+
unsafe { c::select(n, &set, ptr::null(), ptr::null(), &tv) }
566+
}) {
567+
-1 => Err(last_error()),
568+
0 => Err(timeout("accept timed out")),
569+
_ => return Ok(()),
570+
}
571+
}
549572
}
550573

551574
impl rtio::RtioSocket for TcpAcceptor {
@@ -561,6 +584,12 @@ impl rtio::RtioTcpAcceptor for TcpAcceptor {
561584

562585
fn accept_simultaneously(&mut self) -> IoResult<()> { Ok(()) }
563586
fn dont_accept_simultaneously(&mut self) -> IoResult<()> { Ok(()) }
587+
fn set_timeout(&mut self, timeout: Option<u64>) {
588+
self.deadline = match timeout {
589+
None => 0,
590+
Some(t) => ::io::timer::now() + t,
591+
};
592+
}
564593
}
565594

566595
////////////////////////////////////////////////////////////////////////////////

branches/try/src/libnative/io/timer_win32.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,17 @@ fn helper(input: libc::HANDLE, messages: Receiver<Req>) {
8989
}
9090
}
9191

92+
// returns the current time (in milliseconds)
93+
pub fn now() -> u64 {
94+
let mut ticks_per_s = 0;
95+
assert_eq!(unsafe { libc::QueryPerformanceFrequency(&mut ticks_per_s) }, 1);
96+
let ticks_per_s = if ticks_per_s == 0 {1} else {ticks_per_s};
97+
let mut ticks = 0;
98+
assert_eq!(unsafe { libc::QueryPerformanceCounter(&mut ticks) }, 1);
99+
100+
return (ticks as u64 * 1000) / (ticks_per_s as u64);
101+
}
102+
92103
impl Timer {
93104
pub fn new() -> IoResult<Timer> {
94105
timer_helper::boot(helper);

branches/try/src/libnum/bigint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ impl ToStrRadix for BigUint {
672672
s.push_str("0".repeat(l - ss.len()));
673673
s.push_str(ss);
674674
}
675-
s.as_slice().trim_left_chars(&'0').to_owned()
675+
s.as_slice().trim_left_chars('0').to_owned()
676676
}
677677
}
678678
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ impl<'a> Archive<'a> {
184184
let unixlibname = format!("lib{}.a", name);
185185

186186
let mut rustpath = filesearch::rust_path();
187-
rustpath.push(self.sess.filesearch().get_target_lib_path());
187+
rustpath.push(self.sess.target_filesearch().get_lib_path());
188188
let search = self.sess.opts.addl_lib_search_paths.borrow();
189189
for path in search.iter().chain(rustpath.iter()) {
190190
debug!("looking for {} inside {}", name, path.display());

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ pub fn llvm_err(sess: &Session, msg: ~str) -> ! {
6060
if cstr == ptr::null() {
6161
sess.fatal(msg);
6262
} else {
63-
let err = CString::new(cstr, false);
63+
let err = CString::new(cstr, true);
6464
let err = str::from_utf8_lossy(err.as_bytes());
6565
sess.fatal(msg + ": " + err.as_slice());
6666
}
@@ -516,7 +516,10 @@ pub mod write {
516516

517517
pub fn find_crate_id(attrs: &[ast::Attribute], out_filestem: &str) -> CrateId {
518518
match attr::find_crateid(attrs) {
519-
None => from_str(out_filestem).unwrap(),
519+
None => from_str(out_filestem).unwrap_or_else(|| {
520+
let mut s = out_filestem.chars().filter(|c| c.is_XID_continue());
521+
from_str(s.collect::<~str>()).or(from_str("rust-out")).unwrap()
522+
}),
520523
Some(s) => s,
521524
}
522525
}
@@ -1088,7 +1091,7 @@ fn link_args(sess: &Session,
10881091
// The default library location, we need this to find the runtime.
10891092
// The location of crates will be determined as needed.
10901093
// FIXME (#9639): This needs to handle non-utf8 paths
1091-
let lib_path = sess.filesearch().get_target_lib_path();
1094+
let lib_path = sess.target_filesearch().get_lib_path();
10921095
let stage: ~str = "-L".to_owned() + lib_path.as_str().unwrap();
10931096

10941097
let mut args = vec!(stage);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub fn get_rpath_flags(sess: &Session, out_filename: &Path) -> Vec<~str> {
4040

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

43-
let sysroot = sess.filesearch().sysroot;
43+
let sysroot = sess.sysroot();
4444
let output = out_filename;
4545
let libs = sess.cstore.get_used_crates(cstore::RequireDynamic);
4646
let libs = libs.move_iter().filter_map(|(_, l)| {

0 commit comments

Comments
 (0)