From 270f0eef733a625bcee68019189f19dc119f8f24 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Tue, 17 Feb 2015 21:41:32 +0100 Subject: [PATCH] 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. --- src/liballoc/arc.rs | 4 ++- src/liballoc/heap.rs | 3 +- src/liballoc/lib.rs | 6 ++++ src/liballoc/rc.rs | 3 +- src/libarena/lib.rs | 8 ++--- src/libcollections/binary_heap.rs | 2 +- src/libcollections/linked_list.rs | 2 +- src/libcollections/slice.rs | 26 ++++++++------- src/libcollections/vec.rs | 4 +-- src/libcollections/vec_map.rs | 2 +- src/libcoretest/any.rs | 2 +- src/libcoretest/option.rs | 2 +- src/librustc_back/sha2.rs | 2 +- src/libstd/old_io/net/ip.rs | 12 +++---- src/libstd/sync/mpsc/mod.rs | 8 ++--- src/libstd/sync/mpsc/mpsc_queue.rs | 2 +- src/libstd/sync/mpsc/spsc_queue.rs | 2 +- src/libstd/thread.rs | 2 +- src/test/bench/shootout-k-nucleotide.rs | 4 +-- src/test/bench/sudoku.rs | 2 +- src/test/compile-fail/borrow-tuple-fields.rs | 2 +- .../borrowck-bad-nested-calls-free.rs | 4 +-- .../borrowck-bad-nested-calls-move.rs | 4 +-- ...rrowck-borrow-immut-deref-of-box-as-mut.rs | 2 +- .../borrowck-box-insensitivity.rs | 32 +++++++++---------- .../borrowck-closures-mut-and-imm.rs | 6 ++-- .../compile-fail/borrowck-closures-two-mut.rs | 2 +- .../borrowck-closures-use-after-free.rs | 2 +- ...rrowck-for-loop-correct-cmt-for-pattern.rs | 2 +- src/test/compile-fail/borrowck-issue-14498.rs | 4 +-- .../compile-fail/borrowck-issue-2657-1.rs | 2 +- .../compile-fail/borrowck-issue-2657-2.rs | 2 +- .../compile-fail/borrowck-lend-flow-if.rs | 4 +-- .../compile-fail/borrowck-lend-flow-loop.rs | 24 +++++++------- src/test/compile-fail/borrowck-lend-flow.rs | 4 +-- .../borrowck-loan-blocks-move-cc.rs | 4 +-- .../borrowck-loan-blocks-mut-uniq.rs | 2 +- .../compile-fail/borrowck-move-by-capture.rs | 2 +- ...owck-move-from-subpath-of-borrowed-path.rs | 2 +- .../borrowck-move-moved-value-into-closure.rs | 2 +- .../borrowck-multiple-captures.rs | 12 +++---- .../borrowck-no-cycle-in-exchange-heap.rs | 2 +- .../borrowck-overloaded-index-2.rs | 2 +- .../compile-fail/borrowck-uniq-via-lend.rs | 14 ++++---- src/test/compile-fail/issue-10398.rs | 2 +- src/test/compile-fail/issue-11192.rs | 2 +- src/test/compile-fail/issue-11925.rs | 2 +- src/test/compile-fail/issue-12127.rs | 2 +- src/test/compile-fail/issue-17263.rs | 4 +-- src/test/compile-fail/issue-17913.rs | 4 +-- .../compile-fail/kindck-impl-type-params-2.rs | 2 +- .../kindck-inherited-copy-bound.rs | 4 +-- .../compile-fail/liveness-use-after-move.rs | 2 +- src/test/compile-fail/move-in-guard-1.rs | 2 +- src/test/compile-fail/move-in-guard-2.rs | 2 +- .../compile-fail/move-out-of-tuple-field.rs | 2 +- src/test/compile-fail/mut-cross-borrowing.rs | 2 +- src/test/compile-fail/static-region-bound.rs | 2 +- ...use-after-move-implicity-coerced-object.rs | 4 +-- src/test/debuginfo/borrowed-struct.rs | 2 +- src/test/debuginfo/boxed-struct.rs | 4 +-- .../generic-method-on-generic-struct.rs | 2 +- src/test/debuginfo/method-on-enum.rs | 2 +- .../debuginfo/method-on-generic-struct.rs | 2 +- src/test/debuginfo/method-on-struct.rs | 2 +- src/test/debuginfo/method-on-trait.rs | 2 +- src/test/debuginfo/method-on-tuple-struct.rs | 2 +- src/test/debuginfo/self-in-default-method.rs | 2 +- .../self-in-generic-default-method.rs | 2 +- src/test/debuginfo/unique-enum.rs | 6 ++-- .../var-captured-in-nested-closure.rs | 2 +- .../var-captured-in-sendable-closure.rs | 2 +- .../var-captured-in-stack-closure.rs | 2 +- .../run-pass/autoderef-method-on-trait.rs | 2 +- .../run-pass/autoderef-method-priority.rs | 2 +- .../autoderef-method-twice-but-not-thrice.rs | 2 +- src/test/run-pass/autoderef-method-twice.rs | 2 +- src/test/run-pass/autoderef-method.rs | 2 +- .../autoref-intermediate-types-issue-3585.rs | 2 +- src/test/run-pass/bitv-perf-test.rs | 4 +-- .../run-pass/borrowck-move-by-capture-ok.rs | 2 +- src/test/run-pass/borrowck-mut-uniq.rs | 2 +- src/test/run-pass/cci_borrow.rs | 2 +- ...nup-rvalue-temp-during-incomplete-alloc.rs | 2 +- src/test/run-pass/clone-with-exterior.rs | 2 +- src/test/run-pass/coerce-match.rs | 8 +++-- .../crate-method-reexport-grrrrrrr.rs | 2 +- src/test/run-pass/deref-lval.rs | 2 +- src/test/run-pass/explicit-self-generic.rs | 2 +- src/test/run-pass/explicit-self.rs | 2 +- src/test/run-pass/expr-block-unique.rs | 2 +- src/test/run-pass/expr-if-unique.rs | 2 +- src/test/run-pass/expr-match-unique.rs | 2 +- .../run-pass/func-arg-incomplete-pattern.rs | 2 +- src/test/run-pass/func-arg-ref-pattern.rs | 2 +- src/test/run-pass/generic-alias-unique.rs | 2 +- src/test/run-pass/ifmt.rs | 2 +- src/test/run-pass/init-res-into-things.rs | 4 +-- src/test/run-pass/intrinsic-atomics.rs | 2 +- src/test/run-pass/intrinsic-move-val.rs | 2 +- src/test/run-pass/issue-10802.rs | 4 +-- src/test/run-pass/issue-14399.rs | 2 +- src/test/run-pass/issue-2633-2.rs | 2 +- src/test/run-pass/issue-2708.rs | 2 +- src/test/run-pass/issue-2935.rs | 2 +- src/test/run-pass/issue-3012-2.rs | 2 +- src/test/run-pass/issue-3026.rs | 2 +- src/test/run-pass/issue-3290.rs | 2 +- src/test/run-pass/issue-3878.rs | 2 +- src/test/run-pass/issue-5718.rs | 2 +- src/test/run-pass/last-use-is-capture.rs | 2 +- src/test/run-pass/let-assignability.rs | 2 +- .../run-pass/match-implicit-copy-unique.rs | 2 +- .../method-two-trait-defer-resolution-2.rs | 2 +- src/test/run-pass/move-1-unique.rs | 2 +- src/test/run-pass/move-2-unique.rs | 2 +- src/test/run-pass/move-2.rs | 2 +- src/test/run-pass/move-3-unique.rs | 2 +- src/test/run-pass/move-guard-const.rs | 2 +- .../run-pass/overloaded-index-autoderef.rs | 2 +- src/test/run-pass/pure-sum.rs | 4 +-- src/test/run-pass/rcvr-borrowed-to-region.rs | 2 +- src/test/run-pass/regions-borrow-at.rs | 2 +- src/test/run-pass/regions-borrow-uniq.rs | 2 +- .../run-pass/regions-escape-into-other-fn.rs | 2 +- ...gions-infer-borrow-scope-within-loop-ok.rs | 2 +- .../run-pass/regions-infer-borrow-scope.rs | 2 +- .../self-in-mut-slot-default-method.rs | 2 +- src/test/run-pass/self-re-assign.rs | 2 +- src/test/run-pass/sendfn-spawn-with-fn-arg.rs | 2 +- src/test/run-pass/task-spawn-move-and-copy.rs | 2 +- src/test/run-pass/type-param-constraints.rs | 8 ++--- src/test/run-pass/ufcs-explicit-self.rs | 4 +-- src/test/run-pass/uniq-self-in-mut-slot.rs | 2 +- src/test/run-pass/unique-assign-copy.rs | 2 +- src/test/run-pass/unique-assign-drop.rs | 4 +-- src/test/run-pass/unique-assign-generic.rs | 2 +- src/test/run-pass/unique-assign.rs | 2 +- src/test/run-pass/unique-autoderef-field.rs | 2 +- src/test/run-pass/unique-autoderef-index.rs | 2 +- src/test/run-pass/unique-cmp.rs | 2 +- src/test/run-pass/unique-containing-tag.rs | 2 +- src/test/run-pass/unique-create.rs | 2 +- src/test/run-pass/unique-decl-init-copy.rs | 2 +- src/test/run-pass/unique-decl-init.rs | 2 +- src/test/run-pass/unique-decl-move.rs | 2 +- src/test/run-pass/unique-deref.rs | 2 +- src/test/run-pass/unique-drop-complex.rs | 2 +- src/test/run-pass/unique-in-vec-copy.rs | 2 +- src/test/run-pass/unique-in-vec.rs | 2 +- src/test/run-pass/unique-init.rs | 2 +- src/test/run-pass/unique-kinds.rs | 24 +++++++------- src/test/run-pass/unique-log.rs | 2 +- src/test/run-pass/unique-move-drop.rs | 4 +-- src/test/run-pass/unique-move-temp.rs | 2 +- src/test/run-pass/unique-move.rs | 2 +- src/test/run-pass/unique-mutable.rs | 2 +- src/test/run-pass/unique-rec.rs | 2 +- src/test/run-pass/unique-send.rs | 2 +- src/test/run-pass/unique-swap.rs | 4 +-- src/test/run-pass/unsized3.rs | 7 ++-- src/test/run-pass/unused-move-capture.rs | 2 +- src/test/run-pass/unused-move.rs | 2 +- src/test/run-pass/unwind-unique.rs | 2 +- 164 files changed, 281 insertions(+), 264 deletions(-) diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index c95b413b397..dc1938cac1a 100644 --- a/src/liballoc/arc.rs +++ b/src/liballoc/arc.rs @@ -69,6 +69,8 @@ //! } //! ``` +use boxed::Box; + use core::prelude::*; use core::atomic; @@ -170,7 +172,7 @@ impl Arc { pub fn new(data: T) -> Arc { // Start the weak pointer count as 1 which is the weak pointer that's // held by all the strong pointers (kinda), see std/rc.rs for more info - let x = box ArcInner { + let x: Box<_> = box ArcInner { strong: atomic::AtomicUsize::new(1), weak: atomic::AtomicUsize::new(1), data: data, diff --git a/src/liballoc/heap.rs b/src/liballoc/heap.rs index 726d5c8a23b..3b93171386a 100644 --- a/src/liballoc/heap.rs +++ b/src/liballoc/heap.rs @@ -387,6 +387,7 @@ mod test { extern crate test; use self::test::Bencher; use core::ptr::PtrExt; + use boxed::Box; use heap; #[test] @@ -404,7 +405,7 @@ mod test { #[bench] fn alloc_owned_small(b: &mut Bencher) { b.iter(|| { - box 10 + let _: Box<_> = box 10; }) } } diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index 82bd13475c7..b1fdf139b0c 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -96,9 +96,15 @@ pub mod heap; // Primitive types using the heaps above +// Need to conditionally define the mod from `boxed.rs` to avoid +// duplicating the lang-items when building in test cfg; but also need +// to allow code to have `use boxed::HEAP;` +// and `use boxed::Box;` declarations. #[cfg(not(test))] pub mod boxed; #[cfg(test)] +mod boxed { pub use std::boxed::{Box, HEAP}; } +#[cfg(test)] mod boxed_test; pub mod arc; pub mod rc; diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index f57286bbf11..763dcc7f256 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -795,6 +795,7 @@ impl RcBoxPtr for Weak { #[cfg(test)] mod tests { use super::{Rc, Weak, weak_count, strong_count}; + use std::boxed::Box; use std::cell::RefCell; use std::option::Option; use std::option::Option::{Some, None}; @@ -826,7 +827,7 @@ mod tests { #[test] fn test_destructor() { - let x = Rc::new(box 5); + let x: Rc> = Rc::new(box 5); assert_eq!(**x, 5); } diff --git a/src/libarena/lib.rs b/src/libarena/lib.rs index b43f9adfb26..4678fe15c8b 100644 --- a/src/libarena/lib.rs +++ b/src/libarena/lib.rs @@ -581,11 +581,11 @@ mod tests { #[bench] pub fn bench_copy_nonarena(b: &mut Bencher) { b.iter(|| { - box Point { + let _: Box<_> = box Point { x: 1, y: 2, z: 3, - } + }; }) } @@ -634,10 +634,10 @@ mod tests { #[bench] pub fn bench_noncopy_nonarena(b: &mut Bencher) { b.iter(|| { - box Noncopy { + let _: Box<_> = box Noncopy { string: "hello world".to_string(), array: vec!( 1, 2, 3, 4, 5 ), - } + }; }) } diff --git a/src/libcollections/binary_heap.rs b/src/libcollections/binary_heap.rs index 36c76dbad14..2e575ddb00a 100644 --- a/src/libcollections/binary_heap.rs +++ b/src/libcollections/binary_heap.rs @@ -790,7 +790,7 @@ mod tests { #[test] fn test_push_unique() { - let mut heap = BinaryHeap::from_vec(vec![box 2, box 4, box 9]); + let mut heap = BinaryHeap::>::from_vec(vec![box 2, box 4, box 9]); assert_eq!(heap.len(), 3); assert!(*heap.peek().unwrap() == box 9); heap.push(box 11); diff --git a/src/libcollections/linked_list.rs b/src/libcollections/linked_list.rs index 9b5fbfc2511..5ca3cb38058 100644 --- a/src/libcollections/linked_list.rs +++ b/src/libcollections/linked_list.rs @@ -984,7 +984,7 @@ mod tests { #[test] fn test_basic() { - let mut m = LinkedList::new(); + let mut m = LinkedList::>::new(); assert_eq!(m.pop_front(), None); assert_eq!(m.pop_back(), None); assert_eq!(m.pop_front(), None); diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs index b3706e20352..ecff2c7cc4b 100644 --- a/src/libcollections/slice.rs +++ b/src/libcollections/slice.rs @@ -1509,6 +1509,7 @@ fn merge_sort(v: &mut [T], mut compare: F) where F: FnMut(&T, &T) -> Order #[cfg(test)] mod tests { + use alloc::boxed::Box; use core::cmp::Ordering::{Greater, Less, Equal}; use core::prelude::{Some, None, Clone}; use core::prelude::{Iterator, IteratorExt}; @@ -1799,7 +1800,7 @@ mod tests { #[test] fn test_swap_remove_noncopyable() { // Tests that we don't accidentally run destructors twice. - let mut v = Vec::new(); + let mut v: Vec> = Vec::new(); v.push(box 0u8); v.push(box 0u8); v.push(box 0u8); @@ -1828,7 +1829,7 @@ mod tests { #[test] fn test_truncate() { - let mut v = vec![box 6,box 5,box 4]; + let mut v: Vec> = vec![box 6,box 5,box 4]; v.truncate(1); let v = v; assert_eq!(v.len(), 1); @@ -1838,7 +1839,7 @@ mod tests { #[test] fn test_clear() { - let mut v = vec![box 6,box 5,box 4]; + let mut v: Vec> = vec![box 6,box 5,box 4]; v.clear(); assert_eq!(v.len(), 0); // If the unsafe block didn't drop things properly, we blow up here. @@ -1863,11 +1864,11 @@ mod tests { #[test] fn test_dedup_unique() { - let mut v0 = vec![box 1, box 1, box 2, box 3]; + let mut v0: Vec> = vec![box 1, box 1, box 2, box 3]; v0.dedup(); - let mut v1 = vec![box 1, box 2, box 2, box 3]; + let mut v1: Vec> = vec![box 1, box 2, box 2, box 3]; v1.dedup(); - let mut v2 = vec![box 1, box 2, box 3, box 3]; + let mut v2: Vec> = vec![box 1, box 2, box 3, box 3]; v2.dedup(); /* * If the boxed pointers were leaked or otherwise misused, valgrind @@ -1877,11 +1878,11 @@ mod tests { #[test] fn test_dedup_shared() { - let mut v0 = vec![box 1, box 1, box 2, box 3]; + let mut v0: Vec> = vec![box 1, box 1, box 2, box 3]; v0.dedup(); - let mut v1 = vec![box 1, box 2, box 2, box 3]; + let mut v1: Vec> = vec![box 1, box 2, box 2, box 3]; v1.dedup(); - let mut v2 = vec![box 1, box 2, box 3, box 3]; + let mut v2: Vec> = vec![box 1, box 2, box 3, box 3]; v2.dedup(); /* * If the pointers were leaked or otherwise misused, valgrind and/or @@ -2254,8 +2255,9 @@ mod tests { #[test] #[should_fail] fn test_permute_fail() { - let v = [(box 0, Rc::new(0)), (box 0, Rc::new(0)), - (box 0, Rc::new(0)), (box 0, Rc::new(0))]; + let v: [(Box<_>, Rc<_>); 4] = + [(box 0, Rc::new(0)), (box 0, Rc::new(0)), + (box 0, Rc::new(0)), (box 0, Rc::new(0))]; let mut i = 0; for _ in v.permutations() { if i == 2 { @@ -2849,7 +2851,7 @@ mod tests { #[test] fn test_to_vec() { - let xs = box [1, 2, 3]; + let xs: Box<_> = box [1, 2, 3]; let ys = xs.to_vec(); assert_eq!(ys, [1, 2, 3]); } diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index a4d39974c70..2e947ea2460 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -2130,8 +2130,8 @@ mod tests { #[test] fn test_clone_from() { let mut v = vec!(); - let three = vec!(box 1, box 2, box 3); - let two = vec!(box 4, box 5); + let three: Vec> = vec!(box 1, box 2, box 3); + let two: Vec> = vec!(box 4, box 5); // zero, long v.clone_from(&three); assert_eq!(v, three); diff --git a/src/libcollections/vec_map.rs b/src/libcollections/vec_map.rs index 5a0aa750bf5..515de74e340 100644 --- a/src/libcollections/vec_map.rs +++ b/src/libcollections/vec_map.rs @@ -1205,7 +1205,7 @@ mod test_map { #[test] fn test_move_iter() { - let mut m = VecMap::new(); + let mut m: VecMap> = VecMap::new(); m.insert(1, box 2); let mut called = false; for (k, v) in m { diff --git a/src/libcoretest/any.rs b/src/libcoretest/any.rs index 8b5e46f85fa..39f5d237a2b 100644 --- a/src/libcoretest/any.rs +++ b/src/libcoretest/any.rs @@ -68,7 +68,7 @@ fn any_downcast_ref() { #[test] fn any_downcast_mut() { let mut a = 5_usize; - let mut b = box 7_usize; + let mut b: Box<_> = box 7_usize; let a_r = &mut a as &mut Any; let tmp: &mut uint = &mut *b; diff --git a/src/libcoretest/option.rs b/src/libcoretest/option.rs index 860bd40e21e..59116f23d44 100644 --- a/src/libcoretest/option.rs +++ b/src/libcoretest/option.rs @@ -16,7 +16,7 @@ use core::clone::Clone; #[test] fn test_get_ptr() { unsafe { - let x = box 0; + let x: Box<_> = box 0; let addr_x: *const int = mem::transmute(&*x); let opt = Some(x); let y = opt.unwrap(); diff --git a/src/librustc_back/sha2.rs b/src/librustc_back/sha2.rs index 8acb6851f11..844920ad5ec 100644 --- a/src/librustc_back/sha2.rs +++ b/src/librustc_back/sha2.rs @@ -606,7 +606,7 @@ mod tests { let tests = wikipedia_tests; - let mut sh = box Sha256::new(); + let mut sh: Box<_> = box Sha256::new(); test_hash(&mut *sh, &tests); } diff --git a/src/libstd/old_io/net/ip.rs b/src/libstd/old_io/net/ip.rs index 9c89c943994..f1634cd4229 100644 --- a/src/libstd/old_io/net/ip.rs +++ b/src/libstd/old_io/net/ip.rs @@ -323,22 +323,22 @@ impl<'a> Parser<'a> { } fn read_ip_addr(&mut self) -> Option { - let ipv4_addr = |p: &mut Parser| p.read_ipv4_addr(); - let ipv6_addr = |p: &mut Parser| p.read_ipv6_addr(); - self.read_or(&mut [box ipv4_addr, box ipv6_addr]) + let ipv4_addr: Box<_> = box |p: &mut Parser| p.read_ipv4_addr(); + let ipv6_addr: Box<_> = box |p: &mut Parser| p.read_ipv6_addr(); + self.read_or(&mut [ipv4_addr, ipv6_addr]) } fn read_socket_addr(&mut self) -> Option { let ip_addr = |p: &mut Parser| { - let ipv4_p = |p: &mut Parser| p.read_ip_addr(); - let ipv6_p = |p: &mut Parser| { + let ipv4_p: Box<_> = box |p: &mut Parser| p.read_ip_addr(); + let ipv6_p: Box<_> = box |p: &mut Parser| { let open_br = |p: &mut Parser| p.read_given_char('['); let ip_addr = |p: &mut Parser| p.read_ipv6_addr(); let clos_br = |p: &mut Parser| p.read_given_char(']'); p.read_seq_3::(open_br, ip_addr, clos_br) .map(|t| match t { (_, ip, _) => ip }) }; - p.read_or(&mut [box ipv4_p, box ipv6_p]) + p.read_or(&mut [ipv4_p, ipv6_p]) }; let colon = |p: &mut Parser| p.read_given_char(':'); let port = |p: &mut Parser| p.read_number(10, 5, 0x10000).map(|n| n as u16); 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::>(); tx.send(box 1).unwrap(); } #[test] fn drop_full_shared() { - let (tx, _rx) = channel(); + let (tx, _rx) = channel::>(); 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::>(); 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::>(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> = 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> = Queue::new(0); q.push(box 1); q.push(box 2); } diff --git a/src/libstd/thread.rs b/src/libstd/thread.rs index e8330820906..9be77e78ed1 100644 --- a/src/libstd/thread.rs +++ b/src/libstd/thread.rs @@ -804,7 +804,7 @@ mod test { fn avoid_copying_the_body(spawnfn: F) where F: FnOnce(Thunk<'static>) { let (tx, rx) = channel(); - let x = box 1; + let x: Box<_> = box 1; let x_in_parent = (&*x) as *const i32 as usize; spawnfn(Thunk::new(move|| { diff --git a/src/test/bench/shootout-k-nucleotide.rs b/src/test/bench/shootout-k-nucleotide.rs index f239a0d78d1..5cfe62d967c 100644 --- a/src/test/bench/shootout-k-nucleotide.rs +++ b/src/test/bench/shootout-k-nucleotide.rs @@ -146,7 +146,7 @@ impl Table { fn search_remainder(item: &mut Entry, key: Code, c: C) { match item.next { None => { - let mut entry = box Entry { + let mut entry: Box<_> = box Entry { code: key, count: 0, next: None, @@ -170,7 +170,7 @@ impl Table { { if self.items[index as usize].is_none() { - let mut entry = box Entry { + let mut entry: Box<_> = box Entry { code: key, count: 0, next: None, diff --git a/src/test/bench/sudoku.rs b/src/test/bench/sudoku.rs index 40e1e7d2b76..f308743ad13 100644 --- a/src/test/bench/sudoku.rs +++ b/src/test/bench/sudoku.rs @@ -124,7 +124,7 @@ impl Sudoku { fn next_color(&mut self, row: u8, col: u8, start_color: u8) -> bool { if start_color < 10u8 { // colors not yet used - let mut avail = box Colors::new(start_color); + let mut avail: Box<_> = box Colors::new(start_color); // drop colors already in use in neighbourhood self.drop_colors(&mut *avail, row, col); diff --git a/src/test/compile-fail/borrow-tuple-fields.rs b/src/test/compile-fail/borrow-tuple-fields.rs index 40e077bd1b5..b1abbad5253 100644 --- a/src/test/compile-fail/borrow-tuple-fields.rs +++ b/src/test/compile-fail/borrow-tuple-fields.rs @@ -16,7 +16,7 @@ struct Foo(Box, isize); struct Bar(isize, isize); fn main() { - let x = (box 1, 2); + let x: (Box<_>, _) = (box 1, 2); let r = &x.0; let y = x; //~ ERROR cannot move out of `x` because it is borrowed diff --git a/src/test/compile-fail/borrowck-bad-nested-calls-free.rs b/src/test/compile-fail/borrowck-bad-nested-calls-free.rs index 4d1939be5b9..7913f9ac903 100644 --- a/src/test/compile-fail/borrowck-bad-nested-calls-free.rs +++ b/src/test/compile-fail/borrowck-bad-nested-calls-free.rs @@ -23,7 +23,7 @@ fn add(v: &usize, w: usize) -> usize { } fn implicit() { - let mut a = box 1; + let mut a: Box<_> = box 1; // Note the danger here: // @@ -36,7 +36,7 @@ fn implicit() { } fn explicit() { - let mut a = box 1; + let mut a: Box<_> = box 1; add( &*a, rewrite(&mut a)); //~ ERROR cannot borrow diff --git a/src/test/compile-fail/borrowck-bad-nested-calls-move.rs b/src/test/compile-fail/borrowck-bad-nested-calls-move.rs index 9eda3689334..e24d4e87add 100644 --- a/src/test/compile-fail/borrowck-bad-nested-calls-move.rs +++ b/src/test/compile-fail/borrowck-bad-nested-calls-move.rs @@ -23,7 +23,7 @@ fn add(v: &usize, w: Box) -> usize { } fn implicit() { - let mut a = box 1; + let mut a: Box<_> = box 1; // Note the danger here: // @@ -36,7 +36,7 @@ fn implicit() { } fn explicit() { - let mut a = box 1; + let mut a: Box<_> = box 1; add( &*a, a); //~ ERROR cannot move diff --git a/src/test/compile-fail/borrowck-borrow-immut-deref-of-box-as-mut.rs b/src/test/compile-fail/borrowck-borrow-immut-deref-of-box-as-mut.rs index 794e0fc6e3a..3662e23a412 100644 --- a/src/test/compile-fail/borrowck-borrow-immut-deref-of-box-as-mut.rs +++ b/src/test/compile-fail/borrowck-borrow-immut-deref-of-box-as-mut.rs @@ -18,7 +18,7 @@ impl A { } pub fn main() { - let a = box A; + let a: Box<_> = box A; a.foo(); //~^ ERROR cannot borrow immutable `Box` content `*a` as mutable } diff --git a/src/test/compile-fail/borrowck-box-insensitivity.rs b/src/test/compile-fail/borrowck-box-insensitivity.rs index 648d0d81ffb..59514f75a77 100644 --- a/src/test/compile-fail/borrowck-box-insensitivity.rs +++ b/src/test/compile-fail/borrowck-box-insensitivity.rs @@ -31,100 +31,100 @@ struct D { } fn copy_after_move() { - let a = box A { x: box 0, y: 1 }; + let a: Box<_> = box A { x: box 0, y: 1 }; let _x = a.x; let _y = a.y; //~ ERROR use of moved //~^^ NOTE `a` moved here (through moving `a.x`) } fn move_after_move() { - let a = box B { x: box 0, y: box 1 }; + let a: Box<_> = box B { x: box 0, y: box 1 }; let _x = a.x; let _y = a.y; //~ ERROR use of moved //~^^ NOTE `a` moved here (through moving `a.x`) } fn borrow_after_move() { - let a = box A { x: box 0, y: 1 }; + let a: Box<_> = box A { x: box 0, y: 1 }; let _x = a.x; let _y = &a.y; //~ ERROR use of moved //~^^ NOTE `a` moved here (through moving `a.x`) } fn move_after_borrow() { - let a = box B { x: box 0, y: box 1 }; + let a: Box<_> = box B { x: box 0, y: box 1 }; let _x = &a.x; let _y = a.y; //~ ERROR cannot move } fn copy_after_mut_borrow() { - let mut a = box A { x: box 0, y: 1 }; + let mut a: Box<_> = box A { x: box 0, y: 1 }; let _x = &mut a.x; let _y = a.y; //~ ERROR cannot use } fn move_after_mut_borrow() { - let mut a = box B { x: box 0, y: box 1 }; + let mut a: Box<_> = box B { x: box 0, y: box 1 }; let _x = &mut a.x; let _y = a.y; //~ ERROR cannot move } fn borrow_after_mut_borrow() { - let mut a = box A { x: box 0, y: 1 }; + let mut a: Box<_> = box A { x: box 0, y: 1 }; let _x = &mut a.x; let _y = &a.y; //~ ERROR cannot borrow } fn mut_borrow_after_borrow() { - let mut a = box A { x: box 0, y: 1 }; + let mut a: Box<_> = box A { x: box 0, y: 1 }; let _x = &a.x; let _y = &mut a.y; //~ ERROR cannot borrow } fn copy_after_move_nested() { - let a = box C { x: box A { x: box 0, y: 1 }, y: 2 }; + let a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 }; let _x = a.x.x; let _y = a.y; //~ ERROR use of collaterally moved } fn move_after_move_nested() { - let a = box D { x: box A { x: box 0, y: 1 }, y: box 2 }; + let a: Box<_> = box D { x: box A { x: box 0, y: 1 }, y: box 2 }; let _x = a.x.x; let _y = a.y; //~ ERROR use of collaterally moved } fn borrow_after_move_nested() { - let a = box C { x: box A { x: box 0, y: 1 }, y: 2 }; + let a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 }; let _x = a.x.x; let _y = &a.y; //~ ERROR use of collaterally moved } fn move_after_borrow_nested() { - let a = box D { x: box A { x: box 0, y: 1 }, y: box 2 }; + let a: Box<_> = box D { x: box A { x: box 0, y: 1 }, y: box 2 }; let _x = &a.x.x; let _y = a.y; //~ ERROR cannot move } fn copy_after_mut_borrow_nested() { - let mut a = box C { x: box A { x: box 0, y: 1 }, y: 2 }; + let mut a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 }; let _x = &mut a.x.x; let _y = a.y; //~ ERROR cannot use } fn move_after_mut_borrow_nested() { - let mut a = box D { x: box A { x: box 0, y: 1 }, y: box 2 }; + let mut a: Box<_> = box D { x: box A { x: box 0, y: 1 }, y: box 2 }; let _x = &mut a.x.x; let _y = a.y; //~ ERROR cannot move } fn borrow_after_mut_borrow_nested() { - let mut a = box C { x: box A { x: box 0, y: 1 }, y: 2 }; + let mut a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 }; let _x = &mut a.x.x; let _y = &a.y; //~ ERROR cannot borrow } fn mut_borrow_after_borrow_nested() { - let mut a = box C { x: box A { x: box 0, y: 1 }, y: 2 }; + let mut a: Box<_> = box C { x: box A { x: box 0, y: 1 }, y: 2 }; let _x = &a.x.x; let _y = &mut a.y; //~ ERROR cannot borrow } diff --git a/src/test/compile-fail/borrowck-closures-mut-and-imm.rs b/src/test/compile-fail/borrowck-closures-mut-and-imm.rs index 851b11fac2b..aaa07661215 100644 --- a/src/test/compile-fail/borrowck-closures-mut-and-imm.rs +++ b/src/test/compile-fail/borrowck-closures-mut-and-imm.rs @@ -52,7 +52,7 @@ fn e() { } fn f() { - let mut x = box 3; + let mut x: Box<_> = box 3; let c1 = || get(&*x); *x = 5; //~ ERROR cannot assign } @@ -62,7 +62,7 @@ fn g() { f: Box } - let mut x = box Foo { f: box 3 }; + let mut x: Box<_> = box Foo { f: box 3 }; let c1 = || get(&*x.f); *x.f = 5; //~ ERROR cannot assign to `*x.f` } @@ -72,7 +72,7 @@ fn h() { f: Box } - let mut x = box Foo { f: box 3 }; + let mut x: Box<_> = box Foo { f: box 3 }; let c1 = || get(&*x.f); let c2 = || *x.f = 5; //~ ERROR cannot borrow `x` as mutable } diff --git a/src/test/compile-fail/borrowck-closures-two-mut.rs b/src/test/compile-fail/borrowck-closures-two-mut.rs index 8ab4e257b06..29546abe0bb 100644 --- a/src/test/compile-fail/borrowck-closures-two-mut.rs +++ b/src/test/compile-fail/borrowck-closures-two-mut.rs @@ -50,7 +50,7 @@ fn g() { f: Box } - let mut x = box Foo { f: box 3 }; + let mut x: Box<_> = box Foo { f: box 3 }; let c1 = to_fn_mut(|| set(&mut *x.f)); let c2 = to_fn_mut(|| set(&mut *x.f)); //~^ ERROR cannot borrow `x` as mutable more than once diff --git a/src/test/compile-fail/borrowck-closures-use-after-free.rs b/src/test/compile-fail/borrowck-closures-use-after-free.rs index 32cd364d1f2..bb474342a7c 100644 --- a/src/test/compile-fail/borrowck-closures-use-after-free.rs +++ b/src/test/compile-fail/borrowck-closures-use-after-free.rs @@ -25,7 +25,7 @@ impl Drop for Foo { } fn main() { - let mut ptr = box Foo { x: 0 }; + let mut ptr: Box<_> = box Foo { x: 0 }; let mut test = |foo: &Foo| { ptr = box Foo { x: ptr.x + 1 }; }; diff --git a/src/test/compile-fail/borrowck-for-loop-correct-cmt-for-pattern.rs b/src/test/compile-fail/borrowck-for-loop-correct-cmt-for-pattern.rs index 492fd4a2c84..b6b26006555 100644 --- a/src/test/compile-fail/borrowck-for-loop-correct-cmt-for-pattern.rs +++ b/src/test/compile-fail/borrowck-for-loop-correct-cmt-for-pattern.rs @@ -28,7 +28,7 @@ fn main() { for &a in &f.a { //~ ERROR cannot move out } - let x = Some(box 1); + let x: Option> = Some(box 1); for &a in x.iter() { //~ ERROR cannot move out } } diff --git a/src/test/compile-fail/borrowck-issue-14498.rs b/src/test/compile-fail/borrowck-issue-14498.rs index cc562afa9f8..deae1fbad20 100644 --- a/src/test/compile-fail/borrowck-issue-14498.rs +++ b/src/test/compile-fail/borrowck-issue-14498.rs @@ -18,7 +18,7 @@ struct B<'a> { a: Box<&'a mut isize> } fn borrow_in_var_from_var() { let mut x: isize = 1; - let y = box &mut x; + let y: Box<_> = box &mut x; let p = &y; let q = &***p; **y = 2; //~ ERROR cannot assign to `**y` because it is borrowed @@ -28,7 +28,7 @@ fn borrow_in_var_from_var() { fn borrow_in_var_from_field() { let mut x = A { a: 1 }; - let y = box &mut x.a; + let y: Box<_> = box &mut x.a; let p = &y; let q = &***p; **y = 2; //~ ERROR cannot assign to `**y` because it is borrowed diff --git a/src/test/compile-fail/borrowck-issue-2657-1.rs b/src/test/compile-fail/borrowck-issue-2657-1.rs index 0c717d2ee5f..0e1712137d3 100644 --- a/src/test/compile-fail/borrowck-issue-2657-1.rs +++ b/src/test/compile-fail/borrowck-issue-2657-1.rs @@ -11,7 +11,7 @@ #![feature(box_syntax)] fn main() { - let x = Some(box 1); + let x: Option> = Some(box 1); match x { Some(ref _y) => { let _a = x; //~ ERROR cannot move diff --git a/src/test/compile-fail/borrowck-issue-2657-2.rs b/src/test/compile-fail/borrowck-issue-2657-2.rs index b4e5ae1c25b..a389a4a5593 100644 --- a/src/test/compile-fail/borrowck-issue-2657-2.rs +++ b/src/test/compile-fail/borrowck-issue-2657-2.rs @@ -11,7 +11,7 @@ #![feature(box_syntax)] fn main() { - let x = Some(box 1); + let x: Option> = Some(box 1); match x { Some(ref y) => { let _b = *y; //~ ERROR cannot move out diff --git a/src/test/compile-fail/borrowck-lend-flow-if.rs b/src/test/compile-fail/borrowck-lend-flow-if.rs index ca8efb5dc96..0efe8622621 100644 --- a/src/test/compile-fail/borrowck-lend-flow-if.rs +++ b/src/test/compile-fail/borrowck-lend-flow-if.rs @@ -30,7 +30,7 @@ fn pre_freeze_cond() { // In this instance, the freeze is conditional and starts before // the mut borrow. - let mut v = box 3; + let mut v: Box<_> = box 3; let _w; if cond() { _w = &v; @@ -42,7 +42,7 @@ fn pre_freeze_else() { // In this instance, the freeze and mut borrow are on separate sides // of the if. - let mut v = box 3; + let mut v: Box<_> = box 3; let _w; if cond() { _w = &v; diff --git a/src/test/compile-fail/borrowck-lend-flow-loop.rs b/src/test/compile-fail/borrowck-lend-flow-loop.rs index 5418a531fe6..f841fedf75a 100644 --- a/src/test/compile-fail/borrowck-lend-flow-loop.rs +++ b/src/test/compile-fail/borrowck-lend-flow-loop.rs @@ -28,7 +28,7 @@ fn inc(v: &mut Box) { fn loop_overarching_alias_mut() { // In this instance, the borrow encompasses the entire loop. - let mut v = box 3; + let mut v: Box<_> = box 3; let mut x = &mut v; **x += 1; loop { @@ -39,7 +39,7 @@ fn loop_overarching_alias_mut() { fn block_overarching_alias_mut() { // In this instance, the borrow encompasses the entire closure call. - let mut v = box 3; + let mut v: Box<_> = box 3; let mut x = &mut v; for _ in 0..3 { borrow(&*v); //~ ERROR cannot borrow @@ -50,8 +50,8 @@ fn block_overarching_alias_mut() { fn loop_aliased_mut() { // In this instance, the borrow is carried through the loop. - let mut v = box 3; - let mut w = box 4; + let mut v: Box<_> = box 3; + let mut w: Box<_> = box 4; let mut _x = &w; loop { borrow_mut(&mut *v); //~ ERROR cannot borrow @@ -62,8 +62,8 @@ fn loop_aliased_mut() { fn while_aliased_mut() { // In this instance, the borrow is carried through the loop. - let mut v = box 3; - let mut w = box 4; + let mut v: Box<_> = box 3; + let mut w: Box<_> = box 4; let mut _x = &w; while cond() { borrow_mut(&mut *v); //~ ERROR cannot borrow @@ -75,8 +75,8 @@ fn while_aliased_mut() { fn loop_aliased_mut_break() { // In this instance, the borrow is carried through the loop. - let mut v = box 3; - let mut w = box 4; + let mut v: Box<_> = box 3; + let mut w: Box<_> = box 4; let mut _x = &w; loop { borrow_mut(&mut *v); @@ -89,8 +89,8 @@ fn loop_aliased_mut_break() { fn while_aliased_mut_break() { // In this instance, the borrow is carried through the loop. - let mut v = box 3; - let mut w = box 4; + let mut v: Box<_> = box 3; + let mut w: Box<_> = box 4; let mut _x = &w; while cond() { borrow_mut(&mut *v); @@ -101,8 +101,8 @@ fn while_aliased_mut_break() { } fn while_aliased_mut_cond(cond: bool, cond2: bool) { - let mut v = box 3; - let mut w = box 4; + let mut v: Box<_> = box 3; + let mut w: Box<_> = box 4; let mut x = &mut w; while cond { **x += 1; diff --git a/src/test/compile-fail/borrowck-lend-flow.rs b/src/test/compile-fail/borrowck-lend-flow.rs index 177976c15f0..6da8f088b32 100644 --- a/src/test/compile-fail/borrowck-lend-flow.rs +++ b/src/test/compile-fail/borrowck-lend-flow.rs @@ -29,7 +29,7 @@ fn inc(v: &mut Box) { fn pre_freeze() { // In this instance, the freeze starts before the mut borrow. - let mut v = box 3; + let mut v: Box<_> = box 3; let _w = &v; borrow_mut(&mut *v); //~ ERROR cannot borrow } @@ -37,7 +37,7 @@ fn pre_freeze() { fn post_freeze() { // In this instance, the const alias starts after the borrow. - let mut v = box 3; + let mut v: Box<_> = box 3; borrow_mut(&mut *v); let _w = &v; } diff --git a/src/test/compile-fail/borrowck-loan-blocks-move-cc.rs b/src/test/compile-fail/borrowck-loan-blocks-move-cc.rs index 7f676f5166f..57b584a8959 100644 --- a/src/test/compile-fail/borrowck-loan-blocks-move-cc.rs +++ b/src/test/compile-fail/borrowck-loan-blocks-move-cc.rs @@ -17,7 +17,7 @@ fn borrow(v: &isize, f: F) where F: FnOnce(&isize) { } fn box_imm() { - let v = box 3; + let v: Box<_> = box 3; let _w = &v; thread::spawn(move|| { println!("v={}", *v); @@ -26,7 +26,7 @@ fn box_imm() { } fn box_imm_explicit() { - let v = box 3; + let v: Box<_> = box 3; let _w = &v; thread::spawn(move|| { println!("v={}", *v); diff --git a/src/test/compile-fail/borrowck-loan-blocks-mut-uniq.rs b/src/test/compile-fail/borrowck-loan-blocks-mut-uniq.rs index a52a4484b20..32d8088549d 100644 --- a/src/test/compile-fail/borrowck-loan-blocks-mut-uniq.rs +++ b/src/test/compile-fail/borrowck-loan-blocks-mut-uniq.rs @@ -15,7 +15,7 @@ fn borrow(v: &isize, f: F) where F: FnOnce(&isize) { } fn box_imm() { - let mut v = box 3; + let mut v: Box<_> = box 3; borrow(&*v, |w| { //~ ERROR cannot borrow `v` as mutable v = box 4; diff --git a/src/test/compile-fail/borrowck-move-by-capture.rs b/src/test/compile-fail/borrowck-move-by-capture.rs index a1708e7f497..bad52121043 100644 --- a/src/test/compile-fail/borrowck-move-by-capture.rs +++ b/src/test/compile-fail/borrowck-move-by-capture.rs @@ -14,7 +14,7 @@ fn to_fn_mut>(f: F) -> F { f } fn to_fn_once>(f: F) -> F { f } pub fn main() { - let bar = box 3; + let bar: Box<_> = box 3; let _g = to_fn_mut(|| { let _h = to_fn_once(move || -> isize { *bar }); //~ ERROR cannot move out of }); diff --git a/src/test/compile-fail/borrowck-move-from-subpath-of-borrowed-path.rs b/src/test/compile-fail/borrowck-move-from-subpath-of-borrowed-path.rs index 3d8d599970f..c02c6a71514 100644 --- a/src/test/compile-fail/borrowck-move-from-subpath-of-borrowed-path.rs +++ b/src/test/compile-fail/borrowck-move-from-subpath-of-borrowed-path.rs @@ -14,7 +14,7 @@ #![feature(box_syntax)] fn main() { - let a = box box 2; + let a: Box> = box box 2; let b = &a; let z = *a; //~ ERROR: cannot move out of `*a` because it is borrowed diff --git a/src/test/compile-fail/borrowck-move-moved-value-into-closure.rs b/src/test/compile-fail/borrowck-move-moved-value-into-closure.rs index 43bf3f25d1a..c46bcbb32b9 100644 --- a/src/test/compile-fail/borrowck-move-moved-value-into-closure.rs +++ b/src/test/compile-fail/borrowck-move-moved-value-into-closure.rs @@ -15,7 +15,7 @@ fn call_f isize>(f: F) -> isize { } fn main() { - let t = box 3; + let t: Box<_> = box 3; call_f(move|| { *t + 1 }); call_f(move|| { *t + 1 }); //~ ERROR capture of moved value diff --git a/src/test/compile-fail/borrowck-multiple-captures.rs b/src/test/compile-fail/borrowck-multiple-captures.rs index 9db05d76284..f417416e7b5 100644 --- a/src/test/compile-fail/borrowck-multiple-captures.rs +++ b/src/test/compile-fail/borrowck-multiple-captures.rs @@ -15,9 +15,9 @@ use std::thread; fn borrow(_: &T) { } fn different_vars_after_borrows() { - let x1 = box 1; + let x1: Box<_> = box 1; let p1 = &x1; - let x2 = box 2; + let x2: Box<_> = box 2; let p2 = &x2; thread::spawn(move|| { drop(x1); //~ ERROR cannot move `x1` into closure because it is borrowed @@ -28,9 +28,9 @@ fn different_vars_after_borrows() { } fn different_vars_after_moves() { - let x1 = box 1; + let x1: Box<_> = box 1; drop(x1); - let x2 = box 2; + let x2: Box<_> = box 2; drop(x2); thread::spawn(move|| { drop(x1); //~ ERROR capture of moved value: `x1` @@ -39,7 +39,7 @@ fn different_vars_after_moves() { } fn same_var_after_borrow() { - let x = box 1; + let x: Box<_> = box 1; let p = &x; thread::spawn(move|| { drop(x); //~ ERROR cannot move `x` into closure because it is borrowed @@ -49,7 +49,7 @@ fn same_var_after_borrow() { } fn same_var_after_move() { - let x = box 1; + let x: Box<_> = box 1; drop(x); thread::spawn(move|| { drop(x); //~ ERROR capture of moved value: `x` diff --git a/src/test/compile-fail/borrowck-no-cycle-in-exchange-heap.rs b/src/test/compile-fail/borrowck-no-cycle-in-exchange-heap.rs index 6985d203fb1..8cb7423f3cb 100644 --- a/src/test/compile-fail/borrowck-no-cycle-in-exchange-heap.rs +++ b/src/test/compile-fail/borrowck-no-cycle-in-exchange-heap.rs @@ -19,7 +19,7 @@ enum cycle { empty } fn main() { - let mut x = box cycle::node(node_ {a: box cycle::empty}); + let mut x: Box<_> = box cycle::node(node_ {a: box cycle::empty}); // Create a cycle! match *x { cycle::node(ref mut y) => { diff --git a/src/test/compile-fail/borrowck-overloaded-index-2.rs b/src/test/compile-fail/borrowck-overloaded-index-2.rs index e9d8544a06a..58668b73cbf 100644 --- a/src/test/compile-fail/borrowck-overloaded-index-2.rs +++ b/src/test/compile-fail/borrowck-overloaded-index-2.rs @@ -25,7 +25,7 @@ impl Index for MyVec { } fn main() { - let v = MyVec { data: vec!(box 1, box 2, box 3) }; + let v = MyVec::> { data: vec!(box 1, box 2, box 3) }; let good = &v[0]; // Shouldn't fail here let bad = v[0]; //~^ ERROR cannot move out of indexed content diff --git a/src/test/compile-fail/borrowck-uniq-via-lend.rs b/src/test/compile-fail/borrowck-uniq-via-lend.rs index 49a1b782a3d..f36dc0ca43f 100644 --- a/src/test/compile-fail/borrowck-uniq-via-lend.rs +++ b/src/test/compile-fail/borrowck-uniq-via-lend.rs @@ -13,7 +13,7 @@ fn borrow(_v: &isize) {} fn local() { - let mut v = box 3; + let mut v: Box<_> = box 3; borrow(&*v); } @@ -32,27 +32,27 @@ fn local_recs() { } fn aliased_imm() { - let mut v = box 3; + let mut v: Box<_> = box 3; let _w = &v; borrow(&*v); } fn aliased_mut() { - let mut v = box 3; + let mut v: Box<_> = box 3; let _w = &mut v; borrow(&*v); //~ ERROR cannot borrow `*v` } fn aliased_other() { - let mut v = box 3; - let mut w = box 4; + let mut v: Box<_> = box 3; + let mut w: Box<_> = box 4; let _x = &mut w; borrow(&*v); } fn aliased_other_reassign() { - let mut v = box 3; - let mut w = box 4; + let mut v: Box<_> = box 3; + let mut w: Box<_> = box 4; let mut _x = &mut w; _x = &mut v; borrow(&*v); //~ ERROR cannot borrow `*v` diff --git a/src/test/compile-fail/issue-10398.rs b/src/test/compile-fail/issue-10398.rs index 736f9630127..08e8effc626 100644 --- a/src/test/compile-fail/issue-10398.rs +++ b/src/test/compile-fail/issue-10398.rs @@ -11,7 +11,7 @@ #![feature(box_syntax)] fn main() { - let x = box 1; + let x: Box<_> = box 1; let f = move|| { let _a = x; drop(x); diff --git a/src/test/compile-fail/issue-11192.rs b/src/test/compile-fail/issue-11192.rs index a95bcc73a9c..7313d357ffc 100644 --- a/src/test/compile-fail/issue-11192.rs +++ b/src/test/compile-fail/issue-11192.rs @@ -21,7 +21,7 @@ impl Drop for Foo { } fn main() { - let mut ptr = box Foo { x: 0 }; + let mut ptr: Box<_> = box Foo { x: 0 }; let mut test = |foo: &Foo| { println!("access {}", foo.x); ptr = box Foo { x: ptr.x + 1 }; diff --git a/src/test/compile-fail/issue-11925.rs b/src/test/compile-fail/issue-11925.rs index df4dab2552e..7bd072c6268 100644 --- a/src/test/compile-fail/issue-11925.rs +++ b/src/test/compile-fail/issue-11925.rs @@ -14,7 +14,7 @@ fn to_fn_once>(f: F) -> F { f } fn main() { let r = { - let x = box 42; + let x: Box<_> = box 42; let f = to_fn_once(move|| &x); //~ ERROR: `x` does not live long enough f() }; diff --git a/src/test/compile-fail/issue-12127.rs b/src/test/compile-fail/issue-12127.rs index 40d446b91a5..5565a9a5761 100644 --- a/src/test/compile-fail/issue-12127.rs +++ b/src/test/compile-fail/issue-12127.rs @@ -14,7 +14,7 @@ fn to_fn_once>(f: F) -> F { f } fn do_it(x: &isize) { } fn main() { - let x = box 22; + let x: Box<_> = box 22; let f = to_fn_once(move|| do_it(&*x)); to_fn_once(move|| { f(); diff --git a/src/test/compile-fail/issue-17263.rs b/src/test/compile-fail/issue-17263.rs index 543063b3fc9..f40d51f1d2f 100644 --- a/src/test/compile-fail/issue-17263.rs +++ b/src/test/compile-fail/issue-17263.rs @@ -13,12 +13,12 @@ struct Foo { a: isize, b: isize } fn main() { - let mut x = box Foo { a: 1, b: 2 }; + let mut x: Box<_> = box Foo { a: 1, b: 2 }; let (a, b) = (&mut x.a, &mut x.b); //~^ ERROR cannot borrow `x` (here through borrowing `x.b`) as mutable more than once at a time //~^^ NOTE previous borrow of `x` occurs here (through borrowing `x.a`) - let mut foo = box Foo { a: 1, b: 2 }; + let mut foo: Box<_> = box Foo { a: 1, b: 2 }; let (c, d) = (&mut foo.a, &foo.b); //~^ ERROR cannot borrow `foo` (here through borrowing `foo.b`) as immutable //~^^ NOTE previous borrow of `foo` occurs here (through borrowing `foo.a`) diff --git a/src/test/compile-fail/issue-17913.rs b/src/test/compile-fail/issue-17913.rs index 8035cffabda..80e5f2b6e21 100644 --- a/src/test/compile-fail/issue-17913.rs +++ b/src/test/compile-fail/issue-17913.rs @@ -16,13 +16,13 @@ #[cfg(target_pointer_width = "64")] fn main() { let n = 0_usize; - let a = box [&n; 0xF000000000000000_usize]; + let a: Box<_> = box [&n; 0xF000000000000000_usize]; println!("{}", a[0xFFFFFF_usize]); } #[cfg(target_pointer_width = "32")] fn main() { let n = 0_usize; - let a = box [&n; 0xFFFFFFFF_usize]; + let a: Box<_> = box [&n; 0xFFFFFFFF_usize]; println!("{}", a[0xFFFFFF_usize]); } diff --git a/src/test/compile-fail/kindck-impl-type-params-2.rs b/src/test/compile-fail/kindck-impl-type-params-2.rs index b575144f637..fd0789421e0 100644 --- a/src/test/compile-fail/kindck-impl-type-params-2.rs +++ b/src/test/compile-fail/kindck-impl-type-params-2.rs @@ -21,7 +21,7 @@ impl Foo for T { fn take_param(foo: &T) { } fn main() { - let x = box 3; + let x: Box<_> = box 3; take_param(&x); //~^ ERROR the trait `core::marker::Copy` is not implemented } diff --git a/src/test/compile-fail/kindck-inherited-copy-bound.rs b/src/test/compile-fail/kindck-inherited-copy-bound.rs index 0072b1228af..52ca24d0f54 100644 --- a/src/test/compile-fail/kindck-inherited-copy-bound.rs +++ b/src/test/compile-fail/kindck-inherited-copy-bound.rs @@ -24,12 +24,12 @@ impl Foo for T { fn take_param(foo: &T) { } fn a() { - let x = box 3; + let x: Box<_> = box 3; take_param(&x); //~ ERROR `core::marker::Copy` is not implemented } fn b() { - let x = box 3; + let x: Box<_> = box 3; let y = &x; let z = &x as &Foo; //~ ERROR `core::marker::Copy` is not implemented } diff --git a/src/test/compile-fail/liveness-use-after-move.rs b/src/test/compile-fail/liveness-use-after-move.rs index 985eb1cd7ba..6fcab380030 100644 --- a/src/test/compile-fail/liveness-use-after-move.rs +++ b/src/test/compile-fail/liveness-use-after-move.rs @@ -11,7 +11,7 @@ #![feature(box_syntax)] fn main() { - let x = box 5; + let x: Box<_> = box 5; let y = x; println!("{}", *x); //~ ERROR use of moved value: `*x` y.clone(); diff --git a/src/test/compile-fail/move-in-guard-1.rs b/src/test/compile-fail/move-in-guard-1.rs index 5d29d0e1fd0..068bfa3cd7c 100644 --- a/src/test/compile-fail/move-in-guard-1.rs +++ b/src/test/compile-fail/move-in-guard-1.rs @@ -11,7 +11,7 @@ #![feature(box_syntax)] pub fn main() { - let x = box 1; + let x: Box<_> = box 1; let v = (1, 2); diff --git a/src/test/compile-fail/move-in-guard-2.rs b/src/test/compile-fail/move-in-guard-2.rs index 23af2579797..984963b2f83 100644 --- a/src/test/compile-fail/move-in-guard-2.rs +++ b/src/test/compile-fail/move-in-guard-2.rs @@ -11,7 +11,7 @@ #![feature(box_syntax)] pub fn main() { - let x = box 1; + let x: Box<_> = box 1; let v = (1, 2); diff --git a/src/test/compile-fail/move-out-of-tuple-field.rs b/src/test/compile-fail/move-out-of-tuple-field.rs index 7e3a85569d4..b7393666719 100644 --- a/src/test/compile-fail/move-out-of-tuple-field.rs +++ b/src/test/compile-fail/move-out-of-tuple-field.rs @@ -13,7 +13,7 @@ struct Foo(Box); fn main() { - let x = (box 1,); + let x: (Box<_>,) = (box 1,); let y = x.0; let z = x.0; //~ ERROR use of moved value: `x.0` diff --git a/src/test/compile-fail/mut-cross-borrowing.rs b/src/test/compile-fail/mut-cross-borrowing.rs index 2cf6e67a909..6829cd574e1 100644 --- a/src/test/compile-fail/mut-cross-borrowing.rs +++ b/src/test/compile-fail/mut-cross-borrowing.rs @@ -13,7 +13,7 @@ fn f(_: &mut isize) {} fn main() { - let mut x = box 3; + let mut x: Box<_> = box 3; f(x) //~ ERROR mismatched types } diff --git a/src/test/compile-fail/static-region-bound.rs b/src/test/compile-fail/static-region-bound.rs index 200aa989193..eca22bfdda0 100644 --- a/src/test/compile-fail/static-region-bound.rs +++ b/src/test/compile-fail/static-region-bound.rs @@ -13,7 +13,7 @@ fn f(_: T) {} fn main() { - let x = box 3; + let x: Box<_> = box 3; f(x); let x = &3; //~ ERROR borrowed value does not live long enough f(x); diff --git a/src/test/compile-fail/use-after-move-implicity-coerced-object.rs b/src/test/compile-fail/use-after-move-implicity-coerced-object.rs index 1998f8ab155..26d22b072eb 100644 --- a/src/test/compile-fail/use-after-move-implicity-coerced-object.rs +++ b/src/test/compile-fail/use-after-move-implicity-coerced-object.rs @@ -34,8 +34,8 @@ impl List { } fn main() { - let n = box Number { n: 42 }; - let mut l = box List { list: Vec::new() }; + let n: Box<_> = box Number { n: 42 }; + let mut l: Box<_> = box List { list: Vec::new() }; l.push(n); let x = n.to_string(); //~^ ERROR: use of moved value: `n` diff --git a/src/test/debuginfo/borrowed-struct.rs b/src/test/debuginfo/borrowed-struct.rs index 2cfc6855e5b..4430ea9380d 100644 --- a/src/test/debuginfo/borrowed-struct.rs +++ b/src/test/debuginfo/borrowed-struct.rs @@ -78,7 +78,7 @@ fn main() { let stack_val_interior_ref_2: &f64 = &stack_val.y; let ref_to_unnamed: &SomeStruct = &SomeStruct { x: 11, y: 24.5 }; - let unique_val = box SomeStruct { x: 13, y: 26.5 }; + let unique_val: Box<_> = box SomeStruct { x: 13, y: 26.5 }; let unique_val_ref: &SomeStruct = &*unique_val; let unique_val_interior_ref_1: &int = &unique_val.x; let unique_val_interior_ref_2: &f64 = &unique_val.y; diff --git a/src/test/debuginfo/boxed-struct.rs b/src/test/debuginfo/boxed-struct.rs index 972d6ab12e1..9c6e197e65e 100644 --- a/src/test/debuginfo/boxed-struct.rs +++ b/src/test/debuginfo/boxed-struct.rs @@ -57,9 +57,9 @@ impl Drop for StructWithDestructor { fn main() { - let unique = box StructWithSomePadding { x: 99, y: 999, z: 9999, w: 99999 }; + let unique: Box<_> = box StructWithSomePadding { x: 99, y: 999, z: 9999, w: 99999 }; - let unique_dtor = box StructWithDestructor { x: 77, y: 777, z: 7777, w: 77777 }; + let unique_dtor: Box<_> = box StructWithDestructor { x: 77, y: 777, z: 7777, w: 77777 }; zzz(); // #break } diff --git a/src/test/debuginfo/generic-method-on-generic-struct.rs b/src/test/debuginfo/generic-method-on-generic-struct.rs index 8c4eeb27c0f..8b698d900af 100644 --- a/src/test/debuginfo/generic-method-on-generic-struct.rs +++ b/src/test/debuginfo/generic-method-on-generic-struct.rs @@ -142,7 +142,7 @@ fn main() { let _ = stack.self_by_ref(-1, 2_u16); let _ = stack.self_by_val(-3, -4_i16); - let owned = box Struct { x: 1234.5f64 }; + let owned: Box<_> = box Struct { x: 1234.5f64 }; let _ = owned.self_by_ref(-5, -6_i32); let _ = owned.self_by_val(-7, -8_i64); let _ = owned.self_owned(-9, -10.5_f32); diff --git a/src/test/debuginfo/method-on-enum.rs b/src/test/debuginfo/method-on-enum.rs index 7ad668791d3..638d73f0d4e 100644 --- a/src/test/debuginfo/method-on-enum.rs +++ b/src/test/debuginfo/method-on-enum.rs @@ -144,7 +144,7 @@ fn main() { let _ = stack.self_by_ref(-1, -2); let _ = stack.self_by_val(-3, -4); - let owned = box Enum::Variant1{ x: 1799, y: 1799 }; + let owned: Box<_> = box Enum::Variant1{ x: 1799, y: 1799 }; let _ = owned.self_by_ref(-5, -6); let _ = owned.self_by_val(-7, -8); let _ = owned.self_owned(-9, -10); diff --git a/src/test/debuginfo/method-on-generic-struct.rs b/src/test/debuginfo/method-on-generic-struct.rs index 6b56a7998c9..784d60eec9a 100644 --- a/src/test/debuginfo/method-on-generic-struct.rs +++ b/src/test/debuginfo/method-on-generic-struct.rs @@ -143,7 +143,7 @@ fn main() { let _ = stack.self_by_ref(-1, -2); let _ = stack.self_by_val(-3, -4); - let owned = box Struct { x: 1234.5f64 }; + let owned: Box<_> = box Struct { x: 1234.5f64 }; let _ = owned.self_by_ref(-5, -6); let _ = owned.self_by_val(-7, -8); let _ = owned.self_owned(-9, -10); diff --git a/src/test/debuginfo/method-on-struct.rs b/src/test/debuginfo/method-on-struct.rs index e32288a8e7d..a91586a6aa6 100644 --- a/src/test/debuginfo/method-on-struct.rs +++ b/src/test/debuginfo/method-on-struct.rs @@ -143,7 +143,7 @@ fn main() { let _ = stack.self_by_ref(-1, -2); let _ = stack.self_by_val(-3, -4); - let owned = box Struct { x: 200 }; + let owned: Box<_> = box Struct { x: 200 }; let _ = owned.self_by_ref(-5, -6); let _ = owned.self_by_val(-7, -8); let _ = owned.self_owned(-9, -10); diff --git a/src/test/debuginfo/method-on-trait.rs b/src/test/debuginfo/method-on-trait.rs index 6e9a695720a..e2c827ee517 100644 --- a/src/test/debuginfo/method-on-trait.rs +++ b/src/test/debuginfo/method-on-trait.rs @@ -149,7 +149,7 @@ fn main() { let _ = stack.self_by_ref(-1, -2); let _ = stack.self_by_val(-3, -4); - let owned = box Struct { x: 200 }; + let owned: Box<_> = box Struct { x: 200 }; let _ = owned.self_by_ref(-5, -6); let _ = owned.self_by_val(-7, -8); let _ = owned.self_owned(-9, -10); diff --git a/src/test/debuginfo/method-on-tuple-struct.rs b/src/test/debuginfo/method-on-tuple-struct.rs index cee04e92c2d..e8bc40f1810 100644 --- a/src/test/debuginfo/method-on-tuple-struct.rs +++ b/src/test/debuginfo/method-on-tuple-struct.rs @@ -141,7 +141,7 @@ fn main() { let _ = stack.self_by_ref(-1, -2); let _ = stack.self_by_val(-3, -4); - let owned = box TupleStruct(200, -200.5); + let owned: Box<_> = box TupleStruct(200, -200.5); let _ = owned.self_by_ref(-5, -6); let _ = owned.self_by_val(-7, -8); let _ = owned.self_owned(-9, -10); diff --git a/src/test/debuginfo/self-in-default-method.rs b/src/test/debuginfo/self-in-default-method.rs index cb2b04f4d86..03a79993342 100644 --- a/src/test/debuginfo/self-in-default-method.rs +++ b/src/test/debuginfo/self-in-default-method.rs @@ -143,7 +143,7 @@ fn main() { let _ = stack.self_by_ref(-1, -2); let _ = stack.self_by_val(-3, -4); - let owned = box Struct { x: 200 }; + let owned: Box<_> = box Struct { x: 200 }; let _ = owned.self_by_ref(-5, -6); let _ = owned.self_by_val(-7, -8); let _ = owned.self_owned(-9, -10); diff --git a/src/test/debuginfo/self-in-generic-default-method.rs b/src/test/debuginfo/self-in-generic-default-method.rs index b96ec3b7b88..5869625bafe 100644 --- a/src/test/debuginfo/self-in-generic-default-method.rs +++ b/src/test/debuginfo/self-in-generic-default-method.rs @@ -144,7 +144,7 @@ fn main() { let _ = stack.self_by_ref(-1, 2_u16); let _ = stack.self_by_val(-3, -4_i16); - let owned = box Struct { x: 879 }; + let owned: Box<_> = box Struct { x: 879 }; let _ = owned.self_by_ref(-5, -6_i32); let _ = owned.self_by_val(-7, -8_i64); let _ = owned.self_owned(-9, -10.5_f32); diff --git a/src/test/debuginfo/unique-enum.rs b/src/test/debuginfo/unique-enum.rs index 69b5797007b..607a237d22e 100644 --- a/src/test/debuginfo/unique-enum.rs +++ b/src/test/debuginfo/unique-enum.rs @@ -67,15 +67,15 @@ fn main() { // 0b01111100011111000111110001111100 = 2088533116 // 0b0111110001111100 = 31868 // 0b01111100 = 124 - let the_a = box ABC::TheA { x: 0, y: 8970181431921507452 }; + let the_a: Box<_> = box ABC::TheA { x: 0, y: 8970181431921507452 }; // 0b0001000100010001000100010001000100010001000100010001000100010001 = 1229782938247303441 // 0b00010001000100010001000100010001 = 286331153 // 0b0001000100010001 = 4369 // 0b00010001 = 17 - let the_b = box ABC::TheB (0, 286331153, 286331153); + let the_b: Box<_> = box ABC::TheB (0, 286331153, 286331153); - let univariant = box Univariant::TheOnlyCase(123234); + let univariant: Box<_> = box Univariant::TheOnlyCase(123234); zzz(); // #break } diff --git a/src/test/debuginfo/var-captured-in-nested-closure.rs b/src/test/debuginfo/var-captured-in-nested-closure.rs index 9c9d82249ee..05872e3fc36 100644 --- a/src/test/debuginfo/var-captured-in-nested-closure.rs +++ b/src/test/debuginfo/var-captured-in-nested-closure.rs @@ -98,7 +98,7 @@ fn main() { }; let struct_ref = &a_struct; - let owned = box 6; + let owned: Box<_> = box 6; let mut closure = || { let closure_local = 8; diff --git a/src/test/debuginfo/var-captured-in-sendable-closure.rs b/src/test/debuginfo/var-captured-in-sendable-closure.rs index 3c442c95e0f..295d57f4cfa 100644 --- a/src/test/debuginfo/var-captured-in-sendable-closure.rs +++ b/src/test/debuginfo/var-captured-in-sendable-closure.rs @@ -58,7 +58,7 @@ fn main() { c: 4 }; - let owned = box 5; + let owned: Box<_> = box 5; let closure = move || { zzz(); // #break diff --git a/src/test/debuginfo/var-captured-in-stack-closure.rs b/src/test/debuginfo/var-captured-in-stack-closure.rs index e3bd1eade75..57dcac409ba 100644 --- a/src/test/debuginfo/var-captured-in-stack-closure.rs +++ b/src/test/debuginfo/var-captured-in-stack-closure.rs @@ -90,7 +90,7 @@ fn main() { }; let struct_ref = &a_struct; - let owned = box 6; + let owned: Box<_> = box 6; { let mut first_closure = || { diff --git a/src/test/run-pass/autoderef-method-on-trait.rs b/src/test/run-pass/autoderef-method-on-trait.rs index 9e88eb6da6a..8121edfd2cc 100644 --- a/src/test/run-pass/autoderef-method-on-trait.rs +++ b/src/test/run-pass/autoderef-method-on-trait.rs @@ -20,6 +20,6 @@ impl double for uint { } pub fn main() { - let x = box() (box 3_usize as Box); + let x: Box<_> = box() (box 3_usize as Box); assert_eq!(x.double(), 6_usize); } diff --git a/src/test/run-pass/autoderef-method-priority.rs b/src/test/run-pass/autoderef-method-priority.rs index 67dd25ddc53..537894bfd15 100644 --- a/src/test/run-pass/autoderef-method-priority.rs +++ b/src/test/run-pass/autoderef-method-priority.rs @@ -24,6 +24,6 @@ impl double for Box { } pub fn main() { - let x = box 3_usize; + let x: Box<_> = box 3_usize; assert_eq!(x.double(), 6_usize); } diff --git a/src/test/run-pass/autoderef-method-twice-but-not-thrice.rs b/src/test/run-pass/autoderef-method-twice-but-not-thrice.rs index 6437c78161c..2ffdd576ffb 100644 --- a/src/test/run-pass/autoderef-method-twice-but-not-thrice.rs +++ b/src/test/run-pass/autoderef-method-twice-but-not-thrice.rs @@ -20,6 +20,6 @@ impl double for Box { } pub fn main() { - let x = box box box box box 3_usize; + let x: Box>>>> = box box box box box 3_usize; assert_eq!(x.double(), 6_usize); } diff --git a/src/test/run-pass/autoderef-method-twice.rs b/src/test/run-pass/autoderef-method-twice.rs index 8cbc151f0cd..82510aea162 100644 --- a/src/test/run-pass/autoderef-method-twice.rs +++ b/src/test/run-pass/autoderef-method-twice.rs @@ -20,6 +20,6 @@ impl double for uint { } pub fn main() { - let x = box box 3_usize; + let x: Box> = box box 3_usize; assert_eq!(x.double(), 6_usize); } diff --git a/src/test/run-pass/autoderef-method.rs b/src/test/run-pass/autoderef-method.rs index c8fa3c9fd5f..c9aa1133101 100644 --- a/src/test/run-pass/autoderef-method.rs +++ b/src/test/run-pass/autoderef-method.rs @@ -20,6 +20,6 @@ impl double for uint { } pub fn main() { - let x = box 3_usize; + let x: Box<_> = box 3_usize; assert_eq!(x.double(), 6_usize); } diff --git a/src/test/run-pass/autoref-intermediate-types-issue-3585.rs b/src/test/run-pass/autoref-intermediate-types-issue-3585.rs index 87157b9334f..6e6e58a7ddf 100644 --- a/src/test/run-pass/autoref-intermediate-types-issue-3585.rs +++ b/src/test/run-pass/autoref-intermediate-types-issue-3585.rs @@ -29,6 +29,6 @@ impl Foo for uint { } pub fn main() { - let x = box 3_usize; + let x: Box<_> = box 3_usize; assert_eq!(x.foo(), "box 3".to_string()); } diff --git a/src/test/run-pass/bitv-perf-test.rs b/src/test/run-pass/bitv-perf-test.rs index 7bb9f042fe8..24bfbd9eb44 100644 --- a/src/test/run-pass/bitv-perf-test.rs +++ b/src/test/run-pass/bitv-perf-test.rs @@ -16,8 +16,8 @@ extern crate collections; use std::collections::BitVec; fn bitv_test() { - let mut v1 = box BitVec::from_elem(31, false); - let v2 = box BitVec::from_elem(31, true); + let mut v1: Box<_> = box BitVec::from_elem(31, false); + let v2: Box<_> = box BitVec::from_elem(31, true); v1.union(&*v2); } diff --git a/src/test/run-pass/borrowck-move-by-capture-ok.rs b/src/test/run-pass/borrowck-move-by-capture-ok.rs index 1be57674fa1..27fbfc96410 100644 --- a/src/test/run-pass/borrowck-move-by-capture-ok.rs +++ b/src/test/run-pass/borrowck-move-by-capture-ok.rs @@ -13,7 +13,7 @@ #![feature(unboxed_closures)] pub fn main() { - let bar = box 3; + let bar: Box<_> = box 3; let h = || -> int *bar; assert_eq!(h(), 3); } diff --git a/src/test/run-pass/borrowck-mut-uniq.rs b/src/test/run-pass/borrowck-mut-uniq.rs index 2dbaec8fbb1..499650a6e51 100644 --- a/src/test/run-pass/borrowck-mut-uniq.rs +++ b/src/test/run-pass/borrowck-mut-uniq.rs @@ -30,7 +30,7 @@ fn iter_ints(x: &Ints, mut f: F) -> bool where F: FnMut(&int) -> bool { } pub fn main() { - let mut ints = box Ints {sum: box 0, values: Vec::new()}; + let mut ints: Box<_> = box Ints {sum: box 0, values: Vec::new()}; add_int(&mut *ints, 22); add_int(&mut *ints, 44); diff --git a/src/test/run-pass/cci_borrow.rs b/src/test/run-pass/cci_borrow.rs index 00c600ed006..89babb8f722 100644 --- a/src/test/run-pass/cci_borrow.rs +++ b/src/test/run-pass/cci_borrow.rs @@ -17,7 +17,7 @@ extern crate cci_borrow_lib; use cci_borrow_lib::foo; pub fn main() { - let p = box 22_usize; + let p: Box<_> = box 22_usize; let r = foo(&*p); println!("r={}", r); assert_eq!(r, 22_usize); diff --git a/src/test/run-pass/cleanup-rvalue-temp-during-incomplete-alloc.rs b/src/test/run-pass/cleanup-rvalue-temp-during-incomplete-alloc.rs index 96ae7e3d336..ff883294fd3 100644 --- a/src/test/run-pass/cleanup-rvalue-temp-during-incomplete-alloc.rs +++ b/src/test/run-pass/cleanup-rvalue-temp-during-incomplete-alloc.rs @@ -43,7 +43,7 @@ fn get_bar(x: uint) -> Vec { vec!(x * 2) } pub fn fails() { let x = 2; - let mut y = Vec::new(); + let mut y: Vec> = Vec::new(); y.push(box Conzabble::Bickwick(do_it(&get_bar(x)))); } diff --git a/src/test/run-pass/clone-with-exterior.rs b/src/test/run-pass/clone-with-exterior.rs index 8eeae7a28ac..5cc567cb14c 100644 --- a/src/test/run-pass/clone-with-exterior.rs +++ b/src/test/run-pass/clone-with-exterior.rs @@ -19,7 +19,7 @@ struct Pair { } pub fn main() { - let z = box Pair { a : 10, b : 12}; + let z: Box<_> = box Pair { a : 10, b : 12}; let _t = Thread::spawn(move|| { assert_eq!(z.a, 10); diff --git a/src/test/run-pass/coerce-match.rs b/src/test/run-pass/coerce-match.rs index 098a08b0787..2592957b738 100644 --- a/src/test/run-pass/coerce-match.rs +++ b/src/test/run-pass/coerce-match.rs @@ -14,9 +14,13 @@ #![feature(box_syntax)] pub fn main() { - let _: Box<[int]> = if true { box [1, 2, 3] } else { box [1] }; + let _: Box<[int]> = + if true { let b: Box<_> = box [1, 2, 3]; b } else { let b: Box<_> = box [1]; b }; - let _: Box<[int]> = match true { true => box [1, 2, 3], false => box [1] }; + let _: Box<[int]> = match true { + true => { let b: Box<_> = box [1, 2, 3]; b } + false => { let b: Box<_> = box [1]; b } + }; // Check we don't get over-keen at propagating coercions in the case of casts. let x = if true { 42 } else { 42u8 } as u16; diff --git a/src/test/run-pass/crate-method-reexport-grrrrrrr.rs b/src/test/run-pass/crate-method-reexport-grrrrrrr.rs index 1a3e87b55b6..043bfe429ad 100644 --- a/src/test/run-pass/crate-method-reexport-grrrrrrr.rs +++ b/src/test/run-pass/crate-method-reexport-grrrrrrr.rs @@ -22,7 +22,7 @@ extern crate crate_method_reexport_grrrrrrr2; pub fn main() { use crate_method_reexport_grrrrrrr2::rust::add; use crate_method_reexport_grrrrrrr2::rust::cx; - let x = box() (); + let x: Box<_> = box () (); x.cx(); let y = (); y.add("hi".to_string()); diff --git a/src/test/run-pass/deref-lval.rs b/src/test/run-pass/deref-lval.rs index 41c74250b3b..fc97b22a4a9 100644 --- a/src/test/run-pass/deref-lval.rs +++ b/src/test/run-pass/deref-lval.rs @@ -14,7 +14,7 @@ use std::cell::Cell; pub fn main() { - let x = box Cell::new(5); + let x: Box<_> = box Cell::new(5); x.set(1000); println!("{}", x.get()); } diff --git a/src/test/run-pass/explicit-self-generic.rs b/src/test/run-pass/explicit-self-generic.rs index 382c5c58e92..865fccbc3fa 100644 --- a/src/test/run-pass/explicit-self-generic.rs +++ b/src/test/run-pass/explicit-self-generic.rs @@ -33,6 +33,6 @@ impl HashMap { } pub fn main() { - let mut m = box linear_map::<(),()>(); + let mut m: Box<_> = box linear_map::<(),()>(); assert_eq!(m.len(), 0); } diff --git a/src/test/run-pass/explicit-self.rs b/src/test/run-pass/explicit-self.rs index e5d8ec3f8ad..3d06a556203 100644 --- a/src/test/run-pass/explicit-self.rs +++ b/src/test/run-pass/explicit-self.rs @@ -70,7 +70,7 @@ trait Nus { fn f(&self); } impl Nus for thing { fn f(&self) {} } pub fn main() { - let y = box thing(A {a: 10}); + let y: Box<_> = box thing(A {a: 10}); assert_eq!(y.clone().bar(), 10); assert_eq!(y.quux(), 10); diff --git a/src/test/run-pass/expr-block-unique.rs b/src/test/run-pass/expr-block-unique.rs index d10b209965f..d7d5a39f452 100644 --- a/src/test/run-pass/expr-block-unique.rs +++ b/src/test/run-pass/expr-block-unique.rs @@ -12,4 +12,4 @@ #![allow(unknown_features)] #![feature(box_syntax)] -pub fn main() { let x = { box 100 }; assert!((*x == 100)); } +pub fn main() { let x: Box<_> = { box 100 }; assert!((*x == 100)); } diff --git a/src/test/run-pass/expr-if-unique.rs b/src/test/run-pass/expr-if-unique.rs index 317e5434930..a5816127798 100644 --- a/src/test/run-pass/expr-if-unique.rs +++ b/src/test/run-pass/expr-if-unique.rs @@ -15,7 +15,7 @@ // Tests for if as expressions returning boxed types fn test_box() { - let rs = if true { box 100 } else { box 101 }; + let rs: Box<_> = if true { box 100 } else { box 101 }; assert_eq!(*rs, 100); } diff --git a/src/test/run-pass/expr-match-unique.rs b/src/test/run-pass/expr-match-unique.rs index 57ccfe1d5e0..9641cacddc0 100644 --- a/src/test/run-pass/expr-match-unique.rs +++ b/src/test/run-pass/expr-match-unique.rs @@ -13,7 +13,7 @@ // Tests for match as expressions resulting in boxed types fn test_box() { - let res = match true { true => { box 100 }, _ => panic!() }; + let res: Box<_> = match true { true => { box 100 }, _ => panic!() }; assert_eq!(*res, 100); } diff --git a/src/test/run-pass/func-arg-incomplete-pattern.rs b/src/test/run-pass/func-arg-incomplete-pattern.rs index b23d8db3cfd..581f71a7376 100644 --- a/src/test/run-pass/func-arg-incomplete-pattern.rs +++ b/src/test/run-pass/func-arg-incomplete-pattern.rs @@ -25,7 +25,7 @@ fn foo(Foo {x, ..}: Foo) -> *const uint { } pub fn main() { - let obj = box 1; + let obj: Box<_> = box 1; let objptr: *const uint = &*obj; let f = Foo {x: obj, y: box 2}; let xptr = foo(f); diff --git a/src/test/run-pass/func-arg-ref-pattern.rs b/src/test/run-pass/func-arg-ref-pattern.rs index 5d44a9461be..799b865bd2d 100644 --- a/src/test/run-pass/func-arg-ref-pattern.rs +++ b/src/test/run-pass/func-arg-ref-pattern.rs @@ -28,7 +28,7 @@ fn checkval(box ref x: Box) -> uint { } pub fn main() { - let obj = box 1; + let obj: Box<_> = box 1; let objptr: *const uint = &*obj; let xptr = getaddr(obj); assert_eq!(objptr, xptr); diff --git a/src/test/run-pass/generic-alias-unique.rs b/src/test/run-pass/generic-alias-unique.rs index db468ba1802..42062b89cfd 100644 --- a/src/test/run-pass/generic-alias-unique.rs +++ b/src/test/run-pass/generic-alias-unique.rs @@ -14,7 +14,7 @@ fn id(t: T) -> T { return t; } pub fn main() { - let expected = box 100; + let expected: Box<_> = box 100; let actual = id::>(expected.clone()); println!("{}", *actual); assert_eq!(*expected, *actual); diff --git a/src/test/run-pass/ifmt.rs b/src/test/run-pass/ifmt.rs index 62b8ff528a5..41c859214e9 100644 --- a/src/test/run-pass/ifmt.rs +++ b/src/test/run-pass/ifmt.rs @@ -154,7 +154,7 @@ pub fn main() { test_order(); // make sure that format! doesn't move out of local variables - let a = box 3; + let a: Box<_> = box 3; format!("{}", a); format!("{}", a); diff --git a/src/test/run-pass/init-res-into-things.rs b/src/test/run-pass/init-res-into-things.rs index ee793359fbc..4ee06d44e65 100644 --- a/src/test/run-pass/init-res-into-things.rs +++ b/src/test/run-pass/init-res-into-things.rs @@ -67,7 +67,7 @@ fn test_tup() { fn test_unique() { let i = &Cell::new(0); { - let _a = box r(i); + let _a: Box<_> = box r(i); } assert_eq!(i.get(), 1); } @@ -75,7 +75,7 @@ fn test_unique() { fn test_unique_rec() { let i = &Cell::new(0); { - let _a = box BoxR { + let _a: Box<_> = box BoxR { x: r(i) }; } diff --git a/src/test/run-pass/intrinsic-atomics.rs b/src/test/run-pass/intrinsic-atomics.rs index d3f62f9d04a..1d7a74b042f 100644 --- a/src/test/run-pass/intrinsic-atomics.rs +++ b/src/test/run-pass/intrinsic-atomics.rs @@ -40,7 +40,7 @@ mod rusti { pub fn main() { unsafe { - let mut x = box 1; + let mut x: Box<_> = box 1; assert_eq!(rusti::atomic_load(&*x), 1); *x = 5; diff --git a/src/test/run-pass/intrinsic-move-val.rs b/src/test/run-pass/intrinsic-move-val.rs index 0daf661c2f6..09dd5304ec5 100644 --- a/src/test/run-pass/intrinsic-move-val.rs +++ b/src/test/run-pass/intrinsic-move-val.rs @@ -23,7 +23,7 @@ mod rusti { pub fn main() { unsafe { - let x = box 1; + let x: Box<_> = box 1; let mut y = rusti::init(); let mut z: *const uint = transmute(&x); rusti::move_val_init(&mut y, x); diff --git a/src/test/run-pass/issue-10802.rs b/src/test/run-pass/issue-10802.rs index 174a69e1135..48ea00e47d6 100644 --- a/src/test/run-pass/issue-10802.rs +++ b/src/test/run-pass/issue-10802.rs @@ -42,13 +42,13 @@ impl Whatever { fn main() { { - let f = box DroppableStruct; + let f: Box<_> = box DroppableStruct; let _a = Whatever::new(box f as Box); } assert!(unsafe { DROPPED }); unsafe { DROPPED = false; } { - let f = box DroppableEnum::DroppableVariant1; + let f: Box<_> = box DroppableEnum::DroppableVariant1; let _a = Whatever::new(box f as Box); } assert!(unsafe { DROPPED }); diff --git a/src/test/run-pass/issue-14399.rs b/src/test/run-pass/issue-14399.rs index db7eacce9d1..d413e323a09 100644 --- a/src/test/run-pass/issue-14399.rs +++ b/src/test/run-pass/issue-14399.rs @@ -23,6 +23,6 @@ trait A { fn foo(&self) {} } impl A for B1 {} fn main() { - let v = box B1; + let v: Box<_> = box B1; let _c: Box = v.clone(); } diff --git a/src/test/run-pass/issue-2633-2.rs b/src/test/run-pass/issue-2633-2.rs index 80e9ca47025..0bef42b6202 100644 --- a/src/test/run-pass/issue-2633-2.rs +++ b/src/test/run-pass/issue-2633-2.rs @@ -17,6 +17,6 @@ fn a_val(x: Box, y: Box) -> int { } pub fn main() { - let z = box 22; + let z: Box<_> = box 22; a_val(z.clone(), z.clone()); } diff --git a/src/test/run-pass/issue-2708.rs b/src/test/run-pass/issue-2708.rs index 1f072af0f5a..6aeec228c0d 100644 --- a/src/test/run-pass/issue-2708.rs +++ b/src/test/run-pass/issue-2708.rs @@ -31,5 +31,5 @@ fn Font() -> Font { } pub fn main() { - let _f = box Font(); + let _f: Box<_> = box Font(); } diff --git a/src/test/run-pass/issue-2935.rs b/src/test/run-pass/issue-2935.rs index 31599d0caad..e653dda8de5 100644 --- a/src/test/run-pass/issue-2935.rs +++ b/src/test/run-pass/issue-2935.rs @@ -28,7 +28,7 @@ pub fn main() { // let y = box ({a: 4}); // let z = box ({a: 4} as it); // let z = box ({a: true} as it); - let z = box() (box true as Box); + let z: Box<_> = box () (box true as Box); // x.f(); // y.f(); // (*z).f(); diff --git a/src/test/run-pass/issue-3012-2.rs b/src/test/run-pass/issue-3012-2.rs index de2d4374d78..6f107a37e9b 100644 --- a/src/test/run-pass/issue-3012-2.rs +++ b/src/test/run-pass/issue-3012-2.rs @@ -20,5 +20,5 @@ use socketlib::socket; pub fn main() { let fd: libc::c_int = 1 as libc::c_int; - let _sock = box socket::socket_handle(fd); + let _sock: Box<_> = box socket::socket_handle(fd); } diff --git a/src/test/run-pass/issue-3026.rs b/src/test/run-pass/issue-3026.rs index 25663f2605f..98c9f3d5ec5 100644 --- a/src/test/run-pass/issue-3026.rs +++ b/src/test/run-pass/issue-3026.rs @@ -17,7 +17,7 @@ extern crate collections; use std::collections::HashMap; pub fn main() { - let x; + let x: Box<_>; let mut buggy_map: HashMap = HashMap::new(); x = box 1; buggy_map.insert(42, &*x); diff --git a/src/test/run-pass/issue-3290.rs b/src/test/run-pass/issue-3290.rs index c8d6e69801f..1c1b329e314 100644 --- a/src/test/run-pass/issue-3290.rs +++ b/src/test/run-pass/issue-3290.rs @@ -12,7 +12,7 @@ #![feature(box_syntax)] pub fn main() { - let mut x = box 3; + let mut x: Box<_> = box 3; x = x; assert_eq!(*x, 3); } diff --git a/src/test/run-pass/issue-3878.rs b/src/test/run-pass/issue-3878.rs index c1d19f228db..1f53d9ce542 100644 --- a/src/test/run-pass/issue-3878.rs +++ b/src/test/run-pass/issue-3878.rs @@ -13,6 +13,6 @@ #![feature(box_syntax)] pub fn main() { - let y = box 1; + let y: Box<_> = box 1; y; } diff --git a/src/test/run-pass/issue-5718.rs b/src/test/run-pass/issue-5718.rs index 36aa8a9cbca..7e773cd7994 100644 --- a/src/test/run-pass/issue-5718.rs +++ b/src/test/run-pass/issue-5718.rs @@ -16,7 +16,7 @@ struct Element; macro_rules! foo { ($tag: expr, $string: expr) => { if $tag == $string { - let element = box Element; + let element: Box<_> = box Element; unsafe { return std::mem::transmute::<_, uint>(element); } diff --git a/src/test/run-pass/last-use-is-capture.rs b/src/test/run-pass/last-use-is-capture.rs index 19a780d180f..7b11aae168c 100644 --- a/src/test/run-pass/last-use-is-capture.rs +++ b/src/test/run-pass/last-use-is-capture.rs @@ -17,7 +17,7 @@ struct A { a: Box } pub fn main() { fn invoke(f: F) where F: FnOnce() { f(); } - let k = box 22; + let k: Box<_> = box 22; let _u = A {a: k.clone()}; invoke(|| println!("{}", k.clone()) ) } diff --git a/src/test/run-pass/let-assignability.rs b/src/test/run-pass/let-assignability.rs index 9ac016d534f..1500edce779 100644 --- a/src/test/run-pass/let-assignability.rs +++ b/src/test/run-pass/let-assignability.rs @@ -12,7 +12,7 @@ #![feature(box_syntax)] fn f() { - let a = box 1; + let a: Box<_> = box 1; let b: &int = &*a; println!("{}", b); } diff --git a/src/test/run-pass/match-implicit-copy-unique.rs b/src/test/run-pass/match-implicit-copy-unique.rs index 6883187c402..cd4802f4b39 100644 --- a/src/test/run-pass/match-implicit-copy-unique.rs +++ b/src/test/run-pass/match-implicit-copy-unique.rs @@ -14,7 +14,7 @@ struct Pair { a: Box, b: Box } pub fn main() { - let mut x = box Pair {a: box 10, b: box 20}; + let mut x: Box<_> = box Pair {a: box 10, b: box 20}; let x_internal = &mut *x; match *x_internal { Pair {a: ref mut a, b: ref mut _b} => { diff --git a/src/test/run-pass/method-two-trait-defer-resolution-2.rs b/src/test/run-pass/method-two-trait-defer-resolution-2.rs index 7463783be59..a49ce826170 100644 --- a/src/test/run-pass/method-two-trait-defer-resolution-2.rs +++ b/src/test/run-pass/method-two-trait-defer-resolution-2.rs @@ -39,7 +39,7 @@ fn call_foo_copy() -> int { } fn call_foo_other() -> int { - let mut x = Vec::new(); + let mut x: Vec> = Vec::new(); let y = x.foo(); x.push(box 0); y diff --git a/src/test/run-pass/move-1-unique.rs b/src/test/run-pass/move-1-unique.rs index 018cd440cad..ff06df079b0 100644 --- a/src/test/run-pass/move-1-unique.rs +++ b/src/test/run-pass/move-1-unique.rs @@ -26,7 +26,7 @@ fn test(x: bool, foo: Box) -> int { } pub fn main() { - let x = box Triple{x: 1, y: 2, z: 3}; + let x: Box<_> = box Triple{x: 1, y: 2, z: 3}; assert_eq!(test(true, x.clone()), 2); assert_eq!(test(true, x.clone()), 2); assert_eq!(test(true, x.clone()), 2); diff --git a/src/test/run-pass/move-2-unique.rs b/src/test/run-pass/move-2-unique.rs index 50187ef8baa..590caff3c2d 100644 --- a/src/test/run-pass/move-2-unique.rs +++ b/src/test/run-pass/move-2-unique.rs @@ -14,7 +14,7 @@ struct X { x: int, y: int, z: int } pub fn main() { - let x = box X{x: 1, y: 2, z: 3}; + let x: Box<_> = box X{x: 1, y: 2, z: 3}; let y = x; assert!((y.y == 2)); } diff --git a/src/test/run-pass/move-2.rs b/src/test/run-pass/move-2.rs index 6561a9b2d5b..0bff2c2292e 100644 --- a/src/test/run-pass/move-2.rs +++ b/src/test/run-pass/move-2.rs @@ -13,4 +13,4 @@ struct X { x: int, y: int, z: int } -pub fn main() { let x = box X {x: 1, y: 2, z: 3}; let y = x; assert!((y.y == 2)); } +pub fn main() { let x: Box<_> = box X {x: 1, y: 2, z: 3}; let y = x; assert!((y.y == 2)); } diff --git a/src/test/run-pass/move-3-unique.rs b/src/test/run-pass/move-3-unique.rs index 07d0594b494..8241424124e 100644 --- a/src/test/run-pass/move-3-unique.rs +++ b/src/test/run-pass/move-3-unique.rs @@ -26,7 +26,7 @@ fn test(x: bool, foo: Box) -> int { } pub fn main() { - let x = box Triple{x: 1, y: 2, z: 3}; + let x: Box<_> = box Triple{x: 1, y: 2, z: 3}; for _ in 0_usize..10000_usize { assert_eq!(test(true, x.clone()), 2); } diff --git a/src/test/run-pass/move-guard-const.rs b/src/test/run-pass/move-guard-const.rs index 64c4f1fdbae..d68a7c831f2 100644 --- a/src/test/run-pass/move-guard-const.rs +++ b/src/test/run-pass/move-guard-const.rs @@ -11,7 +11,7 @@ #![feature(box_syntax)] fn main() { - let x = box 1; + let x: Box<_> = box 1; let v = (1, 2); diff --git a/src/test/run-pass/overloaded-index-autoderef.rs b/src/test/run-pass/overloaded-index-autoderef.rs index d5ccf8cd2be..8f655f0517d 100644 --- a/src/test/run-pass/overloaded-index-autoderef.rs +++ b/src/test/run-pass/overloaded-index-autoderef.rs @@ -55,7 +55,7 @@ impl Int for int { } fn main() { - let mut f = box Foo { + let mut f: Box<_> = box Foo { x: 1, y: 2, }; diff --git a/src/test/run-pass/pure-sum.rs b/src/test/run-pass/pure-sum.rs index f7adb0f6e44..1fd83041f62 100644 --- a/src/test/run-pass/pure-sum.rs +++ b/src/test/run-pass/pure-sum.rs @@ -25,7 +25,7 @@ fn sums_to(v: Vec , sum: int) -> bool { fn sums_to_using_uniq(v: Vec , sum: int) -> bool { let mut i = 0_usize; - let mut sum0 = box 0; + let mut sum0: Box<_> = box 0; while i < v.len() { *sum0 += v[i]; i += 1_usize; @@ -47,7 +47,7 @@ struct F { f: T } fn sums_to_using_uniq_rec(v: Vec , sum: int) -> bool { let mut i = 0_usize; - let mut sum0 = F {f: box 0}; + let mut sum0 = F::> {f: box 0}; while i < v.len() { *sum0.f += v[i]; i += 1_usize; diff --git a/src/test/run-pass/rcvr-borrowed-to-region.rs b/src/test/run-pass/rcvr-borrowed-to-region.rs index 84a230fd576..7bc761d2f60 100644 --- a/src/test/run-pass/rcvr-borrowed-to-region.rs +++ b/src/test/run-pass/rcvr-borrowed-to-region.rs @@ -25,7 +25,7 @@ impl<'a> get for &'a int { } pub fn main() { - let x = box 6; + let x: Box<_> = box 6; let y = x.get(); println!("y={}", y); assert_eq!(y, 6); diff --git a/src/test/run-pass/regions-borrow-at.rs b/src/test/run-pass/regions-borrow-at.rs index 89779fa4d2d..1e91ab7e921 100644 --- a/src/test/run-pass/regions-borrow-at.rs +++ b/src/test/run-pass/regions-borrow-at.rs @@ -16,7 +16,7 @@ fn foo(x: &uint) -> uint { } pub fn main() { - let p = box 22_usize; + let p: Box<_> = box 22_usize; let r = foo(&*p); println!("r={}", r); assert_eq!(r, 22_usize); diff --git a/src/test/run-pass/regions-borrow-uniq.rs b/src/test/run-pass/regions-borrow-uniq.rs index a1af7159a93..7c9b1ae226f 100644 --- a/src/test/run-pass/regions-borrow-uniq.rs +++ b/src/test/run-pass/regions-borrow-uniq.rs @@ -16,7 +16,7 @@ fn foo(x: &uint) -> uint { } pub fn main() { - let p = box 3_usize; + let p: Box<_> = box 3_usize; let r = foo(&*p); assert_eq!(r, 3_usize); } diff --git a/src/test/run-pass/regions-escape-into-other-fn.rs b/src/test/run-pass/regions-escape-into-other-fn.rs index b15f9d34859..0ca17e218d2 100644 --- a/src/test/run-pass/regions-escape-into-other-fn.rs +++ b/src/test/run-pass/regions-escape-into-other-fn.rs @@ -15,6 +15,6 @@ fn foo(x: &uint) -> &uint { x } fn bar(x: &uint) -> uint { *x } pub fn main() { - let p = box 3_usize; + let p: Box<_> = box 3_usize; assert_eq!(bar(foo(&*p)), 3); } diff --git a/src/test/run-pass/regions-infer-borrow-scope-within-loop-ok.rs b/src/test/run-pass/regions-infer-borrow-scope-within-loop-ok.rs index d07110fd721..86f4f2dd18e 100644 --- a/src/test/run-pass/regions-infer-borrow-scope-within-loop-ok.rs +++ b/src/test/run-pass/regions-infer-borrow-scope-within-loop-ok.rs @@ -14,7 +14,7 @@ fn borrow(x: &T) -> &T {x} pub fn main() { - let x = box 3; + let x: Box<_> = box 3; loop { let y = borrow(&*x); assert_eq!(*x, *y); diff --git a/src/test/run-pass/regions-infer-borrow-scope.rs b/src/test/run-pass/regions-infer-borrow-scope.rs index 708d031a68a..ebbc5b70f60 100644 --- a/src/test/run-pass/regions-infer-borrow-scope.rs +++ b/src/test/run-pass/regions-infer-borrow-scope.rs @@ -18,7 +18,7 @@ fn x_coord(p: &Point) -> &int { } pub fn main() { - let p = box Point {x: 3, y: 4}; + let p: Box<_> = box Point {x: 3, y: 4}; let xc = x_coord(&*p); assert_eq!(*xc, 3); } diff --git a/src/test/run-pass/self-in-mut-slot-default-method.rs b/src/test/run-pass/self-in-mut-slot-default-method.rs index e934498ea05..92582177989 100644 --- a/src/test/run-pass/self-in-mut-slot-default-method.rs +++ b/src/test/run-pass/self-in-mut-slot-default-method.rs @@ -40,7 +40,7 @@ pub fn main() { let new_x = x.change(); assert_eq!(new_x.a, 55); - let x = box new_x; + let x: Box<_> = box new_x; let new_x = x.change_again(); assert_eq!(new_x.a, 45); } diff --git a/src/test/run-pass/self-re-assign.rs b/src/test/run-pass/self-re-assign.rs index cf09737e32e..b71b907fcf0 100644 --- a/src/test/run-pass/self-re-assign.rs +++ b/src/test/run-pass/self-re-assign.rs @@ -17,7 +17,7 @@ use std::rc::Rc; pub fn main() { - let mut x = box 3; + let mut x: Box<_> = box 3; x = x; assert!(*x == 3); diff --git a/src/test/run-pass/sendfn-spawn-with-fn-arg.rs b/src/test/run-pass/sendfn-spawn-with-fn-arg.rs index 523b7528103..264ee5f55b9 100644 --- a/src/test/run-pass/sendfn-spawn-with-fn-arg.rs +++ b/src/test/run-pass/sendfn-spawn-with-fn-arg.rs @@ -20,7 +20,7 @@ fn test05_start(f: F) { } fn test05() { - let three = box 3; + let three: Box<_> = box 3; let fn_to_send = move|n:int| { println!("{}", *three + n); // will copy x into the closure assert_eq!(*three, 3); diff --git a/src/test/run-pass/task-spawn-move-and-copy.rs b/src/test/run-pass/task-spawn-move-and-copy.rs index ca2a8cf5506..46f9e991347 100644 --- a/src/test/run-pass/task-spawn-move-and-copy.rs +++ b/src/test/run-pass/task-spawn-move-and-copy.rs @@ -17,7 +17,7 @@ use std::sync::mpsc::channel; pub fn main() { let (tx, rx) = channel::(); - let x = box 1; + let x: Box<_> = box 1; let x_in_parent = &(*x) as *const int as uint; let _t = Thread::spawn(move || { diff --git a/src/test/run-pass/type-param-constraints.rs b/src/test/run-pass/type-param-constraints.rs index 7d1fad5d281..432dbd72a29 100644 --- a/src/test/run-pass/type-param-constraints.rs +++ b/src/test/run-pass/type-param-constraints.rs @@ -32,13 +32,13 @@ fn r(i:int) -> r { pub fn main() { p_foo(r(10)); - p_foo(box r(10)); - p_foo(box 10); + p_foo::>(box r(10)); + p_foo::>(box 10); p_foo(10); - s_foo(box 10); + s_foo::>(box 10); s_foo(10); - u_foo(box 10); + u_foo::>(box 10); u_foo(10); } diff --git a/src/test/run-pass/ufcs-explicit-self.rs b/src/test/run-pass/ufcs-explicit-self.rs index 2be9f75dae1..832c1f8802d 100644 --- a/src/test/run-pass/ufcs-explicit-self.rs +++ b/src/test/run-pass/ufcs-explicit-self.rs @@ -46,11 +46,11 @@ impl Bar { } fn main() { - let foo = box Foo { + let foo: Box<_> = box Foo { f: 1, }; println!("{} {} {}", foo.foo(2), foo.bar(2), foo.baz(2)); - let bar = box Bar { + let bar: Box<_> = box Bar { f: 1, }; println!("{} {} {}", bar.foo(2), bar.bar(2), bar.baz(2)); diff --git a/src/test/run-pass/uniq-self-in-mut-slot.rs b/src/test/run-pass/uniq-self-in-mut-slot.rs index b7980ed9021..d44a8cdcc24 100644 --- a/src/test/run-pass/uniq-self-in-mut-slot.rs +++ b/src/test/run-pass/uniq-self-in-mut-slot.rs @@ -27,7 +27,7 @@ impl Changer for X { } pub fn main() { - let x = box X { a: 32 }; + let x: Box<_> = box X { a: 32 }; let new_x = x.change(); assert_eq!(new_x.a, 55); } diff --git a/src/test/run-pass/unique-assign-copy.rs b/src/test/run-pass/unique-assign-copy.rs index c19063fe464..78578bdb3c3 100644 --- a/src/test/run-pass/unique-assign-copy.rs +++ b/src/test/run-pass/unique-assign-copy.rs @@ -12,7 +12,7 @@ #![feature(box_syntax)] pub fn main() { - let mut i = box 1; + let mut i: Box<_> = box 1; // Should be a copy let mut j; j = i.clone(); diff --git a/src/test/run-pass/unique-assign-drop.rs b/src/test/run-pass/unique-assign-drop.rs index 241258f089c..9edd83d2c7c 100644 --- a/src/test/run-pass/unique-assign-drop.rs +++ b/src/test/run-pass/unique-assign-drop.rs @@ -13,8 +13,8 @@ #![feature(box_syntax)] pub fn main() { - let i = box 1; - let mut j = box 2; + let i: Box<_> = box 1; + let mut j: Box<_> = box 2; // Should drop the previous value of j j = i; assert_eq!(*j, 1); diff --git a/src/test/run-pass/unique-assign-generic.rs b/src/test/run-pass/unique-assign-generic.rs index c8abb080848..64f8b998096 100644 --- a/src/test/run-pass/unique-assign-generic.rs +++ b/src/test/run-pass/unique-assign-generic.rs @@ -18,6 +18,6 @@ fn f(t: T) -> T { } pub fn main() { - let t = f(box 100); + let t = f::>(box 100); assert_eq!(t, box 100); } diff --git a/src/test/run-pass/unique-assign.rs b/src/test/run-pass/unique-assign.rs index cbcb6afb4c8..c9cbaf27c4f 100644 --- a/src/test/run-pass/unique-assign.rs +++ b/src/test/run-pass/unique-assign.rs @@ -12,7 +12,7 @@ #![feature(box_syntax)] pub fn main() { - let mut i; + let mut i: Box<_>; i = box 1; assert_eq!(*i, 1); } diff --git a/src/test/run-pass/unique-autoderef-field.rs b/src/test/run-pass/unique-autoderef-field.rs index aab7f4108fb..3bab3a6b79a 100644 --- a/src/test/run-pass/unique-autoderef-field.rs +++ b/src/test/run-pass/unique-autoderef-field.rs @@ -14,7 +14,7 @@ struct J { j: int } pub fn main() { - let i = box J { + let i: Box<_> = box J { j: 100 }; assert_eq!(i.j, 100); diff --git a/src/test/run-pass/unique-autoderef-index.rs b/src/test/run-pass/unique-autoderef-index.rs index 30c4b2d7b56..1c944473921 100644 --- a/src/test/run-pass/unique-autoderef-index.rs +++ b/src/test/run-pass/unique-autoderef-index.rs @@ -12,6 +12,6 @@ #![feature(box_syntax)] pub fn main() { - let i = box vec!(100); + let i: Box<_> = box vec!(100); assert_eq!((*i)[0], 100); } diff --git a/src/test/run-pass/unique-cmp.rs b/src/test/run-pass/unique-cmp.rs index a2962dc00d5..8fe86455b45 100644 --- a/src/test/run-pass/unique-cmp.rs +++ b/src/test/run-pass/unique-cmp.rs @@ -12,7 +12,7 @@ #![feature(box_syntax)] pub fn main() { - let i = box 100; + let i: Box<_> = box 100; assert!(i == box 100); assert!(i < box 101); assert!(i <= box 100); diff --git a/src/test/run-pass/unique-containing-tag.rs b/src/test/run-pass/unique-containing-tag.rs index e4099c94c2f..cb6e84ae1aa 100644 --- a/src/test/run-pass/unique-containing-tag.rs +++ b/src/test/run-pass/unique-containing-tag.rs @@ -14,7 +14,7 @@ pub fn main() { enum t { t1(int), t2(int), } - let _x = box t::t1(10); + let _x: Box<_> = box t::t1(10); /*alt *x { t1(a) { diff --git a/src/test/run-pass/unique-create.rs b/src/test/run-pass/unique-create.rs index 975f1e9da82..7264b9fee95 100644 --- a/src/test/run-pass/unique-create.rs +++ b/src/test/run-pass/unique-create.rs @@ -12,7 +12,7 @@ #![feature(box_syntax)] pub fn main() { - box 100; + let _: Box<_> = box 100; } fn vec() { diff --git a/src/test/run-pass/unique-decl-init-copy.rs b/src/test/run-pass/unique-decl-init-copy.rs index 3af38784add..14bb72f4412 100644 --- a/src/test/run-pass/unique-decl-init-copy.rs +++ b/src/test/run-pass/unique-decl-init-copy.rs @@ -12,7 +12,7 @@ #![feature(box_syntax)] pub fn main() { - let mut i = box 1; + let mut i: Box<_> = box 1; // Should be a copy let mut j = i.clone(); *i = 2; diff --git a/src/test/run-pass/unique-decl-init.rs b/src/test/run-pass/unique-decl-init.rs index c9192748809..803e7ba16ed 100644 --- a/src/test/run-pass/unique-decl-init.rs +++ b/src/test/run-pass/unique-decl-init.rs @@ -12,7 +12,7 @@ #![feature(box_syntax)] pub fn main() { - let i = box 1; + let i: Box<_> = box 1; let j = i; assert_eq!(*j, 1); } diff --git a/src/test/run-pass/unique-decl-move.rs b/src/test/run-pass/unique-decl-move.rs index 96dd9f51fbe..360adaa638f 100644 --- a/src/test/run-pass/unique-decl-move.rs +++ b/src/test/run-pass/unique-decl-move.rs @@ -12,7 +12,7 @@ #![feature(box_syntax)] pub fn main() { - let i = box 100; + let i: Box<_> = box 100; let j = i; assert_eq!(*j, 100); } diff --git a/src/test/run-pass/unique-deref.rs b/src/test/run-pass/unique-deref.rs index 41d3b87a003..1c1228f9241 100644 --- a/src/test/run-pass/unique-deref.rs +++ b/src/test/run-pass/unique-deref.rs @@ -12,6 +12,6 @@ #![feature(box_syntax)] pub fn main() { - let i = box 100; + let i: Box<_> = box 100; assert_eq!(*i, 100); } diff --git a/src/test/run-pass/unique-drop-complex.rs b/src/test/run-pass/unique-drop-complex.rs index c5a0a4df275..745a55e0651 100644 --- a/src/test/run-pass/unique-drop-complex.rs +++ b/src/test/run-pass/unique-drop-complex.rs @@ -12,5 +12,5 @@ #![feature(box_syntax)] pub fn main() { - let _x = box vec!(0,0,0,0,0); + let _x: Box<_> = box vec!(0,0,0,0,0); } diff --git a/src/test/run-pass/unique-in-vec-copy.rs b/src/test/run-pass/unique-in-vec-copy.rs index 3bde79fdce0..20bf4bef171 100644 --- a/src/test/run-pass/unique-in-vec-copy.rs +++ b/src/test/run-pass/unique-in-vec-copy.rs @@ -12,7 +12,7 @@ #![feature(box_syntax)] pub fn main() { - let mut a = vec!(box 10); + let mut a: Vec> = vec!(box 10); let b = a.clone(); assert_eq!(*a[0], 10); diff --git a/src/test/run-pass/unique-in-vec.rs b/src/test/run-pass/unique-in-vec.rs index 05b0c7244de..c24ec8fe44a 100644 --- a/src/test/run-pass/unique-in-vec.rs +++ b/src/test/run-pass/unique-in-vec.rs @@ -12,6 +12,6 @@ #![feature(box_syntax)] pub fn main() { - let vect = vec!(box 100); + let vect : Vec> = vec!(box 100); assert!(vect[0] == box 100); } diff --git a/src/test/run-pass/unique-init.rs b/src/test/run-pass/unique-init.rs index d3f13f1609f..44e8703aaf2 100644 --- a/src/test/run-pass/unique-init.rs +++ b/src/test/run-pass/unique-init.rs @@ -12,5 +12,5 @@ #![feature(box_syntax)] pub fn main() { - let _i = box 100; + let _i: Box<_> = box 100; } diff --git a/src/test/run-pass/unique-kinds.rs b/src/test/run-pass/unique-kinds.rs index 4c93c379b48..6bb1fdcf562 100644 --- a/src/test/run-pass/unique-kinds.rs +++ b/src/test/run-pass/unique-kinds.rs @@ -23,11 +23,11 @@ fn sendable() { assert!(i != j); } - let i = box 100; - let j = box 100; + let i: Box<_> = box 100; + let j: Box<_> = box 100; f(i, j); - let i = box 100; - let j = box 101; + let i: Box<_> = box 100; + let j: Box<_> = box 101; g(i, j); } @@ -41,11 +41,11 @@ fn copyable() { assert!(i != j); } - let i = box 100; - let j = box 100; + let i: Box<_> = box 100; + let j: Box<_> = box 100; f(i, j); - let i = box 100; - let j = box 101; + let i: Box<_> = box 100; + let j: Box<_> = box 101; g(i, j); } @@ -59,11 +59,11 @@ fn noncopyable() { assert!(i != j); } - let i = box 100; - let j = box 100; + let i: Box<_> = box 100; + let j: Box<_> = box 100; f(i, j); - let i = box 100; - let j = box 101; + let i: Box<_> = box 100; + let j: Box<_> = box 101; g(i, j); } diff --git a/src/test/run-pass/unique-log.rs b/src/test/run-pass/unique-log.rs index 4b21b949f88..148ca4757ae 100644 --- a/src/test/run-pass/unique-log.rs +++ b/src/test/run-pass/unique-log.rs @@ -12,6 +12,6 @@ #![feature(box_syntax)] pub fn main() { - let i = box 100; + let i: Box<_> = box 100; println!("{}", i); } diff --git a/src/test/run-pass/unique-move-drop.rs b/src/test/run-pass/unique-move-drop.rs index 705b9d6e92c..126cc646833 100644 --- a/src/test/run-pass/unique-move-drop.rs +++ b/src/test/run-pass/unique-move-drop.rs @@ -13,8 +13,8 @@ #![feature(box_syntax)] pub fn main() { - let i = box 100; - let j = box 200; + let i: Box<_> = box 100; + let j: Box<_> = box 200; let j = i; assert_eq!(*j, 100); } diff --git a/src/test/run-pass/unique-move-temp.rs b/src/test/run-pass/unique-move-temp.rs index b6c24f5be28..9ac5e86f87b 100644 --- a/src/test/run-pass/unique-move-temp.rs +++ b/src/test/run-pass/unique-move-temp.rs @@ -12,7 +12,7 @@ #![feature(box_syntax)] pub fn main() { - let mut i; + let mut i: Box<_>; i = box 100; assert_eq!(*i, 100); } diff --git a/src/test/run-pass/unique-move.rs b/src/test/run-pass/unique-move.rs index ed13bf6a5c4..a54b343f2fa 100644 --- a/src/test/run-pass/unique-move.rs +++ b/src/test/run-pass/unique-move.rs @@ -12,7 +12,7 @@ #![feature(box_syntax)] pub fn main() { - let i = box 100; + let i: Box<_> = box 100; let mut j; j = i; assert_eq!(*j, 100); diff --git a/src/test/run-pass/unique-mutable.rs b/src/test/run-pass/unique-mutable.rs index 403b8bf18b8..ca01c07ab80 100644 --- a/src/test/run-pass/unique-mutable.rs +++ b/src/test/run-pass/unique-mutable.rs @@ -12,7 +12,7 @@ #![feature(box_syntax)] pub fn main() { - let mut i = box 0; + let mut i: Box<_> = box 0; *i = 1; assert_eq!(*i, 1); } diff --git a/src/test/run-pass/unique-rec.rs b/src/test/run-pass/unique-rec.rs index 756911d29fc..c20604406b9 100644 --- a/src/test/run-pass/unique-rec.rs +++ b/src/test/run-pass/unique-rec.rs @@ -14,7 +14,7 @@ struct X { x: int } pub fn main() { - let x = box X {x: 1}; + let x: Box<_> = box X {x: 1}; let bar = x; assert_eq!(bar.x, 1); } diff --git a/src/test/run-pass/unique-send.rs b/src/test/run-pass/unique-send.rs index 2a462e9cdd8..72022afe5fd 100644 --- a/src/test/run-pass/unique-send.rs +++ b/src/test/run-pass/unique-send.rs @@ -14,7 +14,7 @@ use std::sync::mpsc::channel; pub fn main() { - let (tx, rx) = channel(); + let (tx, rx) = channel::>(); tx.send(box 100).unwrap(); let v = rx.recv().unwrap(); assert_eq!(v, box 100); diff --git a/src/test/run-pass/unique-swap.rs b/src/test/run-pass/unique-swap.rs index 2adb9c22f60..1315e443816 100644 --- a/src/test/run-pass/unique-swap.rs +++ b/src/test/run-pass/unique-swap.rs @@ -14,8 +14,8 @@ use std::mem::swap; pub fn main() { - let mut i = box 100; - let mut j = box 200; + let mut i: Box<_> = box 100; + let mut j: Box<_> = box 200; swap(&mut i, &mut j); assert_eq!(i, box 200); assert_eq!(j, box 100); diff --git a/src/test/run-pass/unsized3.rs b/src/test/run-pass/unsized3.rs index 983152cd056..c9a9d6ad147 100644 --- a/src/test/run-pass/unsized3.rs +++ b/src/test/run-pass/unsized3.rs @@ -66,7 +66,7 @@ pub fn main() { f: [T; 3] } - let data = box Foo_{f: [1i32, 2, 3] }; + let data: Box<_> = box Foo_{f: [1i32, 2, 3] }; let x: &Foo = mem::transmute(raw::Slice { len: 3, data: &*data }); assert!(x.f.len() == 3); assert!(x.f[0] == 1); @@ -78,7 +78,8 @@ pub fn main() { f2: [u8; 5], } - let data = box Baz_{ f1: 42, f2: ['a' as u8, 'b' as u8, 'c' as u8, 'd' as u8, 'e' as u8] }; + let data: Box<_> = box Baz_ { + f1: 42, f2: ['a' as u8, 'b' as u8, 'c' as u8, 'd' as u8, 'e' as u8] }; let x: &Baz = mem::transmute( raw::Slice { len: 5, data: &*data } ); assert!(x.f1 == 42); let chs: Vec = x.f2.chars().collect(); @@ -96,7 +97,7 @@ pub fn main() { let obj: Box = box St { f: 42 }; let obj: &Tr = &*obj; let obj: raw::TraitObject = mem::transmute(&*obj); - let data = box Qux_{ f: St { f: 234 } }; + let data: Box<_> = box Qux_{ f: St { f: 234 } }; let x: &Qux = mem::transmute(raw::TraitObject { vtable: obj.vtable, data: mem::transmute(&*data) }); assert!(x.f.foo() == 234); diff --git a/src/test/run-pass/unused-move-capture.rs b/src/test/run-pass/unused-move-capture.rs index 4e8fdda9563..9f20426aa21 100644 --- a/src/test/run-pass/unused-move-capture.rs +++ b/src/test/run-pass/unused-move-capture.rs @@ -12,7 +12,7 @@ #![feature(box_syntax)] pub fn main() { - let _x = box 1; + let _x: Box<_> = box 1; let lam_move = || {}; lam_move(); } diff --git a/src/test/run-pass/unused-move.rs b/src/test/run-pass/unused-move.rs index d053b03a2ca..57534feec31 100644 --- a/src/test/run-pass/unused-move.rs +++ b/src/test/run-pass/unused-move.rs @@ -18,6 +18,6 @@ pub fn main() { - let y = box 1; + let y: Box<_> = box 1; y; } diff --git a/src/test/run-pass/unwind-unique.rs b/src/test/run-pass/unwind-unique.rs index 4d90f71c830..b7229a00480 100644 --- a/src/test/run-pass/unwind-unique.rs +++ b/src/test/run-pass/unwind-unique.rs @@ -14,7 +14,7 @@ use std::thread; fn f() { - let _a = box 0; + let _a: Box<_> = box 0; panic!(); }