diff options
| author | Felix S. Klock II <pnkfelix@pnkfx.org> | 2015-02-17 21:41:32 +0100 |
|---|---|---|
| committer | Felix S. Klock II <pnkfelix@pnkfx.org> | 2015-03-03 20:29:01 +0100 |
| commit | 270f0eef733a625bcee68019189f19dc119f8f24 (patch) | |
| tree | 1b58f6d17a7ca5cb04f6124eaa93e0234ff3c906 /src/libstd/sync | |
| parent | 14f0942a49b77f81d0bedb3d8b5fb615ef521bb3 (diff) | |
| download | rust-270f0eef733a625bcee68019189f19dc119f8f24.tar.gz rust-270f0eef733a625bcee68019189f19dc119f8f24.zip | |
Add `: Box<_>` or `::Box<_>` type annotations to various places.
This is the kind of change that one is expected to need to make to accommodate overloaded-`box`. ---- Note that this is not *all* of the changes necessary to accommodate Issue 22181. It is merely the subset of those cases where there was already a let-binding in place that made it easy to add the necesasry type ascription. (For unnamed intermediate `Box` values, one must go down a different route; `Box::new` is the option that maximizes portability, but has potential inefficiency depending on whether the call is inlined.) ---- There is one place worth note, `run-pass/coerce-match.rs`, where I used an ugly form of `Box<_>` type ascription where I would have preferred to use `Box::new` to accommodate overloaded-`box`. I deliberately did not use `Box::new` here, because that is already done in coerce-match-calls.rs. ---- Precursor for overloaded-`box` and placement-`in`; see Issue 22181.
Diffstat (limited to 'src/libstd/sync')
| -rw-r--r-- | src/libstd/sync/mpsc/mod.rs | 8 | ||||
| -rw-r--r-- | src/libstd/sync/mpsc/mpsc_queue.rs | 2 | ||||
| -rw-r--r-- | src/libstd/sync/mpsc/spsc_queue.rs | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/src/libstd/sync/mpsc/mod.rs b/src/libstd/sync/mpsc/mod.rs index ee8bef50d89..1a1e9e69e71 100644 --- a/src/libstd/sync/mpsc/mod.rs +++ b/src/libstd/sync/mpsc/mod.rs @@ -1044,13 +1044,13 @@ mod test { #[test] fn drop_full() { - let (tx, _rx) = channel(); + let (tx, _rx) = channel::<Box<int>>(); tx.send(box 1).unwrap(); } #[test] fn drop_full_shared() { - let (tx, _rx) = channel(); + let (tx, _rx) = channel::<Box<int>>(); drop(tx.clone()); drop(tx.clone()); tx.send(box 1).unwrap(); @@ -1389,7 +1389,7 @@ mod test { #[test] fn oneshot_multi_thread_send_recv_stress() { for _ in 0..stress_factor() { - let (tx, rx) = channel(); + let (tx, rx) = channel::<Box<int>>(); let _t = thread::spawn(move|| { tx.send(box 10).unwrap(); }); @@ -1566,7 +1566,7 @@ mod sync_tests { #[test] fn drop_full() { - let (tx, _rx) = sync_channel(1); + let (tx, _rx) = sync_channel::<Box<int>>(1); tx.send(box 1).unwrap(); } diff --git a/src/libstd/sync/mpsc/mpsc_queue.rs b/src/libstd/sync/mpsc/mpsc_queue.rs index 59fa2e6bc9a..14ed253d8e2 100644 --- a/src/libstd/sync/mpsc/mpsc_queue.rs +++ b/src/libstd/sync/mpsc/mpsc_queue.rs @@ -164,7 +164,7 @@ mod tests { #[test] fn test_full() { - let q = Queue::new(); + let q: Queue<Box<_>> = Queue::new(); q.push(box 1); q.push(box 2); } diff --git a/src/libstd/sync/mpsc/spsc_queue.rs b/src/libstd/sync/mpsc/spsc_queue.rs index ce40fa2672a..3fb13739aa7 100644 --- a/src/libstd/sync/mpsc/spsc_queue.rs +++ b/src/libstd/sync/mpsc/spsc_queue.rs @@ -289,7 +289,7 @@ mod test { #[test] fn drop_full() { unsafe { - let q = Queue::new(0); + let q: Queue<Box<_>> = Queue::new(0); q.push(box 1); q.push(box 2); } |
