diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2014-05-05 18:56:44 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2014-05-06 23:12:54 -0700 |
| commit | 090040bf4037a094e50b03d79e4baf5cd89c912b (patch) | |
| tree | 27fa91d623889d59260d3db167abdfa8c4288849 /src/libstd/ptr.rs | |
| parent | 24f6f26e633e50b5b59f9d0f6cca0b1e49e215d9 (diff) | |
| download | rust-090040bf4037a094e50b03d79e4baf5cd89c912b.tar.gz rust-090040bf4037a094e50b03d79e4baf5cd89c912b.zip | |
librustc: Remove `~EXPR`, `~TYPE`, and `~PAT` from the language, except
for `~str`/`~[]`. Note that `~self` still remains, since I forgot to add support for `Box<self>` before the snapshot. How to update your code: * Instead of `~EXPR`, you should write `box EXPR`. * Instead of `~TYPE`, you should write `Box<Type>`. * Instead of `~PATTERN`, you should write `box PATTERN`. [breaking-change]
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)); //! } //! ``` //! |
