From e9019101a82dd7f61dcdcd52bcc0123d5ed25d22 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Fri, 13 Mar 2015 15:28:35 -0700 Subject: Add #![feature] attributes to doctests --- src/liballoc/arc.rs | 8 ++++++++ src/liballoc/boxed.rs | 3 +++ src/liballoc/lib.rs | 1 + src/liballoc/rc.rs | 12 ++++++++++++ 4 files changed, 24 insertions(+) (limited to 'src/liballoc') diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index 8528be2860c..97d3f78f67c 100644 --- a/src/liballoc/arc.rs +++ b/src/liballoc/arc.rs @@ -95,6 +95,7 @@ use heap::deallocate; /// task. /// /// ``` +/// # #![feature(alloc, core)] /// use std::sync::Arc; /// use std::thread; /// @@ -185,6 +186,7 @@ impl Arc { /// # Examples /// /// ``` + /// # #![feature(alloc)] /// use std::sync::Arc; /// /// let five = Arc::new(5); @@ -246,6 +248,7 @@ impl Clone for Arc { /// # Examples /// /// ``` + /// # #![feature(alloc)] /// use std::sync::Arc; /// /// let five = Arc::new(5); @@ -289,6 +292,7 @@ impl Arc { /// # Examples /// /// ``` + /// # #![feature(alloc)] /// use std::sync::Arc; /// /// let mut five = Arc::new(5); @@ -324,6 +328,7 @@ impl Drop for Arc { /// # Examples /// /// ``` + /// # #![feature(alloc)] /// use std::sync::Arc; /// /// { @@ -387,6 +392,7 @@ impl Weak { /// # Examples /// /// ``` + /// # #![feature(alloc)] /// use std::sync::Arc; /// /// let five = Arc::new(5); @@ -424,6 +430,7 @@ impl Clone for Weak { /// # Examples /// /// ``` + /// # #![feature(alloc)] /// use std::sync::Arc; /// /// let weak_five = Arc::new(5).downgrade(); @@ -448,6 +455,7 @@ impl Drop for Weak { /// # Examples /// /// ``` + /// # #![feature(alloc)] /// use std::sync::Arc; /// /// { diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 6bdfe2b1551..8b18fbf554a 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -65,6 +65,7 @@ use core::raw::TraitObject; /// The following two examples are equivalent: /// /// ``` +/// # #![feature(alloc)] /// #![feature(box_syntax)] /// use std::boxed::HEAP; /// @@ -135,6 +136,7 @@ impl Box { /// /// # Examples /// ``` +/// # #![feature(alloc)] /// use std::boxed; /// /// let seventeen = Box::new(17u32); @@ -178,6 +180,7 @@ impl Clone for Box { /// # Examples /// /// ``` + /// # #![feature(alloc, core)] /// let x = Box::new(5); /// let mut y = Box::new(10); /// diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index 34c0686fe37..541de2d37fb 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -66,6 +66,7 @@ #![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png", html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/")] +#![doc(test(no_crate_inject))] #![feature(no_std)] #![no_std] diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index 855235e89c8..e4b09bba529 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -32,6 +32,7 @@ //! and have the `Owner` remain allocated as long as any `Gadget` points at it. //! //! ```rust +//! # #![feature(alloc, collections)] //! use std::rc::Rc; //! //! struct Owner { @@ -88,6 +89,7 @@ //! Read the `Cell` documentation for more details on interior mutability. //! //! ```rust +//! # #![feature(alloc)] //! use std::rc::Rc; //! use std::rc::Weak; //! use std::cell::RefCell; @@ -218,6 +220,7 @@ impl Rc { /// # Examples /// /// ``` + /// # #![feature(alloc)] /// use std::rc::Rc; /// /// let five = Rc::new(5); @@ -247,6 +250,7 @@ pub fn strong_count(this: &Rc) -> usize { this.strong() } /// # Examples /// /// ``` +/// # #![feature(alloc)] /// use std::rc; /// use std::rc::Rc; /// @@ -267,6 +271,7 @@ pub fn is_unique(rc: &Rc) -> bool { /// # Examples /// /// ``` +/// # #![feature(alloc)] /// use std::rc::{self, Rc}; /// /// let x = Rc::new(3); @@ -301,6 +306,7 @@ pub fn try_unwrap(rc: Rc) -> Result> { /// # Examples /// /// ``` +/// # #![feature(alloc)] /// use std::rc::{self, Rc}; /// /// let mut x = Rc::new(3); @@ -330,6 +336,7 @@ impl Rc { /// # Examples /// /// ``` + /// # #![feature(alloc)] /// use std::rc::Rc; /// /// let mut five = Rc::new(5); @@ -372,6 +379,7 @@ impl Drop for Rc { /// # Examples /// /// ``` + /// # #![feature(alloc)] /// use std::rc::Rc; /// /// { @@ -420,6 +428,7 @@ impl Clone for Rc { /// # Examples /// /// ``` + /// # #![feature(alloc)] /// use std::rc::Rc; /// /// let five = Rc::new(5); @@ -648,6 +657,7 @@ impl Weak { /// # Examples /// /// ``` + /// # #![feature(alloc)] /// use std::rc::Rc; /// /// let five = Rc::new(5); @@ -676,6 +686,7 @@ impl Drop for Weak { /// # Examples /// /// ``` + /// # #![feature(alloc)] /// use std::rc::Rc; /// /// { @@ -721,6 +732,7 @@ impl Clone for Weak { /// # Examples /// /// ``` + /// # #![feature(alloc)] /// use std::rc::Rc; /// /// let weak_five = Rc::new(5).downgrade(); -- cgit 1.4.1-3-g733a5