Skip to content

Rollup of 5 pull requests #32046

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Mar 5, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/bootstrap/build/sanity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ pub fn check(build: &mut Build) {
}

// Make sure musl-root is valid if specified
if target.contains("musl") {
if target.contains("musl") && target.contains("x86_64") {
match build.config.musl_root {
Some(ref root) => {
if fs::metadata(root.join("lib/libc.a")).is_err() {
Expand Down
30 changes: 30 additions & 0 deletions src/doc/book/vectors.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,36 @@ for i in v {
}
```

Note: You cannot use the vector again once you have iterated by taking ownership of the vector.
You can iterate the vector multiple times by taking a reference to the vector whilst iterating.
For example, the following code does not compile.

```rust,ignore
let mut v = vec![1, 2, 3, 4, 5];

for i in v {
println!("Take ownership of the vector and its element {}", i);
}

for i in v {
println!("Take ownership of the vector and its element {}", i);
}
```

Whereas the following works perfectly,

```rust
let mut v = vec![1, 2, 3, 4, 5];

for i in &v {
println!("This is a reference to {}", i);
}

for i in &v {
println!("This is a reference to {}", i);
}
```

Vectors have many more useful methods, which you can read about in [their
API documentation][vec].

Expand Down
2 changes: 1 addition & 1 deletion src/libcore/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1532,7 +1532,7 @@ pub trait Iterator {
/// An iterator adaptor that applies a function, producing a single, final value.
///
/// `fold()` takes two arguments: an initial value, and a closure with two
/// arguments: an 'accumulator', and an element. It returns the value that
/// arguments: an 'accumulator', and an element. The closure returns the value that
/// the accumulator should have for the next iteration.
///
/// The initial value is the value the accumulator will have on the first
Expand Down
2 changes: 0 additions & 2 deletions src/libcore/str/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1095,8 +1095,6 @@ fn eq_slice(a: &str, b: &str) -> bool {
/// faster than comparing each byte in a loop.
#[inline]
unsafe fn cmp_slice(a: &str, b: &str, len: usize) -> i32 {
// NOTE: In theory n should be libc::size_t and not usize, but libc is not available here
#[allow(improper_ctypes)]
extern { fn memcmp(s1: *const i8, s2: *const i8, n: usize) -> i32; }
memcmp(a.as_ptr() as *const i8, b.as_ptr() as *const i8, len)
}
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fn main() {
}

if target.contains("unknown-linux") {
if target.contains("musl") {
if target.contains("musl") && target.contains("x86_64") {
println!("cargo:rustc-link-lib=static=unwind");
} else {
println!("cargo:rustc-link-lib=dl");
Expand Down
1 change: 1 addition & 0 deletions src/test/rustdoc/issue-27362.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

// aux-build:issue-27362.rs
// ignore-cross-compile
// ignore-test This test fails on beta/stable #32019

extern crate issue_27362;
pub use issue_27362 as quux;
Expand Down