diff options
| author | Felix S. Klock II <pnkfelix@pnkfx.org> | 2015-02-17 21:41:32 +0100 |
|---|---|---|
| committer | Felix S. Klock II <pnkfelix@pnkfx.org> | 2015-03-03 20:29:01 +0100 |
| commit | 270f0eef733a625bcee68019189f19dc119f8f24 (patch) | |
| tree | 1b58f6d17a7ca5cb04f6124eaa93e0234ff3c906 /src/libcoretest | |
| parent | 14f0942a49b77f81d0bedb3d8b5fb615ef521bb3 (diff) | |
| download | rust-270f0eef733a625bcee68019189f19dc119f8f24.tar.gz rust-270f0eef733a625bcee68019189f19dc119f8f24.zip | |
Add `: Box<_>` or `::Box<_>` type annotations to various places.
This is the kind of change that one is expected to need to make to accommodate overloaded-`box`. ---- Note that this is not *all* of the changes necessary to accommodate Issue 22181. It is merely the subset of those cases where there was already a let-binding in place that made it easy to add the necesasry type ascription. (For unnamed intermediate `Box` values, one must go down a different route; `Box::new` is the option that maximizes portability, but has potential inefficiency depending on whether the call is inlined.) ---- There is one place worth note, `run-pass/coerce-match.rs`, where I used an ugly form of `Box<_>` type ascription where I would have preferred to use `Box::new` to accommodate overloaded-`box`. I deliberately did not use `Box::new` here, because that is already done in coerce-match-calls.rs. ---- Precursor for overloaded-`box` and placement-`in`; see Issue 22181.
Diffstat (limited to 'src/libcoretest')
| -rw-r--r-- | src/libcoretest/any.rs | 2 | ||||
| -rw-r--r-- | src/libcoretest/option.rs | 2 |
2 files changed, 2 insertions, 2 deletions
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(); |
