Skip to content

Commit 44fe9b7

Browse files
committed
---
yaml --- r: 63246 b: refs/heads/snap-stage3 c: e7213aa h: refs/heads/master v: v3
1 parent 0d1a304 commit 44fe9b7

File tree

15 files changed

+67
-1462
lines changed

15 files changed

+67
-1462
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 84280819585fb65bf18903aef9364579f3552522
4+
refs/heads/snap-stage3: e7213aa21e9a79db01d2e9d1b76761a420e4c967
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libstd/macros.rs

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,29 +38,16 @@ macro_rules! rtassert (
3838
} )
3939
)
4040

41-
42-
// The do_abort function was originally inside the abort macro, but
43-
// this was ICEing the compiler so it has been moved outside. Now this
44-
// seems to work?
45-
pub fn do_abort() -> ! {
46-
unsafe { ::libc::abort(); }
47-
}
48-
4941
macro_rules! abort(
5042
($( $msg:expr),+) => ( {
5143
rtdebug!($($msg),+);
5244

53-
// do_abort();
54-
55-
// NB: This is in a fn to avoid putting the `unsafe` block in
56-
// a macro, which causes spurious 'unnecessary unsafe block'
57-
// warnings.
58-
// fn do_abort() -> ! {
59-
// unsafe { ::libc::abort(); }
60-
// }
61-
62-
::macros::do_abort();
45+
do_abort();
6346

47+
// NB: This is in a fn to avoid putting the `unsafe` block in a macro,
48+
// which causes spurious 'unnecessary unsafe block' warnings.
49+
fn do_abort() -> ! {
50+
unsafe { ::libc::abort(); }
51+
}
6452
} )
6553
)
66-

branches/snap-stage3/src/libstd/rt/comm.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,13 @@ impl<T> ChanOne<T> {
120120
match oldstate {
121121
STATE_BOTH => {
122122
// Port is not waiting yet. Nothing to do
123-
do Local::borrow::<Scheduler, ()> |sched| {
123+
do Local::borrow::<Scheduler> |sched| {
124124
rtdebug!("non-rendezvous send");
125125
sched.metrics.non_rendezvous_sends += 1;
126126
}
127127
}
128128
STATE_ONE => {
129-
do Local::borrow::<Scheduler, ()> |sched| {
129+
do Local::borrow::<Scheduler> |sched| {
130130
rtdebug!("rendezvous send");
131131
sched.metrics.rendezvous_sends += 1;
132132
}

branches/snap-stage3/src/libstd/rt/io/extensions.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -749,8 +749,6 @@ mod test {
749749
#[should_fail]
750750
#[ignore(cfg(windows))]
751751
fn push_bytes_fail_reset_len() {
752-
use unstable::finally::Finally;
753-
754752
// push_bytes unsafely sets the vector length. This is testing that
755753
// upon failure the length is reset correctly.
756754
let mut reader = MockReader::new();
@@ -772,7 +770,8 @@ mod test {
772770
reader.push_bytes(&mut *buf, 4);
773771
}).finally {
774772
// NB: Using rtassert here to trigger abort on failure since this is a should_fail test
775-
rtassert!(*buf == ~[8, 9, 10]);
773+
// FIXME: #7049 This fails because buf is still borrowed
774+
//rtassert!(*buf == ~[8, 9, 10]);
776775
}
777776
}
778777

branches/snap-stage3/src/libstd/rt/local.rs

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub trait Local {
1818
fn put(value: ~Self);
1919
fn take() -> ~Self;
2020
fn exists() -> bool;
21-
fn borrow<T>(f: &fn(&mut Self) -> T) -> T;
21+
fn borrow(f: &fn(&mut Self));
2222
unsafe fn unsafe_borrow() -> *mut Self;
2323
unsafe fn try_unsafe_borrow() -> Option<*mut Self>;
2424
}
@@ -27,20 +27,7 @@ impl Local for Scheduler {
2727
fn put(value: ~Scheduler) { unsafe { local_ptr::put(value) }}
2828
fn take() -> ~Scheduler { unsafe { local_ptr::take() } }
2929
fn exists() -> bool { local_ptr::exists() }
30-
fn borrow<T>(f: &fn(&mut Scheduler) -> T) -> T {
31-
let mut res: Option<T> = None;
32-
let res_ptr: *mut Option<T> = &mut res;
33-
unsafe {
34-
do local_ptr::borrow |sched| {
35-
let result = f(sched);
36-
*res_ptr = Some(result);
37-
}
38-
}
39-
match res {
40-
Some(r) => { r }
41-
None => abort!("function failed!")
42-
}
43-
}
30+
fn borrow(f: &fn(&mut Scheduler)) { unsafe { local_ptr::borrow(f) } }
4431
unsafe fn unsafe_borrow() -> *mut Scheduler { local_ptr::unsafe_borrow() }
4532
unsafe fn try_unsafe_borrow() -> Option<*mut Scheduler> { abort!("unimpl") }
4633
}
@@ -49,8 +36,8 @@ impl Local for Task {
4936
fn put(_value: ~Task) { abort!("unimpl") }
5037
fn take() -> ~Task { abort!("unimpl") }
5138
fn exists() -> bool { abort!("unimpl") }
52-
fn borrow<T>(f: &fn(&mut Task) -> T) -> T {
53-
do Local::borrow::<Scheduler, T> |sched| {
39+
fn borrow(f: &fn(&mut Task)) {
40+
do Local::borrow::<Scheduler> |sched| {
5441
match sched.current_task {
5542
Some(~ref mut task) => {
5643
f(&mut *task.task)
@@ -87,7 +74,7 @@ impl Local for IoFactoryObject {
8774
fn put(_value: ~IoFactoryObject) { abort!("unimpl") }
8875
fn take() -> ~IoFactoryObject { abort!("unimpl") }
8976
fn exists() -> bool { abort!("unimpl") }
90-
fn borrow<T>(_f: &fn(&mut IoFactoryObject) -> T) -> T { abort!("unimpl") }
77+
fn borrow(_f: &fn(&mut IoFactoryObject)) { abort!("unimpl") }
9178
unsafe fn unsafe_borrow() -> *mut IoFactoryObject {
9279
let sched = Local::unsafe_borrow::<Scheduler>();
9380
let io: *mut IoFactoryObject = (*sched).event_loop.io().unwrap();
@@ -128,16 +115,4 @@ mod test {
128115
}
129116
let _scheduler: ~Scheduler = Local::take();
130117
}
131-
132-
#[test]
133-
fn borrow_with_return() {
134-
let scheduler = ~new_test_uv_sched();
135-
Local::put(scheduler);
136-
let res = do Local::borrow::<Scheduler,bool> |_sched| {
137-
true
138-
};
139-
assert!(res)
140-
let _scheduler: ~Scheduler = Local::take();
141-
}
142-
143118
}

branches/snap-stage3/src/libstd/rt/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ pub fn context() -> RuntimeContext {
208208
} else {
209209
if Local::exists::<Scheduler>() {
210210
let context = ::cell::empty_cell();
211-
do Local::borrow::<Scheduler, ()> |sched| {
211+
do Local::borrow::<Scheduler> |sched| {
212212
if sched.in_task_context() {
213213
context.put_back(TaskContext);
214214
} else {

0 commit comments

Comments
 (0)