about summary refs log tree commit diff
path: root/src/libarena
diff options
context:
space:
mode:
authorFelix S. Klock II <pnkfelix@pnkfx.org>2015-02-17 21:41:32 +0100
committerFelix S. Klock II <pnkfelix@pnkfx.org>2015-03-03 20:29:01 +0100
commit270f0eef733a625bcee68019189f19dc119f8f24 (patch)
tree1b58f6d17a7ca5cb04f6124eaa93e0234ff3c906 /src/libarena
parent14f0942a49b77f81d0bedb3d8b5fb615ef521bb3 (diff)
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/libarena')
-rw-r--r--src/libarena/lib.rs8
1 files changed, 4 insertions, 4 deletions
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 ),
-            }
+            };
         })
     }