Show appropriate feature flags in docs

This commit is contained in:
Steve Klabnik
2015-07-27 10:50:19 -04:00
parent d019a49ac8
commit ba5fcb726f
47 changed files with 419 additions and 214 deletions

View File

@@ -200,7 +200,8 @@ impl<T: ?Sized> Arc<T> {
/// # Examples
///
/// ```
/// # #![feature(arc_weak)]
/// #![feature(arc_weak)]
///
/// use std::sync::Arc;
///
/// let five = Arc::new(5);
@@ -337,7 +338,8 @@ impl<T: Clone> Arc<T> {
/// # Examples
///
/// ```
/// # #![feature(arc_unique)]
/// #![feature(arc_unique)]
///
/// use std::sync::Arc;
///
/// let mut five = Arc::new(5);
@@ -408,7 +410,8 @@ impl<T: ?Sized> Arc<T> {
/// # Examples
///
/// ```
/// # #![feature(arc_unique, alloc)]
/// #![feature(arc_unique, alloc)]
///
/// extern crate alloc;
/// # fn main() {
/// use alloc::arc::Arc;
@@ -555,7 +558,8 @@ impl<T: ?Sized> Weak<T> {
/// # Examples
///
/// ```
/// # #![feature(arc_weak)]
/// #![feature(arc_weak)]
///
/// use std::sync::Arc;
///
/// let five = Arc::new(5);
@@ -599,7 +603,8 @@ impl<T: ?Sized> Clone for Weak<T> {
/// # Examples
///
/// ```
/// # #![feature(arc_weak)]
/// #![feature(arc_weak)]
///
/// use std::sync::Arc;
///
/// let weak_five = Arc::new(5).downgrade();
@@ -626,7 +631,8 @@ impl<T: ?Sized> Drop for Weak<T> {
/// # Examples
///
/// ```
/// # #![feature(arc_weak)]
/// #![feature(arc_weak)]
///
/// use std::sync::Arc;
///
/// {

View File

@@ -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<T : ?Sized> Box<T> {
///
/// # 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<T : ?Sized> Box<T> {
///
/// # Examples
/// ```
/// # #![feature(box_raw)]
/// #![feature(box_raw)]
///
/// use std::boxed;
///
/// let seventeen = Box::new(17u32);
@@ -303,7 +306,8 @@ impl<T: Clone> Clone for Box<T> {
/// # Examples
///
/// ```
/// # #![feature(box_raw)]
/// #![feature(box_raw)]
///
/// let x = Box::new(5);
/// let mut y = Box::new(10);
///

View File

@@ -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<T> Rc<T> {
/// # Examples
///
/// ```
/// # #![feature(rc_unique)]
/// #![feature(rc_unique)]
///
/// use std::rc::Rc;
///
/// let x = Rc::new(3);
@@ -262,7 +264,8 @@ impl<T: ?Sized> Rc<T> {
/// # Examples
///
/// ```
/// # #![feature(rc_weak)]
/// #![feature(rc_weak)]
///
/// use std::rc::Rc;
///
/// let five = Rc::new(5);
@@ -292,7 +295,8 @@ impl<T: ?Sized> Rc<T> {
/// # Examples
///
/// ```
/// # #![feature(rc_unique)]
/// #![feature(rc_unique)]
///
/// use std::rc::Rc;
///
/// let five = Rc::new(5);
@@ -313,7 +317,8 @@ impl<T: ?Sized> Rc<T> {
/// # 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<T: ?Sized>(this: &Rc<T>) -> 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<T>(rc: &Rc<T>) -> 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<T>(rc: Rc<T>) -> Result<T, Rc<T>> { 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<T: Clone> Rc<T> {
/// # Examples
///
/// ```
/// # #![feature(rc_unique)]
/// #![feature(rc_unique)]
///
/// use std::rc::Rc;
///
/// let mut five = Rc::new(5);
@@ -750,7 +759,8 @@ impl<T: ?Sized> Weak<T> {
/// # Examples
///
/// ```
/// # #![feature(rc_weak)]
/// #![feature(rc_weak)]
///
/// use std::rc::Rc;
///
/// let five = Rc::new(5);
@@ -778,7 +788,8 @@ impl<T: ?Sized> Drop for Weak<T> {
/// # Examples
///
/// ```
/// # #![feature(rc_weak)]
/// #![feature(rc_weak)]
///
/// use std::rc::Rc;
///
/// {
@@ -825,7 +836,8 @@ impl<T: ?Sized> Clone for Weak<T> {
/// # Examples
///
/// ```
/// # #![feature(rc_weak)]
/// #![feature(rc_weak)]
///
/// use std::rc::Rc;
///
/// let weak_five = Rc::new(5).downgrade();