diff --git a/src/doc/reference.md b/src/doc/reference.md index 415ec4e4fbf..07df3bdad34 100644 --- a/src/doc/reference.md +++ b/src/doc/reference.md @@ -816,8 +816,7 @@ may optionally begin with any number of `attributes` that apply to the containing module. Attributes on the anonymous crate module define important metadata that influences the behavior of the compiler. -```{.rust} -# #![allow(unused_attribute)] +```no_run // Crate name #![crate_name = "projx"] @@ -1020,6 +1019,7 @@ Use declarations support a number of convenient shortcuts: An example of `use` declarations: ``` +# #![feature(core)] use std::iter::range_step; use std::option::Option::{Some, None}; use std::collections::hash_map::{self, HashMap}; @@ -1080,6 +1080,7 @@ declarations. An example of what will and will not work for `use` items: ``` +# #![feature(core)] # #![allow(unused_imports)] use foo::core::iter; // good: foo is at the root of the crate use foo::baz::foobaz; // good: foo is at the root of the crate @@ -1781,6 +1782,7 @@ functions, with the exception that they may not have a body and are instead terminated by a semicolon. ``` +# #![feature(libc)] extern crate libc; use libc::{c_char, FILE}; diff --git a/src/doc/trpl/concurrency.md b/src/doc/trpl/concurrency.md index 4a16db63950..9c86d2d3b84 100644 --- a/src/doc/trpl/concurrency.md +++ b/src/doc/trpl/concurrency.md @@ -88,6 +88,7 @@ When `guard` goes out of scope, it will block execution until the thread is finished. If we didn't want this behaviour, we could use `thread::spawn()`: ``` +# #![feature(old_io, std_misc)] use std::thread; use std::old_io::timer; use std::time::Duration; @@ -146,6 +147,7 @@ As an example, here is a Rust program that would have a data race in many languages. It will not compile: ```ignore +# #![feature(old_io, std_misc)] use std::thread; use std::old_io::timer; use std::time::Duration; @@ -185,6 +187,7 @@ only one person at a time can mutate what's inside. For that, we can use the but for a different reason: ```ignore +# #![feature(old_io, std_misc)] use std::thread; use std::old_io::timer; use std::time::Duration; @@ -229,6 +232,7 @@ guard across thread boundaries, which gives us our error. We can use `Arc` to fix this. Here's the working version: ``` +# #![feature(old_io, std_misc)] use std::sync::{Arc, Mutex}; use std::thread; use std::old_io::timer; @@ -254,6 +258,7 @@ handle is then moved into the new thread. Let's examine the body of the thread more closely: ``` +# #![feature(old_io, std_misc)] # use std::sync::{Arc, Mutex}; # use std::thread; # use std::old_io::timer; diff --git a/src/doc/trpl/ffi.md b/src/doc/trpl/ffi.md index 018f35337f3..695279e2d5b 100644 --- a/src/doc/trpl/ffi.md +++ b/src/doc/trpl/ffi.md @@ -12,6 +12,7 @@ The following is a minimal example of calling a foreign function which will compile if snappy is installed: ```no_run +# #![feature(libc)] extern crate libc; use libc::size_t; @@ -45,6 +46,7 @@ keeping the binding correct at runtime. The `extern` block can be extended to cover the entire snappy API: ```no_run +# #![feature(libc)] extern crate libc; use libc::{c_int, size_t}; @@ -80,6 +82,7 @@ length is number of elements currently contained, and the capacity is the total the allocated memory. The length is less than or equal to the capacity. ``` +# #![feature(libc)] # extern crate libc; # use libc::{c_int, size_t}; # unsafe fn snappy_validate_compressed_buffer(_: *const u8, _: size_t) -> c_int { 0 } @@ -104,6 +107,7 @@ required capacity to hold the compressed output. The vector can then be passed t the true length after compression for setting the length. ``` +# #![feature(libc)] # extern crate libc; # use libc::{size_t, c_int}; # unsafe fn snappy_compress(a: *const u8, b: size_t, c: *mut u8, @@ -130,6 +134,7 @@ Decompression is similar, because snappy stores the uncompressed size as part of format and `snappy_uncompressed_length` will retrieve the exact buffer size required. ``` +# #![feature(libc)] # extern crate libc; # use libc::{size_t, c_int}; # unsafe fn snappy_uncompress(compressed: *const u8, @@ -408,6 +413,7 @@ global state. In order to access these variables, you declare them in `extern` blocks with the `static` keyword: ```no_run +# #![feature(libc)] extern crate libc; #[link(name = "readline")] @@ -426,6 +432,7 @@ interface. To do this, statics can be declared with `mut` so we can mutate them. ```no_run +# #![feature(libc)] extern crate libc; use std::ffi::CString; @@ -458,6 +465,7 @@ calling foreign functions. Some foreign functions, most notably the Windows API, conventions. Rust provides a way to tell the compiler which convention to use: ``` +# #![feature(libc)] extern crate libc; #[cfg(all(target_os = "win32", target_arch = "x86"))] diff --git a/src/doc/trpl/iterators.md b/src/doc/trpl/iterators.md index 33dc1ba07ca..8d7b1c3bd83 100644 --- a/src/doc/trpl/iterators.md +++ b/src/doc/trpl/iterators.md @@ -246,6 +246,7 @@ These two basic iterators should serve you well. There are some more advanced iterators, including ones that are infinite. Like `count`: ```rust +# #![feature(core)] std::iter::count(1, 5); ``` @@ -294,6 +295,7 @@ has no side effect on the original iterator. Let's try it out with our infinite iterator from before, `count()`: ```rust +# #![feature(core)] for i in std::iter::count(1, 5).take(5) { println!("{}", i); } diff --git a/src/doc/trpl/method-syntax.md b/src/doc/trpl/method-syntax.md index 0ca42c3b12d..8cb16f7ab33 100644 --- a/src/doc/trpl/method-syntax.md +++ b/src/doc/trpl/method-syntax.md @@ -23,6 +23,7 @@ the ability to use this *method call syntax* via the `impl` keyword. Here's how it works: ```{rust} +# #![feature(core)] struct Circle { x: f64, y: f64, @@ -87,6 +88,7 @@ original example, `foo.bar().baz()`? This is called 'method chaining', and we can do it by returning `self`. ``` +# #![feature(core)] struct Circle { x: f64, y: f64, @@ -164,6 +166,7 @@ have method overloading, named arguments, or variable arguments. We employ the builder pattern instead. It looks like this: ``` +# #![feature(core)] struct Circle { x: f64, y: f64, diff --git a/src/doc/trpl/more-strings.md b/src/doc/trpl/more-strings.md index 6567cd448f9..4b2281badd7 100644 --- a/src/doc/trpl/more-strings.md +++ b/src/doc/trpl/more-strings.md @@ -148,6 +148,7 @@ Rust provides iterators for each of these situations: Usually, the `graphemes()` method on `&str` is what you want: ``` +# #![feature(unicode)] let s = "u͔n͈̰̎i̙̮͚̦c͚̉o̼̩̰͗d͔̆̓ͥé"; for l in s.graphemes(true) { diff --git a/src/doc/trpl/standard-input.md b/src/doc/trpl/standard-input.md index 794b1df7563..0ef286ac069 100644 --- a/src/doc/trpl/standard-input.md +++ b/src/doc/trpl/standard-input.md @@ -5,7 +5,7 @@ we haven't seen before. Here's a simple program that reads some input, and then prints it back out: ```{rust,ignore} -fn main() { +corefn main() { println!("Type something!"); let input = std::old_io::stdin().read_line().ok().expect("Failed to read line"); @@ -28,6 +28,7 @@ Since writing the fully qualified name all the time is annoying, we can use the `use` statement to import it in: ```{rust} +# #![feature(old_io)] use std::old_io::stdin; stdin(); @@ -37,6 +38,7 @@ However, it's considered better practice to not import individual functions, but to import the module, and only use one level of qualification: ```{rust} +# #![feature(old_io)] use std::old_io; old_io::stdin(); diff --git a/src/doc/trpl/testing.md b/src/doc/trpl/testing.md index 72e9ec9f750..8fb08e1c6cf 100644 --- a/src/doc/trpl/testing.md +++ b/src/doc/trpl/testing.md @@ -546,6 +546,8 @@ is an opaque "black box" to the optimizer and so forces it to consider any argument as used. ```rust +# #![feature(test)] + extern crate test; # fn main() { diff --git a/src/doc/trpl/traits.md b/src/doc/trpl/traits.md index 676f1cc425a..fe26fc5e1eb 100644 --- a/src/doc/trpl/traits.md +++ b/src/doc/trpl/traits.md @@ -4,6 +4,7 @@ Do you remember the `impl` keyword, used to call a function with method syntax? ```{rust} +# #![feature(core)] struct Circle { x: f64, y: f64, @@ -21,6 +22,7 @@ Traits are similar, except that we define a trait with just the method signature, then implement the trait for that struct. Like this: ```{rust} +# #![feature(core)] struct Circle { x: f64, y: f64, @@ -84,6 +86,7 @@ which implements `HasArea` will have an `.area()` method. Here's an extended example of how this works: ```{rust} +# #![feature(core)] trait HasArea { fn area(&self) -> f64; } @@ -225,6 +228,7 @@ If we add a `use` line right above `main` and make the right things public, everything is fine: ```{rust} +# #![feature(core)] use shapes::HasArea; mod shapes { @@ -408,6 +412,7 @@ but instead, we found a floating-point variable. We need a different bound. `Flo to the rescue: ``` +# #![feature(std_misc)] use std::num::Float; fn inverse(x: T) -> Result { @@ -423,6 +428,7 @@ from the `Float` trait. Both `f32` and `f64` implement `Float`, so our function works just fine: ``` +# #![feature(std_misc)] # use std::num::Float; # fn inverse(x: T) -> Result { # if x == Float::zero() { return Err("x cannot be zero!".to_string()) } diff --git a/src/doc/trpl/unsafe.md b/src/doc/trpl/unsafe.md index 11f0b8e1ddb..2116976d55a 100644 --- a/src/doc/trpl/unsafe.md +++ b/src/doc/trpl/unsafe.md @@ -187,6 +187,7 @@ As an example, we give a reimplementation of owned boxes by wrapping reimplementation is as safe as the `Box` type. ``` +# #![feature(libc)] #![feature(unsafe_destructor)] extern crate libc; @@ -443,6 +444,7 @@ The function marked `#[start]` is passed the command line parameters in the same format as C: ``` +# #![feature(libc)] #![feature(lang_items, start, no_std)] #![no_std] @@ -470,6 +472,7 @@ correct ABI and the correct name, which requires overriding the compiler's name mangling too: ```ignore +# #![feature(libc)] #![feature(no_std)] #![no_std] #![no_main] @@ -526,6 +529,7 @@ As an example, here is a program that will calculate the dot product of two vectors provided from C, using idiomatic Rust practices. ``` +# #![feature(libc, core)] #![feature(lang_items, start, no_std)] #![no_std] @@ -650,6 +654,7 @@ and one for deallocation. A freestanding program that uses the `Box` sugar for dynamic allocations via `malloc` and `free`: ``` +# #![feature(libc)] #![feature(lang_items, box_syntax, start, no_std)] #![no_std] 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(); diff --git a/src/libcollections/binary_heap.rs b/src/libcollections/binary_heap.rs index 11c8656c994..6edee82dc30 100644 --- a/src/libcollections/binary_heap.rs +++ b/src/libcollections/binary_heap.rs @@ -216,6 +216,7 @@ impl BinaryHeap { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BinaryHeap; /// let heap = BinaryHeap::from_vec(vec![9, 1, 2, 7, 3, 2]); /// ``` @@ -235,6 +236,7 @@ impl BinaryHeap { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BinaryHeap; /// let heap = BinaryHeap::from_vec(vec![1, 2, 3, 4]); /// @@ -255,6 +257,7 @@ impl BinaryHeap { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BinaryHeap; /// let heap = BinaryHeap::from_vec(vec![1, 2, 3, 4]); /// @@ -360,6 +363,7 @@ impl BinaryHeap { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BinaryHeap; /// let mut heap = BinaryHeap::from_vec(vec![1, 3]); /// @@ -405,6 +409,7 @@ impl BinaryHeap { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BinaryHeap; /// let mut heap = BinaryHeap::new(); /// heap.push(1); @@ -436,6 +441,7 @@ impl BinaryHeap { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BinaryHeap; /// let mut heap = BinaryHeap::new(); /// @@ -461,6 +467,7 @@ impl BinaryHeap { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BinaryHeap; /// let heap = BinaryHeap::from_vec(vec![1, 2, 3, 4, 5, 6, 7]); /// let vec = heap.into_vec(); @@ -478,6 +485,7 @@ impl BinaryHeap { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BinaryHeap; /// /// let mut heap = BinaryHeap::from_vec(vec![1, 2, 4, 5, 7]); diff --git a/src/libcollections/bit.rs b/src/libcollections/bit.rs index 90fbe04d348..d83ff92bf3d 100644 --- a/src/libcollections/bit.rs +++ b/src/libcollections/bit.rs @@ -38,6 +38,7 @@ //! [sieve]: http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes //! //! ``` +//! # #![feature(collections, core)] //! use std::collections::{BitSet, BitVec}; //! use std::num::Float; //! use std::iter; @@ -134,6 +135,7 @@ static FALSE: bool = false; /// # Examples /// /// ``` +/// # #![feature(collections)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_elem(10, false); @@ -250,6 +252,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// let mut bv = BitVec::new(); /// ``` @@ -264,6 +267,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_elem(10, false); @@ -304,6 +308,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let bv = BitVec::from_bytes(&[0b10100000, 0b00010010]); @@ -346,6 +351,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let bv = BitVec::from_fn(5, |i| { i % 2 == 0 }); @@ -364,6 +370,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let bv = BitVec::from_bytes(&[0b01100000]); @@ -396,6 +403,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_elem(5, false); @@ -420,6 +428,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let before = 0b01100000; @@ -440,6 +449,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let before = 0b01100000; @@ -468,6 +478,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let a = 0b01100100; @@ -498,6 +509,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let a = 0b01100100; @@ -528,6 +540,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let a = 0b01100100; @@ -557,6 +570,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_elem(5, true); @@ -581,6 +595,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let bv = BitVec::from_bytes(&[0b01110100, 0b10010010]); @@ -597,6 +612,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_elem(10, false); @@ -614,6 +630,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_elem(10, false); @@ -635,6 +652,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_elem(3, true); @@ -682,6 +700,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let bv = BitVec::from_bytes(&[0b10100000]); @@ -702,6 +721,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_bytes(&[0b01001011]); @@ -728,6 +748,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_elem(3, false); @@ -758,6 +779,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_elem(3, false); @@ -780,6 +802,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::new(); @@ -801,6 +824,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_bytes(&[0b01001011]); @@ -851,6 +875,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::from_bytes(&[0b01001001]); @@ -881,6 +906,7 @@ impl BitVec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitVec; /// /// let mut bv = BitVec::new(); @@ -1091,6 +1117,7 @@ impl<'a> IntoIterator for &'a BitVec { /// # Examples /// /// ``` +/// # #![feature(collections)] /// use std::collections::{BitSet, BitVec}; /// /// // It's a regular set @@ -1187,6 +1214,7 @@ impl BitSet { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitSet; /// /// let mut s = BitSet::new(); @@ -1203,6 +1231,7 @@ impl BitSet { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitSet; /// /// let mut s = BitSet::with_capacity(100); @@ -1220,6 +1249,7 @@ impl BitSet { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::{BitVec, BitSet}; /// /// let bv = BitVec::from_bytes(&[0b01100000]); @@ -1249,6 +1279,7 @@ impl BitSet { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitSet; /// /// let mut s = BitSet::with_capacity(100); @@ -1270,6 +1301,7 @@ impl BitSet { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitSet; /// /// let mut s = BitSet::new(); @@ -1296,6 +1328,7 @@ impl BitSet { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitSet; /// /// let mut s = BitSet::new(); @@ -1316,6 +1349,7 @@ impl BitSet { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitSet; /// /// let mut s = BitSet::new(); @@ -1336,6 +1370,7 @@ impl BitSet { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitSet; /// /// let mut s = BitSet::new(); @@ -1382,6 +1417,7 @@ impl BitSet { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BitSet; /// /// let mut s = BitSet::new(); @@ -1414,6 +1450,7 @@ impl BitSet { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::{BitVec, BitSet}; /// /// let s = BitSet::from_bit_vec(BitVec::from_bytes(&[0b01001010])); @@ -1435,6 +1472,7 @@ impl BitSet { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::{BitVec, BitSet}; /// /// let a = BitSet::from_bit_vec(BitVec::from_bytes(&[0b01101000])); @@ -1465,6 +1503,7 @@ impl BitSet { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::{BitVec, BitSet}; /// /// let a = BitSet::from_bit_vec(BitVec::from_bytes(&[0b01101000])); @@ -1495,6 +1534,7 @@ impl BitSet { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::{BitSet, BitVec}; /// /// let a = BitSet::from_bit_vec(BitVec::from_bytes(&[0b01101000])); @@ -1533,6 +1573,7 @@ impl BitSet { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::{BitSet, BitVec}; /// /// let a = BitSet::from_bit_vec(BitVec::from_bytes(&[0b01101000])); @@ -1562,6 +1603,7 @@ impl BitSet { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::{BitSet, BitVec}; /// /// let a = 0b01101000; @@ -1585,6 +1627,7 @@ impl BitSet { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::{BitSet, BitVec}; /// /// let a = 0b01101000; @@ -1609,6 +1652,7 @@ impl BitSet { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::{BitSet, BitVec}; /// /// let a = 0b01101000; @@ -1641,6 +1685,7 @@ impl BitSet { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::{BitSet, BitVec}; /// /// let a = 0b01101000; diff --git a/src/libcollections/btree/map.rs b/src/libcollections/btree/map.rs index a9e1ce8d7ce..e69ca8c9a09 100644 --- a/src/libcollections/btree/map.rs +++ b/src/libcollections/btree/map.rs @@ -1269,6 +1269,7 @@ impl BTreeMap { /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::collections::BTreeMap; /// /// let mut a = BTreeMap::new(); @@ -1291,6 +1292,7 @@ impl BTreeMap { /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::collections::BTreeMap; /// /// let mut a = BTreeMap::new(); @@ -1478,6 +1480,7 @@ impl BTreeMap { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BTreeMap; /// use std::collections::Bound::{Included, Unbounded}; /// @@ -1504,6 +1507,7 @@ impl BTreeMap { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BTreeMap; /// use std::collections::Bound::{Included, Excluded}; /// @@ -1529,6 +1533,7 @@ impl BTreeMap { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BTreeMap; /// use std::collections::btree_map::Entry; /// diff --git a/src/libcollections/btree/set.rs b/src/libcollections/btree/set.rs index 5616d36ce0b..bce0450852f 100644 --- a/src/libcollections/btree/set.rs +++ b/src/libcollections/btree/set.rs @@ -116,6 +116,7 @@ impl BTreeSet { /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::collections::BTreeSet; /// /// let set: BTreeSet = [1, 2, 3, 4].iter().cloned().collect(); @@ -137,6 +138,7 @@ impl BTreeSet { /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::collections::BTreeSet; /// /// let set: BTreeSet = [1, 2, 3, 4].iter().cloned().collect(); @@ -162,6 +164,7 @@ impl BTreeSet { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::BTreeSet; /// use std::collections::Bound::{Included, Unbounded}; /// @@ -190,6 +193,7 @@ impl BTreeSet { /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::collections::BTreeSet; /// /// let mut a = BTreeSet::new(); @@ -213,6 +217,7 @@ impl BTreeSet { /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::collections::BTreeSet; /// /// let mut a = BTreeSet::new(); @@ -237,6 +242,7 @@ impl BTreeSet { /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::collections::BTreeSet; /// /// let mut a = BTreeSet::new(); @@ -261,6 +267,7 @@ impl BTreeSet { /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::collections::BTreeSet; /// /// let mut a = BTreeSet::new(); @@ -333,6 +340,7 @@ impl BTreeSet { /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::collections::BTreeSet; /// /// let set: BTreeSet<_> = [1, 2, 3].iter().cloned().collect(); @@ -350,6 +358,7 @@ impl BTreeSet { /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::collections::BTreeSet; /// /// let a: BTreeSet<_> = [1, 2, 3].iter().cloned().collect(); @@ -371,6 +380,7 @@ impl BTreeSet { /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::collections::BTreeSet; /// /// let sup: BTreeSet<_> = [1, 2, 3].iter().cloned().collect(); @@ -413,6 +423,7 @@ impl BTreeSet { /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::collections::BTreeSet; /// /// let sub: BTreeSet<_> = [1, 2].iter().cloned().collect(); diff --git a/src/libcollections/fmt.rs b/src/libcollections/fmt.rs index 3af7485b237..b106f4adbc7 100644 --- a/src/libcollections/fmt.rs +++ b/src/libcollections/fmt.rs @@ -174,6 +174,7 @@ //! like: //! //! ``` +//! # #![feature(core, std_misc)] //! use std::fmt; //! use std::f64; //! use std::num::Float; @@ -261,6 +262,7 @@ //! Example usage is: //! //! ``` +//! # #![feature(old_io)] //! # #![allow(unused_must_use)] //! use std::io::Write; //! let mut w = Vec::new(); @@ -288,6 +290,7 @@ //! off, some example usage is: //! //! ``` +//! # #![feature(old_io)] //! use std::fmt; //! use std::io::{self, Write}; //! diff --git a/src/libcollections/lib.rs b/src/libcollections/lib.rs index cf9f6a39a55..fa8413ff170 100644 --- a/src/libcollections/lib.rs +++ b/src/libcollections/lib.rs @@ -22,6 +22,7 @@ html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/", html_playground_url = "http://play.rust-lang.org/")] +#![doc(test(no_crate_inject))] #![feature(alloc)] #![feature(box_syntax)] diff --git a/src/libcollections/linked_list.rs b/src/libcollections/linked_list.rs index 9e0a6d04381..ae00c820a1d 100644 --- a/src/libcollections/linked_list.rs +++ b/src/libcollections/linked_list.rs @@ -235,6 +235,7 @@ impl LinkedList { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::LinkedList; /// /// let mut a = LinkedList::new(); @@ -483,6 +484,7 @@ impl LinkedList { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::LinkedList; /// /// let mut dl = LinkedList::new(); @@ -530,6 +532,7 @@ impl LinkedList { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::LinkedList; /// /// let mut d = LinkedList::new(); @@ -548,6 +551,7 @@ impl LinkedList { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::LinkedList; /// /// let mut d = LinkedList::new(); @@ -573,6 +577,7 @@ impl LinkedList { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::LinkedList; /// /// let mut d = LinkedList::new(); @@ -765,6 +770,7 @@ impl<'a, A> IterMut<'a, A> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::LinkedList; /// /// let mut list: LinkedList<_> = vec![1, 3, 4].into_iter().collect(); @@ -792,6 +798,7 @@ impl<'a, A> IterMut<'a, A> { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::LinkedList; /// /// let mut list: LinkedList<_> = vec![1, 2, 3].into_iter().collect(); diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs index 45864153dd7..9b9417d2be7 100644 --- a/src/libcollections/slice.rs +++ b/src/libcollections/slice.rs @@ -14,6 +14,7 @@ //! Slices are a view into a block of memory represented as a pointer and a length. //! //! ```rust +//! # #![feature(core)] //! // slicing a Vec //! let vec = vec!(1, 2, 3); //! let int_slice = vec.as_slice(); @@ -270,6 +271,7 @@ impl [T] { /// # Examples /// /// ```rust + /// # #![feature(collections)] /// let mut a = [1, 2, 3, 4, 5]; /// let b = vec![6, 7, 8]; /// let num_moved = a.move_from(b, 0, 3); @@ -560,6 +562,7 @@ impl [T] { /// found; the fourth could match any position in `[1,4]`. /// /// ```rust + /// # #![feature(core)] /// let s = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]; /// let s = s.as_slice(); /// @@ -842,6 +845,7 @@ impl [T] { /// # Examples /// /// ```rust + /// # #![feature(collections)] /// let v = [1, 2, 3]; /// let mut perms = v.permutations(); /// @@ -853,6 +857,7 @@ impl [T] { /// Iterating through permutations one by one. /// /// ```rust + /// # #![feature(collections)] /// let v = [1, 2, 3]; /// let mut perms = v.permutations(); /// @@ -874,6 +879,7 @@ impl [T] { /// # Example /// /// ```rust + /// # #![feature(collections)] /// let mut dst = [0, 0, 0]; /// let src = [1, 2]; /// @@ -921,6 +927,7 @@ impl [T] { /// found; the fourth could match any position in `[1,4]`. /// /// ```rust + /// # #![feature(core)] /// let s = [0, 1, 1, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55]; /// let s = s.as_slice(); /// @@ -950,6 +957,7 @@ impl [T] { /// # Example /// /// ```rust + /// # #![feature(collections)] /// let v: &mut [_] = &mut [0, 1, 2]; /// v.next_permutation(); /// let b: &mut [_] = &mut [0, 2, 1]; @@ -972,6 +980,7 @@ impl [T] { /// # Example /// /// ```rust + /// # #![feature(collections)] /// let v: &mut [_] = &mut [1, 0, 2]; /// v.prev_permutation(); /// let b: &mut [_] = &mut [0, 2, 1]; diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index 3a289e4ef37..494dd009ea9 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -548,6 +548,7 @@ impl str { /// # Examples /// /// ``` + /// # #![feature(collections)] /// assert!("hello".contains_char('e')); /// /// assert!(!"hello".contains_char('z')); @@ -739,6 +740,7 @@ impl str { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let v: Vec<(usize, usize)> = "abcXXXabcYYYabc".match_indices("abc").collect(); /// assert_eq!(v, [(0,3), (6,9), (12,15)]); /// @@ -761,6 +763,7 @@ impl str { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let v: Vec<&str> = "abcXXXabcYYYabc".split_str("abc").collect(); /// assert_eq!(v, ["", "XXX", "YYY", ""]); /// @@ -869,6 +872,7 @@ impl str { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let s = "Löwe 老虎 Léopard"; /// /// assert_eq!(s.slice_chars(0, 4), "Löwe"); @@ -1019,6 +1023,7 @@ impl str { /// # Examples /// /// ``` + /// # #![feature(str_char)] /// let s = "Löwe 老虎 Léopard"; /// assert!(s.is_char_boundary(0)); /// // start of `老` @@ -1055,6 +1060,7 @@ impl str { /// done by `.chars()` or `.char_indices()`. /// /// ``` + /// # #![feature(str_char, core)] /// use std::str::CharRange; /// /// let s = "中华Việt Nam"; @@ -1105,6 +1111,7 @@ impl str { /// done by `.chars().rev()` or `.char_indices()`. /// /// ``` + /// # #![feature(str_char, core)] /// use std::str::CharRange; /// /// let s = "中华Việt Nam"; @@ -1148,6 +1155,7 @@ impl str { /// # Examples /// /// ``` + /// # #![feature(str_char)] /// let s = "abπc"; /// assert_eq!(s.char_at(1), 'b'); /// assert_eq!(s.char_at(2), 'π'); @@ -1172,6 +1180,7 @@ impl str { /// # Examples /// /// ``` + /// # #![feature(str_char)] /// let s = "abπc"; /// assert_eq!(s.char_at_reverse(1), 'a'); /// assert_eq!(s.char_at_reverse(2), 'b'); @@ -1286,6 +1295,7 @@ impl str { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let s = "Löwe 老虎 Léopard"; /// /// assert_eq!(s.find_str("老虎 L"), Some(6)); @@ -1307,6 +1317,7 @@ impl str { /// # Examples /// /// ``` + /// # #![feature(str_char)] /// let s = "Löwe 老虎 Léopard"; /// let (c, s1) = s.slice_shift_char().unwrap(); /// @@ -1335,6 +1346,7 @@ impl str { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let string = "a\nb\nc"; /// let lines: Vec<&str> = string.lines().collect(); /// @@ -1434,6 +1446,7 @@ impl str { /// # Examples /// /// ``` + /// # #![feature(unicode, core)] /// let gr1 = "a\u{310}e\u{301}o\u{308}\u{332}".graphemes(true).collect::>(); /// let b: &[_] = &["a\u{310}", "e\u{301}", "o\u{308}\u{332}"]; /// @@ -1456,6 +1469,7 @@ impl str { /// # Examples /// /// ``` + /// # #![feature(unicode, core)] /// let gr_inds = "a̐éö̲\r\n".grapheme_indices(true).collect::>(); /// let b: &[_] = &[(0, "a̐"), (3, "é"), (6, "ö̲"), (11, "\r\n")]; /// @@ -1475,6 +1489,7 @@ impl str { /// # Examples /// /// ``` + /// # #![feature(str_words)] /// let some_words = " Mary had\ta little \n\t lamb"; /// let v: Vec<&str> = some_words.words().collect(); /// diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs index cd6f27bf65f..abc67aa6136 100644 --- a/src/libcollections/string.rs +++ b/src/libcollections/string.rs @@ -90,6 +90,7 @@ impl String { /// # Examples /// /// ``` + /// # #![feature(collections, core)] /// let s = String::from_str("hello"); /// assert_eq!(s.as_slice(), "hello"); /// ``` @@ -122,6 +123,7 @@ impl String { /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::str::Utf8Error; /// /// let hello_vec = vec![104, 101, 108, 108, 111]; @@ -350,6 +352,7 @@ impl String { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let s = String::from_str("hello"); /// let bytes = s.into_bytes(); /// assert_eq!(bytes, [104, 101, 108, 108, 111]); @@ -365,6 +368,7 @@ impl String { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let mut s = String::from_str("foo"); /// s.push_str("bar"); /// assert_eq!(s, "foobar"); @@ -441,6 +445,7 @@ impl String { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let mut s = String::from_str("foo"); /// s.reserve(100); /// assert!(s.capacity() >= 100); @@ -458,6 +463,7 @@ impl String { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let mut s = String::from_str("abc"); /// s.push('1'); /// s.push('2'); @@ -493,6 +499,7 @@ impl String { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let s = String::from_str("hello"); /// let b: &[_] = &[104, 101, 108, 108, 111]; /// assert_eq!(s.as_bytes(), b); @@ -513,6 +520,7 @@ impl String { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let mut s = String::from_str("hello"); /// s.truncate(2); /// assert_eq!(s, "he"); @@ -530,6 +538,7 @@ impl String { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let mut s = String::from_str("foo"); /// assert_eq!(s.pop(), Some('o')); /// assert_eq!(s.pop(), Some('o')); @@ -567,6 +576,7 @@ impl String { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let mut s = String::from_str("foo"); /// assert_eq!(s.remove(0), 'f'); /// assert_eq!(s.remove(1), 'o'); @@ -629,6 +639,7 @@ impl String { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let mut s = String::from_str("hello"); /// unsafe { /// let vec = s.as_mut_vec(); @@ -930,6 +941,7 @@ impl<'a> Deref for DerefString<'a> { /// # Examples /// /// ``` +/// # #![feature(collections)] /// use std::string::as_string; /// /// fn string_consumer(s: String) { diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index b0e8dc7d0b6..473442e531b 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -73,6 +73,7 @@ use borrow::{Cow, IntoCow}; /// # Examples /// /// ``` +/// # #![feature(collections)] /// let mut vec = Vec::new(); /// vec.push(1); /// vec.push(2); @@ -345,6 +346,7 @@ impl Vec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let mut vec = Vec::with_capacity(10); /// vec.push_all(&[1, 2, 3]); /// assert_eq!(vec.capacity(), 10); @@ -400,6 +402,7 @@ impl Vec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let mut vec = vec![1, 2, 3, 4]; /// vec.truncate(2); /// assert_eq!(vec, [1, 2]); @@ -565,6 +568,7 @@ impl Vec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let mut v = vec![1, 2, 3]; /// assert_eq!(v.remove(1), 2); /// assert_eq!(v, [1, 3]); @@ -696,6 +700,7 @@ impl Vec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let mut vec = vec![1, 2, 3]; /// let mut vec2 = vec![4, 5, 6]; /// vec.append(&mut vec2); @@ -732,6 +737,7 @@ impl Vec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let mut v = vec!["a".to_string(), "b".to_string()]; /// for s in v.drain() { /// // s has type String, not &String @@ -813,6 +819,7 @@ impl Vec { /// # Examples /// /// ``` + /// # #![feature(collections, core)] /// let v = vec![0, 1, 2]; /// let w = v.map_in_place(|i| i + 3); /// assert_eq!(w.as_slice(), [3, 4, 5].as_slice()); @@ -1015,6 +1022,7 @@ impl Vec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let mut vec = vec![1,2,3]; /// let vec2 = vec.split_off(1); /// assert_eq!(vec, [1]); @@ -1053,6 +1061,7 @@ impl Vec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let mut vec = vec!["hello"]; /// vec.resize(3, "world"); /// assert_eq!(vec, ["hello", "world", "world"]); @@ -1081,6 +1090,7 @@ impl Vec { /// # Examples /// /// ``` + /// # #![feature(collections)] /// let mut vec = vec![1]; /// vec.push_all(&[2, 3, 4]); /// assert_eq!(vec, [1, 2, 3, 4]); @@ -1554,6 +1564,7 @@ impl AsSlice for Vec { /// # Examples /// /// ``` + /// # #![feature(core)] /// fn foo(slice: &[i32]) {} /// /// let vec = vec![1, 2]; diff --git a/src/libcollections/vec_deque.rs b/src/libcollections/vec_deque.rs index 56ca74dab1f..d2570640038 100644 --- a/src/libcollections/vec_deque.rs +++ b/src/libcollections/vec_deque.rs @@ -257,6 +257,7 @@ impl VecDeque { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecDeque; /// /// let mut buf = VecDeque::new(); @@ -284,6 +285,7 @@ impl VecDeque { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecDeque; /// /// let buf: VecDeque = VecDeque::with_capacity(10); @@ -307,6 +309,7 @@ impl VecDeque { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecDeque; /// /// let mut buf: VecDeque = vec![1].into_iter().collect(); @@ -328,6 +331,7 @@ impl VecDeque { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecDeque; /// /// let mut buf: VecDeque = vec![1].into_iter().collect(); @@ -403,6 +407,7 @@ impl VecDeque { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecDeque; /// /// let mut buf = VecDeque::with_capacity(15); @@ -489,6 +494,7 @@ impl VecDeque { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecDeque; /// /// let mut buf = VecDeque::new(); @@ -512,6 +518,7 @@ impl VecDeque { /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::collections::VecDeque; /// /// let mut buf = VecDeque::new(); @@ -535,6 +542,7 @@ impl VecDeque { /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::collections::VecDeque; /// /// let mut buf = VecDeque::new(); @@ -644,6 +652,7 @@ impl VecDeque { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecDeque; /// /// let mut v = VecDeque::new(); @@ -882,6 +891,7 @@ impl VecDeque { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecDeque; /// /// let mut buf = VecDeque::new(); @@ -915,6 +925,7 @@ impl VecDeque { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecDeque; /// /// let mut buf = VecDeque::new(); @@ -948,6 +959,7 @@ impl VecDeque { /// /// # Examples /// ``` + /// # #![feature(collections)] /// use std::collections::VecDeque; /// /// let mut buf = VecDeque::new(); @@ -1321,6 +1333,7 @@ impl VecDeque { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecDeque; /// /// let mut buf: VecDeque<_> = vec![1,2,3].into_iter().collect(); @@ -1383,6 +1396,7 @@ impl VecDeque { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecDeque; /// /// let mut buf: VecDeque<_> = vec![1, 2, 3].into_iter().collect(); @@ -1407,6 +1421,7 @@ impl VecDeque { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecDeque; /// /// let mut buf = VecDeque::new(); diff --git a/src/libcollections/vec_map.rs b/src/libcollections/vec_map.rs index 6e67d876327..84fb06809b9 100644 --- a/src/libcollections/vec_map.rs +++ b/src/libcollections/vec_map.rs @@ -34,6 +34,7 @@ use vec::Vec; /// # Examples /// /// ``` +/// # #![feature(collections)] /// use std::collections::VecMap; /// /// let mut months = VecMap::new(); @@ -132,6 +133,7 @@ impl VecMap { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecMap; /// let mut map: VecMap<&str> = VecMap::new(); /// ``` @@ -144,6 +146,7 @@ impl VecMap { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecMap; /// let mut map: VecMap<&str> = VecMap::with_capacity(10); /// ``` @@ -158,6 +161,7 @@ impl VecMap { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecMap; /// let map: VecMap = VecMap::with_capacity(10); /// assert!(map.capacity() >= 10); @@ -177,6 +181,7 @@ impl VecMap { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecMap; /// let mut map: VecMap<&str> = VecMap::new(); /// map.reserve_len(10); @@ -201,6 +206,7 @@ impl VecMap { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecMap; /// let mut map: VecMap<&str> = VecMap::new(); /// map.reserve_len_exact(10); @@ -240,6 +246,7 @@ impl VecMap { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecMap; /// /// let mut map = VecMap::new(); @@ -268,6 +275,7 @@ impl VecMap { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecMap; /// /// let mut map = VecMap::new(); @@ -299,6 +307,7 @@ impl VecMap { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecMap; /// /// let mut map = VecMap::new(); @@ -325,6 +334,7 @@ impl VecMap { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecMap; /// /// let mut a = VecMap::new(); @@ -360,6 +370,7 @@ impl VecMap { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecMap; /// /// let mut a = VecMap::new(); @@ -416,6 +427,7 @@ impl VecMap { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecMap; /// /// let mut map = VecMap::new(); @@ -443,6 +455,7 @@ impl VecMap { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecMap; /// /// let mut a = VecMap::new(); @@ -460,6 +473,7 @@ impl VecMap { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecMap; /// /// let mut a = VecMap::new(); @@ -477,6 +491,7 @@ impl VecMap { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecMap; /// /// let mut a = VecMap::new(); @@ -492,6 +507,7 @@ impl VecMap { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecMap; /// /// let mut map = VecMap::new(); @@ -516,6 +532,7 @@ impl VecMap { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecMap; /// /// let mut map = VecMap::new(); @@ -534,6 +551,7 @@ impl VecMap { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecMap; /// /// let mut map = VecMap::new(); @@ -562,6 +580,7 @@ impl VecMap { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecMap; /// /// let mut map = VecMap::new(); @@ -587,6 +606,7 @@ impl VecMap { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecMap; /// /// let mut map = VecMap::new(); @@ -608,6 +628,7 @@ impl VecMap { /// # Examples /// /// ``` + /// # #![feature(collections)] /// use std::collections::VecMap; /// use std::collections::vec_map::Entry; /// diff --git a/src/libcore/cell.rs b/src/libcore/cell.rs index e3a7f23851c..a9c5de23d94 100644 --- a/src/libcore/cell.rs +++ b/src/libcore/cell.rs @@ -220,6 +220,7 @@ impl Cell { /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::cell::Cell; /// /// let c = Cell::new(5); diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs index b37bad5f754..9ab8ab8672d 100644 --- a/src/libcore/cmp.rs +++ b/src/libcore/cmp.rs @@ -19,7 +19,8 @@ //! could do the following: //! //! ``` -//! use core::num::SignedInt; +//! # #![feature(core)] +//! use std::num::SignedInt; //! //! struct FuzzyNum { //! num: i32, @@ -398,6 +399,7 @@ pub fn max(v1: T, v2: T) -> T { /// # Examples /// /// ``` +/// # #![feature(core)] /// use std::cmp; /// /// assert_eq!(Some(1), cmp::partial_min(1, 2)); @@ -407,6 +409,7 @@ pub fn max(v1: T, v2: T) -> T { /// When comparison is impossible: /// /// ``` +/// # #![feature(core)] /// use std::cmp; /// /// let result = cmp::partial_min(std::f64::NAN, 1.0); @@ -429,6 +432,7 @@ pub fn partial_min(v1: T, v2: T) -> Option { /// # Examples /// /// ``` +/// # #![feature(core)] /// use std::cmp; /// /// assert_eq!(Some(2), cmp::partial_max(1, 2)); @@ -438,6 +442,7 @@ pub fn partial_min(v1: T, v2: T) -> Option { /// When comparison is impossible: /// /// ``` +/// # #![feature(core)] /// use std::cmp; /// /// let result = cmp::partial_max(std::f64::NAN, 1.0); diff --git a/src/libcore/error.rs b/src/libcore/error.rs index 161f6c78921..8baf9744bbc 100644 --- a/src/libcore/error.rs +++ b/src/libcore/error.rs @@ -48,6 +48,7 @@ //! For example, //! //! ``` +//! # #![feature(os, old_io, old_path)] //! use std::error::FromError; //! use std::old_io::{File, IoError}; //! use std::os::{MemoryMap, MapError}; diff --git a/src/libcore/finally.rs b/src/libcore/finally.rs index 19cd34cdb09..93a7d2bb17b 100644 --- a/src/libcore/finally.rs +++ b/src/libcore/finally.rs @@ -19,6 +19,7 @@ //! # Examples //! //! ``` +//! # #![feature(core)] //! # #![feature(unboxed_closures)] //! //! use std::finally::Finally; @@ -70,6 +71,7 @@ impl Finally for F where F: FnMut() -> T { /// # Examples /// /// ``` +/// # #![feature(core)] /// use std::finally::try_finally; /// /// struct State<'a> { buffer: &'a mut [u8], len: usize } diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index 741cf7b47fa..cf427c16588 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -624,6 +624,7 @@ impl<'a> Formatter<'a> { /// # Examples /// /// ```rust + /// # #![feature(debug_builders, core)] /// use std::fmt; /// /// struct Foo { @@ -655,6 +656,7 @@ impl<'a> Formatter<'a> { /// # Examples /// /// ```rust + /// # #![feature(debug_builders, core)] /// use std::fmt; /// /// struct Foo(i32, String); @@ -683,6 +685,7 @@ impl<'a> Formatter<'a> { /// # Examples /// /// ```rust + /// # #![feature(debug_builders, core)] /// use std::fmt; /// /// struct Foo(Vec); @@ -712,6 +715,7 @@ impl<'a> Formatter<'a> { /// # Examples /// /// ```rust + /// # #![feature(debug_builders, core)] /// use std::fmt; /// /// struct Foo(Vec<(String, i32)>); diff --git a/src/libcore/fmt/num.rs b/src/libcore/fmt/num.rs index fe22ee60da6..49da99b97cb 100644 --- a/src/libcore/fmt/num.rs +++ b/src/libcore/fmt/num.rs @@ -146,6 +146,7 @@ pub struct RadixFmt(T, R); /// # Examples /// /// ``` +/// # #![feature(core)] /// use std::fmt::radix; /// assert_eq!(format!("{}", radix(55, 36)), "1j".to_string()); /// ``` diff --git a/src/libcore/hash/mod.rs b/src/libcore/hash/mod.rs index fdc0020dfcd..3c5810fdf80 100644 --- a/src/libcore/hash/mod.rs +++ b/src/libcore/hash/mod.rs @@ -16,6 +16,7 @@ //! # Examples //! //! ```rust +//! # #![feature(hash)] //! use std::hash::{hash, Hash, SipHasher}; //! //! #[derive(Hash)] @@ -35,6 +36,7 @@ //! the trait `Hash`: //! //! ```rust +//! # #![feature(hash)] //! use std::hash::{hash, Hash, Hasher, SipHasher}; //! //! struct Person { diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index 1462d07652d..9873ba476ac 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -262,6 +262,7 @@ extern "rust-intrinsic" { /// A safe swap function: /// /// ``` + /// # #![feature(core)] /// use std::mem; /// use std::ptr; /// @@ -301,6 +302,7 @@ extern "rust-intrinsic" { /// Efficiently create a Rust vector from an unsafe buffer: /// /// ``` + /// # #![feature(core)] /// use std::ptr; /// /// unsafe fn from_buf_raw(ptr: *const T, elts: uint) -> Vec { diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index 4f8b1c21ab2..5f5b8ef73ef 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -334,6 +334,7 @@ pub trait IteratorExt: Iterator + Sized { /// # Examples /// /// ``` + /// # #![feature(core)] /// let xs = [100, 200, 300]; /// let mut it = xs.iter().cloned().peekable(); /// assert_eq!(*it.peek().unwrap(), 100); @@ -465,6 +466,7 @@ pub trait IteratorExt: Iterator + Sized { /// # Examples /// /// ``` + /// # #![feature(core)] /// let xs = [2, 3]; /// let ys = [0, 1, 0, 1, 2]; /// let it = xs.iter().flat_map(|&x| std::iter::count(0, 1).take(x)); @@ -521,6 +523,7 @@ pub trait IteratorExt: Iterator + Sized { /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::iter::AdditiveIterator; /// /// let a = [1, 4, 2, 3, 8, 9, 6]; @@ -563,6 +566,7 @@ pub trait IteratorExt: Iterator + Sized { /// # Examples /// /// ``` + /// # #![feature(core)] /// let a = [1, 2, 3, 4, 5]; /// let b: Vec<_> = a.iter().cloned().collect(); /// assert_eq!(a, b); @@ -579,6 +583,7 @@ pub trait IteratorExt: Iterator + Sized { /// do not. /// /// ``` + /// # #![feature(core)] /// let vec = vec![1, 2, 3, 4]; /// let (even, odd): (Vec<_>, Vec<_>) = vec.into_iter().partition(|&n| n % 2 == 0); /// assert_eq!(even, [2, 4]); @@ -648,6 +653,7 @@ pub trait IteratorExt: Iterator + Sized { /// # Examples /// /// ``` + /// # #![feature(core)] /// let a = [1, 2, 3, 4, 5]; /// let mut it = a.iter(); /// assert!(it.any(|x| *x == 3)); @@ -668,6 +674,7 @@ pub trait IteratorExt: Iterator + Sized { /// # Examples /// /// ``` + /// # #![feature(core)] /// let a = [1, 2, 3, 4, 5]; /// let mut it = a.iter(); /// assert_eq!(it.find(|&x| *x == 3).unwrap(), &3); @@ -690,6 +697,7 @@ pub trait IteratorExt: Iterator + Sized { /// # Examples /// /// ``` + /// # #![feature(core)] /// let a = [1, 2, 3, 4, 5]; /// let mut it = a.iter(); /// assert_eq!(it.position(|x| *x == 3).unwrap(), 2); @@ -718,6 +726,7 @@ pub trait IteratorExt: Iterator + Sized { /// # Examples /// /// ``` + /// # #![feature(core)] /// let a = [1, 2, 2, 4, 5]; /// let mut it = a.iter(); /// assert_eq!(it.rposition(|x| *x == 2).unwrap(), 2); @@ -795,6 +804,7 @@ pub trait IteratorExt: Iterator + Sized { /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::iter::MinMaxResult::{NoElements, OneElement, MinMax}; /// /// let a: [i32; 0] = []; @@ -860,7 +870,8 @@ pub trait IteratorExt: Iterator + Sized { /// # Examples /// /// ``` - /// use core::num::SignedInt; + /// # #![feature(core)] + /// use std::num::SignedInt; /// /// let a = [-3, 0, 1, 5, -10]; /// assert_eq!(*a.iter().max_by(|x| x.abs()).unwrap(), -10); @@ -890,7 +901,8 @@ pub trait IteratorExt: Iterator + Sized { /// # Examples /// /// ``` - /// use core::num::SignedInt; + /// # #![feature(core)] + /// use std::num::SignedInt; /// /// let a = [-3, 0, 1, 5, -10]; /// assert_eq!(*a.iter().min_by(|x| x.abs()).unwrap(), 0); @@ -940,6 +952,7 @@ pub trait IteratorExt: Iterator + Sized { /// # Examples /// /// ``` + /// # #![feature(core)] /// let a = [(1, 2), (3, 4)]; /// let (left, right): (Vec<_>, Vec<_>) = a.iter().cloned().unzip(); /// assert_eq!([1, 3], left); @@ -1146,6 +1159,7 @@ pub trait AdditiveIterator { /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::iter::AdditiveIterator; /// /// let a = [1, 2, 3, 4, 5]; @@ -1188,6 +1202,7 @@ pub trait MultiplicativeIterator { /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::iter::{count, MultiplicativeIterator}; /// /// fn factorial(n: usize) -> usize { @@ -1248,6 +1263,7 @@ impl MinMaxResult { /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::iter::MinMaxResult::{self, NoElements, OneElement, MinMax}; /// /// let r: MinMaxResult = NoElements; @@ -2292,6 +2308,7 @@ impl RandomAccessIterator for Inspect /// An iterator that yields sequential Fibonacci numbers, and stops on overflow. /// /// ``` +/// # #![feature(core)] /// use std::iter::Unfold; /// use std::num::Int; // For `.checked_add()` /// @@ -2693,6 +2710,7 @@ pub struct RangeStepInclusive { /// # Examples /// /// ``` +/// # #![feature(core)] /// use std::iter::range_step_inclusive; /// /// for i in range_step_inclusive(0, 10, 2) { diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index 29cc11d5a60..6e82f0f854c 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -56,6 +56,7 @@ html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/", html_playground_url = "http://play.rust-lang.org/")] +#![doc(test(no_crate_inject))] #![feature(no_std)] #![no_std] diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs index c647b037944..40e32f4171a 100644 --- a/src/libcore/macros.rs +++ b/src/libcore/macros.rs @@ -231,6 +231,7 @@ macro_rules! writeln { /// Iterators: /// /// ``` +/// # #![feature(core)] /// fn divide_by_three(x: u32) -> u32 { // one of the poorest implementations of x/3 /// for i in std::iter::count(0, 1) { /// if 3*i < i { panic!("u32 overflow"); } diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs index 1b866501b8e..ae6bcc79539 100644 --- a/src/libcore/marker.rs +++ b/src/libcore/marker.rs @@ -319,6 +319,7 @@ impl MarkerTrait for T { } /// `MarkerTrait`: /// /// ``` +/// # #![feature(core)] /// use std::marker::MarkerTrait; /// trait Even : MarkerTrait { } /// ``` diff --git a/src/libcore/num/f32.rs b/src/libcore/num/f32.rs index ae1b5f65eeb..d211b0f9928 100644 --- a/src/libcore/num/f32.rs +++ b/src/libcore/num/f32.rs @@ -282,7 +282,8 @@ impl Float for f32 { /// The fractional part of the number, satisfying: /// /// ``` - /// use core::num::Float; + /// # #![feature(core)] + /// use std::num::Float; /// /// let x = 1.65f32; /// assert!(x == x.trunc() + x.fract()) diff --git a/src/libcore/num/f64.rs b/src/libcore/num/f64.rs index 4a73c1e8fcf..1421fdd72f2 100644 --- a/src/libcore/num/f64.rs +++ b/src/libcore/num/f64.rs @@ -289,7 +289,8 @@ impl Float for f64 { /// The fractional part of the number, satisfying: /// /// ``` - /// use core::num::Float; + /// # #![feature(core)] + /// use std::num::Float; /// /// let x = 1.65f64; /// assert!(x == x.trunc() + x.fract()) diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index 17ef0ecb1c0..9ca7b48fbe5 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -85,6 +85,7 @@ pub trait Int /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::num::Int; /// /// let n = 0b01001100u8; @@ -100,6 +101,7 @@ pub trait Int /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::num::Int; /// /// let n = 0b01001100u8; @@ -119,6 +121,7 @@ pub trait Int /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::num::Int; /// /// let n = 0b0101000u16; @@ -135,6 +138,7 @@ pub trait Int /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::num::Int; /// /// let n = 0b0101000u16; @@ -151,6 +155,7 @@ pub trait Int /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::num::Int; /// /// let n = 0x0123456789ABCDEFu64; @@ -168,6 +173,7 @@ pub trait Int /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::num::Int; /// /// let n = 0x0123456789ABCDEFu64; @@ -392,6 +398,7 @@ pub trait Int /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::num::Int; /// /// assert_eq!(2.pow(4), 16); @@ -787,6 +794,7 @@ macro_rules! int_impl { /// # Examples /// /// ```rust + /// # #![feature(core)] /// use std::num::Int; /// /// let n = 0b01001100u8; @@ -803,6 +811,7 @@ macro_rules! int_impl { /// # Examples /// /// ```rust + /// # #![feature(core)] /// use std::num::Int; /// /// let n = 0b01001100u8; @@ -822,6 +831,7 @@ macro_rules! int_impl { /// # Examples /// /// ```rust + /// # #![feature(core)] /// use std::num::Int; /// /// let n = 0b0101000u16; @@ -841,6 +851,7 @@ macro_rules! int_impl { /// # Examples /// /// ```rust + /// # #![feature(core)] /// use std::num::Int; /// /// let n = 0b0101000u16; @@ -860,6 +871,7 @@ macro_rules! int_impl { /// # Examples /// /// ```rust + /// # #![feature(core)] /// use std::num::Int; /// /// let n = 0x0123456789ABCDEFu64; @@ -881,6 +893,7 @@ macro_rules! int_impl { /// # Examples /// /// ```rust + /// # #![feature(core)] /// use std::num::Int; /// /// let n = 0x0123456789ABCDEFu64; @@ -1112,6 +1125,7 @@ macro_rules! int_impl { /// # Examples /// /// ```rust + /// # #![feature(core)] /// use std::num::Int; /// /// assert_eq!(2.pow(4), 16); @@ -1277,6 +1291,7 @@ macro_rules! uint_impl { /// # Examples /// /// ```rust + /// # #![feature(core)] /// use std::num::Int; /// /// let n = 0b01001100u8; @@ -1295,6 +1310,7 @@ macro_rules! uint_impl { /// # Examples /// /// ```rust + /// # #![feature(core)] /// use std::num::Int; /// /// let n = 0b01001100u8; @@ -1314,6 +1330,7 @@ macro_rules! uint_impl { /// # Examples /// /// ```rust + /// # #![feature(core)] /// use std::num::Int; /// /// let n = 0b0101000u16; @@ -1333,6 +1350,7 @@ macro_rules! uint_impl { /// # Examples /// /// ```rust + /// # #![feature(core)] /// use std::num::Int; /// /// let n = 0b0101000u16; @@ -1352,6 +1370,7 @@ macro_rules! uint_impl { /// # Examples /// /// ```rust + /// # #![feature(core)] /// use std::num::Int; /// /// let n = 0x0123456789ABCDEFu64; @@ -1375,6 +1394,7 @@ macro_rules! uint_impl { /// # Examples /// /// ```rust + /// # #![feature(core)] /// use std::num::Int; /// /// let n = 0x0123456789ABCDEFu64; @@ -1606,6 +1626,7 @@ macro_rules! uint_impl { /// # Examples /// /// ```rust + /// # #![feature(core)] /// use std::num::Int; /// /// assert_eq!(2.pow(4), 16); @@ -2266,6 +2287,7 @@ impl_from_primitive! { f64, to_f64 } /// # Examples /// /// ``` +/// # #![feature(core)] /// use std::num; /// /// let twenty: f32 = num::cast(0x14).unwrap(); diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 455c68d4319..ecb060397ab 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -275,6 +275,7 @@ impl Option { /// # Examples /// /// ``` + /// # #![feature(core)] /// let mut x = Some("Diamonds"); /// { /// let v = x.as_mut_slice(); @@ -470,6 +471,7 @@ impl Option { /// # Examples /// /// ``` + /// # #![feature(core)] /// let x = Some("foo"); /// assert_eq!(x.ok_or(0), Ok("foo")); /// @@ -491,6 +493,7 @@ impl Option { /// # Examples /// /// ``` + /// # #![feature(core)] /// let x = Some("foo"); /// assert_eq!(x.ok_or_else(|| 0), Ok("foo")); /// @@ -532,6 +535,7 @@ impl Option { /// # Examples /// /// ``` + /// # #![feature(core)] /// let mut x = Some(4); /// match x.iter_mut().next() { /// Some(&mut ref mut v) => *v = 42, diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 1cbea057e88..c05dffb3696 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -52,6 +52,7 @@ //! the raw pointer. It doesn't destroy `T` or deallocate any memory. //! //! ``` +//! # #![feature(alloc)] //! use std::boxed; //! //! unsafe { @@ -70,6 +71,7 @@ //! ## 3. Get it from C. //! //! ``` +//! # #![feature(libc)] //! extern crate libc; //! //! use std::mem; diff --git a/src/libcore/raw.rs b/src/libcore/raw.rs index 35dfc762687..8502a9c53c4 100644 --- a/src/libcore/raw.rs +++ b/src/libcore/raw.rs @@ -48,6 +48,7 @@ use mem; /// # Examples /// /// ``` +/// # #![feature(core)] /// use std::raw::{self, Repr}; /// /// let slice: &[u16] = &[1, 2, 3, 4]; @@ -106,6 +107,7 @@ pub struct Closure { /// # Examples /// /// ``` +/// # #![feature(core)] /// use std::mem; /// use std::raw; /// diff --git a/src/libcore/result.rs b/src/libcore/result.rs index bc8d53e2a57..a994590a395 100644 --- a/src/libcore/result.rs +++ b/src/libcore/result.rs @@ -95,6 +95,7 @@ //! by the [`Writer`](../io/trait.Writer.html) trait: //! //! ``` +//! # #![feature(old_io)] //! use std::old_io::IoError; //! //! trait Writer { @@ -110,6 +111,7 @@ //! something like this: //! //! ```{.ignore} +//! # #![feature(old_io)] //! use std::old_io::*; //! use std::old_path::Path; //! @@ -129,6 +131,7 @@ //! a marginally useful message indicating why: //! //! ```{.no_run} +//! # #![feature(old_io, old_path)] //! use std::old_io::*; //! use std::old_path::Path; //! @@ -140,6 +143,7 @@ //! You might also simply assert success: //! //! ```{.no_run} +//! # #![feature(old_io, old_path)] //! # use std::old_io::*; //! # use std::old_path::Path; //! @@ -151,6 +155,7 @@ //! Or propagate the error up the call stack with `try!`: //! //! ``` +//! # #![feature(old_io, old_path)] //! # use std::old_io::*; //! # use std::old_path::Path; //! fn write_message() -> Result<(), IoError> { @@ -171,6 +176,7 @@ //! It replaces this: //! //! ``` +//! # #![feature(old_io, old_path)] //! use std::old_io::*; //! use std::old_path::Path; //! @@ -196,6 +202,7 @@ //! With this: //! //! ``` +//! # #![feature(old_io, old_path)] //! use std::old_io::*; //! use std::old_path::Path; //! @@ -411,6 +418,7 @@ impl Result { /// Convert from `Result` to `&mut [T]` (without copying) /// /// ``` + /// # #![feature(core)] /// let mut x: Result<&str, u32> = Ok("Gold"); /// { /// let v = x.as_mut_slice(); @@ -452,6 +460,7 @@ impl Result { /// ignoring I/O and parse errors: /// /// ``` + /// # #![feature(old_io)] /// use std::old_io::*; /// /// let mut buffer: &[u8] = b"1\n2\n3\n4\n"; diff --git a/src/libcore/simd.rs b/src/libcore/simd.rs index 0058971faf0..21cff3021ab 100644 --- a/src/libcore/simd.rs +++ b/src/libcore/simd.rs @@ -19,7 +19,7 @@ //! provided beyond this module. //! //! ```rust -//! +//! # #![feature(core)] //! fn main() { //! use std::simd::f32x4; //! let a = f32x4(40.0, 41.0, 42.0, 43.0); diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs index 907b2eba80c..b8e6a05f3da 100644 --- a/src/libcore/slice.rs +++ b/src/libcore/slice.rs @@ -1491,6 +1491,7 @@ pub unsafe fn from_raw_parts_mut<'a, T>(p: *mut T, len: usize) -> &'a mut [T] { /// # Examples /// /// ``` +/// #![feature(core)] /// use std::slice; /// /// // manifest a slice out of thin air! diff --git a/src/libgraphviz/lib.rs b/src/libgraphviz/lib.rs index 0e080459344..a5017c67ee4 100644 --- a/src/libgraphviz/lib.rs +++ b/src/libgraphviz/lib.rs @@ -47,6 +47,7 @@ //! which is cyclic. //! //! ```rust +//! # #![feature(rustc_private, core)] //! use std::borrow::IntoCow; //! use std::io::Write; //! use graphviz as dot; @@ -148,6 +149,7 @@ //! entity `&sube`). //! //! ```rust +//! # #![feature(rustc_private, core)] //! use std::borrow::IntoCow; //! use std::io::Write; //! use graphviz as dot; @@ -205,6 +207,7 @@ //! Hasse-diagram for the subsets of the set `{x, y}`. //! //! ```rust +//! # #![feature(rustc_private, core)] //! use std::borrow::IntoCow; //! use std::io::Write; //! use graphviz as dot; diff --git a/src/liblibc/lib.rs b/src/liblibc/lib.rs index 893781e6220..41c782a2a46 100644 --- a/src/liblibc/lib.rs +++ b/src/liblibc/lib.rs @@ -5031,7 +5031,7 @@ pub mod funcs { /// /// # Examples /// - /// ```no_run + /// ```no_run,ignore /// extern crate libc; /// /// fn main() { diff --git a/src/librand/distributions/exponential.rs b/src/librand/distributions/exponential.rs index 3180f03cfd3..0c5f5cb0d44 100644 --- a/src/librand/distributions/exponential.rs +++ b/src/librand/distributions/exponential.rs @@ -60,6 +60,7 @@ impl Rand for Exp1 { /// # Examples /// /// ``` +/// # #![feature(rand)] /// use std::rand; /// use std::rand::distributions::{Exp, IndependentSample}; /// diff --git a/src/librand/distributions/gamma.rs b/src/librand/distributions/gamma.rs index 8eaac203fb4..d04e83e84f7 100644 --- a/src/librand/distributions/gamma.rs +++ b/src/librand/distributions/gamma.rs @@ -40,6 +40,7 @@ use super::{IndependentSample, Sample, Exp}; /// # Examples /// /// ``` +/// # #![feature(rand)] /// use std::rand; /// use std::rand::distributions::{IndependentSample, Gamma}; /// @@ -187,6 +188,7 @@ impl IndependentSample for GammaLargeShape { /// # Examples /// /// ``` +/// # #![feature(rand)] /// use std::rand; /// use std::rand::distributions::{ChiSquared, IndependentSample}; /// @@ -244,6 +246,7 @@ impl IndependentSample for ChiSquared { /// # Examples /// /// ``` +/// # #![feature(rand)] /// use std::rand; /// use std::rand::distributions::{FisherF, IndependentSample}; /// @@ -288,6 +291,7 @@ impl IndependentSample for FisherF { /// # Examples /// /// ``` +/// # #![feature(rand)] /// use std::rand; /// use std::rand::distributions::{StudentT, IndependentSample}; /// diff --git a/src/librand/distributions/mod.rs b/src/librand/distributions/mod.rs index a46709932e2..5cafb8d2e5e 100644 --- a/src/librand/distributions/mod.rs +++ b/src/librand/distributions/mod.rs @@ -94,6 +94,7 @@ pub struct Weighted { /// # Examples /// /// ``` +/// # #![feature(rand)] /// use std::rand; /// use std::rand::distributions::{Weighted, WeightedChoice, IndependentSample}; /// diff --git a/src/librand/distributions/normal.rs b/src/librand/distributions/normal.rs index d07964624bf..7cecc6ac611 100644 --- a/src/librand/distributions/normal.rs +++ b/src/librand/distributions/normal.rs @@ -76,6 +76,7 @@ impl Rand for StandardNormal { /// # Examples /// /// ``` +/// # #![feature(rand)] /// use std::rand; /// use std::rand::distributions::{Normal, IndependentSample}; /// @@ -124,6 +125,7 @@ impl IndependentSample for Normal { /// # Examples /// /// ``` +/// # #![feature(rand)] /// use std::rand; /// use std::rand::distributions::{LogNormal, IndependentSample}; /// diff --git a/src/librand/distributions/range.rs b/src/librand/distributions/range.rs index 4086e149e78..e6f27a28ffa 100644 --- a/src/librand/distributions/range.rs +++ b/src/librand/distributions/range.rs @@ -36,6 +36,7 @@ use distributions::{Sample, IndependentSample}; /// # Examples /// /// ``` +/// # #![feature(rand)] /// use std::rand::distributions::{IndependentSample, Range}; /// /// fn main() { diff --git a/src/librand/lib.rs b/src/librand/lib.rs index 8de773e9fec..9f6399ff12d 100644 --- a/src/librand/lib.rs +++ b/src/librand/lib.rs @@ -149,6 +149,7 @@ pub trait Rng : Sized { /// # Examples /// /// ``` + /// # #![feature(rand, core)] /// use std::rand::{thread_rng, Rng}; /// /// let mut v = [0; 13579]; @@ -184,6 +185,7 @@ pub trait Rng : Sized { /// # Examples /// /// ``` + /// # #![feature(rand)] /// use std::rand::{thread_rng, Rng}; /// /// let mut rng = thread_rng(); @@ -202,6 +204,7 @@ pub trait Rng : Sized { /// # Examples /// /// ``` + /// # #![feature(rand)] /// use std::rand::{thread_rng, Rng}; /// /// let mut rng = thread_rng(); @@ -229,6 +232,7 @@ pub trait Rng : Sized { /// # Examples /// /// ``` + /// # #![feature(rand)] /// use std::rand::{thread_rng, Rng}; /// /// let mut rng = thread_rng(); @@ -247,6 +251,7 @@ pub trait Rng : Sized { /// # Examples /// /// ``` + /// # #![feature(rand)] /// use std::rand::{thread_rng, Rng}; /// /// let mut rng = thread_rng(); @@ -261,6 +266,7 @@ pub trait Rng : Sized { /// # Examples /// /// ``` + /// # #![feature(rand)] /// use std::rand::{thread_rng, Rng}; /// /// let s: String = thread_rng().gen_ascii_chars().take(10).collect(); @@ -277,6 +283,7 @@ pub trait Rng : Sized { /// # Examples /// /// ``` + /// # #![feature(rand)] /// use std::rand::{thread_rng, Rng}; /// /// let choices = [1, 2, 4, 8, 16, 32]; @@ -297,6 +304,7 @@ pub trait Rng : Sized { /// # Examples /// /// ``` + /// # #![feature(rand, core)] /// use std::rand::{thread_rng, Rng}; /// /// let mut rng = thread_rng(); @@ -360,6 +368,7 @@ pub trait SeedableRng: Rng { /// # Examples /// /// ``` + /// # #![feature(rand)] /// use std::rand::{Rng, SeedableRng, StdRng}; /// /// let seed: &[_] = &[1, 2, 3, 4]; @@ -375,6 +384,7 @@ pub trait SeedableRng: Rng { /// # Examples /// /// ``` + /// # #![feature(rand)] /// use std::rand::{Rng, SeedableRng, StdRng}; /// /// let seed: &[_] = &[1, 2, 3, 4]; @@ -480,6 +490,7 @@ impl Rand for XorShiftRng { /// # Examples /// /// ``` +/// # #![feature(rand)] /// use std::rand::{random, Open01}; /// /// let Open01(val) = random::>(); @@ -497,6 +508,7 @@ pub struct Open01(pub F); /// # Examples /// /// ``` +/// # #![feature(rand)] /// use std::rand::{random, Closed01}; /// /// let Closed01(val) = random::>(); diff --git a/src/librand/reseeding.rs b/src/librand/reseeding.rs index 81e65da37fc..95dd986d2e3 100644 --- a/src/librand/reseeding.rs +++ b/src/librand/reseeding.rs @@ -103,6 +103,7 @@ impl, Rsdr: Reseeder + Default> /// # Examples /// /// ``` +/// # #![feature(rand)] /// use std::rand::{Rng, SeedableRng, StdRng}; /// use std::rand::reseeding::{Reseeder, ReseedingRng}; /// diff --git a/src/librustc_bitflags/lib.rs b/src/librustc_bitflags/lib.rs index 054bfec7a20..93a2a5d1257 100644 --- a/src/librustc_bitflags/lib.rs +++ b/src/librustc_bitflags/lib.rs @@ -33,6 +33,7 @@ /// # Examples /// /// ```{.rust} +/// # #![feature(rustc_private)] /// #[macro_use] extern crate rustc_bitflags; /// /// bitflags! { @@ -59,6 +60,7 @@ /// The generated `struct`s can also be extended with type and trait implementations: /// /// ```{.rust} +/// # #![feature(rustc_private)] /// #[macro_use] extern crate rustc_bitflags; /// /// use std::fmt; diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index 1b596e65a78..0f645d2b8ea 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -268,7 +268,7 @@ pub fn maketest(s: &str, cratename: Option<&str>, lints: bool, // Don't inject `extern crate std` because it's already injected by the // compiler. - if !s.contains("extern crate") && cratename != Some("std") && inject_crate { + if !s.contains("extern crate") && inject_crate { match cratename { Some(cratename) => { if s.contains(cratename) { diff --git a/src/libserialize/hex.rs b/src/libserialize/hex.rs index 1f8d45a007d..e42aa1835dc 100644 --- a/src/libserialize/hex.rs +++ b/src/libserialize/hex.rs @@ -32,6 +32,7 @@ impl ToHex for [u8] { /// # Examples /// /// ``` + /// # #![feature(rustc_private)] /// extern crate serialize; /// use serialize::hex::ToHex; /// @@ -101,6 +102,7 @@ impl FromHex for str { /// This converts a string literal to hexadecimal and back. /// /// ``` + /// # #![feature(rustc_private)] /// extern crate serialize; /// use serialize::hex::{FromHex, ToHex}; /// diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs index 9139e182ce4..a632306454e 100644 --- a/src/libstd/collections/hash/map.rs +++ b/src/libstd/collections/hash/map.rs @@ -538,6 +538,7 @@ impl HashMap /// # Examples /// /// ``` + /// # #![feature(std_misc)] /// use std::collections::HashMap; /// use std::collections::hash_map::RandomState; /// @@ -566,6 +567,7 @@ impl HashMap /// # Examples /// /// ``` + /// # #![feature(std_misc)] /// use std::collections::HashMap; /// use std::collections::hash_map::RandomState; /// @@ -981,6 +983,7 @@ impl HashMap /// # Examples /// /// ``` + /// # #![feature(std_misc)] /// use std::collections::HashMap; /// /// let mut a = HashMap::new(); diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs index de3f080de82..3bc511f8a22 100644 --- a/src/libstd/collections/hash/set.rs +++ b/src/libstd/collections/hash/set.rs @@ -145,6 +145,7 @@ impl HashSet /// # Examples /// /// ``` + /// # #![feature(std_misc)] /// use std::collections::HashSet; /// use std::collections::hash_map::RandomState; /// @@ -169,6 +170,7 @@ impl HashSet /// # Examples /// /// ``` + /// # #![feature(std_misc)] /// use std::collections::HashSet; /// use std::collections::hash_map::RandomState; /// @@ -295,6 +297,7 @@ impl HashSet /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::collections::HashSet; /// let a: HashSet<_> = [1, 2, 3].iter().cloned().collect(); /// let b: HashSet<_> = [4, 2, 3, 4].iter().cloned().collect(); @@ -325,6 +328,7 @@ impl HashSet /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::collections::HashSet; /// let a: HashSet<_> = [1, 2, 3].iter().cloned().collect(); /// let b: HashSet<_> = [4, 2, 3, 4].iter().cloned().collect(); @@ -351,6 +355,7 @@ impl HashSet /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::collections::HashSet; /// let a: HashSet<_> = [1, 2, 3].iter().cloned().collect(); /// let b: HashSet<_> = [4, 2, 3, 4].iter().cloned().collect(); @@ -376,6 +381,7 @@ impl HashSet /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::collections::HashSet; /// let a: HashSet<_> = [1, 2, 3].iter().cloned().collect(); /// let b: HashSet<_> = [4, 2, 3, 4].iter().cloned().collect(); @@ -458,6 +464,7 @@ impl HashSet /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::collections::HashSet; /// /// let set: HashSet<_> = [1, 2, 3].iter().cloned().collect(); @@ -477,6 +484,7 @@ impl HashSet /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::collections::HashSet; /// /// let a: HashSet<_> = [1, 2, 3].iter().cloned().collect(); @@ -498,6 +506,7 @@ impl HashSet /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::collections::HashSet; /// /// let sup: HashSet<_> = [1, 2, 3].iter().cloned().collect(); @@ -519,6 +528,7 @@ impl HashSet /// # Examples /// /// ``` + /// # #![feature(core)] /// use std::collections::HashSet; /// /// let sub: HashSet<_> = [1, 2].iter().cloned().collect(); diff --git a/src/libstd/collections/mod.rs b/src/libstd/collections/mod.rs index caada8ae50f..8d24f6b1916 100644 --- a/src/libstd/collections/mod.rs +++ b/src/libstd/collections/mod.rs @@ -300,6 +300,7 @@ //! #### Counting the number of times each character in a string occurs //! //! ``` +//! # #![feature(collections)] //! use std::collections::btree_map::{BTreeMap, Entry}; //! //! let mut count = BTreeMap::new(); @@ -327,6 +328,7 @@ //! #### Tracking the inebriation of customers at a bar //! //! ``` +//! # #![feature(collections)] //! use std::collections::btree_map::{BTreeMap, Entry}; //! //! // A client of the bar. They have an id and a blood alcohol level. diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs index fc4f03ff3a5..96088003b99 100644 --- a/src/libstd/ffi/c_str.rs +++ b/src/libstd/ffi/c_str.rs @@ -44,6 +44,7 @@ use vec::Vec; /// # Examples /// /// ```no_run +/// # #![feature(libc)] /// # extern crate libc; /// # fn main() { /// use std::ffi::CString; @@ -82,6 +83,7 @@ pub struct CString { /// Inspecting a foreign C string /// /// ```no_run +/// # #![feature(libc)] /// extern crate libc; /// use std::ffi::CStr; /// @@ -98,6 +100,7 @@ pub struct CString { /// Passing a Rust-originating C string /// /// ```no_run +/// # #![feature(libc)] /// extern crate libc; /// use std::ffi::{CString, CStr}; /// @@ -144,6 +147,7 @@ impl CString { /// # Examples /// /// ```no_run + /// # #![feature(libc)] /// extern crate libc; /// use std::ffi::CString; /// @@ -179,6 +183,7 @@ impl CString { /// # Examples /// /// ```no_run + /// # #![feature(libc)] /// extern crate libc; /// use std::ffi::CString; /// @@ -329,6 +334,7 @@ impl CStr { /// # Examples /// /// ```no_run + /// # #![feature(libc)] /// # extern crate libc; /// # fn main() { /// use std::ffi::CStr; diff --git a/src/libstd/fs/mod.rs b/src/libstd/fs/mod.rs index 7df6d6887a2..ba98e1ddd55 100644 --- a/src/libstd/fs/mod.rs +++ b/src/libstd/fs/mod.rs @@ -633,6 +633,7 @@ pub fn remove_dir_all(path: P) -> io::Result<()> { /// # Examples /// /// ``` +/// # #![feature(path_ext)] /// use std::io; /// use std::fs::{self, PathExt, DirEntry}; /// use std::path::Path; @@ -771,6 +772,7 @@ pub fn set_file_times(path: P, accessed: u64, /// # Examples /// /// ``` +/// # #![feature(fs)] /// # fn foo() -> std::io::Result<()> { /// use std::fs; /// diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 1aa2189d315..dc390b534b7 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -105,6 +105,7 @@ html_favicon_url = "http://www.rust-lang.org/favicon.ico", html_root_url = "http://doc.rust-lang.org/nightly/", html_playground_url = "http://play.rust-lang.org/")] +#![doc(test(no_crate_inject))] #![feature(alloc)] #![feature(box_syntax)] diff --git a/src/libstd/macros.rs b/src/libstd/macros.rs index f4a7e8b1b98..061c00329d2 100644 --- a/src/libstd/macros.rs +++ b/src/libstd/macros.rs @@ -112,6 +112,7 @@ macro_rules! try { /// # Examples /// /// ``` +/// # #![feature(std_misc)] /// use std::thread; /// use std::sync::mpsc; /// diff --git a/src/libstd/net/addr.rs b/src/libstd/net/addr.rs index 87241117043..e8187dc2c40 100644 --- a/src/libstd/net/addr.rs +++ b/src/libstd/net/addr.rs @@ -263,6 +263,7 @@ impl hash::Hash for SocketAddrV6 { /// Some examples: /// /// ```no_run +/// # #![feature(net)] /// use std::net::{SocketAddrV4, TcpStream, UdpSocket, TcpListener, Ipv4Addr}; /// /// fn main() { diff --git a/src/libstd/net/mod.rs b/src/libstd/net/mod.rs index 543fdd16f41..48b3247f212 100644 --- a/src/libstd/net/mod.rs +++ b/src/libstd/net/mod.rs @@ -91,6 +91,7 @@ impl Iterator for LookupHost { /// # Examples /// /// ```no_run +/// # #![feature(net)] /// use std::net; /// /// # fn foo() -> std::io::Result<()> { diff --git a/src/libstd/net/tcp.rs b/src/libstd/net/tcp.rs index f263d7d72d3..869faa795f9 100644 --- a/src/libstd/net/tcp.rs +++ b/src/libstd/net/tcp.rs @@ -27,6 +27,7 @@ use sys_common::AsInner; /// # Examples /// /// ```no_run +/// # #![feature(net)] /// use std::io::prelude::*; /// use std::net::TcpStream; /// @@ -46,6 +47,7 @@ pub struct TcpStream(net_imp::TcpStream); /// # Examples /// /// ```no_run +/// # #![feature(net)] /// use std::net::{TcpListener, TcpStream}; /// use std::thread; /// diff --git a/src/libstd/net/udp.rs b/src/libstd/net/udp.rs index 1ace1957526..e593bbe8e48 100644 --- a/src/libstd/net/udp.rs +++ b/src/libstd/net/udp.rs @@ -27,6 +27,7 @@ use sys_common::AsInner; /// # Examples /// /// ```no_run +/// # #![feature(net)] /// use std::net::UdpSocket; /// /// # fn foo() -> std::io::Result<()> { diff --git a/src/libstd/num/f32.rs b/src/libstd/num/f32.rs index b5513dfd035..a4f06f14d49 100644 --- a/src/libstd/num/f32.rs +++ b/src/libstd/num/f32.rs @@ -365,6 +365,7 @@ impl f32 { /// Returns the `NaN` value. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// let nan: f32 = Float::nan(); @@ -379,6 +380,7 @@ impl f32 { /// Returns the infinite value. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// use std::f32; /// @@ -396,6 +398,7 @@ impl f32 { /// Returns the negative infinite value. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// use std::f32; /// @@ -413,6 +416,7 @@ impl f32 { /// Returns `0.0`. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// let inf: f32 = Float::infinity(); @@ -431,6 +435,7 @@ impl f32 { /// Returns `-0.0`. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// let inf: f32 = Float::infinity(); @@ -449,6 +454,7 @@ impl f32 { /// Returns `1.0`. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// let one: f32 = Float::one(); @@ -525,6 +531,7 @@ impl f32 { /// Returns the smallest finite value that this type can represent. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// use std::f64; /// @@ -548,6 +555,7 @@ impl f32 { /// Returns the largest finite value that this type can represent. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// use std::f64; /// @@ -563,6 +571,7 @@ impl f32 { /// Returns `true` if this value is `NaN` and false otherwise. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// use std::f64; /// @@ -580,6 +589,7 @@ impl f32 { /// false otherwise. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// use std::f32; /// @@ -601,6 +611,7 @@ impl f32 { /// Returns `true` if this number is neither infinite nor `NaN`. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// use std::f32; /// @@ -623,6 +634,7 @@ impl f32 { /// [subnormal][subnormal], or `NaN`. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// use std::f32; /// @@ -650,6 +662,7 @@ impl f32 { /// predicate instead. /// /// ``` + /// # #![feature(core)] /// use std::num::{Float, FpCategory}; /// use std::f32; /// @@ -668,6 +681,7 @@ impl f32 { /// The floating point encoding is documented in the [Reference][floating-point]. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// let num = 2.0f32; @@ -770,6 +784,7 @@ impl f32 { /// number is `Float::nan()`. /// /// ``` + /// # #![feature(core, std_misc)] /// use std::num::Float; /// use std::f64; /// @@ -795,6 +810,7 @@ impl f32 { /// - `Float::nan()` if the number is `Float::nan()` /// /// ``` + /// # #![feature(core, std_misc)] /// use std::num::Float; /// use std::f64; /// @@ -856,6 +872,7 @@ impl f32 { /// a separate multiplication operation followed by an add. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// let m = 10.0; @@ -875,6 +892,7 @@ impl f32 { /// Take the reciprocal (inverse) of a number, `1/x`. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// let x = 2.0; @@ -922,6 +940,7 @@ impl f32 { /// Returns NaN if `self` is a negative number. /// /// ``` + /// # #![feature(core, std_misc)] /// use std::num::Float; /// /// let positive = 4.0; @@ -940,6 +959,7 @@ impl f32 { /// Take the reciprocal (inverse) square root of a number, `1/sqrt(x)`. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// let f = 4.0; @@ -1061,6 +1081,7 @@ impl f32 { /// Convert radians to degrees. /// /// ``` + /// # #![feature(std_misc, core)] /// use std::num::Float; /// use std::f64::consts; /// @@ -1077,6 +1098,7 @@ impl f32 { /// Convert degrees to radians. /// /// ``` + /// # #![feature(std_misc, core)] /// use std::num::Float; /// use std::f64::consts; /// @@ -1093,6 +1115,7 @@ impl f32 { /// Constructs a floating point number of `x*2^exp`. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// // 3*2^2 - 12 == 0 @@ -1114,6 +1137,7 @@ impl f32 { /// * `0.5 <= abs(x) < 1.0` /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// let x = 4.0; @@ -1141,6 +1165,7 @@ impl f32 { /// `other`. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// let x = 1.0f32; @@ -1194,6 +1219,7 @@ impl f32 { /// * Else: `self - other` /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// let x = 3.0; @@ -1214,6 +1240,7 @@ impl f32 { /// Take the cubic root of a number. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// let x = 8.0; @@ -1233,6 +1260,7 @@ impl f32 { /// legs of length `x` and `y`. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// let x = 2.0; @@ -1253,6 +1281,7 @@ impl f32 { /// Computes the sine of a number (in radians). /// /// ``` + /// # #![feature(core)] /// use std::num::Float; /// use std::f64; /// @@ -1271,6 +1300,7 @@ impl f32 { /// Computes the cosine of a number (in radians). /// /// ``` + /// # #![feature(core)] /// use std::num::Float; /// use std::f64; /// @@ -1289,6 +1319,7 @@ impl f32 { /// Computes the tangent of a number (in radians). /// /// ``` + /// # #![feature(core)] /// use std::num::Float; /// use std::f64; /// @@ -1308,6 +1339,7 @@ impl f32 { /// [-1, 1]. /// /// ``` + /// # #![feature(core)] /// use std::num::Float; /// use std::f64; /// @@ -1329,6 +1361,7 @@ impl f32 { /// [-1, 1]. /// /// ``` + /// # #![feature(core)] /// use std::num::Float; /// use std::f64; /// @@ -1372,6 +1405,7 @@ impl f32 { /// * `y < 0`: `arctan(y/x) - pi` -> `(-pi, -pi/2)` /// /// ``` + /// # #![feature(core)] /// use std::num::Float; /// use std::f64; /// @@ -1401,6 +1435,7 @@ impl f32 { /// `(sin(x), cos(x))`. /// /// ``` + /// # #![feature(core)] /// use std::num::Float; /// use std::f64; /// @@ -1423,6 +1458,7 @@ impl f32 { /// number is close to zero. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// let x = 7.0; @@ -1442,6 +1478,7 @@ impl f32 { /// the operations were performed separately. /// /// ``` + /// # #![feature(std_misc, core)] /// use std::num::Float; /// use std::f64; /// @@ -1461,6 +1498,7 @@ impl f32 { /// Hyperbolic sine function. /// /// ``` + /// # #![feature(core)] /// use std::num::Float; /// use std::f64; /// @@ -1483,6 +1521,7 @@ impl f32 { /// Hyperbolic cosine function. /// /// ``` + /// # #![feature(core)] /// use std::num::Float; /// use std::f64; /// @@ -1505,6 +1544,7 @@ impl f32 { /// Hyperbolic tangent function. /// /// ``` + /// # #![feature(core)] /// use std::num::Float; /// use std::f64; /// @@ -1527,6 +1567,7 @@ impl f32 { /// Inverse hyperbolic sine function. /// /// ``` + /// # #![feature(core)] /// use std::num::Float; /// /// let x = 1.0; @@ -1548,6 +1589,7 @@ impl f32 { /// Inverse hyperbolic cosine function. /// /// ``` + /// # #![feature(core)] /// use std::num::Float; /// /// let x = 1.0; @@ -1569,6 +1611,7 @@ impl f32 { /// Inverse hyperbolic tangent function. /// /// ``` + /// # #![feature(core)] /// use std::num::Float; /// use std::f64; /// diff --git a/src/libstd/num/f64.rs b/src/libstd/num/f64.rs index 61bddc3d18f..9306804d1f7 100644 --- a/src/libstd/num/f64.rs +++ b/src/libstd/num/f64.rs @@ -374,6 +374,7 @@ impl f64 { /// Returns the `NaN` value. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// let nan: f32 = Float::nan(); @@ -388,6 +389,7 @@ impl f64 { /// Returns the infinite value. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// use std::f32; /// @@ -405,6 +407,7 @@ impl f64 { /// Returns the negative infinite value. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// use std::f32; /// @@ -422,6 +425,7 @@ impl f64 { /// Returns `0.0`. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// let inf: f32 = Float::infinity(); @@ -440,6 +444,7 @@ impl f64 { /// Returns `-0.0`. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// let inf: f32 = Float::infinity(); @@ -458,6 +463,7 @@ impl f64 { /// Returns `1.0`. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// let one: f32 = Float::one(); @@ -534,6 +540,7 @@ impl f64 { /// Returns the smallest finite value that this type can represent. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// use std::f64; /// @@ -557,6 +564,7 @@ impl f64 { /// Returns the largest finite value that this type can represent. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// use std::f64; /// @@ -572,6 +580,7 @@ impl f64 { /// Returns `true` if this value is `NaN` and false otherwise. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// use std::f64; /// @@ -589,6 +598,7 @@ impl f64 { /// false otherwise. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// use std::f32; /// @@ -610,6 +620,7 @@ impl f64 { /// Returns `true` if this number is neither infinite nor `NaN`. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// use std::f32; /// @@ -632,6 +643,7 @@ impl f64 { /// [subnormal][subnormal], or `NaN`. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// use std::f32; /// @@ -659,6 +671,7 @@ impl f64 { /// predicate instead. /// /// ``` + /// # #![feature(core)] /// use std::num::{Float, FpCategory}; /// use std::f32; /// @@ -677,6 +690,7 @@ impl f64 { /// The floating point encoding is documented in the [Reference][floating-point]. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// let num = 2.0f32; @@ -779,6 +793,7 @@ impl f64 { /// number is `Float::nan()`. /// /// ``` + /// # #![feature(core, std_misc)] /// use std::num::Float; /// use std::f64; /// @@ -804,6 +819,7 @@ impl f64 { /// - `Float::nan()` if the number is `Float::nan()` /// /// ``` + /// # #![feature(core, std_misc)] /// use std::num::Float; /// use std::f64; /// @@ -865,6 +881,7 @@ impl f64 { /// a separate multiplication operation followed by an add. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// let m = 10.0; @@ -884,6 +901,7 @@ impl f64 { /// Take the reciprocal (inverse) of a number, `1/x`. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// let x = 2.0; @@ -931,6 +949,7 @@ impl f64 { /// Returns NaN if `self` is a negative number. /// /// ``` + /// # #![feature(core, std_misc)] /// use std::num::Float; /// /// let positive = 4.0; @@ -948,6 +967,7 @@ impl f64 { /// Take the reciprocal (inverse) square root of a number, `1/sqrt(x)`. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// let f = 4.0; @@ -1069,6 +1089,7 @@ impl f64 { /// Convert radians to degrees. /// /// ``` + /// # #![feature(std_misc, core)] /// use std::num::Float; /// use std::f64::consts; /// @@ -1085,6 +1106,7 @@ impl f64 { /// Convert degrees to radians. /// /// ``` + /// # #![feature(std_misc, core)] /// use std::num::Float; /// use std::f64::consts; /// @@ -1101,6 +1123,7 @@ impl f64 { /// Constructs a floating point number of `x*2^exp`. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// // 3*2^2 - 12 == 0 @@ -1122,6 +1145,7 @@ impl f64 { /// * `0.5 <= abs(x) < 1.0` /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// let x = 4.0; @@ -1149,6 +1173,7 @@ impl f64 { /// `other`. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// let x = 1.0f32; @@ -1202,6 +1227,7 @@ impl f64 { /// * Else: `self - other` /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// let x = 3.0; @@ -1222,6 +1248,7 @@ impl f64 { /// Take the cubic root of a number. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// let x = 8.0; @@ -1241,6 +1268,7 @@ impl f64 { /// legs of length `x` and `y`. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// let x = 2.0; @@ -1261,6 +1289,7 @@ impl f64 { /// Computes the sine of a number (in radians). /// /// ``` + /// # #![feature(core)] /// use std::num::Float; /// use std::f64; /// @@ -1279,6 +1308,7 @@ impl f64 { /// Computes the cosine of a number (in radians). /// /// ``` + /// # #![feature(core)] /// use std::num::Float; /// use std::f64; /// @@ -1297,6 +1327,7 @@ impl f64 { /// Computes the tangent of a number (in radians). /// /// ``` + /// # #![feature(core)] /// use std::num::Float; /// use std::f64; /// @@ -1316,6 +1347,7 @@ impl f64 { /// [-1, 1]. /// /// ``` + /// # #![feature(core)] /// use std::num::Float; /// use std::f64; /// @@ -1337,6 +1369,7 @@ impl f64 { /// [-1, 1]. /// /// ``` + /// # #![feature(core)] /// use std::num::Float; /// use std::f64; /// @@ -1380,6 +1413,7 @@ impl f64 { /// * `y < 0`: `arctan(y/x) - pi` -> `(-pi, -pi/2)` /// /// ``` + /// # #![feature(core)] /// use std::num::Float; /// use std::f64; /// @@ -1409,6 +1443,7 @@ impl f64 { /// `(sin(x), cos(x))`. /// /// ``` + /// # #![feature(core)] /// use std::num::Float; /// use std::f64; /// @@ -1431,6 +1466,7 @@ impl f64 { /// number is close to zero. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// let x = 7.0; @@ -1450,6 +1486,7 @@ impl f64 { /// the operations were performed separately. /// /// ``` + /// # #![feature(std_misc, core)] /// use std::num::Float; /// use std::f64; /// @@ -1469,6 +1506,7 @@ impl f64 { /// Hyperbolic sine function. /// /// ``` + /// # #![feature(core)] /// use std::num::Float; /// use std::f64; /// @@ -1491,6 +1529,7 @@ impl f64 { /// Hyperbolic cosine function. /// /// ``` + /// # #![feature(core)] /// use std::num::Float; /// use std::f64; /// @@ -1513,6 +1552,7 @@ impl f64 { /// Hyperbolic tangent function. /// /// ``` + /// # #![feature(core)] /// use std::num::Float; /// use std::f64; /// @@ -1577,6 +1617,7 @@ impl f64 { /// Inverse hyperbolic tangent function. /// /// ``` + /// # #![feature(core)] /// use std::num::Float; /// use std::f64; /// diff --git a/src/libstd/num/mod.rs b/src/libstd/num/mod.rs index 562094a87f4..b9e9433e3ee 100644 --- a/src/libstd/num/mod.rs +++ b/src/libstd/num/mod.rs @@ -55,6 +55,7 @@ pub trait Float /// Returns the `NaN` value. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// let nan: f32 = Float::nan(); @@ -67,6 +68,7 @@ pub trait Float /// Returns the infinite value. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// use std::f32; /// @@ -82,6 +84,7 @@ pub trait Float /// Returns the negative infinite value. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// use std::f32; /// @@ -97,6 +100,7 @@ pub trait Float /// Returns `0.0`. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// let inf: f32 = Float::infinity(); @@ -113,6 +117,7 @@ pub trait Float /// Returns `-0.0`. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// let inf: f32 = Float::infinity(); @@ -129,6 +134,7 @@ pub trait Float /// Returns `1.0`. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// let one: f32 = Float::one(); @@ -182,6 +188,7 @@ pub trait Float /// Returns the smallest finite value that this type can represent. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// use std::f64; /// @@ -199,6 +206,7 @@ pub trait Float /// Returns the largest finite value that this type can represent. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// use std::f64; /// @@ -211,6 +219,7 @@ pub trait Float /// Returns `true` if this value is `NaN` and false otherwise. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// use std::f64; /// @@ -226,6 +235,7 @@ pub trait Float /// false otherwise. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// use std::f32; /// @@ -245,6 +255,7 @@ pub trait Float /// Returns `true` if this number is neither infinite nor `NaN`. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// use std::f32; /// @@ -265,6 +276,7 @@ pub trait Float /// [subnormal][subnormal], or `NaN`. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// use std::f32; /// @@ -291,6 +303,7 @@ pub trait Float /// predicate instead. /// /// ``` + /// # #![feature(core)] /// use std::num::{Float, FpCategory}; /// use std::f32; /// @@ -308,6 +321,7 @@ pub trait Float /// The floating point encoding is documented in the [Reference][floating-point]. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// let num = 2.0f32; @@ -399,6 +413,7 @@ pub trait Float /// number is `Float::nan()`. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// use std::f64; /// @@ -422,6 +437,7 @@ pub trait Float /// - `Float::nan()` if the number is `Float::nan()` /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// use std::f64; /// @@ -478,6 +494,7 @@ pub trait Float /// a separate multiplication operation followed by an add. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// let m = 10.0; @@ -495,6 +512,7 @@ pub trait Float /// Take the reciprocal (inverse) of a number, `1/x`. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// let x = 2.0; @@ -537,6 +555,7 @@ pub trait Float /// Returns NaN if `self` is a negative number. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// let positive = 4.0; @@ -553,6 +572,7 @@ pub trait Float /// Take the reciprocal (inverse) square root of a number, `1/sqrt(x)`. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// let f = 4.0; @@ -662,6 +682,7 @@ pub trait Float /// Convert radians to degrees. /// /// ``` + /// # #![feature(std_misc, core)] /// use std::num::Float; /// use std::f64::consts; /// @@ -676,6 +697,7 @@ pub trait Float /// Convert degrees to radians. /// /// ``` + /// # #![feature(std_misc, core)] /// use std::num::Float; /// use std::f64::consts; /// @@ -690,6 +712,7 @@ pub trait Float /// Constructs a floating point number of `x*2^exp`. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// // 3*2^2 - 12 == 0 @@ -707,6 +730,7 @@ pub trait Float /// * `0.5 <= abs(x) < 1.0` /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// let x = 4.0; @@ -726,6 +750,7 @@ pub trait Float /// `other`. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// let x = 1.0f32; @@ -769,6 +794,7 @@ pub trait Float /// * Else: `self - other` /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// let x = 3.0; @@ -785,6 +811,7 @@ pub trait Float /// Take the cubic root of a number. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// let x = 8.0; @@ -800,6 +827,7 @@ pub trait Float /// legs of length `x` and `y`. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// let x = 2.0; @@ -817,6 +845,7 @@ pub trait Float /// Computes the sine of a number (in radians). /// /// ``` + /// # #![feature(core)] /// use std::num::Float; /// use std::f64; /// @@ -831,6 +860,7 @@ pub trait Float /// Computes the cosine of a number (in radians). /// /// ``` + /// # #![feature(core)] /// use std::num::Float; /// use std::f64; /// @@ -845,6 +875,7 @@ pub trait Float /// Computes the tangent of a number (in radians). /// /// ``` + /// # #![feature(core)] /// use std::num::Float; /// use std::f64; /// @@ -860,6 +891,7 @@ pub trait Float /// [-1, 1]. /// /// ``` + /// # #![feature(core)] /// use std::num::Float; /// use std::f64; /// @@ -877,6 +909,7 @@ pub trait Float /// [-1, 1]. /// /// ``` + /// # #![feature(core)] /// use std::num::Float; /// use std::f64; /// @@ -912,6 +945,7 @@ pub trait Float /// * `y < 0`: `arctan(y/x) - pi` -> `(-pi, -pi/2)` /// /// ``` + /// # #![feature(core)] /// use std::num::Float; /// use std::f64; /// @@ -937,6 +971,7 @@ pub trait Float /// `(sin(x), cos(x))`. /// /// ``` + /// # #![feature(core)] /// use std::num::Float; /// use std::f64; /// @@ -956,6 +991,7 @@ pub trait Float /// number is close to zero. /// /// ``` + /// # #![feature(std_misc)] /// use std::num::Float; /// /// let x = 7.0; @@ -971,6 +1007,7 @@ pub trait Float /// the operations were performed separately. /// /// ``` + /// # #![feature(std_misc, core)] /// use std::num::Float; /// use std::f64; /// @@ -987,6 +1024,7 @@ pub trait Float /// Hyperbolic sine function. /// /// ``` + /// # #![feature(core)] /// use std::num::Float; /// use std::f64; /// @@ -1005,6 +1043,7 @@ pub trait Float /// Hyperbolic cosine function. /// /// ``` + /// # #![feature(core)] /// use std::num::Float; /// use std::f64; /// @@ -1023,6 +1062,7 @@ pub trait Float /// Hyperbolic tangent function. /// /// ``` + /// # #![feature(core)] /// use std::num::Float; /// use std::f64; /// @@ -1069,6 +1109,7 @@ pub trait Float /// Inverse hyperbolic tangent function. /// /// ``` + /// # #![feature(core)] /// use std::num::Float; /// use std::f64; /// diff --git a/src/libstd/old_io/buffered.rs b/src/libstd/old_io/buffered.rs index 3e5f732e345..cb67d709a14 100644 --- a/src/libstd/old_io/buffered.rs +++ b/src/libstd/old_io/buffered.rs @@ -33,6 +33,7 @@ use vec::Vec; /// # Examples /// /// ``` +/// # #![feature(old_io, old_path)] /// use std::old_io::*; /// use std::old_path::Path; /// @@ -137,6 +138,7 @@ impl Reader for BufferedReader { /// # Examples /// /// ``` +/// # #![feature(old_io, old_path)] /// use std::old_io::*; /// use std::old_path::Path; /// @@ -324,6 +326,7 @@ impl Reader for InternalBufferedWriter { /// # Examples /// /// ``` +/// # #![feature(old_io, old_path)] /// # #![allow(unused_must_use)] /// use std::old_io::*; /// use std::old_path::Path; diff --git a/src/libstd/old_io/comm_adapters.rs b/src/libstd/old_io/comm_adapters.rs index 7e62a21f105..cd8252540da 100644 --- a/src/libstd/old_io/comm_adapters.rs +++ b/src/libstd/old_io/comm_adapters.rs @@ -23,6 +23,7 @@ use vec::Vec; /// # Examples /// /// ``` +/// # #![feature(old_io)] /// use std::sync::mpsc::channel; /// use std::old_io::*; /// @@ -114,6 +115,7 @@ impl Reader for ChanReader { /// # Examples /// /// ``` +/// # #![feature(old_io, io)] /// # #![allow(unused_must_use)] /// use std::sync::mpsc::channel; /// use std::old_io::*; diff --git a/src/libstd/old_io/fs.rs b/src/libstd/old_io/fs.rs index 87e5b91fc28..40a7cce81dd 100644 --- a/src/libstd/old_io/fs.rs +++ b/src/libstd/old_io/fs.rs @@ -30,6 +30,7 @@ //! # Examples //! //! ```rust +//! # #![feature(old_io, io, old_path)] //! # #![allow(unused_must_use)] //! use std::old_io::fs::PathExtensions; //! use std::old_io::*; @@ -105,6 +106,7 @@ impl File { /// # Examples /// /// ```rust,should_fail + /// # #![feature(old_io, old_path)] /// use std::old_io::*; /// use std::old_path::Path; /// @@ -177,6 +179,7 @@ impl File { /// # Examples /// /// ``` + /// # #![feature(old_io, old_path)] /// use std::old_io::*; /// use std::old_path::Path; /// @@ -197,6 +200,7 @@ impl File { /// # Examples /// /// ``` + /// # #![feature(old_io, old_path, io)] /// # #![allow(unused_must_use)] /// use std::old_io::*; /// use std::old_path::Path; @@ -289,6 +293,7 @@ impl File { /// # Examples /// /// ``` +/// # #![feature(old_io, old_path)] /// # #![allow(unused_must_use)] /// use std::old_io::*; /// use std::old_path::Path; @@ -321,6 +326,7 @@ pub fn unlink(path: &Path) -> IoResult<()> { /// # Examples /// /// ``` +/// # #![feature(old_io, old_path)] /// use std::old_io::*; /// use std::old_path::Path; /// @@ -364,6 +370,7 @@ pub fn lstat(path: &Path) -> IoResult { /// # Examples /// /// ``` +/// # #![feature(old_io, old_path)] /// # #![allow(unused_must_use)] /// use std::old_io::*; /// use std::old_path::Path; @@ -393,6 +400,7 @@ pub fn rename(from: &Path, to: &Path) -> IoResult<()> { /// # Examples /// /// ``` +/// # #![feature(old_io, old_path)] /// # #![allow(unused_must_use)] /// use std::old_io::*; /// use std::old_path::Path; @@ -444,6 +452,7 @@ pub fn copy(from: &Path, to: &Path) -> IoResult<()> { /// # Examples /// /// ``` +/// # #![feature(old_io, old_path)] /// # #![allow(unused_must_use)] /// use std::old_io; /// use std::old_io::*; @@ -516,6 +525,7 @@ pub fn readlink(path: &Path) -> IoResult { /// # Examples /// /// ``` +/// # #![feature(old_io, old_path, old_fs)] /// # #![allow(unused_must_use)] /// use std::old_io; /// use std::old_io::*; @@ -541,6 +551,7 @@ pub fn mkdir(path: &Path, mode: FilePermission) -> IoResult<()> { /// # Examples /// /// ``` +/// # #![feature(old_io, old_path)] /// # #![allow(unused_must_use)] /// use std::old_io::*; /// use std::old_path::Path; @@ -566,6 +577,7 @@ pub fn rmdir(path: &Path) -> IoResult<()> { /// # Examples /// /// ``` +/// # #![feature(old_io, old_path)] /// use std::old_io::fs::PathExtensions; /// use std::old_io; /// use std::old_io::*; diff --git a/src/libstd/old_io/mem.rs b/src/libstd/old_io/mem.rs index 1acc6abc850..d877a60b079 100644 --- a/src/libstd/old_io/mem.rs +++ b/src/libstd/old_io/mem.rs @@ -54,6 +54,7 @@ impl Writer for Vec { /// # Examples /// /// ``` +/// # #![feature(old_io, io)] /// # #![allow(unused_must_use)] /// use std::old_io::*; /// @@ -114,6 +115,7 @@ impl Writer for MemWriter { /// # Examples /// /// ``` +/// # #![feature(old_io)] /// # #![allow(unused_must_use)] /// use std::old_io::*; /// @@ -244,6 +246,7 @@ impl<'a> Buffer for &'a [u8] { /// # Examples /// /// ``` +/// # #![feature(old_io, io)] /// # #![allow(unused_must_use)] /// use std::old_io::*; /// @@ -316,6 +319,7 @@ impl<'a> Seek for BufWriter<'a> { /// # Examples /// /// ``` +/// # #![feature(old_io)] /// # #![allow(unused_must_use)] /// use std::old_io::*; /// diff --git a/src/libstd/old_io/mod.rs b/src/libstd/old_io/mod.rs index 6dfb54fd66c..ac908c529dc 100644 --- a/src/libstd/old_io/mod.rs +++ b/src/libstd/old_io/mod.rs @@ -48,6 +48,7 @@ //! * Read lines from stdin //! //! ```rust +//! # #![feature(old_io, old_path)] //! use std::old_io as io; //! use std::old_io::*; //! @@ -60,6 +61,7 @@ //! * Read a complete file //! //! ```rust +//! # #![feature(old_io, old_path)] //! use std::old_io::*; //! use std::old_path::Path; //! @@ -69,6 +71,7 @@ //! * Write a line to a file //! //! ```rust +//! # #![feature(old_io, old_path)] //! # #![allow(unused_must_use)] //! use std::old_io::*; //! use std::old_path::Path; @@ -82,6 +85,7 @@ //! * Iterate over the lines of a file //! //! ```rust,no_run +//! # #![feature(old_io, old_path)] //! use std::old_io::*; //! use std::old_path::Path; //! @@ -95,6 +99,7 @@ //! * Pull the lines of a file into a vector of strings //! //! ```rust,no_run +//! # #![feature(old_io, old_path)] //! use std::old_io::*; //! use std::old_path::Path; //! @@ -106,6 +111,7 @@ //! * Make a simple TCP client connection and request //! //! ```rust +//! # #![feature(old_io)] //! # #![allow(unused_must_use)] //! use std::old_io::*; //! @@ -122,6 +128,7 @@ //! * Make a simple TCP server //! //! ```rust +//! # #![feature(old_io)] //! # fn main() { } //! # fn foo() { //! # #![allow(dead_code)] @@ -186,6 +193,7 @@ //! If you wanted to handle the error though you might write: //! //! ```rust +//! # #![feature(old_io, old_path)] //! # #![allow(unused_must_use)] //! use std::old_io::*; //! use std::old_path::Path; @@ -221,6 +229,7 @@ //! If you wanted to read several `u32`s from a file and return their product: //! //! ```rust +//! # #![feature(old_io, old_path)] //! use std::old_io::*; //! use std::old_path::Path; //! @@ -948,6 +957,7 @@ unsafe fn slice_vec_capacity<'a, T>(v: &'a mut Vec, start: uint, end: uint) - /// # Examples /// /// ``` +/// # #![feature(old_io)] /// use std::old_io as io; /// use std::old_io::*; /// use std::old_io::util::LimitReader; @@ -1282,6 +1292,7 @@ impl<'a> Writer for &'a mut (Writer+'a) { /// # Examples /// /// ``` +/// # #![feature(old_io)] /// use std::old_io::util::TeeReader; /// use std::old_io::*; /// @@ -1407,6 +1418,7 @@ pub trait Buffer: Reader { /// # Examples /// /// ``` + /// # #![feature(old_io)] /// use std::old_io::*; /// /// let mut reader = BufReader::new(b"hello\nworld"); @@ -1631,6 +1643,7 @@ impl<'a, T, A: ?Sized + Acceptor> Iterator for IncomingConnections<'a, A> { /// # Examples /// /// ``` +/// # #![feature(old_io)] /// use std::old_io as io; /// /// let eof = io::standard_error(io::EndOfFile); @@ -1719,6 +1732,7 @@ pub enum FileType { /// # Examples /// /// ```no_run +/// # #![feature(old_io, old_path)] /// /// use std::old_io::fs::PathExtensions; /// use std::old_path::Path; diff --git a/src/libstd/old_io/net/ip.rs b/src/libstd/old_io/net/ip.rs index 077a5072570..f7953ac51b8 100644 --- a/src/libstd/old_io/net/ip.rs +++ b/src/libstd/old_io/net/ip.rs @@ -414,6 +414,7 @@ pub struct ParseError; /// Some examples: /// /// ```rust,no_run +/// # #![feature(old_io, core)] /// # #![allow(unused_must_use)] /// /// use std::old_io::{TcpStream, TcpListener}; diff --git a/src/libstd/old_io/net/pipe.rs b/src/libstd/old_io/net/pipe.rs index 77efedbc327..f9e5ae71e12 100644 --- a/src/libstd/old_io/net/pipe.rs +++ b/src/libstd/old_io/net/pipe.rs @@ -54,6 +54,7 @@ impl UnixStream { /// # Examples /// /// ``` + /// # #![feature(old_io, old_path, io)] /// # #![allow(unused_must_use)] /// use std::old_io::net::pipe::UnixStream; /// use std::old_io::*; @@ -181,6 +182,7 @@ impl UnixListener { /// # Examples /// /// ``` + /// # #![feature(old_io, io, old_path)] /// # fn foo() { /// use std::old_io::net::pipe::UnixListener; /// use std::old_io::*; diff --git a/src/libstd/old_io/net/tcp.rs b/src/libstd/old_io/net/tcp.rs index dbf3c4a4b1e..75f786f0bb1 100644 --- a/src/libstd/old_io/net/tcp.rs +++ b/src/libstd/old_io/net/tcp.rs @@ -41,6 +41,7 @@ use sys_common; /// # Examples /// /// ```no_run +/// # #![feature(old_io, io)] /// use std::old_io::*; /// /// { @@ -133,6 +134,7 @@ impl TcpStream { /// # Examples /// /// ```no_run + /// # #![feature(old_io, std_misc)] /// # #![allow(unused_must_use)] /// use std::old_io::*; /// use std::time::Duration; @@ -278,6 +280,7 @@ impl sys_common::AsInner for TcpStream { /// # Examples /// /// ``` +/// # #![feature(old_io)] /// # fn foo() { /// use std::old_io::*; /// use std::thread; @@ -374,6 +377,7 @@ impl TcpAcceptor { /// # Examples /// /// ```no_run + /// # #![feature(old_io, io)] /// use std::old_io::*; /// /// let mut a = TcpListener::bind("127.0.0.1:8482").listen().unwrap(); @@ -417,6 +421,7 @@ impl TcpAcceptor { /// # Examples /// /// ``` + /// # #![feature(old_io, io)] /// use std::old_io::*; /// use std::thread; /// diff --git a/src/libstd/old_io/net/udp.rs b/src/libstd/old_io/net/udp.rs index 97ef3da2f36..3aa811974b3 100644 --- a/src/libstd/old_io/net/udp.rs +++ b/src/libstd/old_io/net/udp.rs @@ -31,6 +31,7 @@ use sys_common; /// # Examples /// /// ```rust,no_run +/// # #![feature(old_io)] /// # #![allow(unused_must_use)] /// /// use std::old_io::net::udp::UdpSocket; diff --git a/src/libstd/old_io/pipe.rs b/src/libstd/old_io/pipe.rs index b2b28453c89..0b555e2f0ff 100644 --- a/src/libstd/old_io/pipe.rs +++ b/src/libstd/old_io/pipe.rs @@ -46,6 +46,7 @@ impl PipeStream { /// # Examples /// /// ```{rust,no_run} + /// # #![feature(old_io, libc, io)] /// # #![allow(unused_must_use)] /// extern crate libc; /// diff --git a/src/libstd/old_io/process.rs b/src/libstd/old_io/process.rs index 54fd20f45e2..d7ede451fb8 100644 --- a/src/libstd/old_io/process.rs +++ b/src/libstd/old_io/process.rs @@ -61,6 +61,7 @@ use thread; /// # Examples /// /// ```should_fail +/// # #![feature(old_io)] /// use std::old_io::*; /// /// let mut child = match Command::new("/bin/cat").arg("file.txt").spawn() { @@ -164,6 +165,7 @@ pub type EnvMap = HashMap; /// to be changed (for example, by adding arguments) prior to spawning: /// /// ``` +/// # #![feature(old_io)] /// use std::old_io::*; /// /// let mut process = match Command::new("sh").arg("-c").arg("echo hello").spawn() { @@ -365,6 +367,7 @@ impl Command { /// # Examples /// /// ``` + /// # #![feature(old_io, core)] /// use std::old_io::Command; /// /// let output = match Command::new("cat").arg("foot.txt").output() { @@ -386,6 +389,7 @@ impl Command { /// # Examples /// /// ``` + /// # #![feature(old_io)] /// use std::old_io::Command; /// /// let status = match Command::new("ls").status() { @@ -660,6 +664,7 @@ impl Process { /// # Examples /// /// ```no_run + /// # #![feature(old_io, io)] /// use std::old_io::{Command, IoResult}; /// use std::old_io::process::ProcessExit; /// diff --git a/src/libstd/old_io/stdio.rs b/src/libstd/old_io/stdio.rs index a1c8630e0ec..ef811f832b3 100644 --- a/src/libstd/old_io/stdio.rs +++ b/src/libstd/old_io/stdio.rs @@ -18,6 +18,7 @@ //! # Examples //! //! ```rust +//! # #![feature(old_io)] //! # #![allow(unused_must_use)] //! use std::old_io; //! use std::old_io::*; @@ -140,6 +141,7 @@ impl StdinReader { /// # Examples /// /// ``` + /// # #![feature(old_io)] /// use std::old_io; /// use std::old_io::*; /// diff --git a/src/libstd/old_io/tempfile.rs b/src/libstd/old_io/tempfile.rs index 90b3d1004c0..c0f6ddaaef7 100644 --- a/src/libstd/old_io/tempfile.rs +++ b/src/libstd/old_io/tempfile.rs @@ -29,6 +29,7 @@ use string::String; /// # Examples /// /// ```no_run +/// # #![feature(old_io, old_path)] /// use std::old_io::*; /// use std::old_path::{Path, GenericPath}; /// diff --git a/src/libstd/old_io/timer.rs b/src/libstd/old_io/timer.rs index 65c62a99335..f8cba044443 100644 --- a/src/libstd/old_io/timer.rs +++ b/src/libstd/old_io/timer.rs @@ -31,6 +31,7 @@ use sys::timer::Timer as TimerImp; /// # Examples /// /// ``` +/// # #![feature(old_io, std_misc)] /// # fn foo() { /// use std::old_io::Timer; /// use std::time::Duration; @@ -54,6 +55,7 @@ use sys::timer::Timer as TimerImp; /// the `old_io::timer` module. /// /// ``` +/// # #![feature(old_io, std_misc)] /// # fn foo() { /// use std::old_io::timer; /// use std::time::Duration; @@ -116,6 +118,7 @@ impl Timer { /// # Examples /// /// ``` + /// # #![feature(old_io, std_misc)] /// use std::old_io::Timer; /// use std::time::Duration; /// @@ -129,6 +132,7 @@ impl Timer { /// ``` /// /// ``` + /// # #![feature(old_io, std_misc)] /// use std::old_io::Timer; /// use std::time::Duration; /// @@ -168,6 +172,7 @@ impl Timer { /// # Examples /// /// ``` + /// # #![feature(old_io, std_misc)] /// use std::old_io::Timer; /// use std::time::Duration; /// @@ -187,6 +192,7 @@ impl Timer { /// ``` /// /// ``` + /// # #![feature(old_io, std_misc)] /// use std::old_io::Timer; /// use std::time::Duration; /// diff --git a/src/libstd/old_path/mod.rs b/src/libstd/old_path/mod.rs index 909fa4062b6..50bda04b5d0 100644 --- a/src/libstd/old_path/mod.rs +++ b/src/libstd/old_path/mod.rs @@ -49,6 +49,7 @@ //! ## Examples //! //! ```rust +//! # #![feature(old_path, old_io)] //! use std::old_io::fs::PathExtensions; //! use std::old_path::{Path, GenericPath}; //! @@ -143,6 +144,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// # #![feature(old_path)] /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} @@ -168,6 +170,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// # #![feature(old_path)] /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} @@ -191,6 +194,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// # #![feature(old_path)] /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} @@ -209,6 +213,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// # #![feature(old_path)] /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} @@ -224,6 +229,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// # #![feature(old_path)] /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} @@ -240,6 +246,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// # #![feature(old_path)] /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} @@ -259,6 +266,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// # #![feature(old_path)] /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} @@ -277,6 +285,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// # #![feature(old_path)] /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} @@ -293,6 +302,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// # #![feature(old_path)] /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} @@ -313,6 +323,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// # #![feature(old_path)] /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} @@ -329,6 +340,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// # #![feature(old_path)] /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} @@ -349,6 +361,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// # #![feature(old_path)] /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} @@ -377,6 +390,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// # #![feature(old_path)] /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} @@ -398,6 +412,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// # #![feature(old_path)] /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} @@ -426,6 +441,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// # #![feature(old_path)] /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} @@ -445,6 +461,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// # #![feature(old_path)] /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} @@ -472,6 +489,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// # #![feature(old_path)] /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} @@ -523,6 +541,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// # #![feature(old_path)] /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} @@ -549,6 +568,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// # #![feature(old_path)] /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} @@ -574,6 +594,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// # #![feature(old_path)] /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} @@ -594,6 +615,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// # #![feature(old_path)] /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} @@ -610,6 +632,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// # #![feature(old_path)] /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} @@ -635,6 +658,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// # #![feature(old_path)] /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} @@ -665,6 +689,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// # #![feature(old_path)] /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} @@ -683,6 +708,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// # #![feature(old_path)] /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} @@ -709,6 +735,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// # #![feature(old_path)] /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} @@ -732,6 +759,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// # #![feature(old_path)] /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} @@ -750,6 +778,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// # #![feature(old_path)] /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} @@ -769,6 +798,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// # #![feature(old_path)] /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} @@ -789,6 +819,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// # #![feature(old_path)] /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} @@ -806,6 +837,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe { /// # Examples /// /// ``` + /// # #![feature(old_path)] /// use std::old_path::{Path, GenericPath}; /// # foo(); /// # #[cfg(windows)] fn foo() {} diff --git a/src/libstd/old_path/windows.rs b/src/libstd/old_path/windows.rs index cea2c238ece..4f367e30526 100644 --- a/src/libstd/old_path/windows.rs +++ b/src/libstd/old_path/windows.rs @@ -605,6 +605,7 @@ impl Path { /// # Examples /// /// ``` + /// # #![feature(old_path)] /// use std::old_path::{Path, GenericPath}; /// println!("{}", Path::new(r"C:\some\path").display()); /// ``` @@ -620,6 +621,7 @@ impl Path { /// # Examples /// /// ``` + /// # #![feature(old_path)] /// use std::old_path::{Path, GenericPath}; /// let path = Path::new_opt(r"C:\some\path"); /// diff --git a/src/libstd/os.rs b/src/libstd/os.rs index 3870b8614ff..6296cd9554c 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -125,6 +125,7 @@ pub const TMPBUF_SZ : uint = 1000; /// # Examples /// /// ``` +/// # #![feature(os, old_path)] /// use std::os; /// use std::old_path::{Path, GenericPath}; /// @@ -146,6 +147,7 @@ pub fn getcwd() -> IoResult { /// # Examples /// /// ``` +/// # #![feature(os)] /// use std::os; /// /// // We will iterate through the references to the element returned by os::env(); @@ -182,6 +184,7 @@ pub fn env_as_bytes() -> Vec<(Vec, Vec)> { /// # Examples /// /// ``` +/// # #![feature(os)] /// use std::os; /// /// let key = "HOME"; @@ -224,6 +227,7 @@ fn byteify(s: OsString) -> Vec { /// # Examples /// /// ``` +/// # #![feature(os)] /// use std::os; /// /// let key = "KEY"; @@ -265,6 +269,7 @@ pub fn unsetenv(n: &str) { /// # Examples /// /// ``` +/// # #![feature(old_path, os)] /// use std::os; /// use std::old_path::{Path, GenericPath}; /// @@ -298,6 +303,7 @@ pub fn split_paths(unparsed: T) -> Vec { /// # Examples /// /// ``` +/// # #![feature(os, old_path, core)] /// use std::os; /// use std::old_path::Path; /// @@ -359,6 +365,7 @@ pub fn dll_filename(base: &str) -> String { /// # Examples /// /// ``` +/// # #![feature(os, old_path)] /// use std::os; /// use std::old_path::{Path, GenericPath}; /// @@ -380,6 +387,7 @@ pub fn self_exe_name() -> Option { /// # Examples /// /// ``` +/// # #![feature(os, old_path)] /// use std::os; /// use std::old_path::{Path, GenericPath}; /// @@ -410,6 +418,7 @@ pub fn self_exe_path() -> Option { /// # Examples /// /// ``` +/// # #![feature(os, old_path)] /// use std::os; /// use std::old_path::{Path, GenericPath}; /// @@ -501,6 +510,7 @@ pub fn tmpdir() -> Path { /// # Examples /// /// ``` +/// # #![feature(os, old_path)] /// use std::os; /// use std::old_path::{Path, GenericPath}; /// @@ -533,6 +543,7 @@ pub fn make_absolute(p: &Path) -> IoResult { /// # Examples /// /// ``` +/// # #![feature(os, old_path)] /// use std::os; /// use std::old_path::{Path, GenericPath}; /// @@ -555,6 +566,7 @@ pub fn errno() -> i32 { /// # Examples /// /// ``` +/// # #![feature(os)] /// use std::os; /// /// // Same as println!("{}", last_os_error()); @@ -751,6 +763,7 @@ extern "system" { /// # Examples /// /// ``` +/// # #![feature(os)] /// use std::os; /// /// // Prints each argument on a separate line diff --git a/src/libstd/rand/mod.rs b/src/libstd/rand/mod.rs index 69053252ed1..656ca980624 100644 --- a/src/libstd/rand/mod.rs +++ b/src/libstd/rand/mod.rs @@ -58,6 +58,7 @@ //! # Examples //! //! ```rust +//! # #![feature(rand)] //! use std::rand; //! use std::rand::Rng; //! @@ -68,6 +69,7 @@ //! ``` //! //! ```rust +//! # #![feature(rand)] //! use std::rand; //! //! let tuple = rand::random::<(f64, char)>(); @@ -92,6 +94,7 @@ //! multiply this fraction by 4. //! //! ``` +//! # #![feature(rand)] //! use std::rand; //! use std::rand::distributions::{IndependentSample, Range}; //! @@ -134,6 +137,7 @@ //! [Monty Hall Problem]: http://en.wikipedia.org/wiki/Monty_Hall_problem //! //! ``` +//! # #![feature(rand)] //! use std::rand; //! use std::rand::Rng; //! use std::rand::distributions::{IndependentSample, Range}; @@ -384,6 +388,7 @@ impl Rng for ThreadRng { /// # Examples /// /// ``` +/// # #![feature(rand)] /// use std::rand; /// /// let x: u8 = rand::random(); @@ -400,6 +405,7 @@ impl Rng for ThreadRng { /// Caching the thread local random number generator: /// /// ``` +/// # #![feature(rand)] /// use std::rand; /// use std::rand::Rng; /// @@ -427,6 +433,7 @@ pub fn random() -> T { /// # Examples /// /// ``` +/// # #![feature(rand)] /// use std::rand::{thread_rng, sample}; /// /// let mut rng = thread_rng(); diff --git a/src/libstd/rand/reader.rs b/src/libstd/rand/reader.rs index 5231b122b9e..d3a8fa864fc 100644 --- a/src/libstd/rand/reader.rs +++ b/src/libstd/rand/reader.rs @@ -24,6 +24,7 @@ use result::Result::{Ok, Err}; /// # Examples /// /// ``` +/// # #![feature(rand, old_io)] /// use std::rand::{reader, Rng}; /// use std::old_io::MemReader; /// diff --git a/src/libstd/sync/condvar.rs b/src/libstd/sync/condvar.rs index 4430cc3b0af..69c5267ab69 100644 --- a/src/libstd/sync/condvar.rs +++ b/src/libstd/sync/condvar.rs @@ -69,6 +69,7 @@ pub struct Condvar { inner: Box } /// # Examples /// /// ``` +/// # #![feature(std_misc)] /// use std::sync::{StaticCondvar, CONDVAR_INIT}; /// /// static CVAR: StaticCondvar = CONDVAR_INIT; diff --git a/src/libstd/sync/future.rs b/src/libstd/sync/future.rs index ee9bcd3dd89..3c7fecb7515 100644 --- a/src/libstd/sync/future.rs +++ b/src/libstd/sync/future.rs @@ -14,6 +14,7 @@ //! # Examples //! //! ``` +//! # #![feature(std_misc)] //! use std::sync::Future; //! //! // a fake, for now diff --git a/src/libstd/sync/mpsc/mod.rs b/src/libstd/sync/mpsc/mod.rs index 123dad978f5..cb8acf14e13 100644 --- a/src/libstd/sync/mpsc/mod.rs +++ b/src/libstd/sync/mpsc/mod.rs @@ -119,6 +119,7 @@ //! after 10 seconds no matter what: //! //! ```no_run +//! # #![feature(std_misc, old_io)] //! use std::sync::mpsc::channel; //! use std::old_io::timer::Timer; //! use std::time::Duration; @@ -143,6 +144,7 @@ //! has been inactive for 5 seconds: //! //! ```no_run +//! # #![feature(std_misc, old_io)] //! use std::sync::mpsc::channel; //! use std::old_io::timer::Timer; //! use std::time::Duration; diff --git a/src/libstd/sync/mpsc/select.rs b/src/libstd/sync/mpsc/select.rs index b5739c36aa9..0f936641cdc 100644 --- a/src/libstd/sync/mpsc/select.rs +++ b/src/libstd/sync/mpsc/select.rs @@ -27,6 +27,7 @@ //! # Examples //! //! ```rust +//! # #![feature(std_misc)] //! use std::sync::mpsc::channel; //! //! let (tx1, rx1) = channel(); @@ -119,6 +120,7 @@ impl Select { /// # Examples /// /// ``` + /// # #![feature(std_misc)] /// use std::sync::mpsc::Select; /// /// let select = Select::new(); diff --git a/src/libstd/sync/mutex.rs b/src/libstd/sync/mutex.rs index 130fd1d7dc8..2bf75cf1d37 100644 --- a/src/libstd/sync/mutex.rs +++ b/src/libstd/sync/mutex.rs @@ -85,6 +85,7 @@ use fmt; /// To recover from a poisoned mutex: /// /// ``` +/// # #![feature(std_misc)] /// use std::sync::{Arc, Mutex}; /// use std::thread; /// @@ -136,6 +137,7 @@ unsafe impl Sync for Mutex { } /// # Examples /// /// ``` +/// # #![feature(std_misc)] /// use std::sync::{StaticMutex, MUTEX_INIT}; /// /// static LOCK: StaticMutex = MUTEX_INIT; diff --git a/src/libstd/sync/rwlock.rs b/src/libstd/sync/rwlock.rs index 368e88e4e8b..6e94db6d753 100644 --- a/src/libstd/sync/rwlock.rs +++ b/src/libstd/sync/rwlock.rs @@ -77,6 +77,7 @@ unsafe impl Sync for RwLock {} /// # Examples /// /// ``` +/// # #![feature(std_misc)] /// use std::sync::{StaticRwLock, RW_LOCK_INIT}; /// /// static LOCK: StaticRwLock = RW_LOCK_INIT; diff --git a/src/libstd/sync/semaphore.rs b/src/libstd/sync/semaphore.rs index 2f9873950b6..059cce57245 100644 --- a/src/libstd/sync/semaphore.rs +++ b/src/libstd/sync/semaphore.rs @@ -25,6 +25,7 @@ use sync::{Mutex, Condvar}; /// # Examples /// /// ``` +/// # #![feature(std_misc)] /// use std::sync::Semaphore; /// /// // Create a semaphore that represents 5 resources diff --git a/src/libstd/sync/task_pool.rs b/src/libstd/sync/task_pool.rs index 8a1946b86ab..51cf70e615b 100644 --- a/src/libstd/sync/task_pool.rs +++ b/src/libstd/sync/task_pool.rs @@ -61,6 +61,7 @@ impl<'a> Drop for Sentinel<'a> { /// # Examples /// /// ``` +/// # #![feature(std_misc, core)] /// use std::sync::TaskPool; /// use std::iter::AdditiveIterator; /// use std::sync::mpsc::channel; diff --git a/src/libstd/thread_local/scoped.rs b/src/libstd/thread_local/scoped.rs index 86e6c059a70..34b581f7fda 100644 --- a/src/libstd/thread_local/scoped.rs +++ b/src/libstd/thread_local/scoped.rs @@ -24,6 +24,7 @@ //! # Examples //! //! ``` +//! # #![feature(std_misc)] //! scoped_thread_local!(static FOO: u32); //! //! // Initially each scoped slot is empty. @@ -142,6 +143,7 @@ impl Key { /// # Examples /// /// ``` + /// # #![feature(std_misc)] /// scoped_thread_local!(static FOO: u32); /// /// FOO.set(&100, || { @@ -194,6 +196,7 @@ impl Key { /// # Examples /// /// ```no_run + /// # #![feature(std_misc)] /// scoped_thread_local!(static FOO: u32); /// /// FOO.with(|slot| { diff --git a/src/libterm/lib.rs b/src/libterm/lib.rs index f517dca53cd..990ce769d9b 100644 --- a/src/libterm/lib.rs +++ b/src/libterm/lib.rs @@ -19,6 +19,7 @@ //! # Examples //! //! ```no_run +//! # #![feature(rustc_private)] //! extern crate term; //! //! use std::io::prelude::*; diff --git a/src/libunicode/char.rs b/src/libunicode/char.rs index e0f013cbc80..db5a25b9bed 100644 --- a/src/libunicode/char.rs +++ b/src/libunicode/char.rs @@ -209,6 +209,7 @@ pub trait CharExt { /// In both of these examples, 'ß' takes two bytes to encode. /// /// ``` + /// # #![feature(unicode)] /// let mut b = [0; 2]; /// /// let result = 'ß'.encode_utf8(&mut b); @@ -219,6 +220,7 @@ pub trait CharExt { /// A buffer that's too small: /// /// ``` + /// # #![feature(unicode)] /// let mut b = [0; 1]; /// /// let result = 'ß'.encode_utf8(&mut b); @@ -241,6 +243,7 @@ pub trait CharExt { /// In both of these examples, 'ß' takes one `u16` to encode. /// /// ``` + /// # #![feature(unicode)] /// let mut b = [0; 1]; /// /// let result = 'ß'.encode_utf16(&mut b); @@ -251,6 +254,7 @@ pub trait CharExt { /// A buffer that's too small: /// /// ``` + /// # #![feature(unicode)] /// let mut b = [0; 0]; /// /// let result = 'ß'.encode_utf8(&mut b); diff --git a/src/libunicode/lib.rs b/src/libunicode/lib.rs index a09c0cb3bd6..6879fa7b3ba 100644 --- a/src/libunicode/lib.rs +++ b/src/libunicode/lib.rs @@ -35,6 +35,7 @@ #![feature(no_std)] #![no_std] #![feature(core)] +#![doc(test(no_crate_inject))] extern crate core; diff --git a/src/libunicode/u_str.rs b/src/libunicode/u_str.rs index 485065685f1..de3a593143e 100644 --- a/src/libunicode/u_str.rs +++ b/src/libunicode/u_str.rs @@ -481,19 +481,24 @@ impl<'a> Iterator for Utf16Items<'a> { /// # Examples /// /// ``` +/// # #![feature(unicode)] +/// extern crate unicode; +/// /// use unicode::str::Utf16Item::{ScalarValue, LoneSurrogate}; /// -/// // 𝄞music -/// let v = [0xD834, 0xDD1E, 0x006d, 0x0075, -/// 0x0073, 0xDD1E, 0x0069, 0x0063, -/// 0xD834]; +/// fn main() { +/// // 𝄞music +/// let v = [0xD834, 0xDD1E, 0x006d, 0x0075, +/// 0x0073, 0xDD1E, 0x0069, 0x0063, +/// 0xD834]; /// -/// assert_eq!(unicode::str::utf16_items(&v).collect::>(), -/// vec![ScalarValue('𝄞'), -/// ScalarValue('m'), ScalarValue('u'), ScalarValue('s'), -/// LoneSurrogate(0xDD1E), -/// ScalarValue('i'), ScalarValue('c'), -/// LoneSurrogate(0xD834)]); +/// assert_eq!(unicode::str::utf16_items(&v).collect::>(), +/// vec![ScalarValue('𝄞'), +/// ScalarValue('m'), ScalarValue('u'), ScalarValue('s'), +/// LoneSurrogate(0xDD1E), +/// ScalarValue('i'), ScalarValue('c'), +/// LoneSurrogate(0xD834)]); +/// } /// ``` pub fn utf16_items<'a>(v: &'a [u16]) -> Utf16Items<'a> { Utf16Items { iter : v.iter() } diff --git a/src/test/pretty/default-trait-impl.rs b/src/test/pretty/default-trait-impl.rs index d148bb15e99..509bee9def2 100644 --- a/src/test/pretty/default-trait-impl.rs +++ b/src/test/pretty/default-trait-impl.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(optin_builtin_traits)] +#![feature(optin_builtin_traits, core)] // pp-exact