From 270f0eef733a625bcee68019189f19dc119f8f24 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Tue, 17 Feb 2015 21:41:32 +0100 Subject: 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/lib.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/liballoc/lib.rs') 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; -- cgit 1.4.1-3-g733a5