Auto merge of #27380 - steveklabnik:rollup, r=steveklabnik

- Successful merges: #27102, #27286, #27313, #27325, #27326, #27327, #27341, #27342, #27343, #27345, #27350, #27355, #27374, #27375, #27379
- Failed merges:
This commit is contained in:
bors 2015-07-29 14:47:23 +00:00
commit ddbce1107b
103 changed files with 653 additions and 399 deletions

6
configure vendored
View file

@ -1005,11 +1005,9 @@ then
(''|*clang)
CFG_CLANG_REPORTED_VERSION=$($CFG_CC --version | grep version)
if [[ $CFG_CLANG_REPORTED_VERSION == *"(based on LLVM "* ]]
then
if echo $CFG_CLANG_REPORTED_VERSION | grep -q "(based on LLVM "; then
CFG_CLANG_VERSION=$(echo $CFG_CLANG_REPORTED_VERSION | sed 's/.*(based on LLVM \(.*\))/\1/')
elif [[ $CFG_CLANG_REPORTED_VERSION == "Apple LLVM"* ]]
then
elif echo $CFG_CLANG_REPORTED_VERSION | grep -q "Apple LLVM"; then
CFG_OSX_CLANG_VERSION=$(echo $CFG_CLANG_REPORTED_VERSION | sed 's/.*version \(.*\) .*/\1/')
else
CFG_CLANG_VERSION=$(echo $CFG_CLANG_REPORTED_VERSION | sed 's/.*version \(.*\) .*/\1/')

View file

@ -42,7 +42,7 @@ allowed to share references to this by the regular borrowing rules, checked at c
## `&T` and `&mut T`
These are immutable and mutable references respectively. They follow the &lquo;read-write lock&rquo;
These are immutable and mutable references respectively. They follow the “read-write lock”
pattern, such that one may either have only one mutable reference to some data, or any number of
immutable ones, but not both. This guarantee is enforced at compile time, and has no visible cost at
runtime. In most cases these two pointer types suffice for sharing cheap references between sections
@ -108,7 +108,7 @@ increment the inner reference count and return a copy of the `Rc<T>`.
# Cell types
&lquo;Cell&rquo;s provide interior mutability. In other words, they contain data which can be manipulated even
`Cell`s provide interior mutability. In other words, they contain data which can be manipulated even
if the type cannot be obtained in a mutable form (for example, when it is behind an `&`-ptr or
`Rc<T>`).
@ -127,7 +127,8 @@ If a field is wrapped in `Cell`, it's a nice indicator that the chunk of data is
stay the same between the time you first read it and when you intend to use it.
```rust
# use std::cell::Cell;
use std::cell::Cell;
let x = Cell::new(1);
let y = &x;
let z = &x;
@ -185,7 +186,8 @@ any other borrows active when a mutable borrow is active. If the programmer atte
borrow, the thread will panic.
```rust
# use std::cell::RefCell;
use std::cell::RefCell;
let x = RefCell::new(vec![1,2,3,4]);
{
println!("{:?}", *x.borrow())

View file

@ -355,6 +355,10 @@ Hello in English: Hello!
Goodbye in English: Goodbye.
```
`pub` also applies to `struct`s and their member fields. In keeping with Rusts
tendency toward safety, simply making a `struct` public won't automatically
make its members public: you must mark the fields individually with `pub`.
Now that our functions are public, we can use them. Great! However, typing out
`phrases::english::greetings::hello()` is very long and repetitive. Rust has
another keyword for importing names into the current scope, so that you can
@ -517,9 +521,6 @@ of `foo` relative to where we are. If thats prefixed with `::`, as in
`::foo::bar()`, it refers to a different `foo`, an absolute path from your
crate root.
Also, note that we `pub use`d before we declared our `mod`s. Rust requires that
`use` declarations go first.
This will build and run:
```bash

View file

@ -499,7 +499,7 @@ generator, which is local to the particular [thread][concurrency] of execution
were in. Because we `use rand::Rng`d above, it has a `gen_range()` method
available. This method takes two arguments, and generates a number between
them. Its inclusive on the lower bound, but exclusive on the upper bound,
so we need `1` and `101` to get a number between one and a hundred.
so we need `1` and `101` to get a number ranging from one to a hundred.
[concurrency]: concurrency.html

View file

@ -11,7 +11,7 @@ perform efficient pointer arithmetic, one would import those functions
via a declaration like
```rust
# #![feature(intrinsics)]
#![feature(intrinsics)]
# fn main() {}
extern "rust-intrinsic" {

View file

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

View file

@ -75,7 +75,8 @@ use core::raw::{TraitObject};
/// The following two examples are equivalent:
///
/// ```
/// # #![feature(box_heap)]
/// #![feature(box_heap)]
///
/// #![feature(box_syntax, placement_in_syntax)]
/// use std::boxed::HEAP;
///
@ -241,7 +242,8 @@ impl<T : ?Sized> Box<T> {
///
/// # Examples
/// ```
/// # #![feature(box_raw)]
/// #![feature(box_raw)]
///
/// let seventeen = Box::new(17u32);
/// let raw = Box::into_raw(seventeen);
/// let boxed_again = unsafe { Box::from_raw(raw) };
@ -264,7 +266,8 @@ impl<T : ?Sized> Box<T> {
///
/// # Examples
/// ```
/// # #![feature(box_raw)]
/// #![feature(box_raw)]
///
/// use std::boxed;
///
/// let seventeen = Box::new(17u32);
@ -307,7 +310,8 @@ impl<T: Clone> Clone for Box<T> {
/// # Examples
///
/// ```
/// # #![feature(box_raw)]
/// #![feature(box_raw)]
///
/// let x = Box::new(5);
/// let mut y = Box::new(10);
///

View file

@ -91,7 +91,8 @@
//! documentation for more details on interior mutability.
//!
//! ```rust
//! # #![feature(rc_weak)]
//! #![feature(rc_weak)]
//!
//! use std::rc::Rc;
//! use std::rc::Weak;
//! use std::cell::RefCell;
@ -227,7 +228,8 @@ impl<T> Rc<T> {
/// # Examples
///
/// ```
/// # #![feature(rc_unique)]
/// #![feature(rc_unique)]
///
/// use std::rc::Rc;
///
/// let x = Rc::new(3);
@ -262,7 +264,8 @@ impl<T: ?Sized> Rc<T> {
/// # Examples
///
/// ```
/// # #![feature(rc_weak)]
/// #![feature(rc_weak)]
///
/// use std::rc::Rc;
///
/// let five = Rc::new(5);
@ -292,7 +295,8 @@ impl<T: ?Sized> Rc<T> {
/// # Examples
///
/// ```
/// # #![feature(rc_unique)]
/// #![feature(rc_unique)]
///
/// use std::rc::Rc;
///
/// let five = Rc::new(5);
@ -313,7 +317,8 @@ impl<T: ?Sized> Rc<T> {
/// # Examples
///
/// ```
/// # #![feature(rc_unique)]
/// #![feature(rc_unique)]
///
/// use std::rc::Rc;
///
/// let mut x = Rc::new(3);
@ -353,7 +358,8 @@ pub fn strong_count<T: ?Sized>(this: &Rc<T>) -> usize { Rc::strong_count(this) }
/// # Examples
///
/// ```
/// # #![feature(rc_unique)]
/// #![feature(rc_unique)]
///
/// use std::rc;
/// use std::rc::Rc;
///
@ -373,7 +379,8 @@ pub fn is_unique<T>(rc: &Rc<T>) -> bool { Rc::is_unique(rc) }
/// # Examples
///
/// ```
/// # #![feature(rc_unique)]
/// #![feature(rc_unique)]
///
/// use std::rc::{self, Rc};
///
/// let x = Rc::new(3);
@ -395,7 +402,8 @@ pub fn try_unwrap<T>(rc: Rc<T>) -> Result<T, Rc<T>> { Rc::try_unwrap(rc) }
/// # Examples
///
/// ```
/// # #![feature(rc_unique)]
/// #![feature(rc_unique)]
///
/// use std::rc::{self, Rc};
///
/// let mut x = Rc::new(3);
@ -419,7 +427,8 @@ impl<T: Clone> Rc<T> {
/// # Examples
///
/// ```
/// # #![feature(rc_unique)]
/// #![feature(rc_unique)]
///
/// use std::rc::Rc;
///
/// let mut five = Rc::new(5);
@ -750,7 +759,8 @@ impl<T: ?Sized> Weak<T> {
/// # Examples
///
/// ```
/// # #![feature(rc_weak)]
/// #![feature(rc_weak)]
///
/// use std::rc::Rc;
///
/// let five = Rc::new(5);
@ -778,7 +788,8 @@ impl<T: ?Sized> Drop for Weak<T> {
/// # Examples
///
/// ```
/// # #![feature(rc_weak)]
/// #![feature(rc_weak)]
///
/// use std::rc::Rc;
///
/// {
@ -825,7 +836,8 @@ impl<T: ?Sized> Clone for Weak<T> {
/// # Examples
///
/// ```
/// # #![feature(rc_weak)]
/// #![feature(rc_weak)]
///
/// use std::rc::Rc;
///
/// let weak_five = Rc::new(5).downgrade();

View file

@ -216,7 +216,8 @@ impl<T: Ord> BinaryHeap<T> {
/// # Examples
///
/// ```
/// # #![feature(collections)]
/// #![feature(collections)]
///
/// use std::collections::BinaryHeap;
/// let heap = BinaryHeap::from_vec(vec![9, 1, 2, 7, 3, 2]);
/// ```
@ -236,7 +237,8 @@ impl<T: Ord> BinaryHeap<T> {
/// # Examples
///
/// ```
/// # #![feature(collections)]
/// #![feature(collections)]
///
/// use std::collections::BinaryHeap;
/// let heap = BinaryHeap::from_vec(vec![1, 2, 3, 4]);
///
@ -341,7 +343,8 @@ impl<T: Ord> BinaryHeap<T> {
/// # Examples
///
/// ```
/// # #![feature(collections)]
/// #![feature(collections)]
///
/// use std::collections::BinaryHeap;
/// let mut heap = BinaryHeap::from_vec(vec![1, 3]);
///
@ -387,7 +390,8 @@ impl<T: Ord> BinaryHeap<T> {
/// # Examples
///
/// ```
/// # #![feature(collections)]
/// #![feature(collections)]
///
/// use std::collections::BinaryHeap;
/// let mut heap = BinaryHeap::new();
/// heap.push(1);
@ -419,7 +423,8 @@ impl<T: Ord> BinaryHeap<T> {
/// # Examples
///
/// ```
/// # #![feature(collections)]
/// #![feature(collections)]
///
/// use std::collections::BinaryHeap;
/// let mut heap = BinaryHeap::new();
///
@ -445,7 +450,8 @@ impl<T: Ord> BinaryHeap<T> {
/// # Examples
///
/// ```
/// # #![feature(collections)]
/// #![feature(collections)]
///
/// use std::collections::BinaryHeap;
/// let heap = BinaryHeap::from_vec(vec![1, 2, 3, 4, 5, 6, 7]);
/// let vec = heap.into_vec();
@ -463,7 +469,8 @@ impl<T: Ord> BinaryHeap<T> {
/// # Examples
///
/// ```
/// # #![feature(collections)]
/// #![feature(collections)]
///
/// use std::collections::BinaryHeap;
///
/// let mut heap = BinaryHeap::from_vec(vec![1, 2, 4, 5, 7]);
@ -724,7 +731,8 @@ impl<T: Ord> IntoIterator for BinaryHeap<T> {
/// # Examples
///
/// ```
/// # #![feature(collections)]
/// #![feature(collections)]
///
/// use std::collections::BinaryHeap;
/// let heap = BinaryHeap::from_vec(vec![1, 2, 3, 4]);
///

View file

@ -43,7 +43,8 @@
//! [sieve]: http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes
//!
//! ```
//! # #![feature(bitset, bitvec, range_inclusive, step_by)]
//! #![feature(bitset, bitvec, range_inclusive, step_by)]
//!
//! use std::collections::{BitSet, BitVec};
//! use std::iter;
//!
@ -139,7 +140,8 @@ const FALSE: &'static bool = &false;
/// # Examples
///
/// ```
/// # #![feature(bitvec)]
/// #![feature(bitvec)]
///
/// use std::collections::BitVec;
///
/// let mut bv = BitVec::from_elem(10, false);
@ -256,7 +258,8 @@ impl BitVec {
/// # Examples
///
/// ```
/// # #![feature(bitvec)]
/// #![feature(bitvec)]
///
/// use std::collections::BitVec;
/// let mut bv = BitVec::new();
/// ```
@ -271,7 +274,8 @@ impl BitVec {
/// # Examples
///
/// ```
/// # #![feature(bitvec)]
/// #![feature(bitvec)]
///
/// use std::collections::BitVec;
///
/// let bv = BitVec::from_elem(10, false);
@ -312,7 +316,8 @@ impl BitVec {
/// # Examples
///
/// ```
/// # #![feature(bitvec)]
/// #![feature(bitvec)]
///
/// use std::collections::BitVec;
///
/// let bv = BitVec::from_bytes(&[0b10100000, 0b00010010]);
@ -355,7 +360,8 @@ impl BitVec {
/// # Examples
///
/// ```
/// # #![feature(bitvec)]
/// #![feature(bitvec)]
///
/// use std::collections::BitVec;
///
/// let bv = BitVec::from_fn(5, |i| { i % 2 == 0 });
@ -374,7 +380,8 @@ impl BitVec {
/// # Examples
///
/// ```
/// # #![feature(bitvec)]
/// #![feature(bitvec)]
///
/// use std::collections::BitVec;
///
/// let bv = BitVec::from_bytes(&[0b01100000]);
@ -407,7 +414,8 @@ impl BitVec {
/// # Examples
///
/// ```
/// # #![feature(bitvec)]
/// #![feature(bitvec)]
///
/// use std::collections::BitVec;
///
/// let mut bv = BitVec::from_elem(5, false);
@ -430,7 +438,8 @@ impl BitVec {
/// # Examples
///
/// ```
/// # #![feature(bitvec)]
/// #![feature(bitvec)]
///
/// use std::collections::BitVec;
///
/// let before = 0b01100000;
@ -451,7 +460,8 @@ impl BitVec {
/// # Examples
///
/// ```
/// # #![feature(bitvec)]
/// #![feature(bitvec)]
///
/// use std::collections::BitVec;
///
/// let before = 0b01100000;
@ -480,7 +490,8 @@ impl BitVec {
/// # Examples
///
/// ```
/// # #![feature(bitvec)]
/// #![feature(bitvec)]
///
/// use std::collections::BitVec;
///
/// let a = 0b01100100;
@ -511,7 +522,8 @@ impl BitVec {
/// # Examples
///
/// ```
/// # #![feature(bitvec)]
/// #![feature(bitvec)]
///
/// use std::collections::BitVec;
///
/// let a = 0b01100100;
@ -542,7 +554,8 @@ impl BitVec {
/// # Examples
///
/// ```
/// # #![feature(bitvec)]
/// #![feature(bitvec)]
///
/// use std::collections::BitVec;
///
/// let a = 0b01100100;
@ -572,7 +585,8 @@ impl BitVec {
/// # Examples
///
/// ```
/// # #![feature(bitvec)]
/// #![feature(bitvec)]
///
/// use std::collections::BitVec;
///
/// let mut bv = BitVec::from_elem(5, true);
@ -597,7 +611,8 @@ impl BitVec {
/// # Examples
///
/// ```
/// # #![feature(bitvec)]
/// #![feature(bitvec)]
///
/// use std::collections::BitVec;
///
/// let bv = BitVec::from_bytes(&[0b01110100, 0b10010010]);
@ -614,7 +629,8 @@ impl BitVec {
/// # Examples
///
/// ```
/// # #![feature(bitvec, append)]
/// #![feature(bitvec, append)]
///
/// use std::collections::BitVec;
///
/// let mut a = BitVec::from_bytes(&[0b10000000]);
@ -657,7 +673,8 @@ impl BitVec {
/// # Examples
///
/// ```
/// # #![feature(bitvec, split_off)]
/// #![feature(bitvec, split_off)]
///
/// use std::collections::BitVec;
/// let mut a = BitVec::new();
/// a.push(true);
@ -718,7 +735,8 @@ impl BitVec {
/// # Examples
///
/// ```
/// # #![feature(bitvec)]
/// #![feature(bitvec)]
///
/// use std::collections::BitVec;
///
/// let mut bv = BitVec::from_elem(10, false);
@ -736,7 +754,8 @@ impl BitVec {
/// # Examples
///
/// ```
/// # #![feature(bitvec)]
/// #![feature(bitvec)]
///
/// use std::collections::BitVec;
///
/// let mut bv = BitVec::from_elem(10, false);
@ -758,7 +777,8 @@ impl BitVec {
/// # Examples
///
/// ```
/// # #![feature(bitvec)]
/// #![feature(bitvec)]
///
/// use std::collections::BitVec;
///
/// let mut bv = BitVec::from_elem(3, true);
@ -806,7 +826,8 @@ impl BitVec {
/// # Examples
///
/// ```
/// # #![feature(bitvec)]
/// #![feature(bitvec)]
///
/// use std::collections::BitVec;
///
/// let bv = BitVec::from_bytes(&[0b10100000]);
@ -827,7 +848,8 @@ impl BitVec {
/// # Examples
///
/// ```
/// # #![feature(bitvec)]
/// #![feature(bitvec)]
///
/// use std::collections::BitVec;
///
/// let mut bv = BitVec::from_bytes(&[0b01001011]);
@ -854,7 +876,8 @@ impl BitVec {
/// # Examples
///
/// ```
/// # #![feature(bitvec)]
/// #![feature(bitvec)]
///
/// use std::collections::BitVec;
///
/// let mut bv = BitVec::from_elem(3, false);
@ -885,7 +908,8 @@ impl BitVec {
/// # Examples
///
/// ```
/// # #![feature(bitvec)]
/// #![feature(bitvec)]
///
/// use std::collections::BitVec;
///
/// let mut bv = BitVec::from_elem(3, false);
@ -908,7 +932,8 @@ impl BitVec {
/// # Examples
///
/// ```
/// # #![feature(bitvec)]
/// #![feature(bitvec)]
///
/// use std::collections::BitVec;
///
/// let mut bv = BitVec::new();
@ -930,7 +955,8 @@ impl BitVec {
/// # Examples
///
/// ```
/// # #![feature(bitvec)]
/// #![feature(bitvec)]
///
/// use std::collections::BitVec;
///
/// let mut bv = BitVec::from_bytes(&[0b01001011]);
@ -981,7 +1007,8 @@ impl BitVec {
/// # Examples
///
/// ```
/// # #![feature(bitvec)]
/// #![feature(bitvec)]
///
/// use std::collections::BitVec;
///
/// let mut bv = BitVec::from_bytes(&[0b01001001]);
@ -1012,7 +1039,8 @@ impl BitVec {
/// # Examples
///
/// ```
/// # #![feature(bitvec)]
/// #![feature(bitvec)]
///
/// use std::collections::BitVec;
///
/// let mut bv = BitVec::new();
@ -1231,7 +1259,8 @@ impl<'a> IntoIterator for &'a BitVec {
/// # Examples
///
/// ```
/// # #![feature(bitvec, bitset)]
/// #![feature(bitvec, bitset)]
///
/// use std::collections::{BitSet, BitVec};
///
/// // It's a regular set
@ -1335,7 +1364,8 @@ impl BitSet {
/// # Examples
///
/// ```
/// # #![feature(bitset)]
/// #![feature(bitset)]
///
/// use std::collections::BitSet;
///
/// let mut s = BitSet::new();
@ -1352,7 +1382,8 @@ impl BitSet {
/// # Examples
///
/// ```
/// # #![feature(bitset)]
/// #![feature(bitset)]
///
/// use std::collections::BitSet;
///
/// let mut s = BitSet::with_capacity(100);
@ -1370,7 +1401,8 @@ impl BitSet {
/// # Examples
///
/// ```
/// # #![feature(bitset, bitvec)]
/// #![feature(bitset, bitvec)]
///
/// use std::collections::{BitVec, BitSet};
///
/// let bv = BitVec::from_bytes(&[0b01100000]);
@ -1392,7 +1424,8 @@ impl BitSet {
/// # Examples
///
/// ```
/// # #![feature(bitset)]
/// #![feature(bitset)]
///
/// use std::collections::BitSet;
///
/// let mut s = BitSet::with_capacity(100);
@ -1414,7 +1447,8 @@ impl BitSet {
/// # Examples
///
/// ```
/// # #![feature(bitset)]
/// #![feature(bitset)]
///
/// use std::collections::BitSet;
///
/// let mut s = BitSet::new();
@ -1441,7 +1475,8 @@ impl BitSet {
/// # Examples
///
/// ```
/// # #![feature(bitset)]
/// #![feature(bitset)]
///
/// use std::collections::BitSet;
///
/// let mut s = BitSet::new();
@ -1462,7 +1497,8 @@ impl BitSet {
/// # Examples
///
/// ```
/// # #![feature(bitset)]
/// #![feature(bitset)]
///
/// use std::collections::BitSet;
///
/// let mut s = BitSet::new();
@ -1483,7 +1519,8 @@ impl BitSet {
/// # Examples
///
/// ```
/// # #![feature(bitset)]
/// #![feature(bitset)]
///
/// use std::collections::BitSet;
///
/// let mut s = BitSet::new();
@ -1530,7 +1567,8 @@ impl BitSet {
/// # Examples
///
/// ```
/// # #![feature(bitset)]
/// #![feature(bitset)]
///
/// use std::collections::BitSet;
///
/// let mut s = BitSet::new();
@ -1563,7 +1601,8 @@ impl BitSet {
/// # Examples
///
/// ```
/// # #![feature(bitset, bitvec)]
/// #![feature(bitset, bitvec)]
///
/// use std::collections::{BitVec, BitSet};
///
/// let s = BitSet::from_bit_vec(BitVec::from_bytes(&[0b01001010]));
@ -1585,7 +1624,8 @@ impl BitSet {
/// # Examples
///
/// ```
/// # #![feature(bitset, bitvec)]
/// #![feature(bitset, bitvec)]
///
/// use std::collections::{BitVec, BitSet};
///
/// let a = BitSet::from_bit_vec(BitVec::from_bytes(&[0b01101000]));
@ -1615,7 +1655,8 @@ impl BitSet {
/// # Examples
///
/// ```
/// # #![feature(bitset, bitvec)]
/// #![feature(bitset, bitvec)]
///
/// use std::collections::{BitVec, BitSet};
///
/// let a = BitSet::from_bit_vec(BitVec::from_bytes(&[0b01101000]));
@ -1646,7 +1687,8 @@ impl BitSet {
/// # Examples
///
/// ```
/// # #![feature(bitset, bitvec)]
/// #![feature(bitset, bitvec)]
///
/// use std::collections::{BitSet, BitVec};
///
/// let a = BitSet::from_bit_vec(BitVec::from_bytes(&[0b01101000]));
@ -1684,7 +1726,8 @@ impl BitSet {
/// # Examples
///
/// ```
/// # #![feature(bitset, bitvec)]
/// #![feature(bitset, bitvec)]
///
/// use std::collections::{BitSet, BitVec};
///
/// let a = BitSet::from_bit_vec(BitVec::from_bytes(&[0b01101000]));
@ -1712,7 +1755,8 @@ impl BitSet {
/// # Examples
///
/// ```
/// # #![feature(bitset, bitvec)]
/// #![feature(bitset, bitvec)]
///
/// use std::collections::{BitSet, BitVec};
///
/// let a = 0b01101000;
@ -1736,7 +1780,8 @@ impl BitSet {
/// # Examples
///
/// ```
/// # #![feature(bitset, bitvec)]
/// #![feature(bitset, bitvec)]
///
/// use std::collections::{BitSet, BitVec};
///
/// let a = 0b01101000;
@ -1761,7 +1806,8 @@ impl BitSet {
/// # Examples
///
/// ```
/// # #![feature(bitset, bitvec)]
/// #![feature(bitset, bitvec)]
///
/// use std::collections::{BitSet, BitVec};
///
/// let a = 0b01101000;
@ -1794,7 +1840,8 @@ impl BitSet {
/// # Examples
///
/// ```
/// # #![feature(bitset, bitvec)]
/// #![feature(bitset, bitvec)]
///
/// use std::collections::{BitSet, BitVec};
///
/// let a = 0b01101000;
@ -1818,7 +1865,8 @@ impl BitSet {
/// # Examples
///
/// ```
/// # #![feature(bitset, bitvec, append)]
/// #![feature(bitset, bitvec, append)]
///
/// use std::collections::{BitVec, BitSet};
///
/// let mut a = BitSet::new();
@ -1849,7 +1897,8 @@ impl BitSet {
/// # Examples
///
/// ```
/// # #![feature(bitset, bitvec, split_off)]
/// #![feature(bitset, bitvec, split_off)]
///
/// use std::collections::{BitSet, BitVec};
/// let mut a = BitSet::new();
/// a.insert(2);

View file

@ -1504,7 +1504,8 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// # Examples
///
/// ```
/// # #![feature(btree_range, collections_bound)]
/// #![feature(btree_range, collections_bound)]
///
/// use std::collections::BTreeMap;
/// use std::collections::Bound::{Included, Unbounded};
///
@ -1531,7 +1532,8 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// # Examples
///
/// ```
/// # #![feature(btree_range, collections_bound)]
/// #![feature(btree_range, collections_bound)]
///
/// use std::collections::BTreeMap;
/// use std::collections::Bound::{Included, Excluded};
///

View file

@ -141,7 +141,8 @@ impl<T: Ord> BTreeSet<T> {
/// # Examples
///
/// ```
/// # #![feature(btree_range, collections_bound)]
/// #![feature(btree_range, collections_bound)]
///
/// use std::collections::BTreeSet;
/// use std::collections::Bound::{Included, Unbounded};
///

View file

@ -172,7 +172,7 @@
//! like:
//!
//! ```
//! # #![feature(fmt_flags)]
//! #![feature(fmt_flags)]
//! use std::fmt;
//!
//! #[derive(Debug)]

View file

@ -784,7 +784,8 @@ impl<'a, A> IterMut<'a, A> {
/// # Examples
///
/// ```
/// # #![feature(linked_list_extras)]
/// #![feature(linked_list_extras)]
///
/// use std::collections::LinkedList;
///
/// let mut list: LinkedList<_> = vec![1, 3, 4].into_iter().collect();
@ -812,7 +813,8 @@ impl<'a, A> IterMut<'a, A> {
/// # Examples
///
/// ```
/// # #![feature(linked_list_extras)]
/// #![feature(linked_list_extras)]
///
/// use std::collections::LinkedList;
///
/// let mut list: LinkedList<_> = vec![1, 2, 3].into_iter().collect();

View file

@ -887,7 +887,8 @@ impl<T> [T] {
/// # Examples
///
/// ```rust
/// # #![feature(permutations)]
/// #![feature(permutations)]
///
/// let v = [1, 2, 3];
/// let mut perms = v.permutations();
///
@ -899,7 +900,8 @@ impl<T> [T] {
/// Iterating through permutations one by one.
///
/// ```rust
/// # #![feature(permutations)]
/// #![feature(permutations)]
///
/// let v = [1, 2, 3];
/// let mut perms = v.permutations();
///
@ -924,7 +926,8 @@ impl<T> [T] {
/// # Example
///
/// ```rust
/// # #![feature(permutations)]
/// #![feature(permutations)]
///
/// let v: &mut [_] = &mut [0, 1, 2];
/// v.next_permutation();
/// let b: &mut [_] = &mut [0, 2, 1];
@ -949,7 +952,8 @@ impl<T> [T] {
/// # Example
///
/// ```rust
/// # #![feature(permutations)]
/// #![feature(permutations)]
///
/// let v: &mut [_] = &mut [1, 0, 2];
/// v.prev_permutation();
/// let b: &mut [_] = &mut [0, 2, 1];
@ -973,7 +977,8 @@ impl<T> [T] {
/// # Example
///
/// ```rust
/// # #![feature(clone_from_slice)]
/// #![feature(clone_from_slice)]
///
/// let mut dst = [0, 0, 0];
/// let src = [1, 2];
///
@ -1004,7 +1009,8 @@ impl<T> [T] {
/// # Examples
///
/// ```rust
/// # #![feature(move_from)]
/// #![feature(move_from)]
///
/// let mut a = [1, 2, 3, 4, 5];
/// let b = vec![6, 7, 8];
/// let num_moved = a.move_from(b, 0, 3);

View file

@ -442,7 +442,8 @@ impl str {
/// # Examples
///
/// ```
/// # #![feature(str_char)]
/// #![feature(str_char)]
///
/// let s = "Löwe 老虎 Léopard";
/// assert!(s.is_char_boundary(0));
/// // start of `老`
@ -549,7 +550,8 @@ impl str {
/// # Examples
///
/// ```
/// # #![feature(slice_chars)]
/// #![feature(slice_chars)]
///
/// let s = "Löwe 老虎 Léopard";
///
/// assert_eq!(s.slice_chars(0, 4), "Löwe");
@ -581,7 +583,8 @@ impl str {
/// done by `.chars()` or `.char_indices()`.
///
/// ```
/// # #![feature(str_char, core)]
/// #![feature(str_char, core)]
///
/// use std::str::CharRange;
///
/// let s = "中华Việt Nam";
@ -639,7 +642,8 @@ impl str {
/// done by `.chars().rev()` or `.char_indices()`.
///
/// ```
/// # #![feature(str_char, core)]
/// #![feature(str_char, core)]
///
/// use std::str::CharRange;
///
/// let s = "中华Việt Nam";
@ -686,7 +690,8 @@ impl str {
/// # Examples
///
/// ```
/// # #![feature(str_char)]
/// #![feature(str_char)]
///
/// let s = "abπc";
/// assert_eq!(s.char_at(1), 'b');
/// assert_eq!(s.char_at(2), 'π');
@ -714,7 +719,8 @@ impl str {
/// # Examples
///
/// ```
/// # #![feature(str_char)]
/// #![feature(str_char)]
///
/// let s = "abπc";
/// assert_eq!(s.char_at_reverse(1), 'a');
/// assert_eq!(s.char_at_reverse(2), 'b');
@ -742,7 +748,8 @@ impl str {
/// # Examples
///
/// ```
/// # #![feature(str_char)]
/// #![feature(str_char)]
///
/// let s = "Łódź"; // \u{141}o\u{301}dz\u{301}
/// let (c, s1) = s.slice_shift_char().unwrap();
///
@ -777,7 +784,8 @@ impl str {
///
/// # Examples
/// ```
/// # #![feature(str_split_at)]
/// #![feature(str_split_at)]
///
/// let s = "Löwe 老虎 Léopard";
/// let first_space = s.find(' ').unwrap_or(s.len());
/// let (a, b) = s.split_at(first_space);
@ -879,8 +887,9 @@ impl str {
/// # Examples
///
/// ```
/// # #![feature(str_words)]
/// # #![allow(deprecated)]
/// #![feature(str_words)]
/// #![allow(deprecated)]
///
/// let some_words = " Mary had\ta\u{2009}little \n\t lamb";
/// let v: Vec<&str> = some_words.words().collect();
///
@ -1038,7 +1047,8 @@ impl str {
/// # Examples
///
/// ```
/// # #![feature(unicode, core)]
/// #![feature(unicode, core)]
///
/// let gr1 = "a\u{310}e\u{301}o\u{308}\u{332}".graphemes(true).collect::<Vec<&str>>();
/// let b: &[_] = &["a\u{310}", "e\u{301}", "o\u{308}\u{332}"];
///
@ -1064,7 +1074,8 @@ impl str {
/// # Examples
///
/// ```
/// # #![feature(unicode, core)]
/// #![feature(unicode, core)]
///
/// let gr_inds = "a̐éö̲\r\n".grapheme_indices(true).collect::<Vec<(usize, &str)>>();
/// let b: &[_] = &[(0, "a̐"), (3, "é"), (6, "ö̲"), (11, "\r\n")];
///
@ -1602,7 +1613,8 @@ impl str {
/// # Examples
///
/// ```
/// # #![feature(str_match_indices)]
/// #![feature(str_match_indices)]
///
/// let v: Vec<(usize, usize)> = "abcXXXabcYYYabc".match_indices("abc").collect();
/// assert_eq!(v, [(0, 3), (6, 9), (12, 15)]);
///
@ -1646,7 +1658,8 @@ impl str {
/// # Examples
///
/// ```
/// # #![feature(str_match_indices)]
/// #![feature(str_match_indices)]
///
/// let v: Vec<(usize, usize)> = "abcXXXabcYYYabc".rmatch_indices("abc").collect();
/// assert_eq!(v, [(12, 15), (6, 9), (0, 3)]);
///
@ -1676,7 +1689,8 @@ impl str {
/// # Examples
///
/// ```
/// # #![feature(subslice_offset)]
/// #![feature(subslice_offset)]
///
/// let string = "a\nb\nc";
/// let lines: Vec<&str> = string.lines().collect();
///

View file

@ -89,7 +89,8 @@ impl String {
/// # Examples
///
/// ```
/// # #![feature(collections)]
/// #![feature(collections)]
///
/// let s = String::from("hello");
/// assert_eq!(&s[..], "hello");
/// ```
@ -702,7 +703,7 @@ impl String {
/// # Examples
///
/// ```
/// # #![feature(drain)]
/// #![feature(drain)]
///
/// let mut s = String::from("α is alpha, β is beta");
/// let beta_offset = s.find('β').unwrap_or(s.len());

View file

@ -112,6 +112,13 @@ use super::range::RangeArgument;
/// assert_eq!(vec, [1, 2, 3, 4]);
/// ```
///
/// It can also initialize each element of a `Vec<T>` with a given value:
///
/// ```
/// let vec = vec![0; 5];
/// assert_eq!(vec, [0, 0, 0, 0, 0]);
/// ```
///
/// Use a `Vec<T>` as an efficient stack:
///
/// ```
@ -574,7 +581,7 @@ impl<T> Vec<T> {
/// # Examples
///
/// ```
/// let mut vec = vec!(1, 2);
/// let mut vec = vec![1, 2];
/// vec.push(3);
/// assert_eq!(vec, [1, 2, 3]);
/// ```
@ -622,7 +629,8 @@ impl<T> Vec<T> {
/// # Examples
///
/// ```
/// # #![feature(append)]
/// #![feature(append)]
///
/// let mut vec = vec![1, 2, 3];
/// let mut vec2 = vec![4, 5, 6];
/// vec.append(&mut vec2);
@ -661,7 +669,7 @@ impl<T> Vec<T> {
/// # Examples
///
/// ```
/// # #![feature(drain)]
/// #![feature(drain)]
///
/// // Draining using `..` clears the whole vector.
/// let mut v = vec![1, 2, 3];
@ -759,7 +767,8 @@ impl<T> Vec<T> {
/// # Examples
///
/// ```
/// # #![feature(map_in_place)]
/// #![feature(map_in_place)]
///
/// let v = vec![0, 1, 2];
/// let w = v.map_in_place(|i| i + 3);
/// assert_eq!(&w[..], &[3, 4, 5]);
@ -965,7 +974,8 @@ impl<T> Vec<T> {
/// # Examples
///
/// ```
/// # #![feature(split_off)]
/// #![feature(split_off)]
///
/// let mut vec = vec![1,2,3];
/// let vec2 = vec.split_off(1);
/// assert_eq!(vec, [1]);
@ -1004,7 +1014,8 @@ impl<T: Clone> Vec<T> {
/// # Examples
///
/// ```
/// # #![feature(vec_resize)]
/// #![feature(vec_resize)]
///
/// let mut vec = vec!["hello"];
/// vec.resize(3, "world");
/// assert_eq!(vec, ["hello", "world", "world"]);
@ -1056,7 +1067,8 @@ impl<T: Clone> Vec<T> {
/// # Examples
///
/// ```
/// # #![feature(vec_push_all)]
/// #![feature(vec_push_all)]
///
/// let mut vec = vec![1];
/// vec.push_all(&[2, 3, 4]);
/// assert_eq!(vec, [1, 2, 3, 4]);

View file

@ -231,7 +231,7 @@ impl<T> VecDeque<T> {
/// buf.push_back(3);
/// buf.push_back(4);
/// buf.push_back(5);
/// assert_eq!(buf.get(1).unwrap(), &4);
/// assert_eq!(buf.get(1), Some(&4));
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn get(&self, index: usize) -> Option<&T> {
@ -379,7 +379,8 @@ impl<T> VecDeque<T> {
/// # Examples
///
/// ```
/// # #![feature(collections)]
/// #![feature(collections)]
///
/// use std::collections::VecDeque;
///
/// let mut buf = VecDeque::with_capacity(15);
@ -455,7 +456,8 @@ impl<T> VecDeque<T> {
/// # Examples
///
/// ```
/// # #![feature(deque_extras)]
/// #![feature(deque_extras)]
///
/// use std::collections::VecDeque;
///
/// let mut buf = VecDeque::new();
@ -604,7 +606,8 @@ impl<T> VecDeque<T> {
/// # Examples
///
/// ```
/// # #![feature(drain)]
/// #![feature(drain)]
///
/// use std::collections::VecDeque;
///
/// let mut v = VecDeque::new();
@ -847,17 +850,20 @@ impl<T> VecDeque<T> {
/// # Examples
///
/// ```
/// # #![feature(deque_extras)]
/// #![feature(deque_extras)]
///
/// use std::collections::VecDeque;
///
/// let mut buf = VecDeque::new();
/// assert_eq!(buf.swap_back_remove(0), None);
/// buf.push_back(5);
/// buf.push_back(99);
/// buf.push_back(15);
/// buf.push_back(20);
/// buf.push_back(10);
/// assert_eq!(buf.swap_back_remove(1), Some(99));
/// buf.push_back(1);
/// buf.push_back(2);
/// buf.push_back(3);
///
/// assert_eq!(buf.swap_back_remove(0), Some(1));
/// assert_eq!(buf.len(), 2);
/// assert_eq!(buf[0], 3);
/// assert_eq!(buf[1], 2);
/// ```
#[unstable(feature = "deque_extras",
reason = "the naming of this function may be altered")]
@ -881,17 +887,20 @@ impl<T> VecDeque<T> {
/// # Examples
///
/// ```
/// # #![feature(deque_extras)]
/// #![feature(deque_extras)]
///
/// use std::collections::VecDeque;
///
/// let mut buf = VecDeque::new();
/// assert_eq!(buf.swap_front_remove(0), None);
/// buf.push_back(15);
/// buf.push_back(5);
/// buf.push_back(10);
/// buf.push_back(99);
/// buf.push_back(20);
/// assert_eq!(buf.swap_front_remove(3), Some(99));
/// buf.push_back(1);
/// buf.push_back(2);
/// buf.push_back(3);
///
/// assert_eq!(buf.swap_front_remove(2), Some(3));
/// assert_eq!(buf.len(), 2);
/// assert_eq!(buf[0], 2);
/// assert_eq!(buf[1], 1);
/// ```
#[unstable(feature = "deque_extras",
reason = "the naming of this function may be altered")]
@ -915,7 +924,8 @@ impl<T> VecDeque<T> {
///
/// # Examples
/// ```
/// # #![feature(collections)]
/// #![feature(collections)]
///
/// use std::collections::VecDeque;
///
/// let mut buf = VecDeque::new();
@ -1123,12 +1133,12 @@ impl<T> VecDeque<T> {
/// use std::collections::VecDeque;
///
/// let mut buf = VecDeque::new();
/// buf.push_back(5);
/// buf.push_back(10);
/// buf.push_back(12);
/// buf.push_back(15);
/// buf.remove(2);
/// assert_eq!(Some(&15), buf.get(2));
/// buf.push_back(1);
/// buf.push_back(2);
/// buf.push_back(3);
///
/// assert_eq!(buf.remove(1), Some(2));
/// assert_eq!(buf.get(1), Some(&3));
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn remove(&mut self, index: usize) -> Option<T> {
@ -1291,7 +1301,8 @@ impl<T> VecDeque<T> {
/// # Examples
///
/// ```
/// # #![feature(split_off)]
/// #![feature(split_off)]
///
/// use std::collections::VecDeque;
///
/// let mut buf: VecDeque<_> = vec![1,2,3].into_iter().collect();
@ -1354,7 +1365,8 @@ impl<T> VecDeque<T> {
/// # Examples
///
/// ```
/// # #![feature(append)]
/// #![feature(append)]
///
/// use std::collections::VecDeque;
///
/// let mut buf: VecDeque<_> = vec![1, 2, 3].into_iter().collect();
@ -1380,7 +1392,8 @@ impl<T> VecDeque<T> {
/// # Examples
///
/// ```
/// # #![feature(vec_deque_retain)]
/// #![feature(vec_deque_retain)]
///
/// use std::collections::VecDeque;
///
/// let mut buf = VecDeque::new();
@ -1415,7 +1428,8 @@ impl<T: Clone> VecDeque<T> {
/// # Examples
///
/// ```
/// # #![feature(deque_extras)]
/// #![feature(deque_extras)]
///
/// use std::collections::VecDeque;
///
/// let mut buf = VecDeque::new();

View file

@ -35,7 +35,8 @@ use vec::Vec;
/// # Examples
///
/// ```
/// # #![feature(vecmap)]
/// #![feature(vecmap)]
///
/// use std::collections::VecMap;
///
/// let mut months = VecMap::new();
@ -135,7 +136,8 @@ impl<V> VecMap<V> {
/// # Examples
///
/// ```
/// # #![feature(vecmap)]
/// #![feature(vecmap)]
///
/// use std::collections::VecMap;
/// let mut map: VecMap<&str> = VecMap::new();
/// ```
@ -148,7 +150,8 @@ impl<V> VecMap<V> {
/// # Examples
///
/// ```
/// # #![feature(vecmap)]
/// #![feature(vecmap)]
///
/// use std::collections::VecMap;
/// let mut map: VecMap<&str> = VecMap::with_capacity(10);
/// ```
@ -163,7 +166,8 @@ impl<V> VecMap<V> {
/// # Examples
///
/// ```
/// # #![feature(vecmap)]
/// #![feature(vecmap)]
///
/// use std::collections::VecMap;
/// let map: VecMap<String> = VecMap::with_capacity(10);
/// assert!(map.capacity() >= 10);
@ -183,7 +187,8 @@ impl<V> VecMap<V> {
/// # Examples
///
/// ```
/// # #![feature(vecmap)]
/// #![feature(vecmap)]
///
/// use std::collections::VecMap;
/// let mut map: VecMap<&str> = VecMap::new();
/// map.reserve_len(10);
@ -208,7 +213,8 @@ impl<V> VecMap<V> {
/// # Examples
///
/// ```
/// # #![feature(vecmap)]
/// #![feature(vecmap)]
///
/// use std::collections::VecMap;
/// let mut map: VecMap<&str> = VecMap::new();
/// map.reserve_len_exact(10);
@ -248,7 +254,8 @@ impl<V> VecMap<V> {
/// # Examples
///
/// ```
/// # #![feature(vecmap)]
/// #![feature(vecmap)]
///
/// use std::collections::VecMap;
///
/// let mut map = VecMap::new();
@ -277,7 +284,8 @@ impl<V> VecMap<V> {
/// # Examples
///
/// ```
/// # #![feature(vecmap)]
/// #![feature(vecmap)]
///
/// use std::collections::VecMap;
///
/// let mut map = VecMap::new();
@ -307,7 +315,8 @@ impl<V> VecMap<V> {
/// # Examples
///
/// ```
/// # #![feature(vecmap, append)]
/// #![feature(vecmap, append)]
///
/// use std::collections::VecMap;
///
/// let mut a = VecMap::new();
@ -343,7 +352,8 @@ impl<V> VecMap<V> {
/// # Examples
///
/// ```
/// # #![feature(vecmap, split_off)]
/// #![feature(vecmap, split_off)]
///
/// use std::collections::VecMap;
///
/// let mut a = VecMap::new();
@ -400,7 +410,8 @@ impl<V> VecMap<V> {
/// # Examples
///
/// ```
/// # #![feature(vecmap, drain)]
/// #![feature(vecmap, drain)]
///
/// use std::collections::VecMap;
///
/// let mut map = VecMap::new();
@ -428,7 +439,8 @@ impl<V> VecMap<V> {
/// # Examples
///
/// ```
/// # #![feature(vecmap)]
/// #![feature(vecmap)]
///
/// use std::collections::VecMap;
///
/// let mut a = VecMap::new();
@ -446,7 +458,8 @@ impl<V> VecMap<V> {
/// # Examples
///
/// ```
/// # #![feature(vecmap)]
/// #![feature(vecmap)]
///
/// use std::collections::VecMap;
///
/// let mut a = VecMap::new();
@ -464,7 +477,8 @@ impl<V> VecMap<V> {
/// # Examples
///
/// ```
/// # #![feature(vecmap)]
/// #![feature(vecmap)]
///
/// use std::collections::VecMap;
///
/// let mut a = VecMap::new();
@ -480,7 +494,8 @@ impl<V> VecMap<V> {
/// # Examples
///
/// ```
/// # #![feature(vecmap)]
/// #![feature(vecmap)]
///
/// use std::collections::VecMap;
///
/// let mut map = VecMap::new();
@ -505,7 +520,8 @@ impl<V> VecMap<V> {
/// # Examples
///
/// ```
/// # #![feature(vecmap)]
/// #![feature(vecmap)]
///
/// use std::collections::VecMap;
///
/// let mut map = VecMap::new();
@ -524,7 +540,8 @@ impl<V> VecMap<V> {
/// # Examples
///
/// ```
/// # #![feature(vecmap)]
/// #![feature(vecmap)]
///
/// use std::collections::VecMap;
///
/// let mut map = VecMap::new();
@ -552,7 +569,8 @@ impl<V> VecMap<V> {
/// # Examples
///
/// ```
/// # #![feature(vecmap)]
/// #![feature(vecmap)]
///
/// use std::collections::VecMap;
///
/// let mut map = VecMap::new();
@ -578,7 +596,8 @@ impl<V> VecMap<V> {
/// # Examples
///
/// ```
/// # #![feature(vecmap)]
/// #![feature(vecmap)]
///
/// use std::collections::VecMap;
///
/// let mut map = VecMap::new();
@ -600,7 +619,8 @@ impl<V> VecMap<V> {
/// # Examples
///
/// ```
/// # #![feature(vecmap, entry)]
/// #![feature(vecmap, entry)]
///
/// use std::collections::VecMap;
///
/// let mut count: VecMap<u32> = VecMap::new();
@ -778,7 +798,8 @@ impl<T> IntoIterator for VecMap<T> {
/// # Examples
///
/// ```
/// # #![feature(vecmap)]
/// #![feature(vecmap)]
///
/// use std::collections::VecMap;
///
/// let mut map = VecMap::new();

View file

@ -145,7 +145,7 @@ unsafe impl<T> Sync for AtomicPtr<T> {}
/// "relaxed" atomics allow all reorderings.
///
/// Rust's memory orderings are [the same as
/// C++'s](http://gcc.gnu.org/wiki/Atomic/GCCMM/AtomicSync).
/// LLVM's](http://llvm.org/docs/LangRef.html#memory-model-for-concurrent-operations).
#[stable(feature = "rust1", since = "1.0.0")]
#[derive(Copy, Clone)]
pub enum Ordering {

View file

@ -221,7 +221,8 @@ impl<T:Copy> Cell<T> {
/// # Examples
///
/// ```
/// # #![feature(as_unsafe_cell)]
/// #![feature(as_unsafe_cell)]
///
/// use std::cell::Cell;
///
/// let c = Cell::new(5);
@ -589,7 +590,8 @@ impl<'b, T: ?Sized> Ref<'b, T> {
/// # Example
///
/// ```
/// # #![feature(cell_extras)]
/// #![feature(cell_extras)]
///
/// use std::cell::{RefCell, Ref};
///
/// let c = RefCell::new((5, 'b'));

View file

@ -383,7 +383,8 @@ pub fn max<T: Ord>(v1: T, v2: T) -> T {
/// # Examples
///
/// ```
/// # #![feature(cmp_partial)]
/// #![feature(cmp_partial)]
///
/// use std::cmp;
///
/// assert_eq!(Some(1), cmp::partial_min(1, 2));
@ -393,7 +394,8 @@ pub fn max<T: Ord>(v1: T, v2: T) -> T {
/// When comparison is impossible:
///
/// ```
/// # #![feature(cmp_partial)]
/// #![feature(cmp_partial)]
///
/// use std::cmp;
///
/// let result = cmp::partial_min(std::f64::NAN, 1.0);
@ -417,7 +419,8 @@ pub fn partial_min<T: PartialOrd>(v1: T, v2: T) -> Option<T> {
/// # Examples
///
/// ```
/// # #![feature(cmp_partial)]
/// #![feature(cmp_partial)]
///
/// use std::cmp;
///
/// assert_eq!(Some(2), cmp::partial_max(1, 2));
@ -427,7 +430,8 @@ pub fn partial_min<T: PartialOrd>(v1: T, v2: T) -> Option<T> {
/// When comparison is impossible:
///
/// ```
/// # #![feature(cmp_partial)]
/// #![feature(cmp_partial)]
///
/// use std::cmp;
///
/// let result = cmp::partial_max(std::f64::NAN, 1.0);

View file

@ -167,7 +167,8 @@ pub struct RadixFmt<T, R>(T, R);
/// # Examples
///
/// ```
/// # #![feature(fmt_radix)]
/// #![feature(fmt_radix)]
///
/// use std::fmt::radix;
/// assert_eq!(format!("{}", radix(55, 36)), "1j".to_string());
/// ```

View file

@ -16,7 +16,8 @@
//! # Examples
//!
//! ```rust
//! # #![feature(hash_default)]
//! #![feature(hash_default)]
//!
//! use std::hash::{hash, Hash, SipHasher};
//!
//! #[derive(Hash)]
@ -36,7 +37,8 @@
//! the trait `Hash`:
//!
//! ```rust
//! # #![feature(hash_default)]
//! #![feature(hash_default)]
//!
//! use std::hash::{hash, Hash, Hasher, SipHasher};
//!
//! struct Person {

View file

@ -824,7 +824,8 @@ pub trait Iterator {
/// # Examples
///
/// ```
/// # #![feature(iter_min_max)]
/// #![feature(iter_min_max)]
///
/// use std::iter::MinMaxResult::{NoElements, OneElement, MinMax};
///
/// let a: [i32; 0] = [];
@ -898,7 +899,8 @@ pub trait Iterator {
/// # Examples
///
/// ```
/// # #![feature(iter_cmp)]
/// #![feature(iter_cmp)]
///
/// let a = [-3_i32, 0, 1, 5, -10];
/// assert_eq!(*a.iter().max_by(|x| x.abs()).unwrap(), -10);
/// ```
@ -926,7 +928,8 @@ pub trait Iterator {
/// # Examples
///
/// ```
/// # #![feature(iter_cmp)]
/// #![feature(iter_cmp)]
///
/// let a = [-3_i32, 0, 1, 5, -10];
/// assert_eq!(*a.iter().min_by(|x| x.abs()).unwrap(), 0);
/// ```
@ -1065,7 +1068,8 @@ pub trait Iterator {
/// # Examples
///
/// ```
/// # #![feature(iter_arith)]
/// #![feature(iter_arith)]
///
/// let a = [1, 2, 3, 4, 5];
/// let it = a.iter();
/// assert_eq!(it.sum::<i32>(), 15);
@ -1083,7 +1087,8 @@ pub trait Iterator {
/// # Examples
///
/// ```
/// # #![feature(iter_arith)]
/// #![feature(iter_arith)]
///
/// fn factorial(n: u32) -> u32 {
/// (1..).take_while(|&i| i <= n).product()
/// }
@ -1367,7 +1372,8 @@ impl<T: Clone> MinMaxResult<T> {
/// # Examples
///
/// ```
/// # #![feature(iter_min_max)]
/// #![feature(iter_min_max)]
///
/// use std::iter::MinMaxResult::{self, NoElements, OneElement, MinMax};
///
/// let r: MinMaxResult<i32> = NoElements;
@ -2764,7 +2770,8 @@ impl<A: Step> ops::Range<A> {
/// # Examples
///
/// ```
/// # #![feature(step_by)]
/// #![feature(step_by)]
///
/// for i in (0..10).step_by(2) {
/// println!("{}", i);
/// }

View file

@ -274,7 +274,8 @@ impl<T> Option<T> {
/// # Examples
///
/// ```
/// # #![feature(as_slice)]
/// #![feature(as_slice)]
///
/// let mut x = Some("Diamonds");
/// {
/// let v = x.as_mut_slice();

View file

@ -49,7 +49,8 @@ use mem;
/// # Examples
///
/// ```
/// # #![feature(raw)]
/// #![feature(raw)]
///
/// use std::raw::{self, Repr};
///
/// let slice: &[u16] = &[1, 2, 3, 4];
@ -98,7 +99,8 @@ impl<T> Clone for Slice<T> {
/// # Examples
///
/// ```
/// # #![feature(raw)]
/// #![feature(raw)]
///
/// use std::mem;
/// use std::raw;
///

View file

@ -420,7 +420,8 @@ impl<T, E> Result<T, E> {
/// Converts from `Result<T, E>` to `&mut [T]` (without copying)
///
/// ```
/// # #![feature(as_slice)]
/// #![feature(as_slice)]
///
/// let mut x: Result<&str, u32> = Ok("Gold");
/// {
/// let v = x.as_mut_slice();

View file

@ -19,7 +19,8 @@
//! provided beyond this module.
//!
//! ```rust
//! # #![feature(core_simd)]
//! #![feature(core_simd)]
//!
//! fn main() {
//! use std::simd::f32x4;
//! let a = f32x4(40.0, 41.0, 42.0, 43.0);

View file

@ -47,7 +47,8 @@
//! which is cyclic.
//!
//! ```rust
//! # #![feature(rustc_private, core, into_cow)]
//! #![feature(rustc_private, core, into_cow)]
//!
//! use std::borrow::IntoCow;
//! use std::io::Write;
//! use graphviz as dot;
@ -149,7 +150,8 @@
//! entity `&sube`).
//!
//! ```rust
//! # #![feature(rustc_private, core, into_cow)]
//! #![feature(rustc_private, core, into_cow)]
//!
//! use std::borrow::IntoCow;
//! use std::io::Write;
//! use graphviz as dot;
@ -207,7 +209,8 @@
//! Hasse-diagram for the subsets of the set `{x, y}`.
//!
//! ```rust
//! # #![feature(rustc_private, core, into_cow)]
//! #![feature(rustc_private, core, into_cow)]
//!
//! use std::borrow::IntoCow;
//! use std::io::Write;
//! use graphviz as dot;

View file

@ -674,8 +674,7 @@ impl<'a> LifetimeContext<'a> {
for lifetime in lifetimes {
if special_idents.iter().any(|&i| i.name == lifetime.lifetime.name) {
span_err!(self.sess, lifetime.lifetime.span, E0262,
"illegal lifetime parameter name: `{}`",
lifetime.lifetime.name);
"invalid lifetime parameter name: `{}`", lifetime.lifetime.name);
}
}

View file

@ -34,8 +34,8 @@
/// # Examples
///
/// ```{.rust}
/// # #![feature(rustc_private)]
/// # #![feature(associated_consts)]
/// #![feature(rustc_private)]
/// #![feature(associated_consts)]
/// #[macro_use] extern crate rustc_bitflags;
///
/// bitflags! {
@ -62,7 +62,7 @@
/// The generated `struct`s can also be extended with type and trait implementations:
///
/// ```{.rust}
/// # #![feature(rustc_private)]
/// #![feature(rustc_private)]
/// #[macro_use] extern crate rustc_bitflags;
///
/// use std::fmt;

View file

@ -2325,7 +2325,7 @@ fn deref_once<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
_ => {
bcx.tcx().sess.span_bug(
expr.span,
&format!("deref invoked on expr of illegal type {:?}",
&format!("deref invoked on expr of invalid type {:?}",
datum.ty));
}
};

View file

@ -122,20 +122,21 @@ impl<'tcx> CastCheck<'tcx> {
CastError::NeedViaInt |
CastError::NeedViaUsize => {
fcx.type_error_message(self.span, |actual| {
format!("illegal cast; cast through {} first: `{}` as `{}`",
match e {
CastError::NeedViaPtr => "a raw pointer",
CastError::NeedViaInt => "an integer",
CastError::NeedViaUsize => "a usize",
_ => unreachable!()
},
format!("casting `{}` as `{}` is invalid",
actual,
fcx.infcx().ty_to_string(self.cast_ty))
}, self.expr_ty, None)
}, self.expr_ty, None);
fcx.ccx.tcx.sess.fileline_help(self.span,
&format!("cast through {} first", match e {
CastError::NeedViaPtr => "a raw pointer",
CastError::NeedViaInt => "an integer",
CastError::NeedViaUsize => "a usize",
_ => unreachable!()
}));
}
CastError::CastToBool => {
span_err!(fcx.tcx().sess, self.span, E0054,
"cannot cast as `bool`, compare with zero instead");
span_err!(fcx.tcx().sess, self.span, E0054, "cannot cast as `bool`");
fcx.ccx.tcx.sess.fileline_help(self.span, "compare with zero instead");
}
CastError::CastToChar => {
fcx.type_error_message(self.span, |actual| {
@ -151,17 +152,18 @@ impl<'tcx> CastCheck<'tcx> {
}
CastError::IllegalCast => {
fcx.type_error_message(self.span, |actual| {
format!("illegal cast: `{}` as `{}`",
format!("casting `{}` as `{}` is invalid",
actual,
fcx.infcx().ty_to_string(self.cast_ty))
}, self.expr_ty, None);
}
CastError::DifferingKinds => {
fcx.type_error_message(self.span, |actual| {
format!("illegal cast: `{}` as `{}`; vtable kinds may not match",
format!("casting `{}` as `{}` is invalid",
actual,
fcx.infcx().ty_to_string(self.cast_ty))
}, self.expr_ty, None);
fcx.ccx.tcx.sess.fileline_note(self.span, "vtable kinds may not match");
}
}
}
@ -285,7 +287,7 @@ impl<'tcx> CastCheck<'tcx> {
return Ok(CastKind::PtrPtrCast);
}
// sized -> unsized? report illegal cast (don't complain about vtable kinds)
// sized -> unsized? report invalid cast (don't complain about vtable kinds)
if fcx.type_is_known_to_be_sized(m_expr.ty, self.span) {
return Err(CastError::IllegalCast);
}

View file

@ -3468,7 +3468,7 @@ fn check_expr_with_unifier<'a, 'tcx, F>(fcx: &FnCtxt<'a, 'tcx>,
let tcx = fcx.tcx();
if !tcx.expr_is_lval(&**lhs) {
span_err!(tcx.sess, expr.span, E0070,
"illegal left-hand side expression");
"invalid left-hand side expression");
}
let lhs_ty = fcx.expr_ty(&**lhs);
@ -4273,10 +4273,8 @@ pub fn check_representable(tcx: &ty::ctxt,
// caught by case 1.
match rty.is_representable(tcx, sp) {
ty::SelfRecursive => {
span_err!(tcx.sess, sp, E0072,
"illegal recursive {} type; \
wrap the inner value in a box to make it representable",
designation);
span_err!(tcx.sess, sp, E0072, "invalid recursive {} type", designation);
tcx.sess.fileline_help(sp, "wrap the inner value in a box to make it representable");
return false
}
ty::Representable | ty::ContainsRecursive => (),

View file

@ -57,7 +57,7 @@ pub fn check_binop_assign<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
let tcx = fcx.tcx();
if !tcx.expr_is_lval(lhs_expr) {
span_err!(tcx.sess, lhs_expr.span, E0067, "illegal left-hand side expression");
span_err!(tcx.sess, lhs_expr.span, E0067, "invalid left-hand side expression");
}
fcx.require_expr_have_sized_type(lhs_expr, traits::AssignmentLhsSized);

View file

@ -778,7 +778,7 @@ the pointer the size of the type would need to be unbounded.
Consider the following erroneous definition of a type for a list of bytes:
```
// error, illegal recursive struct type
// error, invalid recursive struct type
struct ListNode {
head: u8,
tail: Option<ListNode>,
@ -1264,7 +1264,7 @@ impl From<Foo> for i32 { // or you use a type from your crate as
E0119: r##"
There are conflicting trait implementations for the same type.
Erroneous code example:
Example of erroneous code:
```
trait MyTrait {
@ -1285,7 +1285,10 @@ impl MyTrait for Foo { // error: conflicting implementations for trait
}
```
When you write:
When looking for the implementation for the trait, the compiler finds
both the `impl<T> MyTrait for T` where T is all types and the `impl
MyTrait for Foo`. Since a trait cannot be implemented multiple times,
this is an error. So, when you write:
```
impl<T> MyTrait for T {
@ -2362,7 +2365,7 @@ register_diagnostics! {
E0241,
E0242, // internal error looking up a definition
E0245, // not a trait
E0246, // illegal recursive type
E0246, // invalid recursive type
E0247, // found module name used as a type
E0248, // found value name used as a type
E0319, // trait impls for defaulted traits allowed just for structs/enums

View file

@ -278,7 +278,8 @@ impl char {
/// In both of these examples, 'ß' takes two bytes to encode.
///
/// ```
/// # #![feature(unicode)]
/// #![feature(unicode)]
///
/// let mut b = [0; 2];
///
/// let result = 'ß'.encode_utf8(&mut b);
@ -289,7 +290,8 @@ impl char {
/// A buffer that's too small:
///
/// ```
/// # #![feature(unicode)]
/// #![feature(unicode)]
///
/// let mut b = [0; 1];
///
/// let result = 'ß'.encode_utf8(&mut b);
@ -315,7 +317,8 @@ impl char {
/// In both of these examples, 'ß' takes one `u16` to encode.
///
/// ```
/// # #![feature(unicode)]
/// #![feature(unicode)]
///
/// let mut b = [0; 1];
///
/// let result = 'ß'.encode_utf16(&mut b);
@ -326,7 +329,8 @@ impl char {
/// A buffer that's too small:
///
/// ```
/// # #![feature(unicode)]
/// #![feature(unicode)]
///
/// let mut b = [0; 0];
///
/// let result = 'ß'.encode_utf8(&mut b);

View file

@ -494,7 +494,8 @@ impl<'a> Iterator for Utf16Items<'a> {
/// # Examples
///
/// ```
/// # #![feature(unicode)]
/// #![feature(unicode)]
///
/// extern crate rustc_unicode;
///
/// use rustc_unicode::str::Utf16Item::{ScalarValue, LoneSurrogate};

View file

@ -30,7 +30,8 @@ impl ToHex for [u8] {
/// # Examples
///
/// ```
/// # #![feature(rustc_private)]
/// #![feature(rustc_private)]
///
/// extern crate serialize;
/// use serialize::hex::ToHex;
///
@ -100,7 +101,8 @@ impl FromHex for str {
/// This converts a string literal to hexadecimal and back.
///
/// ```
/// # #![feature(rustc_private)]
/// #![feature(rustc_private)]
///
/// extern crate serialize;
/// use serialize::hex::{FromHex, ToHex};
///

View file

@ -125,7 +125,8 @@ pub trait AsciiExt {
/// # Examples
///
/// ```
/// # #![feature(ascii)]
/// #![feature(ascii)]
///
/// use std::ascii::AsciiExt;
///
/// let mut ascii = 'a';
@ -144,7 +145,8 @@ pub trait AsciiExt {
/// # Examples
///
/// ```
/// # #![feature(ascii)]
/// #![feature(ascii)]
///
/// use std::ascii::AsciiExt;
///
/// let mut ascii = 'A';

View file

@ -543,7 +543,8 @@ impl<K, V, S> HashMap<K, V, S>
/// # Examples
///
/// ```
/// # #![feature(hashmap_hasher)]
/// #![feature(hashmap_hasher)]
///
/// use std::collections::HashMap;
/// use std::collections::hash_map::RandomState;
///
@ -572,7 +573,8 @@ impl<K, V, S> HashMap<K, V, S>
/// # Examples
///
/// ```
/// # #![feature(hashmap_hasher)]
/// #![feature(hashmap_hasher)]
///
/// use std::collections::HashMap;
/// use std::collections::hash_map::RandomState;
///
@ -979,7 +981,8 @@ impl<K, V, S> HashMap<K, V, S>
/// # Examples
///
/// ```
/// # #![feature(drain)]
/// #![feature(drain)]
///
/// use std::collections::HashMap;
///
/// let mut a = HashMap::new();

View file

@ -154,7 +154,8 @@ impl<T, S> HashSet<T, S>
/// # Examples
///
/// ```
/// # #![feature(hashmap_hasher)]
/// #![feature(hashmap_hasher)]
///
/// use std::collections::HashSet;
/// use std::collections::hash_map::RandomState;
///
@ -179,7 +180,8 @@ impl<T, S> HashSet<T, S>
/// # Examples
///
/// ```
/// # #![feature(hashmap_hasher)]
/// #![feature(hashmap_hasher)]
///
/// use std::collections::HashSet;
/// use std::collections::hash_map::RandomState;
///

View file

@ -407,8 +407,6 @@ impl<W: Write> BufWriter<W> {
/// Gets a mutable reference to the underlying writer.
///
/// # Warning
///
/// It is inadvisable to directly write to the underlying writer.
///
/// # Examples
@ -835,8 +833,6 @@ impl<S: Read + Write> BufStream<S> {
/// Gets a mutable reference to the underlying stream.
///
/// # Warning
///
/// It is inadvisable to read directly from or write directly to the
/// underlying stream.
pub fn get_mut(&mut self) -> &mut S {

View file

@ -15,10 +15,8 @@ use cmp;
use io::{self, SeekFrom, Error, ErrorKind};
use slice;
/// A `Cursor` wraps another type and provides it with a [`Seek`][seek]
/// implementation.
///
/// [seek]: trait.Seek.html
/// A `Cursor` wraps another type and provides it with a
/// [`Seek`](trait.Seek.html) implementation.
///
/// Cursors are typically used with in-memory buffers to allow them to
/// implement `Read` and/or `Write`, allowing these buffers to be used

View file

@ -707,7 +707,7 @@ pub trait Read {
///
/// # fn foo() -> io::Result<()> {
/// let mut f = try!(File::open("foo.txt"));
/// let mut buffer = [0; 10];
/// let mut buffer = [0; 5];
///
/// // read at most five bytes
/// let mut handle = f.take(5);

View file

@ -105,7 +105,7 @@ impl BufRead for Empty {
/// This struct is generally created by calling [`repeat()`][repeat]. Please
/// see the documentation of `repeat()` for more details.
///
/// [empty]: fn.repeat.html
/// [repeat]: fn.repeat.html
#[stable(feature = "rust1", since = "1.0.0")]
pub struct Repeat { byte: u8 }
@ -131,7 +131,7 @@ impl Read for Repeat {
/// This struct is generally created by calling [`sink()`][sink]. Please
/// see the documentation of `sink()` for more details.
///
/// [empty]: fn.sink.html
/// [sink]: fn.sink.html
#[stable(feature = "rust1", since = "1.0.0")]
pub struct Sink { _priv: () }

View file

@ -141,7 +141,8 @@ macro_rules! try {
/// # Examples
///
/// ```
/// # #![feature(mpsc_select)]
/// #![feature(mpsc_select)]
///
/// use std::thread;
/// use std::sync::mpsc;
///

View file

@ -103,7 +103,8 @@ impl Iterator for LookupHost {
/// # Examples
///
/// ```no_run
/// # #![feature(lookup_host)]
/// #![feature(lookup_host)]
///
/// use std::net;
///
/// # fn foo() -> std::io::Result<()> {

View file

@ -235,7 +235,8 @@ impl f32 {
/// The floating point encoding is documented in the [Reference][floating-point].
///
/// ```
/// # #![feature(float_extras)]
/// #![feature(float_extras)]
///
/// use std::f32;
///
/// let num = 2.0f32;
@ -598,7 +599,8 @@ impl f32 {
/// Converts radians to degrees.
///
/// ```
/// # #![feature(float_extras)]
/// #![feature(float_extras)]
///
/// use std::f32::{self, consts};
///
/// let angle = consts::PI;
@ -614,7 +616,8 @@ impl f32 {
/// Converts degrees to radians.
///
/// ```
/// # #![feature(float_extras)]
/// #![feature(float_extras)]
///
/// use std::f32::{self, consts};
///
/// let angle = 180.0f32;
@ -630,7 +633,8 @@ impl f32 {
/// Constructs a floating point number of `x*2^exp`.
///
/// ```
/// # #![feature(float_extras)]
/// #![feature(float_extras)]
///
/// use std::f32;
/// // 3*2^2 - 12 == 0
/// let abs_difference = (f32::ldexp(3.0, 2) - 12.0).abs();
@ -651,7 +655,8 @@ impl f32 {
/// * `0.5 <= abs(x) < 1.0`
///
/// ```
/// # #![feature(float_extras)]
/// #![feature(float_extras)]
///
/// use std::f32;
///
/// let x = 4.0f32;
@ -679,7 +684,8 @@ impl f32 {
/// `other`.
///
/// ```
/// # #![feature(float_extras)]
/// #![feature(float_extras)]
///
/// use std::f32;
///
/// let x = 1.0f32;

View file

@ -191,7 +191,8 @@ impl f64 {
/// The floating point encoding is documented in the [Reference][floating-point].
///
/// ```
/// # #![feature(float_extras)]
/// #![feature(float_extras)]
///
/// let num = 2.0f64;
///
/// // (8388608, -22, 1)
@ -568,7 +569,8 @@ impl f64 {
/// Constructs a floating point number of `x*2^exp`.
///
/// ```
/// # #![feature(float_extras)]
/// #![feature(float_extras)]
///
/// // 3*2^2 - 12 == 0
/// let abs_difference = (f64::ldexp(3.0, 2) - 12.0).abs();
///
@ -588,7 +590,8 @@ impl f64 {
/// * `0.5 <= abs(x) < 1.0`
///
/// ```
/// # #![feature(float_extras)]
/// #![feature(float_extras)]
///
/// let x = 4.0_f64;
///
/// // (1/2)*2^3 -> 1 * 8/2 -> 4.0
@ -614,7 +617,7 @@ impl f64 {
/// `other`.
///
/// ```
/// # #![feature(float_extras)]
/// #![feature(float_extras)]
///
/// let x = 1.0f32;
///

View file

@ -111,7 +111,8 @@ mod prim_unit { }
/// the raw pointer. It doesn't destroy `T` or deallocate any memory.
///
/// ```
/// # #![feature(box_raw)]
/// #![feature(box_raw)]
///
/// let my_speed: Box<i32> = Box::new(88);
/// let my_speed: *mut i32 = Box::into_raw(my_speed);
///

View file

@ -69,7 +69,8 @@ pub struct Condvar { inner: Box<StaticCondvar> }
/// # Examples
///
/// ```
/// # #![feature(static_condvar)]
/// #![feature(static_condvar)]
///
/// use std::sync::{StaticCondvar, CONDVAR_INIT};
///
/// static CVAR: StaticCondvar = CONDVAR_INIT;

View file

@ -14,7 +14,8 @@
//! # Examples
//!
//! ```
//! # #![feature(future)]
//! #![feature(future)]
//!
//! use std::sync::Future;
//!
//! // a fake, for now

View file

@ -27,7 +27,8 @@
//! # Examples
//!
//! ```rust
//! # #![feature(mpsc_select)]
//! #![feature(mpsc_select)]
//!
//! use std::sync::mpsc::channel;
//!
//! let (tx1, rx1) = channel();
@ -124,7 +125,8 @@ impl Select {
/// # Examples
///
/// ```
/// # #![feature(mpsc_select)]
/// #![feature(mpsc_select)]
///
/// use std::sync::mpsc::Select;
///
/// let select = Select::new();

View file

@ -138,7 +138,8 @@ unsafe impl<T: ?Sized + Send> Sync for Mutex<T> { }
/// # Examples
///
/// ```
/// # #![feature(static_mutex)]
/// #![feature(static_mutex)]
///
/// use std::sync::{StaticMutex, MUTEX_INIT};
///
/// static LOCK: StaticMutex = MUTEX_INIT;

View file

@ -81,7 +81,8 @@ unsafe impl<T: ?Sized + Send + Sync> Sync for RwLock<T> {}
/// # Examples
///
/// ```
/// # #![feature(static_rwlock)]
/// #![feature(static_rwlock)]
///
/// use std::sync::{StaticRwLock, RW_LOCK_INIT};
///
/// static LOCK: StaticRwLock = RW_LOCK_INIT;

View file

@ -25,7 +25,8 @@ use sync::{Mutex, Condvar};
/// # Examples
///
/// ```
/// # #![feature(semaphore)]
/// #![feature(semaphore)]
///
/// use std::sync::Semaphore;
///
/// // Create a semaphore that represents 5 resources

View file

@ -367,7 +367,8 @@ pub fn spawn<F, T>(f: F) -> JoinHandle<T> where
/// a join before any relevant stack frames are popped:
///
/// ```rust
/// # #![feature(scoped)]
/// #![feature(scoped)]
///
/// use std::thread;
///
/// let guard = thread::scoped(move || {
@ -447,7 +448,8 @@ pub fn panicking() -> bool {
/// # Examples
///
/// ```
/// # #![feature(catch_panic)]
/// #![feature(catch_panic)]
///
/// use std::thread;
///
/// let result = thread::catch_panic(|| {

View file

@ -24,7 +24,8 @@
//! # Examples
//!
//! ```
//! # #![feature(scoped_tls)]
//! #![feature(scoped_tls)]
//!
//! scoped_thread_local!(static FOO: u32);
//!
//! // Initially each scoped slot is empty.
@ -136,7 +137,8 @@ impl<T> ScopedKey<T> {
/// # Examples
///
/// ```
/// # #![feature(scoped_tls)]
/// #![feature(scoped_tls)]
///
/// scoped_thread_local!(static FOO: u32);
///
/// FOO.set(&100, || {
@ -189,7 +191,8 @@ impl<T> ScopedKey<T> {
/// # Examples
///
/// ```no_run
/// # #![feature(scoped_tls)]
/// #![feature(scoped_tls)]
///
/// scoped_thread_local!(static FOO: u32);
///
/// FOO.with(|slot| {

View file

@ -694,7 +694,7 @@ impl<'a> StringReader<'a> {
accum_int *= 16;
accum_int += c.to_digit(16).unwrap_or_else(|| {
self.err_span_char(self.last_pos, self.pos,
"illegal character in numeric character escape", c);
"invalid character in numeric character escape", c);
valid = false;
0
@ -714,7 +714,7 @@ impl<'a> StringReader<'a> {
Some(_) => valid,
None => {
let last_bpos = self.last_pos;
self.err_span_(start_bpos, last_bpos, "illegal numeric character escape");
self.err_span_(start_bpos, last_bpos, "invalid numeric character escape");
false
}
}
@ -846,7 +846,7 @@ impl<'a> StringReader<'a> {
"unterminated unicode escape (needed a `}`)");
} else {
self.err_span_char(self.last_pos, self.pos,
"illegal character in unicode escape", c);
"invalid character in unicode escape", c);
}
valid = false;
0
@ -862,7 +862,7 @@ impl<'a> StringReader<'a> {
}
if valid && (char::from_u32(accum_int).is_none() || count == 0) {
self.err_span_(start_bpos, self.last_pos, "illegal unicode character escape");
self.err_span_(start_bpos, self.last_pos, "invalid unicode character escape");
valid = false;
}
@ -1138,8 +1138,8 @@ impl<'a> StringReader<'a> {
let last_bpos = self.last_pos;
let curr_char = self.curr.unwrap();
self.fatal_span_char(start_bpos, last_bpos,
"only `#` is allowed in raw string delimitation; \
found illegal character",
"found invalid character; \
only `#` is allowed in raw string delimitation",
curr_char);
}
self.bump();
@ -1323,8 +1323,8 @@ impl<'a> StringReader<'a> {
let last_pos = self.last_pos;
let ch = self.curr.unwrap();
self.fatal_span_char(start_bpos, last_pos,
"only `#` is allowed in raw string delimitation; \
found illegal character",
"found invalid character; \
only `#` is allowed in raw string delimitation",
ch);
}
self.bump();

View file

@ -446,11 +446,11 @@ fn filtered_float_lit(data: token::InternedString, suffix: Option<&str>,
Some(suf) => {
if suf.len() >= 2 && looks_like_width_suffix(&['f'], suf) {
// if it looks like a width, lets try to be helpful.
sd.span_err(sp, &*format!("illegal width `{}` for float literal, \
valid widths are 32 and 64", &suf[1..]));
sd.span_err(sp, &*format!("invalid width `{}` for float literal", &suf[1..]));
sd.fileline_help(sp, "valid widths are 32 and 64");
} else {
sd.span_err(sp, &*format!("illegal suffix `{}` for float literal, \
valid suffixes are `f32` and `f64`", suf));
sd.span_err(sp, &*format!("invalid suffix `{}` for float literal", suf));
sd.fileline_help(sp, "valid suffixes are `f32` and `f64`");
}
ast::LitFloatUnsuffixed(data)
@ -619,11 +619,11 @@ pub fn integer_lit(s: &str,
// i<digits> and u<digits> look like widths, so lets
// give an error message along those lines
if looks_like_width_suffix(&['i', 'u'], suf) {
sd.span_err(sp, &*format!("illegal width `{}` for integer literal; \
valid widths are 8, 16, 32 and 64",
sd.span_err(sp, &*format!("invalid width `{}` for integer literal",
&suf[1..]));
sd.fileline_help(sp, "valid widths are 8, 16, 32 and 64");
} else {
sd.span_err(sp, &*format!("illegal suffix `{}` for numeric literal", suf));
sd.span_err(sp, &*format!("invalid suffix `{}` for numeric literal", suf));
sd.fileline_help(sp, "the suffix must be one of the integral types \
(`u32`, `isize`, etc)");
}

View file

@ -681,7 +681,7 @@ impl<'a> Parser<'a> {
if text.is_empty() {
self.span_bug(sp, "found empty literal suffix in Some")
}
self.span_err(sp, &*format!("{} with a suffix is illegal", kind));
self.span_err(sp, &*format!("{} with a suffix is invalid", kind));
}
}
}
@ -5286,7 +5286,7 @@ impl<'a> Parser<'a> {
let last_span = self.last_span;
self.span_err(
last_span,
&format!("illegal ABI: expected one of [{}], \
&format!("invalid ABI: expected one of [{}], \
found `{}`",
abi::all_names().join(", "),
s));

View file

@ -9,12 +9,12 @@
// except according to those terms.
fn main() {
1 = 2; //~ ERROR illegal left-hand side expression
1 += 2; //~ ERROR illegal left-hand side expression
(1, 2) = (3, 4); //~ ERROR illegal left-hand side expression
1 = 2; //~ ERROR invalid left-hand side expression
1 += 2; //~ ERROR invalid left-hand side expression
(1, 2) = (3, 4); //~ ERROR invalid left-hand side expression
let (a, b) = (1, 2);
(a, b) = (3, 4); //~ ERROR illegal left-hand side expression
(a, b) = (3, 4); //~ ERROR invalid left-hand side expression
None = Some(3); //~ ERROR illegal left-hand side expression
None = Some(3); //~ ERROR invalid left-hand side expression
}

View file

@ -8,5 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern: cannot cast as `bool`, compare with zero instead
fn main() { let u = (5 as bool); }
fn main() {
let u = (5 as bool);
//~^ ERROR cannot cast as `bool`
//~^^ HELP compare with zero instead
}

View file

@ -10,12 +10,16 @@
fn illegal_cast<U:?Sized,V:?Sized>(u: *const U) -> *const V
{
u as *const V //~ ERROR vtable kinds
u as *const V
//~^ ERROR casting
//~^^ NOTE vtable kinds
}
fn illegal_cast_2<U:?Sized>(u: *const U) -> *const str
{
u as *const str //~ ERROR vtable kinds
u as *const str
//~^ ERROR casting
//~^^ NOTE vtable kinds
}
trait Foo { fn foo(&self) {} }
@ -41,32 +45,58 @@ fn main()
let _ = v as (u32,); //~ ERROR non-scalar
let _ = Some(&v) as *const u8; //~ ERROR non-scalar
let _ = v as f32; //~ ERROR through a usize first
let _ = main as f64; //~ ERROR through a usize first
let _ = &v as usize; //~ ERROR through a raw pointer first
let _ = f as *const u8; //~ ERROR through a usize first
let _ = 3 as bool; //~ ERROR compare with zero
let _ = E::A as bool; //~ ERROR compare with zero
let _ = v as f32;
//~^ ERROR casting
//~^^ HELP through a usize first
let _ = main as f64;
//~^ ERROR casting
//~^^ HELP through a usize first
let _ = &v as usize;
//~^ ERROR casting
//~^^ HELP through a raw pointer first
let _ = f as *const u8;
//~^ ERROR casting
//~^^ HELP through a usize first
let _ = 3 as bool;
//~^ ERROR cannot cast as `bool`
//~^^ HELP compare with zero
let _ = E::A as bool;
//~^ ERROR cannot cast as `bool`
//~^^ HELP compare with zero
let _ = 0x61u32 as char; //~ ERROR only `u8` can be cast
let _ = false as f32; //~ ERROR through an integer first
let _ = E::A as f32; //~ ERROR through an integer first
let _ = 'a' as f32; //~ ERROR through an integer first
let _ = false as f32;
//~^ ERROR casting
//~^^ HELP through an integer first
let _ = E::A as f32;
//~^ ERROR casting
//~^^ HELP through an integer first
let _ = 'a' as f32;
//~^ ERROR casting
//~^^ HELP through an integer first
let _ = false as *const u8; //~ ERROR through a usize first
let _ = E::A as *const u8; //~ ERROR through a usize first
let _ = 'a' as *const u8; //~ ERROR through a usize first
let _ = false as *const u8;
//~^ ERROR casting
//~^^ HELP through a usize first
let _ = E::A as *const u8;
//~^ ERROR casting
//~^^ HELP through a usize first
let _ = 'a' as *const u8;
//~^ ERROR casting
//~^^ HELP through a usize first
let _ = 42usize as *const [u8]; //~ ERROR illegal cast
let _ = v as *const [u8]; //~ ERROR illegal cast
let _ = 42usize as *const [u8]; //~ ERROR casting
let _ = v as *const [u8]; //~ ERROR casting
let _ = fat_v as *const Foo;
//~^ ERROR `core::marker::Sized` is not implemented for the type `[u8]`
let _ = foo as *const str; //~ ERROR illegal cast
let _ = foo as *mut str; //~ ERROR illegal cast
let _ = main as *mut str; //~ ERROR illegal cast
let _ = &f as *mut f32; //~ ERROR illegal cast
let _ = &f as *const f64; //~ ERROR illegal cast
let _ = fat_v as usize; //~ ERROR through a raw pointer first
let _ = foo as *const str; //~ ERROR casting
let _ = foo as *mut str; //~ ERROR casting
let _ = main as *mut str; //~ ERROR casting
let _ = &f as *mut f32; //~ ERROR casting
let _ = &f as *const f64; //~ ERROR casting
let _ = fat_v as usize;
//~^ ERROR casting
//~^^ HELP through a raw pointer first
let a : *const str = "hello";
let _ = a as *const Foo;
@ -76,6 +106,10 @@ fn main()
let _ = main.f as *const u32; //~ ERROR attempted access of field
let cf: *const Foo = &0;
let _ = cf as *const [u8]; //~ ERROR vtable kinds
let _ = cf as *const Bar; //~ ERROR vtable kinds
let _ = cf as *const [u8];
//~^ ERROR casting
//~^^ NOTE vtable kinds
let _ = cf as *const Bar;
//~^ ERROR casting
//~^^ NOTE vtable kinds
}

View file

@ -9,8 +9,8 @@
// except according to those terms.
static a: &'static str = "foo";
static b: *const u8 = a as *const u8; //~ ERROR illegal cast
static c: *const u8 = &a as *const u8; //~ ERROR illegal cast
static b: *const u8 = a as *const u8; //~ ERROR casting
static c: *const u8 = &a as *const u8; //~ ERROR casting
fn main() {
}

View file

@ -21,8 +21,8 @@ enum F {
}
pub fn main() {
let a = E::L0 as f32; //~ ERROR illegal cast
let c = F::H1 as f32; //~ ERROR illegal cast
let a = E::L0 as f32; //~ ERROR casting
let c = F::H1 as f32; //~ ERROR casting
assert_eq!(a, -1.0f32);
assert_eq!(c, -1.0f32);
}

View file

@ -20,8 +20,8 @@ enum F {
H1 = 0xFFFFFFFFFFFFFFFF
}
static C0: f32 = E::L0 as f32; //~ ERROR illegal cast
static C1: f32 = F::H1 as f32; //~ ERROR illegal cast
static C0: f32 = E::L0 as f32; //~ ERROR casting
static C1: f32 = F::H1 as f32; //~ ERROR casting
pub fn main() {
let b = C0;

View file

@ -17,14 +17,16 @@ fn main() {
let p = a as *const [i32];
let q = a.as_ptr();
a as usize; //~ ERROR illegal cast
a as usize; //~ ERROR casting
b as usize; //~ ERROR non-scalar cast
p as usize; //~ ERROR illegal cast; cast through a raw pointer
p as usize;
//~^ ERROR casting
//~^^ HELP cast through a raw pointer
// #22955
q as *const [i32]; //~ ERROR illegal cast
q as *const [i32]; //~ ERROR casting
// #21397
let t: *mut (Trait + 'static) = 0 as *mut _; //~ ERROR illegal cast
let mut fail: *const str = 0 as *const str; //~ ERROR illegal cast
let t: *mut (Trait + 'static) = 0 as *mut _; //~ ERROR casting
let mut fail: *const str = 0 as *const str; //~ ERROR casting
}

View file

@ -9,7 +9,7 @@
// except according to those terms.
// error-pattern: illegal recursive enum type; wrap the inner value in a box
// error-pattern: invalid recursive enum type
enum mlist { cons(isize, mlist), nil, }

View file

@ -14,6 +14,6 @@ mod A {
fn main() {
A::C = 1;
//~^ ERROR: illegal left-hand side expression
//~^ ERROR: invalid left-hand side expression
//~| ERROR: mismatched types
}

View file

@ -15,8 +15,8 @@ struct X {
fn main() {
let x = X { a: [0] };
let _f = &x.a as *mut u8; //~ ERROR illegal cast
let _f = &x.a as *mut u8; //~ ERROR casting
let local: [u8; 1] = [0];
let _v = &local as *mut u8; //~ ERROR illegal cast
let _v = &local as *mut u8; //~ ERROR casting
}

View file

@ -9,7 +9,7 @@
// except according to those terms.
struct Foo { foo: Option<Option<Foo>> }
//~^ ERROR illegal recursive struct type; wrap the inner value in a box to make it representable
//~^ ERROR invalid recursive struct type
impl Foo { fn bar(&self) {} }

View file

@ -9,10 +9,10 @@
// except according to those terms.
struct Baz { q: Option<Foo> }
//~^ ERROR illegal recursive struct type; wrap the inner value in a box to make it representable
//~^ ERROR invalid recursive struct type
struct Foo { q: Option<Baz> }
//~^ ERROR illegal recursive struct type; wrap the inner value in a box to make it representable
//~^ ERROR invalid recursive struct type
impl Foo { fn bar(&self) {} }

View file

@ -11,7 +11,7 @@
use std::sync::Mutex;
struct Foo { foo: Mutex<Option<Foo>> }
//~^ ERROR illegal recursive struct type; wrap the inner value in a box to make it representable
//~^ ERROR invalid recursive struct type
impl Foo { fn bar(&self) {} }

View file

@ -11,7 +11,7 @@
use std::marker;
struct Foo<T> { foo: Option<Option<Foo<T>>>, marker: marker::PhantomData<T> }
//~^ ERROR illegal recursive struct type; wrap the inner value in a box to make it representable
//~^ ERROR invalid recursive struct type
impl<T> Foo<T> { fn bar(&self) {} }

View file

@ -12,7 +12,7 @@ use std::marker;
struct Foo { foo: Bar<Foo> }
struct Bar<T> { x: Bar<Foo> , marker: marker::PhantomData<T> }
//~^ ERROR illegal recursive struct type; wrap the inner value in a box to make it representable
//~^ ERROR invalid recursive struct type
impl Foo { fn foo(&self) {} }

View file

@ -11,7 +11,7 @@
use std::sync::Mutex;
enum Foo { X(Mutex<Option<Foo>>) }
//~^ ERROR illegal recursive enum type; wrap the inner value in a box to make it representable
//~^ ERROR invalid recursive enum type
impl Foo { fn bar(self) {} }

View file

@ -9,7 +9,7 @@
// except according to those terms.
enum Foo { Voo(Option<Option<Foo>>) }
//~^ ERROR illegal recursive enum type; wrap the inner value in a box to make it representable
//~^ ERROR invalid recursive enum type
impl Foo { fn bar(&self) {} }

View file

@ -14,5 +14,6 @@ enum Test {
fn main() {
let _x = Test::Foo as *const isize;
//~^ ERROR illegal cast; cast through a usize first: `Test` as `*const isize`
//~^ ERROR casting `Test` as `*const isize` is invalid
//~^^ HELP cast through a usize first
}

View file

@ -11,5 +11,7 @@
struct Inches(i32);
fn main() {
Inches as f32; //~ ERROR illegal cast; cast through a usize first
Inches as f32;
//~^ ERROR casting
//~^^ cast through a usize first
}

View file

@ -16,7 +16,7 @@ mod pingpong {
use send_packet;
pub type ping = send_packet<pong>;
pub struct pong(send_packet<ping>);
//~^ ERROR illegal recursive struct type; wrap the inner value in a box to make it representable
//~^ ERROR invalid recursive struct type
}
fn main() {}

View file

@ -10,7 +10,7 @@
enum foo { foo_(bar) }
enum bar { bar_none, bar_some(bar) }
//~^ ERROR illegal recursive enum type; wrap the inner value in a box to make it representable
//~^ ERROR invalid recursive enum type
fn main() {
}

View file

@ -12,7 +12,7 @@
enum foo { foo_(bar) }
struct bar { x: bar }
//~^ ERROR illegal recursive struct type; wrap the inner value in a box to make it representable
//~^ ERROR invalid recursive struct type
fn main() {
}

View file

@ -12,7 +12,7 @@ use std::marker;
enum E1 { V1(E2<E1>), }
enum E2<T> { V2(E2<E1>, marker::PhantomData<T>), }
//~^ ERROR illegal recursive enum type; wrap the inner value in a box to make it representable
//~^ ERROR invalid recursive enum type
impl E1 { fn foo(&self) {} }

View file

@ -9,7 +9,7 @@
// except according to those terms.
struct S {
//~^ ERROR illegal recursive struct type; wrap the inner value in a box to make it representable
//~^ ERROR invalid recursive struct type
element: Option<S>
}

View file

@ -9,6 +9,6 @@
// except according to those terms.
fn main() {
let a = 1_is; //~ ERROR illegal suffix
let b = 2_us; //~ ERROR illegal suffix
let a = 1_is; //~ ERROR invalid suffix
let b = 2_us; //~ ERROR invalid suffix
}

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern: illegal recursive enum type
// error-pattern: invalid recursive enum type
enum list<T> { cons(T, list<T>), nil }

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
struct Foo<'static> { //~ ERROR illegal lifetime parameter name: `'static`
struct Foo<'static> { //~ ERROR invalid lifetime parameter name: `'static`
x: &'static isize
}

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern:illegal recursive struct type
// error-pattern:invalid recursive struct type
struct t1 {
foo: isize,
foolish: t1

View file

@ -11,5 +11,6 @@
fn main() {
let x : i16 = 22;
((&x) as *const i16) as f32;
//~^ ERROR illegal cast; cast through a usize first: `*const i16` as `f32`
//~^ ERROR casting `*const i16` as `f32` is invalid
//~^^ HELP cast through a usize first
}

View file

@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// error-pattern:illegal cast
// error-pattern:casting
#![feature(libc)]

View file

@ -28,7 +28,7 @@ fn main() {
let mut x1 = X { y: [0, 0] };
// This is still an error since we don't allow casts from &mut [T; n] to *mut T.
let p1: *mut u8 = &mut x1.y as *mut _; //~ ERROR illegal cast
let p1: *mut u8 = &mut x1.y as *mut _; //~ ERROR casting
let t1: *mut [u8; 2] = &mut x1.y as *mut _;
let h1: *mut [u8; 2] = &mut x1.y as *mut [u8; 2];
}

View file

@ -12,28 +12,28 @@
extern
"C"suffix //~ ERROR ABI spec with a suffix is illegal
"C"suffix //~ ERROR ABI spec with a suffix is invalid
fn foo() {}
extern
"C"suffix //~ ERROR ABI spec with a suffix is illegal
"C"suffix //~ ERROR ABI spec with a suffix is invalid
{}
fn main() {
""suffix; //~ ERROR str literal with a suffix is illegal
b""suffix; //~ ERROR binary str literal with a suffix is illegal
r#""#suffix; //~ ERROR str literal with a suffix is illegal
br#""#suffix; //~ ERROR binary str literal with a suffix is illegal
'a'suffix; //~ ERROR char literal with a suffix is illegal
b'a'suffix; //~ ERROR byte literal with a suffix is illegal
""suffix; //~ ERROR str literal with a suffix is invalid
b""suffix; //~ ERROR binary str literal with a suffix is invalid
r#""#suffix; //~ ERROR str literal with a suffix is invalid
br#""#suffix; //~ ERROR binary str literal with a suffix is invalid
'a'suffix; //~ ERROR char literal with a suffix is invalid
b'a'suffix; //~ ERROR byte literal with a suffix is invalid
1234u1024; //~ ERROR illegal width `1024` for integer literal
1234i1024; //~ ERROR illegal width `1024` for integer literal
1234f1024; //~ ERROR illegal width `1024` for float literal
1234.5f1024; //~ ERROR illegal width `1024` for float literal
1234u1024; //~ ERROR invalid width `1024` for integer literal
1234i1024; //~ ERROR invalid width `1024` for integer literal
1234f1024; //~ ERROR invalid width `1024` for float literal
1234.5f1024; //~ ERROR invalid width `1024` for float literal
1234suffix; //~ ERROR illegal suffix `suffix` for numeric literal
0b101suffix; //~ ERROR illegal suffix `suffix` for numeric literal
1.0suffix; //~ ERROR illegal suffix `suffix` for float literal
1.0e10suffix; //~ ERROR illegal suffix `suffix` for float literal
1234suffix; //~ ERROR invalid suffix `suffix` for numeric literal
0b101suffix; //~ ERROR invalid suffix `suffix` for numeric literal
1.0suffix; //~ ERROR invalid suffix `suffix` for float literal
1.0e10suffix; //~ ERROR invalid suffix `suffix` for float literal
}

View file

@ -17,7 +17,7 @@ static FOO: u8 = b'\f'; //~ ERROR unknown byte escape
pub fn main() {
b'\f'; //~ ERROR unknown byte escape
b'\x0Z'; //~ ERROR illegal character in numeric character escape: Z
b'\x0Z'; //~ ERROR invalid character in numeric character escape: Z
b' '; //~ ERROR byte constant must be escaped
b'''; //~ ERROR byte constant must be escaped
b'é'; //~ ERROR byte constant must be ASCII

View file

@ -17,7 +17,7 @@ static FOO: &'static [u8] = b"\f"; //~ ERROR unknown byte escape
pub fn main() {
b"\f"; //~ ERROR unknown byte escape
b"\x0Z"; //~ ERROR illegal character in numeric character escape: Z
b"\x0Z"; //~ ERROR invalid character in numeric character escape: Z
b"é"; //~ ERROR byte constant must be ASCII
b"a //~ ERROR unterminated double quote byte string
}

View file

@ -23,25 +23,25 @@ fn main() {
//~^ ERROR numeric character escape is too short
let _ = b'\xxy';
//~^ ERROR illegal character in numeric character escape: x
//~^^ ERROR illegal character in numeric character escape: y
//~^ ERROR invalid character in numeric character escape: x
//~^^ ERROR invalid character in numeric character escape: y
let _ = '\x5';
//~^ ERROR numeric character escape is too short
let _ = '\xxy';
//~^ ERROR illegal character in numeric character escape: x
//~^^ ERROR illegal character in numeric character escape: y
//~^ ERROR invalid character in numeric character escape: x
//~^^ ERROR invalid character in numeric character escape: y
let _ = b"\u{a4a4} \xf \u";
//~^ ERROR unicode escape sequences cannot be used as a byte or in a byte string
//~^^ ERROR illegal character in numeric character escape:
//~^^ ERROR invalid character in numeric character escape:
//~^^^ ERROR incorrect unicode escape sequence
//~^^^^ ERROR unicode escape sequences cannot be used as a byte or in a byte string
let _ = "\u{ffffff} \xf \u";
//~^ ERROR illegal unicode character escape
//~^^ ERROR illegal character in numeric character escape:
//~^ ERROR invalid unicode character escape
//~^^ ERROR invalid character in numeric character escape:
//~^^^ ERROR form of character escape may only be used with characters in the range [\x00-\x7f]
//~^^^^ ERROR incorrect unicode escape sequence
}

View file

@ -11,7 +11,7 @@
// compile-flags: -Z parse-only
pub extern
"invalid-ab_isize" //~ ERROR illegal ABI
"invalid-ab_isize" //~ ERROR invalid ABI
fn foo() {}
fn main() {}

Some files were not shown because too many files have changed in this diff Show more