From ba5fcb726fb88cc8393f48c9f46ba03fcadf0511 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Mon, 27 Jul 2015 10:50:19 -0400 Subject: Show appropriate feature flags in docs --- src/liballoc/arc.rs | 18 ++++++++++++------ src/liballoc/boxed.rs | 12 ++++++++---- src/liballoc/rc.rs | 36 ++++++++++++++++++++++++------------ 3 files changed, 44 insertions(+), 22 deletions(-) (limited to 'src/liballoc') diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index 2a47fd29bd6..05308b3e9d8 100644 --- a/src/liballoc/arc.rs +++ b/src/liballoc/arc.rs @@ -200,7 +200,8 @@ impl Arc { /// # Examples /// /// ``` - /// # #![feature(arc_weak)] + /// #![feature(arc_weak)] + /// /// use std::sync::Arc; /// /// let five = Arc::new(5); @@ -337,7 +338,8 @@ impl Arc { /// # Examples /// /// ``` - /// # #![feature(arc_unique)] + /// #![feature(arc_unique)] + /// /// use std::sync::Arc; /// /// let mut five = Arc::new(5); @@ -408,7 +410,8 @@ impl Arc { /// # Examples /// /// ``` - /// # #![feature(arc_unique, alloc)] + /// #![feature(arc_unique, alloc)] + /// /// extern crate alloc; /// # fn main() { /// use alloc::arc::Arc; @@ -555,7 +558,8 @@ impl Weak { /// # Examples /// /// ``` - /// # #![feature(arc_weak)] + /// #![feature(arc_weak)] + /// /// use std::sync::Arc; /// /// let five = Arc::new(5); @@ -599,7 +603,8 @@ impl Clone for Weak { /// # Examples /// /// ``` - /// # #![feature(arc_weak)] + /// #![feature(arc_weak)] + /// /// use std::sync::Arc; /// /// let weak_five = Arc::new(5).downgrade(); @@ -626,7 +631,8 @@ impl Drop for Weak { /// # Examples /// /// ``` - /// # #![feature(arc_weak)] + /// #![feature(arc_weak)] + /// /// use std::sync::Arc; /// /// { diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index acf22094233..e6743990e35 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -74,7 +74,8 @@ use core::raw::{TraitObject}; /// The following two examples are equivalent: /// /// ``` -/// # #![feature(box_heap)] +/// #![feature(box_heap)] +/// /// #![feature(box_syntax, placement_in_syntax)] /// use std::boxed::HEAP; /// @@ -237,7 +238,8 @@ impl Box { /// /// # Examples /// ``` - /// # #![feature(box_raw)] + /// #![feature(box_raw)] + /// /// let seventeen = Box::new(17u32); /// let raw = Box::into_raw(seventeen); /// let boxed_again = unsafe { Box::from_raw(raw) }; @@ -260,7 +262,8 @@ impl Box { /// /// # Examples /// ``` -/// # #![feature(box_raw)] +/// #![feature(box_raw)] +/// /// use std::boxed; /// /// let seventeen = Box::new(17u32); @@ -303,7 +306,8 @@ impl Clone for Box { /// # Examples /// /// ``` - /// # #![feature(box_raw)] + /// #![feature(box_raw)] + /// /// let x = Box::new(5); /// let mut y = Box::new(10); /// diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index d461eeea0b7..b4f993205d1 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -91,7 +91,8 @@ //! documentation for more details on interior mutability. //! //! ```rust -//! # #![feature(rc_weak)] +//! #![feature(rc_weak)] +//! //! use std::rc::Rc; //! use std::rc::Weak; //! use std::cell::RefCell; @@ -227,7 +228,8 @@ impl Rc { /// # Examples /// /// ``` - /// # #![feature(rc_unique)] + /// #![feature(rc_unique)] + /// /// use std::rc::Rc; /// /// let x = Rc::new(3); @@ -262,7 +264,8 @@ impl Rc { /// # Examples /// /// ``` - /// # #![feature(rc_weak)] + /// #![feature(rc_weak)] + /// /// use std::rc::Rc; /// /// let five = Rc::new(5); @@ -292,7 +295,8 @@ impl Rc { /// # Examples /// /// ``` - /// # #![feature(rc_unique)] + /// #![feature(rc_unique)] + /// /// use std::rc::Rc; /// /// let five = Rc::new(5); @@ -313,7 +317,8 @@ impl Rc { /// # Examples /// /// ``` - /// # #![feature(rc_unique)] + /// #![feature(rc_unique)] + /// /// use std::rc::Rc; /// /// let mut x = Rc::new(3); @@ -353,7 +358,8 @@ pub fn strong_count(this: &Rc) -> usize { Rc::strong_count(this) } /// # Examples /// /// ``` -/// # #![feature(rc_unique)] +/// #![feature(rc_unique)] +/// /// use std::rc; /// use std::rc::Rc; /// @@ -373,7 +379,8 @@ pub fn is_unique(rc: &Rc) -> bool { Rc::is_unique(rc) } /// # Examples /// /// ``` -/// # #![feature(rc_unique)] +/// #![feature(rc_unique)] +/// /// use std::rc::{self, Rc}; /// /// let x = Rc::new(3); @@ -395,7 +402,8 @@ pub fn try_unwrap(rc: Rc) -> Result> { Rc::try_unwrap(rc) } /// # Examples /// /// ``` -/// # #![feature(rc_unique)] +/// #![feature(rc_unique)] +/// /// use std::rc::{self, Rc}; /// /// let mut x = Rc::new(3); @@ -419,7 +427,8 @@ impl Rc { /// # Examples /// /// ``` - /// # #![feature(rc_unique)] + /// #![feature(rc_unique)] + /// /// use std::rc::Rc; /// /// let mut five = Rc::new(5); @@ -750,7 +759,8 @@ impl Weak { /// # Examples /// /// ``` - /// # #![feature(rc_weak)] + /// #![feature(rc_weak)] + /// /// use std::rc::Rc; /// /// let five = Rc::new(5); @@ -778,7 +788,8 @@ impl Drop for Weak { /// # Examples /// /// ``` - /// # #![feature(rc_weak)] + /// #![feature(rc_weak)] + /// /// use std::rc::Rc; /// /// { @@ -825,7 +836,8 @@ impl Clone for Weak { /// # Examples /// /// ``` - /// # #![feature(rc_weak)] + /// #![feature(rc_weak)] + /// /// use std::rc::Rc; /// /// let weak_five = Rc::new(5).downgrade(); -- cgit 1.4.1-3-g733a5