Skip to content

Commit 6971727

Browse files
committed
Auto merge of #24009 - Manishearth:rollup, r=Manishearth
2 parents bcae782 + b62c110 commit 6971727

27 files changed

+386
-60
lines changed

AUTHORS.txt

+92-4
Large diffs are not rendered by default.

configure

+16-3
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,6 @@ opt verify-install 1 "verify installed binaries work"
545545
# This is used by the automation to produce single-target nightlies
546546
opt dist-host-only 0 "only install bins for the host architecture"
547547
opt inject-std-version 1 "inject the current compiler version of libstd into programs"
548-
opt jemalloc 1 "build liballoc with jemalloc"
549548
opt llvm-version-check 1 "don't check if the LLVM version is supported, build anyway"
550549

551550
valopt localstatedir "/var/lib" "local state directory"
@@ -562,6 +561,7 @@ valopt android-cross-path "/opt/ndk_standalone" "Android NDK standalone path"
562561
# (others are conditionally saved).
563562
opt_nosave manage-submodules 1 "let the build manage the git submodules"
564563
opt_nosave clang 0 "prefer clang to gcc for building the runtime"
564+
opt_nosave jemalloc 1 "build liballoc with jemalloc"
565565

566566
valopt_nosave prefix "/usr/local" "set installation prefix"
567567
valopt_nosave local-rust-root "/usr/local" "set prefix for local rust binary"
@@ -669,7 +669,6 @@ probe CFG_LD ld
669669
probe CFG_VALGRIND valgrind
670670
probe CFG_PERF perf
671671
probe CFG_ISCC iscc
672-
probe CFG_JAVAC javac
673672
probe CFG_ANTLR4 antlr4
674673
probe CFG_GRUN grun
675674
probe CFG_FLEX flex
@@ -679,6 +678,14 @@ probe CFG_XELATEX xelatex
679678
probe CFG_GDB gdb
680679
probe CFG_LLDB lldb
681680

681+
# On MacOS X, invoking `javac` pops up a dialog if the JDK is not
682+
# installed. Since `javac` is only used if `antlr4` is available,
683+
# probe for it only in this case.
684+
if [ ! -z "$CFG_ANTLR4" ]
685+
then
686+
probe CFG_JAVAC javac
687+
fi
688+
682689
if [ ! -z "$CFG_GDB" ]
683690
then
684691
# Store GDB's version
@@ -775,7 +782,7 @@ if [ $CFG_OSTYPE = unknown-bitrig ]
775782
then
776783
step_msg "on Bitrig, forcing use of clang, disabling jemalloc"
777784
CFG_ENABLE_CLANG=1
778-
CFG_ENABLE_JEMALLOC=0
785+
CFG_DISABLE_JEMALLOC=1
779786
fi
780787

781788
if [ -z "$CFG_ENABLE_CLANG" -a -z "$CFG_GCC" ]
@@ -828,6 +835,12 @@ then
828835
putvar CFG_ENABLE_CLANG
829836
fi
830837

838+
# Same with jemalloc. save the setting here.
839+
if [ ! -z "$CFG_DISABLE_JEMALLOC" ]
840+
then
841+
putvar CFG_DISABLE_JEMALLOC
842+
fi
843+
831844
if [ ! -z "$CFG_LLVM_ROOT" -a -z "$CFG_DISABLE_LLVM_VERSION_CHECK" -a -e "$CFG_LLVM_ROOT/bin/llvm-config" ]
832845
then
833846
step_msg "using custom LLVM at $CFG_LLVM_ROOT"

src/doc/trpl/closures.md

-3
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,6 @@ we called `add_num`, it mutated the underlying value, as we'd expect. We also
175175
needed to declare `add_num` as `mut` too, because we’re mutating its
176176
environment.
177177

178-
We also had to declare `add_num` as mut, since we will be modifying its
179-
environment.
180-
181178
If we change to a `move` closure, it's different:
182179

183180
```rust

src/doc/trpl/concurrency.md

+9-23
Original file line numberDiff line numberDiff line change
@@ -88,17 +88,14 @@ When `guard` goes out of scope, it will block execution until the thread is
8888
finished. If we didn't want this behaviour, we could use `thread::spawn()`:
8989

9090
```
91-
# #![feature(old_io, std_misc)]
9291
use std::thread;
93-
use std::old_io::timer;
94-
use std::time::Duration;
9592
9693
fn main() {
9794
thread::spawn(|| {
9895
println!("Hello from a thread!");
9996
});
10097
101-
timer::sleep(Duration::milliseconds(50));
98+
thread::sleep_ms(50);
10299
}
103100
```
104101

@@ -147,10 +144,7 @@ As an example, here is a Rust program that would have a data race in many
147144
languages. It will not compile:
148145

149146
```ignore
150-
# #![feature(old_io, std_misc)]
151147
use std::thread;
152-
use std::old_io::timer;
153-
use std::time::Duration;
154148
155149
fn main() {
156150
let mut data = vec![1u32, 2, 3];
@@ -161,14 +155,14 @@ fn main() {
161155
});
162156
}
163157
164-
timer::sleep(Duration::milliseconds(50));
158+
thread::sleep_ms(50);
165159
}
166160
```
167161

168162
This gives us an error:
169163

170164
```text
171-
12:17 error: capture of moved value: `data`
165+
8:17 error: capture of moved value: `data`
172166
data[i] += 1;
173167
^~~~
174168
```
@@ -187,10 +181,7 @@ only one person at a time can mutate what's inside. For that, we can use the
187181
but for a different reason:
188182

189183
```ignore
190-
# #![feature(old_io, std_misc)]
191184
use std::thread;
192-
use std::old_io::timer;
193-
use std::time::Duration;
194185
use std::sync::Mutex;
195186
196187
fn main() {
@@ -203,17 +194,17 @@ fn main() {
203194
});
204195
}
205196
206-
timer::sleep(Duration::milliseconds(50));
197+
thread::sleep_ms(50);
207198
}
208199
```
209200

210201
Here's the error:
211202

212203
```text
213-
<anon>:11:9: 11:22 error: the trait `core::marker::Send` is not implemented for the type `std::sync::mutex::MutexGuard<'_, collections::vec::Vec<u32>>` [E0277]
204+
<anon>:9:9: 9:22 error: the trait `core::marker::Send` is not implemented for the type `std::sync::mutex::MutexGuard<'_, collections::vec::Vec<u32>>` [E0277]
214205
<anon>:11 thread::spawn(move || {
215206
^~~~~~~~~~~~~
216-
<anon>:11:9: 11:22 note: `std::sync::mutex::MutexGuard<'_, collections::vec::Vec<u32>>` cannot be sent between threads safely
207+
<anon>:9:9: 9:22 note: `std::sync::mutex::MutexGuard<'_, collections::vec::Vec<u32>>` cannot be sent between threads safely
217208
<anon>:11 thread::spawn(move || {
218209
^~~~~~~~~~~~~
219210
```
@@ -232,11 +223,8 @@ guard across thread boundaries, which gives us our error.
232223
We can use `Arc<T>` to fix this. Here's the working version:
233224

234225
```
235-
# #![feature(old_io, std_misc)]
236226
use std::sync::{Arc, Mutex};
237227
use std::thread;
238-
use std::old_io::timer;
239-
use std::time::Duration;
240228
241229
fn main() {
242230
let data = Arc::new(Mutex::new(vec![1u32, 2, 3]));
@@ -249,20 +237,17 @@ fn main() {
249237
});
250238
}
251239
252-
timer::sleep(Duration::milliseconds(50));
240+
thread::sleep_ms(50);
253241
}
254242
```
255243

256244
We now call `clone()` on our `Arc`, which increases the internal count. This
257245
handle is then moved into the new thread. Let's examine the body of the
258246
thread more closely:
259247

260-
```
261-
# #![feature(old_io, std_misc)]
248+
```rust
262249
# use std::sync::{Arc, Mutex};
263250
# use std::thread;
264-
# use std::old_io::timer;
265-
# use std::time::Duration;
266251
# fn main() {
267252
# let data = Arc::new(Mutex::new(vec![1u32, 2, 3]));
268253
# for i in 0..2 {
@@ -272,6 +257,7 @@ thread::spawn(move || {
272257
data[i] += 1;
273258
});
274259
# }
260+
# thread::sleep_ms(50);
275261
# }
276262
```
277263

src/doc/trpl/installing-rust.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ $ sudo sh rustup.sh
1818
```
1919

2020
If you're on Windows, please download either the [32-bit
21-
installer](https://static.rust-lang.org/dist/rust-nightly-i686-pc-windows-gnu.exe)
21+
installer](https://static.rust-lang.org/dist/rust-1.0.0-beta-i686-pc-windows-gnu.exe)
2222
or the [64-bit
23-
installer](https://static.rust-lang.org/dist/rust-nightly-x86_64-pc-windows-gnu.exe)
23+
installer](https://static.rust-lang.org/dist/rust-1.0.0-beta-x86_64-pc-windows-gnu.exe)
2424
and run it.
2525

2626
If you decide you don't want Rust anymore, we'll be a bit sad, but that's okay.

src/doc/trpl/unstable.md

+50
Original file line numberDiff line numberDiff line change
@@ -1 +1,51 @@
11
% Unstable Rust
2+
3+
Rust provides three distribution channels for Rust: nightly, beta, and stable.
4+
Unstable features are only available on nightly Rust. For more details on this
5+
process, see [this post](http://blog.rust-lang.org/2014/10/30/Stability.html).
6+
7+
To install nightly Rust, you can use `rustup.sh`:
8+
9+
```bash
10+
$ curl -s https://static.rust-lang.org/rustup.sh | sudo sh -s -- --channel=nightly
11+
```
12+
13+
If you're concerned about the [potential insecurity](http://curlpipesh.tumblr.com/) of using `curl | sudo sh`,
14+
please keep reading and see our disclaimer below. And feel free to use a two-step version of the installation and examine our installation script:
15+
16+
```bash
17+
$ curl -f -L https://static.rust-lang.org/rustup.sh -O
18+
$ sudo sh rustup.sh --channel=nightly
19+
```
20+
21+
If you're on Windows, please download either the [32-bit
22+
installer](https://static.rust-lang.org/dist/rust-nightly-i686-pc-windows-gnu.exe)
23+
or the [64-bit
24+
installer](https://static.rust-lang.org/dist/rust-nightly-x86_64-pc-windows-gnu.exe)
25+
and run it.
26+
27+
If you decide you don't want Rust anymore, we'll be a bit sad, but that's okay.
28+
Not every programming language is great for everyone. Just run the uninstall
29+
script:
30+
31+
```bash
32+
$ sudo /usr/local/lib/rustlib/uninstall.sh
33+
```
34+
35+
If you used the Windows installer, just re-run the `.exe` and it will give you
36+
an uninstall option.
37+
38+
You can re-run this script any time you want to update Rust. Which, at this
39+
point, is often. Rust is still pre-1.0, and so people assume that you're using
40+
a very recent Rust.
41+
42+
This brings me to one other point: some people, and somewhat rightfully so, get
43+
very upset when we tell you to `curl | sudo sh`. And they should be! Basically,
44+
when you do this, you are trusting that the good people who maintain Rust
45+
aren't going to hack your computer and do bad things. That's a good instinct!
46+
If you're one of those people, please check out the documentation on [building
47+
Rust from Source](https://github.com/rust-lang/rust#building-from-source), or
48+
[the official binary downloads](http://www.rust-lang.org/install.html). And we
49+
promise that this method will not be the way to install Rust forever: it's just
50+
the easiest way to keep people updated while Rust is in its alpha state.
51+

src/liballoc/arc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ impl<T> Weak<T> {
446446
/// ```
447447
pub fn upgrade(&self) -> Option<Arc<T>> {
448448
// We use a CAS loop to increment the strong count instead of a
449-
// fetch_add because once the count hits 0 is must never be above 0.
449+
// fetch_add because once the count hits 0 it must never be above 0.
450450
let inner = self.inner();
451451
loop {
452452
let n = inner.strong.load(SeqCst);

src/libcollections/borrow.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ impl<'a, B: ?Sized> IntoCow<'a, B> for Cow<'a, B> where B: ToOwned {
342342
}
343343

344344
#[stable(feature = "rust1", since = "1.0.0")]
345-
impl<'a, T: Clone> AsRef<T> for Cow<'a, T> {
345+
impl<'a, T: ?Sized + ToOwned> AsRef<T> for Cow<'a, T> {
346346
fn as_ref(&self) -> &T {
347347
self
348348
}

src/libcollections/vec.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ impl<T> Vec<T> {
185185
/// # Examples
186186
///
187187
/// ```
188-
/// let mut vec: Vec<_> = Vec::with_capacity(10);
188+
/// let mut vec = Vec::with_capacity(10);
189189
///
190190
/// // The vector contains no items, even though it has capacity for more
191191
/// assert_eq!(vec.len(), 0);

src/libcore/iter.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1065,7 +1065,7 @@ pub trait IntoIterator {
10651065
#[stable(feature = "rust1", since = "1.0.0")]
10661066
type Item;
10671067

1068-
/// A container for iterating over elements of type Item
1068+
/// A container for iterating over elements of type `Item`
10691069
#[stable(feature = "rust1", since = "1.0.0")]
10701070
type IntoIter: Iterator<Item=Self::Item>;
10711071

src/libcore/result.rs

+7-13
Original file line numberDiff line numberDiff line change
@@ -34,24 +34,18 @@
3434
//! enum Version { Version1, Version2 }
3535
//!
3636
//! fn parse_version(header: &[u8]) -> Result<Version, &'static str> {
37-
//! if header.len() < 1 {
38-
//! return Err("invalid header length");
39-
//! }
40-
//! match header[0] {
41-
//! 1 => Ok(Version::Version1),
42-
//! 2 => Ok(Version::Version2),
43-
//! _ => Err("invalid version")
37+
//! match header.get(0) {
38+
//! None => Err("invalid header length"),
39+
//! Some(&1) => Ok(Version::Version1),
40+
//! Some(&2) => Ok(Version::Version2),
41+
//! Some(_) => Err("invalid version")
4442
//! }
4543
//! }
4644
//!
4745
//! let version = parse_version(&[1, 2, 3, 4]);
4846
//! match version {
49-
//! Ok(v) => {
50-
//! println!("working with version: {:?}", v);
51-
//! }
52-
//! Err(e) => {
53-
//! println!("error parsing header: {:?}", e);
54-
//! }
47+
//! Ok(v) => println!("working with version: {:?}", v),
48+
//! Err(e) => println!("error parsing header: {:?}", e),
5549
//! }
5650
//! ```
5751
//!

src/librustdoc/html/static/main.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -713,10 +713,12 @@
713713
if (crates[i] == window.currentCrate) {
714714
klass += ' current';
715715
}
716-
var desc = rawSearchIndex[crates[i]].items[0][3];
717-
div.append($('<a>', {'href': '../' + crates[i] + '/index.html',
718-
'title': plainSummaryLine(desc),
719-
'class': klass}).text(crates[i]));
716+
if (rawSearchIndex[crates[i]].items[0]) {
717+
var desc = rawSearchIndex[crates[i]].items[0][3];
718+
div.append($('<a>', {'href': '../' + crates[i] + '/index.html',
719+
'title': plainSummaryLine(desc),
720+
'class': klass}).text(crates[i]));
721+
}
720722
}
721723
sidebar.append(div);
722724
}

src/libstd/lib.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,8 @@
7777
//! including [`atomic`](sync/atomic/index.html), and [`mpsc`](sync/mpsc/index.html),
7878
//! which contains the channel types for message passing.
7979
//!
80-
//! Common types of I/O, including files, TCP, UDP, pipes, Unix domain sockets,
81-
//! timers, and process spawning, are defined in the
82-
//! [`old_io`](old_io/index.html) module.
80+
//! Common types of I/O, including files, TCP, UDP, pipes, Unix domain sockets, and
81+
//! process spawning, are defined in the [`io`](io/index.html) module.
8382
//!
8483
//! Rust's I/O and concurrency depends on a small runtime interface
8584
//! that lives, along with its support code, in mod [`rt`](rt/index.html).

src/rust-installer

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
enum BtNode {
12+
Node(u32,Box<BtNode>,Box<BtNode>),
13+
Leaf(u32),
14+
}
15+
16+
fn main() {
17+
let y = match x {
18+
Foo<T>::A(value) => value, //~ error: expected one of `=>`, `@`, `if`, or `|`, found `<`
19+
Foo<T>::B => 7,
20+
};
21+
}
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
fn main() {
12+
let v[0] = v[1]; //~ error: expected one of `:`, `;`, `=`, or `@`, found `[`
13+
}

0 commit comments

Comments
 (0)