(index<- ) ./libcore/owned.rs
git branch: * master 5200215 auto merge of #14035 : alexcrichton/rust/experimental, r=huonw
modified: Fri May 9 13:02:28 2014
1 // Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 //! Operations on unique pointer types
12
13 // FIXME: this module should not exist in libcore. It must currently because the
14 // Box implementation is quite ad-hoc in the compiler. Once there is
15 // proper support in the compiler this type will be able to be defined in
16 // its own module.
17
18 /// A value that represents the global exchange heap. This is the default
19 /// place that the `box` keyword allocates into when no place is supplied.
20 ///
21 /// The following two examples are equivalent:
22 ///
23 /// let foo = box(HEAP) Bar::new(...);
24 /// let foo = box Bar::new(...);
25 #[lang="exchange_heap"]
26 #[cfg(not(test))]
27 pub static HEAP: () = ();
28
29 #[cfg(test)]
30 pub static HEAP: () = ();
31
32 /// A type that represents a uniquely-owned value.
33 #[lang="owned_box"]
34 #[cfg(not(test))]
35 pub struct Box<T>(*T);
36
37 #[cfg(test)]
38 pub struct Box<T>(*T);