Skip to content

Commit 928edfa

Browse files
committed
---
yaml --- r: 151095 b: refs/heads/try2 c: 58a5112 h: refs/heads/master i: 151093: 43ddc88 151091: 14afb59 151087: 8d612c7 v: v3
1 parent b97071b commit 928edfa

File tree

17 files changed

+56
-133
lines changed

17 files changed

+56
-133
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: 3157c3e95b3f8d217e4a1e1e7f93939866e74472
8+
refs/heads/try2: 58a51120a7916a7b8c64f6e0841ba536b02ba11c
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/librustc/middle/kind.rs

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use syntax::ast::*;
2020
use syntax::attr;
2121
use syntax::codemap::Span;
2222
use syntax::owned_slice::OwnedSlice;
23-
use syntax::print::pprust::{expr_to_str,path_to_str};
23+
use syntax::print::pprust::expr_to_str;
2424
use syntax::{visit,ast_util};
2525
use syntax::visit::Visitor;
2626

@@ -63,14 +63,9 @@ impl<'a> Visitor<()> for Context<'a> {
6363
fn visit_ty(&mut self, t: &Ty, _: ()) {
6464
check_ty(self, t);
6565
}
66-
6766
fn visit_item(&mut self, i: &Item, _: ()) {
6867
check_item(self, i);
6968
}
70-
71-
fn visit_pat(&mut self, p: &Pat, _: ()) {
72-
check_pat(self, p);
73-
}
7469
}
7570

7671
pub fn check_crate(tcx: &ty::ctxt,
@@ -556,38 +551,3 @@ pub fn check_cast_for_escaping_regions(
556551
}
557552
}
558553
}
559-
560-
// Ensure that `ty` has a statically known size (i.e., it has the `Sized` bound).
561-
fn check_sized(tcx: &ty::ctxt, ty: ty::t, name: ~str, sp: Span) {
562-
if !ty::type_is_sized(tcx, ty) {
563-
tcx.sess.span_err(sp, format!("variable `{}` has dynamically sized type `{}`",
564-
name, ty_to_str(tcx, ty)));
565-
}
566-
}
567-
568-
// Check that any variables in a pattern have types with statically known size.
569-
fn check_pat(cx: &mut Context, pat: &Pat) {
570-
let var_name = match pat.node {
571-
PatWild => Some("_".to_owned()),
572-
PatIdent(_, ref path, _) => Some(path_to_str(path)),
573-
_ => None
574-
};
575-
576-
match var_name {
577-
Some(name) => {
578-
let types = cx.tcx.node_types.borrow();
579-
let ty = types.find(&(pat.id as uint));
580-
match ty {
581-
Some(ty) => {
582-
debug!("kind: checking sized-ness of variable {}: {}",
583-
name, ty_to_str(cx.tcx, *ty));
584-
check_sized(cx.tcx, *ty, name, pat.span);
585-
}
586-
None => {} // extern fn args
587-
}
588-
}
589-
None => {}
590-
}
591-
592-
visit::walk_pat(cx, pat, ());
593-
}

branches/try2/src/librustuv/async.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
// except according to those terms.
1010

1111
use std::cast;
12-
use libc::c_int;
1312
use std::rt::rtio::{Callback, RemoteCallback};
1413
use std::unstable::sync::Exclusive;
1514

@@ -54,8 +53,7 @@ impl UvHandle<uvll::uv_async_t> for AsyncWatcher {
5453
}
5554
}
5655

57-
extern fn async_cb(handle: *uvll::uv_async_t, status: c_int) {
58-
assert!(status == 0);
56+
extern fn async_cb(handle: *uvll::uv_async_t) {
5957
let payload: &mut Payload = unsafe {
6058
cast::transmute(uvll::get_data_for_uv_handle(handle))
6159
};

branches/try2/src/librustuv/file.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use std::c_str::CString;
1212
use std::c_str;
1313
use std::cast::transmute;
1414
use std::cast;
15-
use libc::{c_int, c_char, c_void, size_t, ssize_t};
15+
use libc::{c_int, c_char, c_void, ssize_t};
1616
use libc;
1717
use std::rt::task::BlockedTask;
1818
use std::io::{FileStat, IoError};
@@ -86,14 +86,12 @@ impl FsRequest {
8686
} else {
8787
offset + written as i64
8888
};
89+
let uvbuf = uvll::uv_buf_t {
90+
base: buf.slice_from(written as uint).as_ptr(),
91+
len: (buf.len() - written) as uvll::uv_buf_len_t,
92+
};
8993
match execute(|req, cb| unsafe {
90-
uvll::uv_fs_write(loop_.handle,
91-
req,
92-
fd,
93-
buf.as_ptr().offset(written as int) as *c_void,
94-
(buf.len() - written) as size_t,
95-
offset,
96-
cb)
94+
uvll::uv_fs_write(loop_.handle, req, fd, &uvbuf, 1, offset, cb)
9795
}).map(|req| req.get_result()) {
9896
Err(e) => return Err(e),
9997
Ok(n) => { written += n as uint; }
@@ -106,9 +104,11 @@ impl FsRequest {
106104
-> Result<int, UvError>
107105
{
108106
execute(|req, cb| unsafe {
109-
uvll::uv_fs_read(loop_.handle, req,
110-
fd, buf.as_ptr() as *c_void,
111-
buf.len() as size_t, offset, cb)
107+
let uvbuf = uvll::uv_buf_t {
108+
base: buf.as_ptr(),
109+
len: buf.len() as uvll::uv_buf_len_t,
110+
};
111+
uvll::uv_fs_read(loop_.handle, req, fd, &uvbuf, 1, offset, cb)
112112
}).map(|req| {
113113
req.get_result() as int
114114
})

branches/try2/src/librustuv/idle.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
// except according to those terms.
1010

1111
use std::cast;
12-
use libc::{c_int, c_void};
12+
use libc::c_void;
1313

1414
use uvll;
1515
use super::{Loop, UvHandle};
@@ -46,8 +46,7 @@ impl IdleWatcher {
4646
assert_eq!(uvll::uv_idle_start(handle, onetime_cb), 0)
4747
}
4848

49-
extern fn onetime_cb(handle: *uvll::uv_idle_t, status: c_int) {
50-
assert_eq!(status, 0);
49+
extern fn onetime_cb(handle: *uvll::uv_idle_t) {
5150
unsafe {
5251
let data = uvll::get_data_for_uv_handle(handle);
5352
let f: ~proc() = cast::transmute(data);
@@ -82,8 +81,7 @@ impl UvHandle<uvll::uv_idle_t> for IdleWatcher {
8281
fn uv_handle(&self) -> *uvll::uv_idle_t { self.handle }
8382
}
8483

85-
extern fn idle_cb(handle: *uvll::uv_idle_t, status: c_int) {
86-
assert_eq!(status, 0);
84+
extern fn idle_cb(handle: *uvll::uv_idle_t) {
8785
let idle: &mut IdleWatcher = unsafe { UvHandle::from_uv_handle(&handle) };
8886
idle.callback.call();
8987
}

branches/try2/src/librustuv/net.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,10 +255,9 @@ impl TcpWatcher {
255255
n => Err(UvError(n))
256256
};
257257

258-
extern fn timer_cb(handle: *uvll::uv_timer_t, status: c_int) {
258+
extern fn timer_cb(handle: *uvll::uv_timer_t) {
259259
// Don't close the corresponding tcp request, just wake up the task
260260
// and let RAII take care of the pending watcher.
261-
assert_eq!(status, 0);
262261
let cx: &mut Ctx = unsafe {
263262
&mut *(uvll::get_data_for_uv_handle(handle) as *mut Ctx)
264263
};
@@ -599,8 +598,7 @@ impl rtio::RtioTcpAcceptor for TcpAcceptor {
599598
self.timeout_tx = Some(tx);
600599
self.timeout_rx = Some(rx);
601600

602-
extern fn timer_cb(timer: *uvll::uv_timer_t, status: c_int) {
603-
assert_eq!(status, 0);
601+
extern fn timer_cb(timer: *uvll::uv_timer_t) {
604602
let acceptor: &mut TcpAcceptor = unsafe {
605603
&mut *(uvll::get_data_for_uv_handle(timer) as *mut TcpAcceptor)
606604
};

branches/try2/src/librustuv/queue.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#![allow(dead_code)]
2222

2323
use std::cast;
24-
use libc::{c_void, c_int};
24+
use libc::c_void;
2525
use std::rt::task::BlockedTask;
2626
use std::unstable::mutex::NativeMutex;
2727
use std::sync::arc::UnsafeArc;
@@ -55,8 +55,7 @@ pub struct Queue {
5555
queue: UnsafeArc<State>,
5656
}
5757

58-
extern fn async_cb(handle: *uvll::uv_async_t, status: c_int) {
59-
assert_eq!(status, 0);
58+
extern fn async_cb(handle: *uvll::uv_async_t) {
6059
let pool: &mut QueuePool = unsafe {
6160
cast::transmute(uvll::get_data_for_uv_handle(handle))
6261
};

branches/try2/src/librustuv/timer.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use libc::c_int;
1211
use std::mem;
1312
use std::rt::rtio::RtioTimer;
1413
use std::rt::task::BlockedTask;
@@ -137,9 +136,8 @@ impl RtioTimer for TimerWatcher {
137136
}
138137
}
139138

140-
extern fn timer_cb(handle: *uvll::uv_timer_t, status: c_int) {
139+
extern fn timer_cb(handle: *uvll::uv_timer_t) {
141140
let _f = ForbidSwitch::new("timer callback can't switch");
142-
assert_eq!(status, 0);
143141
let timer: &mut TimerWatcher = unsafe { UvHandle::from_uv_handle(&handle) };
144142

145143
match timer.action.take_unwrap() {

branches/try2/src/librustuv/tty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl TtyWatcher {
4040
// - https://github.com/joyent/libuv/issues/982
4141
// - https://github.com/joyent/libuv/issues/988
4242
let guess = unsafe { uvll::guess_handle(fd) };
43-
if readable && guess != uvll::UV_TTY as libc::c_int {
43+
if guess != uvll::UV_TTY as libc::c_int {
4444
return Err(UvError(uvll::EBADF));
4545
}
4646

branches/try2/src/librustuv/uvio.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use libc::{O_CREAT, O_APPEND, O_TRUNC, O_RDWR, O_RDONLY, O_WRONLY, S_IRUSR,
2323
use libc;
2424
use std::path::Path;
2525
use std::rt::rtio;
26-
use std::rt::rtio::IoFactory;
26+
use std::rt::rtio::{IoFactory, EventLoop};
2727
use ai = std::io::net::addrinfo;
2828

2929
#[cfg(test)] use std::unstable::run_in_bare_thread;
@@ -69,14 +69,20 @@ impl Drop for UvEventLoop {
6969
// the loop is free'd (use-after-free). We also must free the uv handle
7070
// after the loop has been closed because during the closing of the loop
7171
// the handle is required to be used apparently.
72+
//
73+
// Lastly, after we've closed the pool of handles we pump the event loop
74+
// one last time to run any closing callbacks to make sure the loop
75+
// shuts down cleanly.
7276
let handle = self.uvio.handle_pool.get_ref().handle();
7377
drop(self.uvio.handle_pool.take());
78+
self.run();
79+
7480
self.uvio.loop_.close();
7581
unsafe { uvll::free_handle(handle) }
7682
}
7783
}
7884

79-
impl rtio::EventLoop for UvEventLoop {
85+
impl EventLoop for UvEventLoop {
8086
fn run(&mut self) {
8187
self.uvio.loop_.run();
8288
}
@@ -110,7 +116,6 @@ impl rtio::EventLoop for UvEventLoop {
110116

111117
#[test]
112118
fn test_callback_run_once() {
113-
use std::rt::rtio::EventLoop;
114119
run_in_bare_thread(proc() {
115120
let mut event_loop = UvEventLoop::new();
116121
let mut count = 0;

branches/try2/src/librustuv/uvll.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,7 @@ impl uv_stat_t {
212212
}
213213
}
214214

215-
pub type uv_idle_cb = extern "C" fn(handle: *uv_idle_t,
216-
status: c_int);
215+
pub type uv_idle_cb = extern "C" fn(handle: *uv_idle_t);
217216
pub type uv_alloc_cb = extern "C" fn(stream: *uv_stream_t,
218217
suggested_size: size_t,
219218
buf: *mut uv_buf_t);
@@ -230,14 +229,12 @@ pub type uv_udp_recv_cb = extern "C" fn(handle: *uv_udp_t,
230229
pub type uv_close_cb = extern "C" fn(handle: *uv_handle_t);
231230
pub type uv_walk_cb = extern "C" fn(handle: *uv_handle_t,
232231
arg: *c_void);
233-
pub type uv_async_cb = extern "C" fn(handle: *uv_async_t,
234-
status: c_int);
232+
pub type uv_async_cb = extern "C" fn(handle: *uv_async_t);
235233
pub type uv_connect_cb = extern "C" fn(handle: *uv_connect_t,
236234
status: c_int);
237235
pub type uv_connection_cb = extern "C" fn(handle: *uv_connection_t,
238236
status: c_int);
239-
pub type uv_timer_cb = extern "C" fn(handle: *uv_timer_t,
240-
status: c_int);
237+
pub type uv_timer_cb = extern "C" fn(handle: *uv_timer_t);
241238
pub type uv_write_cb = extern "C" fn(handle: *uv_write_t,
242239
status: c_int);
243240
pub type uv_getaddrinfo_cb = extern "C" fn(req: *uv_getaddrinfo_t,
@@ -597,10 +594,12 @@ extern {
597594
flags: c_int, mode: c_int, cb: uv_fs_cb) -> c_int;
598595
pub fn uv_fs_unlink(loop_ptr: *uv_loop_t, req: *uv_fs_t, path: *c_char,
599596
cb: uv_fs_cb) -> c_int;
600-
pub fn uv_fs_write(l: *uv_loop_t, req: *uv_fs_t, fd: c_int, buf: *c_void,
601-
len: size_t, offset: i64, cb: uv_fs_cb) -> c_int;
602-
pub fn uv_fs_read(l: *uv_loop_t, req: *uv_fs_t, fd: c_int, buf: *c_void,
603-
len: size_t, offset: i64, cb: uv_fs_cb) -> c_int;
597+
pub fn uv_fs_write(l: *uv_loop_t, req: *uv_fs_t, fd: c_int,
598+
bufs: *uv_buf_t, nbufs: c_uint,
599+
offset: i64, cb: uv_fs_cb) -> c_int;
600+
pub fn uv_fs_read(l: *uv_loop_t, req: *uv_fs_t, fd: c_int,
601+
bufs: *uv_buf_t, nbufs: c_uint,
602+
offset: i64, cb: uv_fs_cb) -> c_int;
604603
pub fn uv_fs_close(l: *uv_loop_t, req: *uv_fs_t, fd: c_int,
605604
cb: uv_fs_cb) -> c_int;
606605
pub fn uv_fs_stat(l: *uv_loop_t, req: *uv_fs_t, path: *c_char,

branches/try2/src/libstd/hash/sip.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ mod tests {
364364
use option::{Some, None};
365365
use str::{Str,StrSlice};
366366
use strbuf::StrBuf;
367-
use slice::{Vector, ImmutableVector, OwnedVector};
367+
use slice::{Vector, ImmutableVector};
368368
use self::test::Bencher;
369369

370370
use super::super::Hash;

branches/try2/src/libstd/rt/args.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ mod imp {
6767
use clone::Clone;
6868
use option::{Option, Some, None};
6969
use iter::Iterator;
70-
use str::StrSlice;
7170
use unstable::mutex::{StaticNativeMutex, NATIVE_MUTEX_INIT};
7271
use mem;
72+
#[cfg(not(test))] use str::StrSlice;
7373
#[cfg(not(test))] use ptr::RawPtr;
7474

7575
static mut global_args_ptr: uint = 0;

branches/try2/src/libuv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit 800b56fe6af21ffd8e56aee8cf12dd758f5bbdf1
1+
Subproject commit 43495892ded622de51eba7362c5ffae1ed50c9cc
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Change the contents of this file to force a full rebuild of libuv
2-
2014-02-16
2+
2014-04-18

branches/try2/src/test/compile-fail/unsized5.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,18 @@
99
// except according to those terms.
1010
#![feature(struct_variant)]
1111

12-
// Test `type` types not allowed in fields.
12+
// Test `type` types not allowed in fields or local variables.
13+
14+
/*trait T for type {}
15+
16+
fn f5<type X>(x: &X) {
17+
let _: X; // ERROR local variable with dynamically sized type X
18+
let _: (int, (X, int)); // ERROR local variable with dynamically sized type (int,(X,int))
19+
}
20+
fn f6<type X: T>(x: &X) {
21+
let _: X; // ERROR local variable with dynamically sized type X
22+
let _: (int, (X, int)); // ERROR local variable with dynamically sized type (int,(X,int))
23+
}*/
1324

1425
struct S1<type X> {
1526
f1: X, //~ ERROR type `f1` is dynamically sized. dynamically sized types may only appear as the

0 commit comments

Comments
 (0)