auto merge of #15591 : aturon/rust/box-cell-stability, r=alexcrichton
This PR is the outcome of the library stabilization meeting for the `liballoc::owned` and `libcore::cell` modules. Aside from the stability attributes, there are a few breaking changes: * The `owned` modules is now named `boxed`, to better represent its contents. (`box` was unavailable, since it's a keyword.) This will help avoid the misconception that `Box` plays a special role wrt ownership. * The `AnyOwnExt` extension trait is renamed to `BoxAny`, and its `move` method is renamed to `downcast`, in both cases to improve clarity. * The recently-added `AnySendOwnExt` extension trait is removed; it was not being used and is unnecessary. [breaking-change]
This commit is contained in:
commit
ffd9966c79
49 changed files with 113 additions and 108 deletions
|
|
@ -14,7 +14,7 @@
|
|||
// Tests that the new `box` syntax works with unique pointers and GC pointers.
|
||||
|
||||
use std::gc::{Gc, GC};
|
||||
use std::owned::{Box, HEAP};
|
||||
use std::boxed::{Box, HEAP};
|
||||
|
||||
pub fn main() {
|
||||
let x: Gc<int> = box(HEAP) 2; //~ ERROR mismatched types
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
// Tests that the new `box` syntax works with unique pointers and GC pointers.
|
||||
|
||||
use std::gc::{Gc, GC};
|
||||
use std::owned::{Box, HEAP};
|
||||
use std::boxed::{Box, HEAP};
|
||||
|
||||
struct Structure {
|
||||
x: int,
|
||||
|
|
@ -33,4 +33,3 @@ pub fn main() {
|
|||
let c = box()(3i + 4);
|
||||
let d = box(GC)(5i + 6);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
// Make sure the destructor is run for unit-like structs.
|
||||
|
||||
use std::owned::AnyOwnExt;
|
||||
use std::boxed::BoxAny;
|
||||
use std::task;
|
||||
|
||||
struct Foo;
|
||||
|
|
@ -26,6 +26,6 @@ pub fn main() {
|
|||
let _b = Foo;
|
||||
});
|
||||
|
||||
let s = x.unwrap_err().move::<&'static str>().unwrap();
|
||||
let s = x.unwrap_err().downcast::<&'static str>().unwrap();
|
||||
assert_eq!(s.as_slice(), "This failure should happen.");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue