Skip to content

Rollup of PRs in the queue; Saturday #24009

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 34 commits into from
Apr 4, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
48aea41
Fix sidebar bug
carloslfu Apr 1, 2015
1cbaf9f
Upgrade rust-installer
brson Apr 2, 2015
5a700b2
liballoc: fix typo
richo Apr 2, 2015
e1be69b
Add tests for parsing of patterns
petrochenkov Apr 3, 2015
ad3daa8
Update AUTHORS.txt as of 1.0.0-beta
aturon Apr 3, 2015
6529872
Adjust `AsRef` impl for `Cow`
aturon Apr 3, 2015
b406782
Indicate associated type in comment is code-like
frewsxcv Apr 3, 2015
0621a83
Workaround `javac` popup on MacOS X
ranma42 Apr 3, 2015
787c6cd
this correctly disables jemalloc on Bitrig
Apr 3, 2015
2f63e9c
Remove unnecessary `Vec<_>` annotation from docs
Apr 3, 2015
862e160
Don't speak of old_io
steveklabnik Apr 3, 2015
3b73a6e
Remove old_io from trpl/concurrency.md
callahad Apr 3, 2015
925a52c
Update Rust install instructions in TRPL
steveklabnik Apr 3, 2015
692c88c
Simplify `match` branches in documentation comment
frewsxcv Apr 4, 2015
6ff085c
Make example function in comment more idiomatic
frewsxcv Apr 4, 2015
eb2a6d9
Removed repeated sentence.
hackaugusto Apr 4, 2015
d0c3283
Rollup merge of #23979 - Ryman:error_from_string, r=alexcrichton
Manishearth Apr 4, 2015
cf2773e
Rollup merge of #23995 - aturon:cow-as-ref, r=huonw
Manishearth Apr 4, 2015
3cdbeca
Rollup merge of #24005 - ranma42:macosx-no-javac-popup, r=alexcrichton
Manishearth Apr 4, 2015
90b9b0d
Rollup merge of #24033 - petrochenkov:pattest, r=alexcrichton
Manishearth Apr 4, 2015
9fc7a1e
Rollup merge of #23941 - carloslfu:patch-1, r=steveklabnik
Manishearth Apr 4, 2015
17e83e3
Rollup merge of #23978 - brson:installer, r=alexcrichton
Manishearth Apr 4, 2015
3058eed
Rollup merge of #23990 - dhuseby:bitrig_fixing_jemalloc_config, r=ale…
Manishearth Apr 4, 2015
8ac622c
Rollup merge of #23993 - aturon:beta-update-authors, r=alexcrichton
Manishearth Apr 4, 2015
d83f49b
Rollup merge of #23996 - frewsxcv:patch-8, r=alexcrichton
Manishearth Apr 4, 2015
9ebb53e
Rollup merge of #23997 - richo:typos, r=huonw
Manishearth Apr 4, 2015
0daa005
Rollup merge of #24012 - tsion:patch-1, r=steveklabnik
Manishearth Apr 4, 2015
fb4e0a9
Rollup merge of #24022 - steveklabnik:hn_fix, r=nikomatsakis
Manishearth Apr 4, 2015
91d1e8d
Rollup merge of #24031 - callahad:trpl_old_io_removal, r=steveklabnik
Manishearth Apr 4, 2015
a20aff3
Rollup merge of #24032 - steveklabnik:beta_install, r=alexcrichton
Manishearth Apr 4, 2015
563cf10
Rollup merge of #24038 - frewsxcv:patch-9, r=steveklabnik
Manishearth Apr 4, 2015
61e0aaf
Rollup merge of #24039 - frewsxcv:patch-10, r=steveklabnik
Manishearth Apr 4, 2015
29582d3
Rollup merge of #24040 - hackaugusto:patch-1, r=steveklabnik
Manishearth Apr 4, 2015
b62c110
Fix doc (fixup #24031)
Manishearth Apr 4, 2015
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
96 changes: 92 additions & 4 deletions AUTHORS.txt

Large diffs are not rendered by default.

19 changes: 16 additions & 3 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,6 @@ opt verify-install 1 "verify installed binaries work"
# This is used by the automation to produce single-target nightlies
opt dist-host-only 0 "only install bins for the host architecture"
opt inject-std-version 1 "inject the current compiler version of libstd into programs"
opt jemalloc 1 "build liballoc with jemalloc"
opt llvm-version-check 1 "don't check if the LLVM version is supported, build anyway"

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

valopt_nosave prefix "/usr/local" "set installation prefix"
valopt_nosave local-rust-root "/usr/local" "set prefix for local rust binary"
Expand Down Expand Up @@ -669,7 +669,6 @@ probe CFG_LD ld
probe CFG_VALGRIND valgrind
probe CFG_PERF perf
probe CFG_ISCC iscc
probe CFG_JAVAC javac
probe CFG_ANTLR4 antlr4
probe CFG_GRUN grun
probe CFG_FLEX flex
Expand All @@ -679,6 +678,14 @@ probe CFG_XELATEX xelatex
probe CFG_GDB gdb
probe CFG_LLDB lldb

# On MacOS X, invoking `javac` pops up a dialog if the JDK is not
# installed. Since `javac` is only used if `antlr4` is available,
# probe for it only in this case.
if [ ! -z "$CFG_ANTLR4" ]
then
probe CFG_JAVAC javac
fi

if [ ! -z "$CFG_GDB" ]
then
# Store GDB's version
Expand Down Expand Up @@ -775,7 +782,7 @@ if [ $CFG_OSTYPE = unknown-bitrig ]
then
step_msg "on Bitrig, forcing use of clang, disabling jemalloc"
CFG_ENABLE_CLANG=1
CFG_ENABLE_JEMALLOC=0
CFG_DISABLE_JEMALLOC=1
fi

if [ -z "$CFG_ENABLE_CLANG" -a -z "$CFG_GCC" ]
Expand Down Expand Up @@ -828,6 +835,12 @@ then
putvar CFG_ENABLE_CLANG
fi

# Same with jemalloc. save the setting here.
if [ ! -z "$CFG_DISABLE_JEMALLOC" ]
then
putvar CFG_DISABLE_JEMALLOC
fi

if [ ! -z "$CFG_LLVM_ROOT" -a -z "$CFG_DISABLE_LLVM_VERSION_CHECK" -a -e "$CFG_LLVM_ROOT/bin/llvm-config" ]
then
step_msg "using custom LLVM at $CFG_LLVM_ROOT"
Expand Down
3 changes: 0 additions & 3 deletions src/doc/trpl/closures.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,6 @@ we called `add_num`, it mutated the underlying value, as we'd expect. We also
needed to declare `add_num` as `mut` too, because we’re mutating its
environment.

We also had to declare `add_num` as mut, since we will be modifying its
environment.

If we change to a `move` closure, it's different:

```rust
Expand Down
32 changes: 9 additions & 23 deletions src/doc/trpl/concurrency.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,14 @@ When `guard` goes out of scope, it will block execution until the thread is
finished. If we didn't want this behaviour, we could use `thread::spawn()`:

```
# #![feature(old_io, std_misc)]
use std::thread;
use std::old_io::timer;
use std::time::Duration;

fn main() {
thread::spawn(|| {
println!("Hello from a thread!");
});

timer::sleep(Duration::milliseconds(50));
thread::sleep_ms(50);
}
```

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

```ignore
# #![feature(old_io, std_misc)]
use std::thread;
use std::old_io::timer;
use std::time::Duration;

fn main() {
let mut data = vec![1u32, 2, 3];
Expand All @@ -161,14 +155,14 @@ fn main() {
});
}

timer::sleep(Duration::milliseconds(50));
thread::sleep_ms(50);
}
```

This gives us an error:

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

```ignore
# #![feature(old_io, std_misc)]
use std::thread;
use std::old_io::timer;
use std::time::Duration;
use std::sync::Mutex;

fn main() {
Expand All @@ -203,17 +194,17 @@ fn main() {
});
}

timer::sleep(Duration::milliseconds(50));
thread::sleep_ms(50);
}
```

Here's the error:

```text
<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]
<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]
<anon>:11 thread::spawn(move || {
^~~~~~~~~~~~~
<anon>:11:9: 11:22 note: `std::sync::mutex::MutexGuard<'_, collections::vec::Vec<u32>>` cannot be sent between threads safely
<anon>:9:9: 9:22 note: `std::sync::mutex::MutexGuard<'_, collections::vec::Vec<u32>>` cannot be sent between threads safely
<anon>:11 thread::spawn(move || {
^~~~~~~~~~~~~
```
Expand All @@ -232,11 +223,8 @@ guard across thread boundaries, which gives us our error.
We can use `Arc<T>` to fix this. Here's the working version:

```
# #![feature(old_io, std_misc)]
use std::sync::{Arc, Mutex};
use std::thread;
use std::old_io::timer;
use std::time::Duration;

fn main() {
let data = Arc::new(Mutex::new(vec![1u32, 2, 3]));
Expand All @@ -249,20 +237,17 @@ fn main() {
});
}

timer::sleep(Duration::milliseconds(50));
thread::sleep_ms(50);
}
```

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

```
# #![feature(old_io, std_misc)]
```rust
# use std::sync::{Arc, Mutex};
# use std::thread;
# use std::old_io::timer;
# use std::time::Duration;
# fn main() {
# let data = Arc::new(Mutex::new(vec![1u32, 2, 3]));
# for i in 0..2 {
Expand All @@ -272,6 +257,7 @@ thread::spawn(move || {
data[i] += 1;
});
# }
# thread::sleep_ms(50);
# }
```

Expand Down
4 changes: 2 additions & 2 deletions src/doc/trpl/installing-rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ $ sudo sh rustup.sh
```

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

If you decide you don't want Rust anymore, we'll be a bit sad, but that's okay.
Expand Down
50 changes: 50 additions & 0 deletions src/doc/trpl/unstable.md
Original file line number Diff line number Diff line change
@@ -1 +1,51 @@
% Unstable Rust

Rust provides three distribution channels for Rust: nightly, beta, and stable.
Unstable features are only available on nightly Rust. For more details on this
process, see [this post](http://blog.rust-lang.org/2014/10/30/Stability.html).

To install nightly Rust, you can use `rustup.sh`:

```bash
$ curl -s https://static.rust-lang.org/rustup.sh | sudo sh -s -- --channel=nightly
```

If you're concerned about the [potential insecurity](http://curlpipesh.tumblr.com/) of using `curl | sudo sh`,
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:

```bash
$ curl -f -L https://static.rust-lang.org/rustup.sh -O
$ sudo sh rustup.sh --channel=nightly
```

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

If you decide you don't want Rust anymore, we'll be a bit sad, but that's okay.
Not every programming language is great for everyone. Just run the uninstall
script:

```bash
$ sudo /usr/local/lib/rustlib/uninstall.sh
```

If you used the Windows installer, just re-run the `.exe` and it will give you
an uninstall option.

You can re-run this script any time you want to update Rust. Which, at this
point, is often. Rust is still pre-1.0, and so people assume that you're using
a very recent Rust.

This brings me to one other point: some people, and somewhat rightfully so, get
very upset when we tell you to `curl | sudo sh`. And they should be! Basically,
when you do this, you are trusting that the good people who maintain Rust
aren't going to hack your computer and do bad things. That's a good instinct!
If you're one of those people, please check out the documentation on [building
Rust from Source](https://github.com/rust-lang/rust#building-from-source), or
[the official binary downloads](http://www.rust-lang.org/install.html). And we
promise that this method will not be the way to install Rust forever: it's just
the easiest way to keep people updated while Rust is in its alpha state.

2 changes: 1 addition & 1 deletion src/liballoc/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ impl<T> Weak<T> {
/// ```
pub fn upgrade(&self) -> Option<Arc<T>> {
// We use a CAS loop to increment the strong count instead of a
// fetch_add because once the count hits 0 is must never be above 0.
// fetch_add because once the count hits 0 it must never be above 0.
let inner = self.inner();
loop {
let n = inner.strong.load(SeqCst);
Expand Down
2 changes: 1 addition & 1 deletion src/libcollections/borrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ impl<'a, B: ?Sized> IntoCow<'a, B> for Cow<'a, B> where B: ToOwned {
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T: Clone> AsRef<T> for Cow<'a, T> {
impl<'a, T: ?Sized + ToOwned> AsRef<T> for Cow<'a, T> {
fn as_ref(&self) -> &T {
self
}
Expand Down
2 changes: 1 addition & 1 deletion src/libcollections/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ impl<T> Vec<T> {
/// # Examples
///
/// ```
/// let mut vec: Vec<_> = Vec::with_capacity(10);
/// let mut vec = Vec::with_capacity(10);
///
/// // The vector contains no items, even though it has capacity for more
/// assert_eq!(vec.len(), 0);
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,7 @@ pub trait IntoIterator {
#[stable(feature = "rust1", since = "1.0.0")]
type Item;

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

Expand Down
20 changes: 7 additions & 13 deletions src/libcore/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,18 @@
//! enum Version { Version1, Version2 }
//!
//! fn parse_version(header: &[u8]) -> Result<Version, &'static str> {
//! if header.len() < 1 {
//! return Err("invalid header length");
//! }
//! match header[0] {
//! 1 => Ok(Version::Version1),
//! 2 => Ok(Version::Version2),
//! _ => Err("invalid version")
//! match header.get(0) {
//! None => Err("invalid header length"),
//! Some(&1) => Ok(Version::Version1),
//! Some(&2) => Ok(Version::Version2),
//! Some(_) => Err("invalid version")
//! }
//! }
//!
//! let version = parse_version(&[1, 2, 3, 4]);
//! match version {
//! Ok(v) => {
//! println!("working with version: {:?}", v);
//! }
//! Err(e) => {
//! println!("error parsing header: {:?}", e);
//! }
//! Ok(v) => println!("working with version: {:?}", v),
//! Err(e) => println!("error parsing header: {:?}", e),
//! }
//! ```
//!
Expand Down
10 changes: 6 additions & 4 deletions src/librustdoc/html/static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -713,10 +713,12 @@
if (crates[i] == window.currentCrate) {
klass += ' current';
}
var desc = rawSearchIndex[crates[i]].items[0][3];
div.append($('<a>', {'href': '../' + crates[i] + '/index.html',
'title': plainSummaryLine(desc),
'class': klass}).text(crates[i]));
if (rawSearchIndex[crates[i]].items[0]) {
var desc = rawSearchIndex[crates[i]].items[0][3];
div.append($('<a>', {'href': '../' + crates[i] + '/index.html',
'title': plainSummaryLine(desc),
'class': klass}).text(crates[i]));
}
}
sidebar.append(div);
}
Expand Down
13 changes: 10 additions & 3 deletions src/libstd/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ impl<'a, E: Error + Send + 'a> From<E> for Box<Error + Send + 'a> {
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, 'b> From<&'b str> for Box<Error + Send + 'a> {
fn from(err: &'b str) -> Box<Error + Send + 'a> {
impl From<String> for Box<Error + Send> {
fn from(err: String) -> Box<Error + Send> {
#[derive(Debug)]
struct StringError(String);

Expand All @@ -103,7 +103,14 @@ impl<'a, 'b> From<&'b str> for Box<Error + Send + 'a> {
}
}

Box::new(StringError(String::from_str(err)))
Box::new(StringError(err))
}
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, 'b> From<&'b str> for Box<Error + Send + 'a> {
fn from(err: &'b str) -> Box<Error + Send + 'a> {
From::from(String::from_str(err))
}
}

Expand Down
5 changes: 2 additions & 3 deletions src/libstd/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,8 @@
//! including [`atomic`](sync/atomic/index.html), and [`mpsc`](sync/mpsc/index.html),
//! which contains the channel types for message passing.
//!
//! Common types of I/O, including files, TCP, UDP, pipes, Unix domain sockets,
//! timers, and process spawning, are defined in the
//! [`old_io`](old_io/index.html) module.
//! Common types of I/O, including files, TCP, UDP, pipes, Unix domain sockets, and
//! process spawning, are defined in the [`io`](io/index.html) module.
//!
//! Rust's I/O and concurrency depends on a small runtime interface
//! that lives, along with its support code, in mod [`rt`](rt/index.html).
Expand Down
2 changes: 1 addition & 1 deletion src/rust-installer
Loading