diff options
| author | bors <bors@rust-lang.org> | 2014-05-07 05:16:48 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-05-07 05:16:48 -0700 |
| commit | ef6daf9935da103f1b915a5c9904794da79b0b60 (patch) | |
| tree | ad9695f06d85962039a8f90ac741726b345096aa /src/libstd/ptr.rs | |
| parent | 4a5d39001b1da84fe4be2996a2c7d894d5c248c6 (diff) | |
| parent | 090040bf4037a094e50b03d79e4baf5cd89c912b (diff) | |
| download | rust-ef6daf9935da103f1b915a5c9904794da79b0b60.tar.gz rust-ef6daf9935da103f1b915a5c9904794da79b0b60.zip | |
auto merge of #13958 : pcwalton/rust/detilde, r=pcwalton
for `~str`/`~[]`. Note that `~self` still remains, since I forgot to add support for `Box<self>` before the snapshot. r? @brson or @alexcrichton or whoever
Diffstat (limited to 'src/libstd/ptr.rs')
| -rw-r--r-- | src/libstd/ptr.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/libstd/ptr.rs b/src/libstd/ptr.rs index b4b5185c221..dac727c2aa4 100644 --- a/src/libstd/ptr.rs +++ b/src/libstd/ptr.rs @@ -41,11 +41,11 @@ //! and requires no resource management later, //! but you must not use the pointer after its lifetime. //! -//! ## 2. Transmute an owned box (`~T`). +//! ## 2. Transmute an owned box (`Box<T>`). //! //! The `transmute` function takes, by value, whatever it's given //! and returns it as whatever type is requested, as long as the -//! types are the same size. Because `~T` and `*T` have the same +//! types are the same size. Because `Box<T>` and `*T` have the same //! representation they can be trivially, //! though unsafely, transformed from one type to the other. //! @@ -53,15 +53,15 @@ //! use std::cast; //! //! unsafe { -//! let my_num: ~int = ~10; +//! let my_num: Box<int> = box 10; //! let my_num: *int = cast::transmute(my_num); -//! let my_speed: ~int = ~88; +//! let my_speed: Box<int> = box 88; //! let my_speed: *mut int = cast::transmute(my_speed); //! -//! // By taking ownership of the original `~T` though +//! // By taking ownership of the original `Box<T>` though //! // we are obligated to transmute it back later to be destroyed. -//! drop(cast::transmute::<_, ~int>(my_speed)); -//! drop(cast::transmute::<_, ~int>(my_num)); +//! drop(cast::transmute::<_, Box<int>>(my_speed)); +//! drop(cast::transmute::<_, Box<int>>(my_num)); //! } //! ``` //! |
