diff --git a/AUTHORS.txt b/AUTHORS.txt index 83d8d9ef0c8b5..0f20e510adcd8 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -518,6 +518,7 @@ Luke Francl Luke Metz Luke Steensen Luqman Aden +Łukasz Niemier Magnus Auvinen Mahmut Bulut Makoto Nakashima @@ -997,5 +998,4 @@ xales zofrex zslayton zzmp -Łukasz Niemier 克雷 diff --git a/configure b/configure index 9aebfe07967d9..f0cba4b0c6a6d 100755 --- a/configure +++ b/configure @@ -844,7 +844,7 @@ then CFG_OSX_GCC_VERSION=$("$CFG_GCC" --version 2>&1 | grep "Apple LLVM version") if [ $? -eq 0 ] 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 else if [ $("$CFG_GCC" --version 2>&1 | grep -c ' 4\.[0-6]') -ne 0 ]; then diff --git a/src/doc/trpl/guessing-game.md b/src/doc/trpl/guessing-game.md index 6b58f7dfde817..57479a21e47a8 100644 --- a/src/doc/trpl/guessing-game.md +++ b/src/doc/trpl/guessing-game.md @@ -358,11 +358,10 @@ rand="0.3.0" The `[dependencies]` section of `Cargo.toml` is like the `[package]` section: everything that follows it is part of it, until the next section starts. Cargo uses the dependencies section to know what dependencies on external -crates you have, and what versions you require. In this case, we’ve used `*`, -which means that we’ll use the latest version of `rand`. Cargo understands -[Semantic Versioning][semver], which is a standard for writing version -numbers. If we wanted a specific version or range of versions, we could be -more specific here. [Cargo’s documentation][cargodoc] contains more details. +crates you have, and what versions you require. In this case, we’ve used version `0.3.0`. +Cargo understands [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 +of versions. [Cargo’s documentation][cargodoc] contains more details. [semver]: http://semver.org [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) ``` -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 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 diff --git a/src/doc/trpl/lifetimes.md b/src/doc/trpl/lifetimes.md index 981286c82d798..86164a08a430f 100644 --- a/src/doc/trpl/lifetimes.md +++ b/src/doc/trpl/lifetimes.md @@ -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, diff --git a/src/doc/trpl/method-syntax.md b/src/doc/trpl/method-syntax.md index ed4e9dd359b6d..861357ebbdcd1 100644 --- a/src/doc/trpl/method-syntax.md +++ b/src/doc/trpl/method-syntax.md @@ -188,7 +188,7 @@ struct CircleBuilder { impl 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 { diff --git a/src/doc/trpl/mutability.md b/src/doc/trpl/mutability.md index 816bfb1797061..435407a8a967d 100644 --- a/src/doc/trpl/mutability.md +++ b/src/doc/trpl/mutability.md @@ -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 > 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`) [ownership]: ownership.html diff --git a/src/doc/trpl/ownership.md b/src/doc/trpl/ownership.md index 3003156f875aa..fba5226ca2ed9 100644 --- a/src/doc/trpl/ownership.md +++ b/src/doc/trpl/ownership.md @@ -3,7 +3,7 @@ This guide is one of three presenting Rust’s ownership system. This is one of Rust’s most unique and compelling features, with which Rust developers should 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: * ownership, which you’re reading now. @@ -59,6 +59,7 @@ deterministically, at the end of the scope. [vect]: ../std/vec/struct.Vec.html [heap]: the-stack-and-the-heap.html +[bindings]: variable-bindings.html # Move semantics @@ -122,7 +123,7 @@ let v2 = v; The first line creates some data for the vector on the [stack][sh], `v`. The vector’s 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 heap. That would be a problem: it would violate Rust’s safety guarantees by introducing a data race. Therefore, Rust forbids using `v` after we’ve done the diff --git a/src/doc/trpl/references-and-borrowing.md b/src/doc/trpl/references-and-borrowing.md index 21feff73342ce..8bb3f94760bc9 100644 --- a/src/doc/trpl/references-and-borrowing.md +++ b/src/doc/trpl/references-and-borrowing.md @@ -3,7 +3,7 @@ This guide is one of three presenting Rust’s ownership system. This is one of Rust’s most unique and compelling features, with which Rust developers should 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: * [ownership][ownership], ownership, the key concept diff --git a/src/doc/trpl/traits.md b/src/doc/trpl/traits.md index ea5d2ed711fed..51ee4bf0cdc28 100644 --- a/src/doc/trpl/traits.md +++ b/src/doc/trpl/traits.md @@ -192,7 +192,7 @@ Here’s the error: ```text 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"); ^~~~~~~~~~~~~~~~~~ ``` diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index a787d34f9145a..de962b51e0590 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -137,7 +137,7 @@ pub trait Iterator { /// /// ``` /// let a = [1, 2, 3, 4, 5]; - /// assert!(a.iter().last().unwrap() == &5); + /// assert_eq!(a.iter().last().unwrap(), &5); /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] @@ -155,8 +155,8 @@ pub trait Iterator { /// ``` /// let a = [1, 2, 3, 4, 5]; /// let mut it = a.iter(); - /// assert!(it.nth(2).unwrap() == &3); - /// assert!(it.nth(2) == None); + /// assert_eq!(it.nth(2).unwrap(), &3); + /// assert_eq!(it.nth(2), None); /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] @@ -545,8 +545,8 @@ pub trait Iterator { /// let mut it = 0..10; /// // sum the first five values /// let partial_sum = it.by_ref().take(5).fold(0, |a, b| a + b); - /// assert!(partial_sum == 10); - /// assert!(it.next() == Some(5)); + /// assert_eq!(partial_sum, 10); + /// assert_eq!(it.next(), Some(5)); /// ``` #[stable(feature = "rust1", since = "1.0.0")] 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]; - /// assert!(a.iter().fold(0, |acc, &item| acc + item) == 15); + /// assert_eq!(a.iter().fold(0, |acc, &item| acc + item), 15); /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] @@ -773,7 +773,7 @@ pub trait Iterator { /// /// ``` /// let a = [1, 2, 3, 4, 5]; - /// assert!(a.iter().max().unwrap() == &5); + /// assert_eq!(a.iter().max().unwrap(), &5); /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] @@ -796,7 +796,7 @@ pub trait Iterator { /// /// ``` /// let a = [1, 2, 3, 4, 5]; - /// assert!(a.iter().min().unwrap() == &1); + /// assert_eq!(a.iter().min().unwrap(), &1); /// ``` #[inline] #[stable(feature = "rust1", since = "1.0.0")] @@ -834,13 +834,13 @@ pub trait Iterator { /// assert_eq!(a.iter().min_max(), NoElements); /// /// 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]; - /// assert!(a.iter().min_max() == MinMax(&1, &5)); + /// assert_eq!(a.iter().min_max(), MinMax(&1, &5)); /// /// 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")] fn min_max(mut self) -> MinMaxResult where Self: Sized, Self::Item: Ord @@ -1058,7 +1058,7 @@ pub trait Iterator { /// /// let a = [1, 2, 3, 4, 5]; /// let mut it = a.iter().cloned(); - /// assert!(it.sum::() == 15); + /// assert_eq!(it.sum::(), 15); /// ``` #[unstable(feature="core")] fn sum::Item>(self) -> S where @@ -1078,9 +1078,9 @@ pub trait Iterator { /// fn factorial(n: u32) -> u32 { /// (1..).take_while(|&i| i <= n).product() /// } - /// assert!(factorial(0) == 1); - /// assert!(factorial(1) == 1); - /// assert!(factorial(5) == 120); + /// assert_eq!(factorial(0), 1); + /// assert_eq!(factorial(1), 1); + /// assert_eq!(factorial(5), 120); /// ``` #[unstable(feature="core")] fn product::Item>(self) -> P where diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs index 04839b12ac895..1bd0b3638c683 100644 --- a/src/libcore/marker.rs +++ b/src/libcore/marker.rs @@ -313,7 +313,7 @@ macro_rules! impls{ /// mismatches by enforcing types in the method implementations: /// /// ``` -/// # trait ResType { fn foo(&self); }; +/// # trait ResType { fn foo(&self); } /// # struct ParamType; /// # mod foreign_lib { /// # pub fn new(_: usize) -> *mut () { 42 as *mut () } diff --git a/src/liblibc/lib.rs b/src/liblibc/lib.rs index 4cbc3b4725d3b..55934da00a37c 100644 --- a/src/liblibc/lib.rs +++ b/src/liblibc/lib.rs @@ -12,7 +12,8 @@ #![cfg_attr(stage0, feature(custom_attribute))] #![crate_name = "libc"] #![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"), staged_api)] #![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 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 SO_DEBUG: c_int = 0x0001; diff --git a/src/librand/lib.rs b/src/librand/lib.rs index 53ea28f0c11d3..1359894b4dd72 100644 --- a/src/librand/lib.rs +++ b/src/librand/lib.rs @@ -26,7 +26,8 @@ html_playground_url = "http://play.rust-lang.org/")] #![no_std] #![staged_api] -#![unstable(feature = "rand")] +#![unstable(feature = "rand", + reason = "use `rand` from crates.io")] #![feature(core)] #![feature(no_std)] #![feature(staged_api)] diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index 154d824e67846..f00f0eea1f48d 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -12,6 +12,28 @@ 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##" 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, @@ -106,11 +128,9 @@ register_diagnostics! { E0040, // explicit use of destructor method E0044, E0045, - E0046, E0049, E0050, E0053, - E0054, E0055, E0057, E0059, diff --git a/src/libstd/os/linux/raw.rs b/src/libstd/os/linux/raw.rs index adce5f22ebc10..9589f4cf099b2 100644 --- a/src/libstd/os/linux/raw.rs +++ b/src/libstd/os/linux/raw.rs @@ -60,8 +60,8 @@ mod arch { #[cfg(any(target_arch = "mips", target_arch = "mipsel"))] mod arch { - use super::{dev_t, mode_t}; - use os::raw::c_long; + use super::mode_t; + use os::raw::{c_long, c_ulong}; use os::unix::raw::{gid_t, uid_t}; pub type blkcnt_t = i32;