From dff7676b7dc47505bb5d01d7ae4233d6c68bf694 Mon Sep 17 00:00:00 2001 From: Kevin Mehall Date: Tue, 5 May 2015 23:49:23 +0000 Subject: [PATCH 01/19] Fix MIPS build errors in libstd/os/linux/raw.rs --- src/libstd/os/linux/raw.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; From 6c6b20031c80c8e30b8c4edc36f136b682534de6 Mon Sep 17 00:00:00 2001 From: Kevin Mehall Date: Tue, 5 May 2015 23:50:11 +0000 Subject: [PATCH 02/19] Add TCP_* constants for mips/mipsel Linux PR #24611 added these for other architectures, but missed the `#[cfg(any(target_arch = "mips", target_arch = "mipsel"))]` version of the module. The values are the same. --- src/liblibc/lib.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/liblibc/lib.rs b/src/liblibc/lib.rs index 999e7c643e576..b5d885f46b3fb 100644 --- a/src/liblibc/lib.rs +++ b/src/liblibc/lib.rs @@ -3624,6 +3624,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; From 7150d3cd9e011367f3c6fb6ff8d1e4c0f7a26e95 Mon Sep 17 00:00:00 2001 From: Ben Gesoff Date: Thu, 7 May 2015 14:23:05 +0100 Subject: [PATCH 03/19] Change rand version to '*' Following paragraph says "we've used `*` which..." but code says "rand=\"0.3.0\"" --- src/doc/trpl/guessing-game.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/trpl/guessing-game.md b/src/doc/trpl/guessing-game.md index 6b58f7dfde817..6f8798adaca13 100644 --- a/src/doc/trpl/guessing-game.md +++ b/src/doc/trpl/guessing-game.md @@ -352,7 +352,7 @@ add these few lines at the bottom: ```toml [dependencies] -rand="0.3.0" +rand="*" ``` The `[dependencies]` section of `Cargo.toml` is like the `[package]` section: From 0bc6fe5ea0b4e4fcbc98145855a1c416d08dfab0 Mon Sep 17 00:00:00 2001 From: Ben Gesoff Date: Thu, 7 May 2015 14:48:44 +0100 Subject: [PATCH 04/19] Refactor to keep rand version 0.3.0 changed paragraphs with discussion of Cargo.lock file to agree with rand version 0.3.0 in the Cargo.tom file. --- src/doc/trpl/guessing-game.md | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/src/doc/trpl/guessing-game.md b/src/doc/trpl/guessing-game.md index 6f8798adaca13..1e35dd6e8182d 100644 --- a/src/doc/trpl/guessing-game.md +++ b/src/doc/trpl/guessing-game.md @@ -352,17 +352,16 @@ add these few lines at the bottom: ```toml [dependencies] -rand="*" +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 @@ -372,15 +371,13 @@ Now, without changing any of our code, let’s build our project: ```bash $ cargo build Updating registry `https://github.com/rust-lang/crates.io-index` - Downloading rand v0.3.8 + Downloading rand v0.3.0 Downloading libc v0.1.6 Compiling libc v0.1.6 - Compiling rand v0.3.8 + Compiling rand v0.3.0 Compiling guessing_game v0.1.0 (file:///home/you/projects/guessing_game) ``` -(You may see different versions, of course.) - Lots of new output! Now that we have an external dependency, Cargo fetches the latest versions of everything from the registry, which is a copy of data from [Crates.io][cratesio]. Crates.io is where people in the Rust ecosystem @@ -410,11 +407,11 @@ $ 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 -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 -code? +Let's pretend that we told Cargo we wanted the latest version of `rand` (using `*`) +for a bit. It would have fetched `v0.3.8` (at the time this was written). +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 code? The answer to this problem is the `Cargo.lock` file you’ll now find in your project directory. When you build your project for the first time, Cargo @@ -422,7 +419,7 @@ figures out all of the versions that fit your criteria, and then writes them to the `Cargo.lock` file. When you build your project in the future, Cargo will see that the `Cargo.lock` file exists, and then use that specific version rather than do all the work of figuring out versions again. This lets you -have a repeatable build automatically. In other words, we’ll stay at `0.3.8` +have a repeatable build automatically. In other words, we’ll stay at `0.3.0` until we explicitly upgrade, and so will anyone who we share our code with, thanks to the lock file. @@ -442,7 +439,8 @@ projects which are assembled out of a number of sub-packages. [doccargo]: http://doc.crates.io [doccratesio]: http://doc.crates.io/crates-io.html -Let’s get on to actually _using_ `rand`. Here’s our next step: +Let’s get on to actually _using_ `rand`. Keep the version as `0.3.0` for this +project. Here’s our next step: ```rust,ignore extern crate rand; From 07499918b3dac890cab8f932a3be2ab48be8f447 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Thu, 7 May 2015 10:26:00 -0400 Subject: [PATCH 05/19] Fix incorrect curly quotes --- src/doc/trpl/traits.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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"); ^~~~~~~~~~~~~~~~~~ ``` From 888086d959e7d1b840b0d7644e4e49b6941ecf73 Mon Sep 17 00:00:00 2001 From: Ben Gesoff Date: Thu, 7 May 2015 15:36:47 +0100 Subject: [PATCH 06/19] Undid changes involving misunderstanding of 0.3.x Didn't realise 0.3.0 referred to all 0.3.x versions! Fixed my mistakes. Should have just updated the Cargo.toml now. --- src/doc/trpl/guessing-game.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/doc/trpl/guessing-game.md b/src/doc/trpl/guessing-game.md index 1e35dd6e8182d..57479a21e47a8 100644 --- a/src/doc/trpl/guessing-game.md +++ b/src/doc/trpl/guessing-game.md @@ -371,13 +371,15 @@ Now, without changing any of our code, let’s build our project: ```bash $ cargo build Updating registry `https://github.com/rust-lang/crates.io-index` - Downloading rand v0.3.0 + Downloading rand v0.3.8 Downloading libc v0.1.6 Compiling libc v0.1.6 - Compiling rand v0.3.0 + Compiling rand v0.3.8 Compiling guessing_game v0.1.0 (file:///home/you/projects/guessing_game) ``` +(You may see different versions, of course.) + Lots of new output! Now that we have an external dependency, Cargo fetches the latest versions of everything from the registry, which is a copy of data from [Crates.io][cratesio]. Crates.io is where people in the Rust ecosystem @@ -407,11 +409,11 @@ $ cargo build Compiling guessing_game v0.1.0 (file:///home/you/projects/guessing_game) ``` -Let's pretend that we told Cargo we wanted the latest version of `rand` (using `*`) -for a bit. It would have fetched `v0.3.8` (at the time this was written). -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 code? +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 +code? The answer to this problem is the `Cargo.lock` file you’ll now find in your project directory. When you build your project for the first time, Cargo @@ -419,7 +421,7 @@ figures out all of the versions that fit your criteria, and then writes them to the `Cargo.lock` file. When you build your project in the future, Cargo will see that the `Cargo.lock` file exists, and then use that specific version rather than do all the work of figuring out versions again. This lets you -have a repeatable build automatically. In other words, we’ll stay at `0.3.0` +have a repeatable build automatically. In other words, we’ll stay at `0.3.8` until we explicitly upgrade, and so will anyone who we share our code with, thanks to the lock file. @@ -439,8 +441,7 @@ projects which are assembled out of a number of sub-packages. [doccargo]: http://doc.crates.io [doccratesio]: http://doc.crates.io/crates-io.html -Let’s get on to actually _using_ `rand`. Keep the version as `0.3.0` for this -project. Here’s our next step: +Let’s get on to actually _using_ `rand`. Here’s our next step: ```rust,ignore extern crate rand; From 11cb5e50ab0fb166372d3aab68a06d5c06fdf2eb Mon Sep 17 00:00:00 2001 From: Nick Hamann Date: Thu, 7 May 2015 13:08:59 -0500 Subject: [PATCH 07/19] Add long diagnostic for E0046 --- src/librustc_typeck/diagnostics.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index 154d824e67846..c8b106db65e27 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -12,6 +12,13 @@ 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. +"##, + 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,7 +113,6 @@ register_diagnostics! { E0040, // explicit use of destructor method E0044, E0045, - E0046, E0049, E0050, E0053, From 11a7bad97b79014aa145af11c6537843cb086b78 Mon Sep 17 00:00:00 2001 From: Nick Hamann Date: Thu, 7 May 2015 14:34:54 -0500 Subject: [PATCH 08/19] Add long diagnostic for E0054 --- src/librustc_typeck/diagnostics.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index c8b106db65e27..f00f0eea1f48d 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -19,6 +19,21 @@ 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, @@ -116,7 +131,6 @@ register_diagnostics! { E0049, E0050, E0053, - E0054, E0055, E0057, E0059, From 7ef46e0dde2052abd5108e360ee6fd4766660246 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Fri, 8 May 2015 00:14:00 +0200 Subject: [PATCH 09/19] doc: the prevailing convention is to use assert_eq! when 2 values are compared --- src/libcore/iter.rs | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) 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 From 2213898c1905b3497419221f0ff942dd639696e7 Mon Sep 17 00:00:00 2001 From: Simon Kern Date: Fri, 8 May 2015 00:42:10 +0200 Subject: [PATCH 10/19] two minor fixes --- src/doc/trpl/ownership.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/doc/trpl/ownership.md b/src/doc/trpl/ownership.md index 3003156f875aa..1da21345aa44f 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 From 84c7dfa48c23dd032e4abd917706b5649067b311 Mon Sep 17 00:00:00 2001 From: Simon Kern Date: Fri, 8 May 2015 00:59:45 +0200 Subject: [PATCH 11/19] deleted unnecessary `the` --- src/doc/trpl/references-and-borrowing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 468cb052b8e104f3c79dbb522b57a504f52ba1c1 Mon Sep 17 00:00:00 2001 From: Carol Nichols Date: Thu, 7 May 2015 19:11:18 -0400 Subject: [PATCH 12/19] Expand OS X versions referenced in configure message 10.10 is out, so it's weird to see a message that says you're on 10.9. Change the message to be >=10.9. --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 3e76f2838a68d0669cef64477e7f39af1b6205f6 Mon Sep 17 00:00:00 2001 From: Simon Kern Date: Fri, 8 May 2015 01:43:18 +0200 Subject: [PATCH 13/19] v2 gets a copy of the pointer, not a copy of the data --- src/doc/trpl/ownership.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/trpl/ownership.md b/src/doc/trpl/ownership.md index 1da21345aa44f..fba5226ca2ed9 100644 --- a/src/doc/trpl/ownership.md +++ b/src/doc/trpl/ownership.md @@ -123,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 From 60c0e75e748dd18917736cdfd36de5a8ed23dce0 Mon Sep 17 00:00:00 2001 From: Simon Kern Date: Fri, 8 May 2015 01:46:26 +0200 Subject: [PATCH 14/19] fixed href for structs --- src/doc/trpl/lifetimes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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, From 391d14802eaa8ef694ebbb70d785227156e4bf32 Mon Sep 17 00:00:00 2001 From: Andrew Straw Date: Mon, 27 Apr 2015 07:18:26 -0400 Subject: [PATCH 15/19] fix logic when describing kinds of borrows If you have 0 references (`&T`) to a resource, presumably, you could have a mutable reference (`&mut T`). So this only start to make sense at having 1 reference to a resource. --- src/doc/trpl/mutability.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From c65a1838cbdcc31c05dc170824b24ef67c3f7b58 Mon Sep 17 00:00:00 2001 From: Wojciech Ogrodowczyk Date: Fri, 8 May 2015 07:38:18 +0200 Subject: [PATCH 16/19] Fix sort in AUTHORS.txt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Properly sorted, Ł goes between L and M. --- AUTHORS.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 克雷 From a4ec372a1e8149df2e942b561915c5f08035055c Mon Sep 17 00:00:00 2001 From: Wei-Ming Yang Date: Fri, 8 May 2015 20:44:11 +0800 Subject: [PATCH 17/19] fixed a mistake --- src/libcore/marker.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 () } From 091ba42d77713ace68cd654c9eabbe5412000cc2 Mon Sep 17 00:00:00 2001 From: Huon Wilson Date: Fri, 8 May 2015 23:19:06 +1000 Subject: [PATCH 18/19] Add a reason to the libc & rand instability. Many many many people ask in #rust about this libraries, having an explanatory reason will probably help a lot. --- src/liblibc/lib.rs | 3 ++- src/librand/lib.rs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/liblibc/lib.rs b/src/liblibc/lib.rs index 4cbc3b4725d3b..2ebfb852a748f 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)] 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)] From 962816bc290fc67e083fcd2500125b68f9fdee2b Mon Sep 17 00:00:00 2001 From: Isaac Ge Date: Fri, 8 May 2015 22:39:25 +0800 Subject: [PATCH 19/19] Update method-syntax.md Fix wrong radius valve from 0.0 to 1.0 as above --- src/doc/trpl/method-syntax.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 {