rollup merge of #23598: brson/gate
Conflicts: src/compiletest/compiletest.rs src/libcollections/lib.rs src/librustc_back/lib.rs src/libserialize/lib.rs src/libstd/lib.rs src/libtest/lib.rs src/test/run-make/rustdoc-default-impl/foo.rs src/test/run-pass/env-home-dir.rs
This commit is contained in:
@@ -220,6 +220,7 @@ impl<T:Copy> Cell<T> {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # #![feature(core)]
|
||||
/// use std::cell::Cell;
|
||||
///
|
||||
/// let c = Cell::new(5);
|
||||
|
||||
@@ -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<T: Ord>(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<T: Ord>(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<T: PartialOrd>(v1: T, v2: T) -> Option<T> {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # #![feature(core)]
|
||||
/// use std::cmp;
|
||||
///
|
||||
/// assert_eq!(Some(2), cmp::partial_max(1, 2));
|
||||
@@ -438,6 +442,7 @@ pub fn partial_min<T: PartialOrd>(v1: T, v2: T) -> Option<T> {
|
||||
/// When comparison is impossible:
|
||||
///
|
||||
/// ```
|
||||
/// # #![feature(core)]
|
||||
/// use std::cmp;
|
||||
///
|
||||
/// let result = cmp::partial_max(std::f64::NAN, 1.0);
|
||||
|
||||
@@ -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};
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
//! # Examples
|
||||
//!
|
||||
//! ```
|
||||
//! # #![feature(core)]
|
||||
//! # #![feature(unboxed_closures)]
|
||||
//!
|
||||
//! use std::finally::Finally;
|
||||
@@ -70,6 +71,7 @@ impl<T, F> Finally<T> for F where F: FnMut() -> T {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # #![feature(core)]
|
||||
/// use std::finally::try_finally;
|
||||
///
|
||||
/// struct State<'a> { buffer: &'a mut [u8], len: usize }
|
||||
|
||||
@@ -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<i32>);
|
||||
@@ -712,6 +715,7 @@ impl<'a> Formatter<'a> {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```rust
|
||||
/// # #![feature(debug_builders, core)]
|
||||
/// use std::fmt;
|
||||
///
|
||||
/// struct Foo(Vec<(String, i32)>);
|
||||
|
||||
@@ -146,6 +146,7 @@ pub struct RadixFmt<T, R>(T, R);
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # #![feature(core)]
|
||||
/// use std::fmt::radix;
|
||||
/// assert_eq!(format!("{}", radix(55, 36)), "1j".to_string());
|
||||
/// ```
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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<T>(ptr: *const T, elts: uint) -> Vec<T> {
|
||||
|
||||
@@ -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<A> {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # #![feature(core)]
|
||||
/// use std::iter::AdditiveIterator;
|
||||
///
|
||||
/// let a = [1, 2, 3, 4, 5];
|
||||
@@ -1188,6 +1202,7 @@ pub trait MultiplicativeIterator<A> {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # #![feature(core)]
|
||||
/// use std::iter::{count, MultiplicativeIterator};
|
||||
///
|
||||
/// fn factorial(n: usize) -> usize {
|
||||
@@ -1248,6 +1263,7 @@ impl<T: Clone> MinMaxResult<T> {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # #![feature(core)]
|
||||
/// use std::iter::MinMaxResult::{self, NoElements, OneElement, MinMax};
|
||||
///
|
||||
/// let r: MinMaxResult<i32> = NoElements;
|
||||
@@ -2292,6 +2308,7 @@ impl<I: RandomAccessIterator, F> RandomAccessIterator for Inspect<I, F>
|
||||
/// 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<A> {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # #![feature(core)]
|
||||
/// use std::iter::range_step_inclusive;
|
||||
///
|
||||
/// for i in range_step_inclusive(0, 10, 2) {
|
||||
|
||||
@@ -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]
|
||||
|
||||
@@ -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"); }
|
||||
|
||||
@@ -323,6 +323,7 @@ impl<T:?Sized> MarkerTrait for T { }
|
||||
/// `MarkerTrait`:
|
||||
///
|
||||
/// ```
|
||||
/// # #![feature(core)]
|
||||
/// use std::marker::MarkerTrait;
|
||||
/// trait Even : MarkerTrait { }
|
||||
/// ```
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -276,6 +276,7 @@ impl<T> Option<T> {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # #![feature(core)]
|
||||
/// let mut x = Some("Diamonds");
|
||||
/// {
|
||||
/// let v = x.as_mut_slice();
|
||||
@@ -471,6 +472,7 @@ impl<T> Option<T> {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # #![feature(core)]
|
||||
/// let x = Some("foo");
|
||||
/// assert_eq!(x.ok_or(0), Ok("foo"));
|
||||
///
|
||||
@@ -492,6 +494,7 @@ impl<T> Option<T> {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # #![feature(core)]
|
||||
/// let x = Some("foo");
|
||||
/// assert_eq!(x.ok_or_else(|| 0), Ok("foo"));
|
||||
///
|
||||
@@ -533,6 +536,7 @@ impl<T> Option<T> {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
/// # #![feature(core)]
|
||||
/// let mut x = Some(4);
|
||||
/// match x.iter_mut().next() {
|
||||
/// Some(&mut ref mut v) => *v = 42,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
///
|
||||
|
||||
@@ -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;
|
||||
//!
|
||||
@@ -426,6 +433,7 @@ impl<T, E> Result<T, E> {
|
||||
/// Convert from `Result<T, E>` to `&mut [T]` (without copying)
|
||||
///
|
||||
/// ```
|
||||
/// # #![feature(core)]
|
||||
/// let mut x: Result<&str, u32> = Ok("Gold");
|
||||
/// {
|
||||
/// let v = x.as_mut_slice();
|
||||
@@ -467,6 +475,7 @@ impl<T, E> Result<T, E> {
|
||||
/// ignoring I/O and parse errors:
|
||||
///
|
||||
/// ```
|
||||
/// # #![feature(old_io)]
|
||||
/// use std::old_io::*;
|
||||
///
|
||||
/// let mut buffer: &[u8] = b"1\n2\n3\n4\n";
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -1697,6 +1697,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!
|
||||
|
||||
Reference in New Issue
Block a user