From 090040bf4037a094e50b03d79e4baf5cd89c912b Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Mon, 5 May 2014 18:56:44 -0700 Subject: 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` before the snapshot. How to update your code: * Instead of `~EXPR`, you should write `box EXPR`. * Instead of `~TYPE`, you should write `Box`. * Instead of `~PATTERN`, you should write `box PATTERN`. [breaking-change] --- src/libstd/ptr.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/libstd/ptr.rs') 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`). //! //! 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` 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 = box 10; //! let my_num: *int = cast::transmute(my_num); -//! let my_speed: ~int = ~88; +//! let my_speed: Box = 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` 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>(my_speed)); +//! drop(cast::transmute::<_, Box>(my_num)); //! } //! ``` //! -- cgit 1.4.1-3-g733a5