Auto merge of #25218 - Manishearth:rollup, r=Manishearth

- Successful merges: #24864, #25140, #25179, #25181, #25190, #25194, #25195, #25198, #25203, #25210, #25211, #25215
- Failed merges: #25200
This commit is contained in:
bors 2015-05-08 20:39:08 +00:00
commit b210aea1d4
15 changed files with 83 additions and 37 deletions

View File

@ -518,6 +518,7 @@ Luke Francl <look@recursion.org>
Luke Metz <luke.metz@students.olin.edu> Luke Metz <luke.metz@students.olin.edu>
Luke Steensen <luke.steensen@gmail.com> Luke Steensen <luke.steensen@gmail.com>
Luqman Aden <me@luqman.ca> Luqman Aden <me@luqman.ca>
Łukasz Niemier <lukasz@niemier.pl>
Magnus Auvinen <magnus.auvinen@gmail.com> Magnus Auvinen <magnus.auvinen@gmail.com>
Mahmut Bulut <mahmutbulut0@gmail.com> Mahmut Bulut <mahmutbulut0@gmail.com>
Makoto Nakashima <makoto.nksm+github@gmail.com> Makoto Nakashima <makoto.nksm+github@gmail.com>
@ -997,5 +998,4 @@ xales <xales@naveria.com>
zofrex <zofrex@gmail.com> zofrex <zofrex@gmail.com>
zslayton <zack.slayton@gmail.com> zslayton <zack.slayton@gmail.com>
zzmp <zmp@umich.edu> zzmp <zmp@umich.edu>
Łukasz Niemier <lukasz@niemier.pl>
克雷 <geekcraik@users.noreply.github.com> 克雷 <geekcraik@users.noreply.github.com>

2
configure vendored
View File

@ -844,7 +844,7 @@ then
CFG_OSX_GCC_VERSION=$("$CFG_GCC" --version 2>&1 | grep "Apple LLVM version") CFG_OSX_GCC_VERSION=$("$CFG_GCC" --version 2>&1 | grep "Apple LLVM version")
if [ $? -eq 0 ] if [ $? -eq 0 ]
then then
step_msg "on OS X 10.9, forcing use of clang" step_msg "on OS X >=10.9, forcing use of clang"
CFG_ENABLE_CLANG=1 CFG_ENABLE_CLANG=1
else else
if [ $("$CFG_GCC" --version 2>&1 | grep -c ' 4\.[0-6]') -ne 0 ]; then if [ $("$CFG_GCC" --version 2>&1 | grep -c ' 4\.[0-6]') -ne 0 ]; then

View File

@ -358,11 +358,10 @@ rand="0.3.0"
The `[dependencies]` section of `Cargo.toml` is like the `[package]` section: The `[dependencies]` section of `Cargo.toml` is like the `[package]` section:
everything that follows it is part of it, until the next section starts. everything that follows it is part of it, until the next section starts.
Cargo uses the dependencies section to know what dependencies on external Cargo uses the dependencies section to know what dependencies on external
crates you have, and what versions you require. In this case, weve used `*`, crates you have, and what versions you require. In this case, weve used version `0.3.0`.
which means that well use the latest version of `rand`. Cargo understands Cargo understands [Semantic Versioning][semver], which is a standard for writing version
[Semantic Versioning][semver], which is a standard for writing version numbers. If we wanted to use the latest version we could use `*` or we could use a range
numbers. If we wanted a specific version or range of versions, we could be of versions. [Cargos documentation][cargodoc] contains more details.
more specific here. [Cargos documentation][cargodoc] contains more details.
[semver]: http://semver.org [semver]: http://semver.org
[cargodoc]: http://doc.crates.io/crates-io.html [cargodoc]: http://doc.crates.io/crates-io.html
@ -410,7 +409,7 @@ $ cargo build
Compiling guessing_game v0.1.0 (file:///home/you/projects/guessing_game) Compiling guessing_game v0.1.0 (file:///home/you/projects/guessing_game)
``` ```
So, we told Cargo we wanted any version of `rand`, and so it fetched the latest So, we told Cargo we wanted any `0.3.x` version of `rand`, and so it fetched the latest
version at the time this was written, `v0.3.8`. But what happens when next version at the time this was written, `v0.3.8`. But what happens when next
week, version `v0.3.9` comes out, with an important bugfix? While getting week, version `v0.3.9` comes out, with an important bugfix? While getting
bugfixes is important, what if `0.3.9` contains a regression that breaks our bugfixes is important, what if `0.3.9` contains a regression that breaks our

View File

@ -116,7 +116,7 @@ fn main() {
} }
``` ```
[struct]: structs.html [structs]: structs.html
As you can see, `struct`s can also have lifetimes. In a similar way to functions, As you can see, `struct`s can also have lifetimes. In a similar way to functions,

View File

@ -188,7 +188,7 @@ struct CircleBuilder {
impl CircleBuilder { impl CircleBuilder {
fn new() -> CircleBuilder { fn new() -> CircleBuilder {
CircleBuilder { x: 0.0, y: 0.0, radius: 0.0, } CircleBuilder { x: 0.0, y: 0.0, radius: 1.0, }
} }
fn x(&mut self, coordinate: f64) -> &mut CircleBuilder { fn x(&mut self, coordinate: f64) -> &mut CircleBuilder {

View File

@ -85,7 +85,7 @@ safety, and the mechanism by which Rust guarantees it, the
> You may have one or the other of these two kinds of borrows, but not both at > You may have one or the other of these two kinds of borrows, but not both at
> the same time: > the same time:
> >
> * 0 to N references (`&T`) to a resource. > * one or more references (`&T`) to a resource.
> * exactly one mutable reference (`&mut T`) > * exactly one mutable reference (`&mut T`)
[ownership]: ownership.html [ownership]: ownership.html

View File

@ -3,7 +3,7 @@
This guide is one of three presenting Rusts ownership system. This is one of This guide is one of three presenting Rusts ownership system. This is one of
Rusts most unique and compelling features, with which Rust developers should Rusts most unique and compelling features, with which Rust developers should
become quite acquainted. Ownership is how Rust achieves its largest goal, become quite acquainted. Ownership is how Rust achieves its largest goal,
memory safety. The there are a few distinct concepts, each with its own memory safety. There are a few distinct concepts, each with its own
chapter: chapter:
* ownership, which youre reading now. * ownership, which youre reading now.
@ -59,6 +59,7 @@ deterministically, at the end of the scope.
[vect]: ../std/vec/struct.Vec.html [vect]: ../std/vec/struct.Vec.html
[heap]: the-stack-and-the-heap.html [heap]: the-stack-and-the-heap.html
[bindings]: variable-bindings.html
# Move semantics # Move semantics
@ -122,7 +123,7 @@ let v2 = v;
The first line creates some data for the vector on the [stack][sh], `v`. The The first line creates some data for the vector on the [stack][sh], `v`. The
vectors data, however, is stored on the [heap][sh], and so it contains a vectors data, however, is stored on the [heap][sh], and so it contains a
pointer to that data. When we move `v` to `v2`, it creates a copy of that data, pointer to that data. When we move `v` to `v2`, it creates a copy of that pointer,
for `v2`. Which would mean two pointers to the contents of the vector on the for `v2`. Which would mean two pointers to the contents of the vector on the
heap. That would be a problem: it would violate Rusts safety guarantees by heap. That would be a problem: it would violate Rusts safety guarantees by
introducing a data race. Therefore, Rust forbids using `v` after weve done the introducing a data race. Therefore, Rust forbids using `v` after weve done the

View File

@ -3,7 +3,7 @@
This guide is one of three presenting Rusts ownership system. This is one of This guide is one of three presenting Rusts ownership system. This is one of
Rusts most unique and compelling features, with which Rust developers should Rusts most unique and compelling features, with which Rust developers should
become quite acquainted. Ownership is how Rust achieves its largest goal, become quite acquainted. Ownership is how Rust achieves its largest goal,
memory safety. The there are a few distinct concepts, each with its own memory safety. There are a few distinct concepts, each with its own
chapter: chapter:
* [ownership][ownership], ownership, the key concept * [ownership][ownership], ownership, the key concept

View File

@ -192,7 +192,7 @@ Heres the error:
```text ```text
error: type `std::fs::File` does not implement any method in scope named `write` error: type `std::fs::File` does not implement any method in scope named `write`
let result = f.write(b”whatever”); let result = f.write(b"whatever");
^~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~
``` ```

View File

@ -137,7 +137,7 @@ pub trait Iterator {
/// ///
/// ``` /// ```
/// let a = [1, 2, 3, 4, 5]; /// let a = [1, 2, 3, 4, 5];
/// assert!(a.iter().last().unwrap() == &5); /// assert_eq!(a.iter().last().unwrap(), &5);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
@ -155,8 +155,8 @@ pub trait Iterator {
/// ``` /// ```
/// let a = [1, 2, 3, 4, 5]; /// let a = [1, 2, 3, 4, 5];
/// let mut it = a.iter(); /// let mut it = a.iter();
/// assert!(it.nth(2).unwrap() == &3); /// assert_eq!(it.nth(2).unwrap(), &3);
/// assert!(it.nth(2) == None); /// assert_eq!(it.nth(2), None);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
@ -545,8 +545,8 @@ pub trait Iterator {
/// let mut it = 0..10; /// let mut it = 0..10;
/// // sum the first five values /// // sum the first five values
/// let partial_sum = it.by_ref().take(5).fold(0, |a, b| a + b); /// let partial_sum = it.by_ref().take(5).fold(0, |a, b| a + b);
/// assert!(partial_sum == 10); /// assert_eq!(partial_sum, 10);
/// assert!(it.next() == Some(5)); /// assert_eq!(it.next(), Some(5));
/// ``` /// ```
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
fn by_ref(&mut self) -> &mut Self where Self: Sized { self } fn by_ref(&mut self) -> &mut Self where Self: Sized { self }
@ -608,7 +608,7 @@ pub trait Iterator {
/// ///
/// ``` /// ```
/// let a = [1, 2, 3, 4, 5]; /// let a = [1, 2, 3, 4, 5];
/// assert!(a.iter().fold(0, |acc, &item| acc + item) == 15); /// assert_eq!(a.iter().fold(0, |acc, &item| acc + item), 15);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
@ -773,7 +773,7 @@ pub trait Iterator {
/// ///
/// ``` /// ```
/// let a = [1, 2, 3, 4, 5]; /// let a = [1, 2, 3, 4, 5];
/// assert!(a.iter().max().unwrap() == &5); /// assert_eq!(a.iter().max().unwrap(), &5);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
@ -796,7 +796,7 @@ pub trait Iterator {
/// ///
/// ``` /// ```
/// let a = [1, 2, 3, 4, 5]; /// let a = [1, 2, 3, 4, 5];
/// assert!(a.iter().min().unwrap() == &1); /// assert_eq!(a.iter().min().unwrap(), &1);
/// ``` /// ```
#[inline] #[inline]
#[stable(feature = "rust1", since = "1.0.0")] #[stable(feature = "rust1", since = "1.0.0")]
@ -834,13 +834,13 @@ pub trait Iterator {
/// assert_eq!(a.iter().min_max(), NoElements); /// assert_eq!(a.iter().min_max(), NoElements);
/// ///
/// let a = [1]; /// let a = [1];
/// assert!(a.iter().min_max() == OneElement(&1)); /// assert_eq!(a.iter().min_max(), OneElement(&1));
/// ///
/// let a = [1, 2, 3, 4, 5]; /// let a = [1, 2, 3, 4, 5];
/// assert!(a.iter().min_max() == MinMax(&1, &5)); /// assert_eq!(a.iter().min_max(), MinMax(&1, &5));
/// ///
/// let a = [1, 1, 1, 1]; /// let a = [1, 1, 1, 1];
/// assert!(a.iter().min_max() == MinMax(&1, &1)); /// assert_eq!(a.iter().min_max(), MinMax(&1, &1));
/// ``` /// ```
#[unstable(feature = "core", reason = "return type may change")] #[unstable(feature = "core", reason = "return type may change")]
fn min_max(mut self) -> MinMaxResult<Self::Item> where Self: Sized, Self::Item: Ord fn min_max(mut self) -> MinMaxResult<Self::Item> where Self: Sized, Self::Item: Ord
@ -1058,7 +1058,7 @@ pub trait Iterator {
/// ///
/// let a = [1, 2, 3, 4, 5]; /// let a = [1, 2, 3, 4, 5];
/// let mut it = a.iter().cloned(); /// let mut it = a.iter().cloned();
/// assert!(it.sum::<i32>() == 15); /// assert_eq!(it.sum::<i32>(), 15);
/// ``` /// ```
#[unstable(feature="core")] #[unstable(feature="core")]
fn sum<S=<Self as Iterator>::Item>(self) -> S where fn sum<S=<Self as Iterator>::Item>(self) -> S where
@ -1078,9 +1078,9 @@ pub trait Iterator {
/// fn factorial(n: u32) -> u32 { /// fn factorial(n: u32) -> u32 {
/// (1..).take_while(|&i| i <= n).product() /// (1..).take_while(|&i| i <= n).product()
/// } /// }
/// assert!(factorial(0) == 1); /// assert_eq!(factorial(0), 1);
/// assert!(factorial(1) == 1); /// assert_eq!(factorial(1), 1);
/// assert!(factorial(5) == 120); /// assert_eq!(factorial(5), 120);
/// ``` /// ```
#[unstable(feature="core")] #[unstable(feature="core")]
fn product<P=<Self as Iterator>::Item>(self) -> P where fn product<P=<Self as Iterator>::Item>(self) -> P where

View File

@ -313,7 +313,7 @@ macro_rules! impls{
/// mismatches by enforcing types in the method implementations: /// mismatches by enforcing types in the method implementations:
/// ///
/// ``` /// ```
/// # trait ResType { fn foo(&self); }; /// # trait ResType { fn foo(&self); }
/// # struct ParamType; /// # struct ParamType;
/// # mod foreign_lib { /// # mod foreign_lib {
/// # pub fn new(_: usize) -> *mut () { 42 as *mut () } /// # pub fn new(_: usize) -> *mut () { 42 as *mut () }

View File

@ -12,7 +12,8 @@
#![cfg_attr(stage0, feature(custom_attribute))] #![cfg_attr(stage0, feature(custom_attribute))]
#![crate_name = "libc"] #![crate_name = "libc"]
#![crate_type = "rlib"] #![crate_type = "rlib"]
#![cfg_attr(not(feature = "cargo-build"), unstable(feature = "libc"))] #![cfg_attr(not(feature = "cargo-build"), unstable(feature = "libc",
reason = "use `libc` from crates.io"))]
#![cfg_attr(not(feature = "cargo-build"), feature(staged_api, core, no_std))] #![cfg_attr(not(feature = "cargo-build"), feature(staged_api, core, no_std))]
#![cfg_attr(not(feature = "cargo-build"), staged_api)] #![cfg_attr(not(feature = "cargo-build"), staged_api)]
#![cfg_attr(not(feature = "cargo-build"), no_std)] #![cfg_attr(not(feature = "cargo-build"), no_std)]
@ -3624,6 +3625,30 @@ pub mod consts {
pub const IPV6_DROP_MEMBERSHIP: c_int = 21; pub const IPV6_DROP_MEMBERSHIP: c_int = 21;
pub const TCP_NODELAY: c_int = 1; pub const TCP_NODELAY: c_int = 1;
pub const TCP_MAXSEG: c_int = 2;
pub const TCP_CORK: c_int = 3;
pub const TCP_KEEPIDLE: c_int = 4;
pub const TCP_KEEPINTVL: c_int = 5;
pub const TCP_KEEPCNT: c_int = 6;
pub const TCP_SYNCNT: c_int = 7;
pub const TCP_LINGER2: c_int = 8;
pub const TCP_DEFER_ACCEPT: c_int = 9;
pub const TCP_WINDOW_CLAMP: c_int = 10;
pub const TCP_INFO: c_int = 11;
pub const TCP_QUICKACK: c_int = 12;
pub const TCP_CONGESTION: c_int = 13;
pub const TCP_MD5SIG: c_int = 14;
pub const TCP_COOKIE_TRANSACTIONS: c_int = 15;
pub const TCP_THIN_LINEAR_TIMEOUTS: c_int = 16;
pub const TCP_THIN_DUPACK: c_int = 17;
pub const TCP_USER_TIMEOUT: c_int = 18;
pub const TCP_REPAIR: c_int = 19;
pub const TCP_REPAIR_QUEUE: c_int = 20;
pub const TCP_QUEUE_SEQ: c_int = 21;
pub const TCP_REPAIR_OPTIONS: c_int = 22;
pub const TCP_FASTOPEN: c_int = 23;
pub const TCP_TIMESTAMP: c_int = 24;
pub const SOL_SOCKET: c_int = 65535; pub const SOL_SOCKET: c_int = 65535;
pub const SO_DEBUG: c_int = 0x0001; pub const SO_DEBUG: c_int = 0x0001;

View File

@ -26,7 +26,8 @@
html_playground_url = "http://play.rust-lang.org/")] html_playground_url = "http://play.rust-lang.org/")]
#![no_std] #![no_std]
#![staged_api] #![staged_api]
#![unstable(feature = "rand")] #![unstable(feature = "rand",
reason = "use `rand` from crates.io")]
#![feature(core)] #![feature(core)]
#![feature(no_std)] #![feature(no_std)]
#![feature(staged_api)] #![feature(staged_api)]

View File

@ -12,6 +12,28 @@
register_long_diagnostics! { register_long_diagnostics! {
E0046: r##"
When trying to make some type implement a trait `Foo`, you must, at minimum,
provide implementations for all of `Foo`'s required methods (meaning the
methods that do not have default implementations), as well as any required
trait items like associated types or constants.
"##,
E0054: r##"
It is not allowed to cast to a bool. If you are trying to cast a numeric type
to a bool, you can compare it with zero instead:
```
let x = 5;
// Ok
let x_is_nonzero = x != 0;
// Not allowed, won't compile
let x_is_nonzero = x as bool;
```
"##,
E0081: r##" E0081: r##"
Enum discriminants are used to differentiate enum variants stored in memory. Enum discriminants are used to differentiate enum variants stored in memory.
This error indicates that the same value was used for two or more variants, This error indicates that the same value was used for two or more variants,
@ -106,11 +128,9 @@ register_diagnostics! {
E0040, // explicit use of destructor method E0040, // explicit use of destructor method
E0044, E0044,
E0045, E0045,
E0046,
E0049, E0049,
E0050, E0050,
E0053, E0053,
E0054,
E0055, E0055,
E0057, E0057,
E0059, E0059,

View File

@ -60,8 +60,8 @@ mod arch {
#[cfg(any(target_arch = "mips", #[cfg(any(target_arch = "mips",
target_arch = "mipsel"))] target_arch = "mipsel"))]
mod arch { mod arch {
use super::{dev_t, mode_t}; use super::mode_t;
use os::raw::c_long; use os::raw::{c_long, c_ulong};
use os::unix::raw::{gid_t, uid_t}; use os::unix::raw::{gid_t, uid_t};
pub type blkcnt_t = i32; pub type blkcnt_t = i32;