Skip to content

Rollup of 8 pull requests #31305

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 18 commits into from
Jan 30, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ and documentation.

Read ["Installing Rust"] from [The Book].

["Installing Rust"]: https://doc.rust-lang.org/book/installing-rust.html
["Installing Rust"]: https://doc.rust-lang.org/book/getting-started.html#installing-rust
[The Book]: https://doc.rust-lang.org/book/index.html

## Building from Source
Expand Down
352 changes: 352 additions & 0 deletions RELEASES.md

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions mk/cfg/armv7-unknown-linux-gnueabihf.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# armv7-unknown-linux-gnueabihf configuration
CROSS_PREFIX_armv7-unknown-linux-gnueabihf=armv7-unknown-linux-gnueabihf-
CROSS_PREFIX_armv7-unknown-linux-gnueabihf=arm-linux-gnueabihf-
CC_armv7-unknown-linux-gnueabihf=gcc
CXX_armv7-unknown-linux-gnueabihf=g++
CPP_armv7-unknown-linux-gnueabihf=gcc -E
Expand All @@ -8,8 +8,8 @@ CFG_LIB_NAME_armv7-unknown-linux-gnueabihf=lib$(1).so
CFG_STATIC_LIB_NAME_armv7-unknown-linux-gnueabihf=lib$(1).a
CFG_LIB_GLOB_armv7-unknown-linux-gnueabihf=lib$(1)-*.so
CFG_LIB_DSYM_GLOB_armv7-unknown-linux-gnueabihf=lib$(1)-*.dylib.dSYM
CFG_JEMALLOC_CFLAGS_armv7-unknown-linux-gnueabihf := -D__arm__ $(CFLAGS)
CFG_GCCISH_CFLAGS_armv7-unknown-linux-gnueabihf := -Wall -g -fPIC -D__arm__ $(CFLAGS)
CFG_JEMALLOC_CFLAGS_armv7-unknown-linux-gnueabihf := -D__arm__ $(CFLAGS) -march=armv7
CFG_GCCISH_CFLAGS_armv7-unknown-linux-gnueabihf := -Wall -g -fPIC -D__arm__ $(CFLAGS) -march=armv7
CFG_GCCISH_CXXFLAGS_armv7-unknown-linux-gnueabihf := -fno-rtti $(CXXFLAGS)
CFG_GCCISH_LINK_FLAGS_armv7-unknown-linux-gnueabihf := -shared -fPIC -g
CFG_GCCISH_DEF_FLAG_armv7-unknown-linux-gnueabihf := -Wl,--export-dynamic,--dynamic-list=
Expand Down
1 change: 1 addition & 0 deletions mk/cfg/powerpc64-unknown-linux-gnu.mk
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ CFG_LIB_NAME_powerpc64-unknown-linux-gnu=lib$(1).so
CFG_STATIC_LIB_NAME_powerpc64-unknown-linux-gnu=lib$(1).a
CFG_LIB_GLOB_powerpc64-unknown-linux-gnu=lib$(1)-*.so
CFG_LIB_DSYM_GLOB_powerpc64-unknown-linux-gnu=lib$(1)-*.dylib.dSYM
CFG_JEMALLOC_CFLAGS_powerpc64-unknown-linux-gnu := -m64
CFG_CFLAGS_powerpc64-unknown-linux-gnu := -m64 $(CFLAGS)
CFG_GCCISH_CFLAGS_powerpc64-unknown-linux-gnu := -Wall -Werror -g -fPIC -m64 $(CFLAGS)
CFG_GCCISH_CXXFLAGS_powerpc64-unknown-linux-gnu := -fno-rtti $(CXXFLAGS)
Expand Down
5 changes: 5 additions & 0 deletions src/doc/book/error-handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,8 @@ fn map<F, T, A>(option: Option<T>, f: F) -> Option<A> where F: FnOnce(T) -> A {
```

Indeed, `map` is [defined as a method][2] on `Option<T>` in the standard library.
As a method, it has a slighly different signature: methods take `self`, `&self`,
or `&mut self` as their first argument.

Armed with our new combinator, we can rewrite our `extension_explicit` method
to get rid of the case analysis:
Expand Down Expand Up @@ -294,6 +296,9 @@ fn unwrap_or<T>(option: Option<T>, default: T) -> T {
}
```

Like with `map` above, the standard library implementation is a method instead
of a free function.

The trick here is that the default value must have the same type as the value
that might be inside the `Option<T>`. Using it is dead simple in our case:

Expand Down
4 changes: 2 additions & 2 deletions src/doc/book/guessing-game.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ displaying the message.
[expect]: ../std/option/enum.Option.html#method.expect
[panic]: error-handling.html

If we leave off calling these two methods, our program will compile, but
If we leave off calling this method, our program will compile, but
we’ll get a warning:

```bash
Expand Down Expand Up @@ -680,7 +680,7 @@ fn main() {
}
```

The new three lines:
The new two lines:

```rust,ignore
let guess: u32 = guess.trim().parse()
Expand Down
11 changes: 11 additions & 0 deletions src/doc/book/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Cargo will automatically generate a simple test when you make a new project.
Here's the contents of `src/lib.rs`:

```rust
# fn main() {}
#[test]
fn it_works() {
}
Expand Down Expand Up @@ -75,6 +76,7 @@ So why does our do-nothing test pass? Any test which doesn't `panic!` passes,
and any test that does `panic!` fails. Let's make our test fail:

```rust
# fn main() {}
#[test]
fn it_works() {
assert!(false);
Expand Down Expand Up @@ -145,6 +147,7 @@ This is useful if you want to integrate `cargo test` into other tooling.
We can invert our test's failure with another attribute: `should_panic`:

```rust
# fn main() {}
#[test]
#[should_panic]
fn it_works() {
Expand Down Expand Up @@ -175,6 +178,7 @@ Rust provides another macro, `assert_eq!`, that compares two arguments for
equality:

```rust
# fn main() {}
#[test]
#[should_panic]
fn it_works() {
Expand Down Expand Up @@ -209,6 +213,7 @@ make sure that the failure message contains the provided text. A safer version
of the example above would be:

```rust
# fn main() {}
#[test]
#[should_panic(expected = "assertion failed")]
fn it_works() {
Expand All @@ -219,6 +224,7 @@ fn it_works() {
That's all there is to the basics! Let's write one 'real' test:

```rust,ignore
# fn main() {}
pub fn add_two(a: i32) -> i32 {
a + 2
}
Expand All @@ -238,6 +244,7 @@ Sometimes a few specific tests can be very time-consuming to execute. These
can be disabled by default by using the `ignore` attribute:

```rust
# fn main() {}
#[test]
fn it_works() {
assert_eq!(4, add_two(2));
Expand Down Expand Up @@ -299,6 +306,7 @@ missing the `tests` module. The idiomatic way of writing our example
looks like this:

```rust,ignore
# fn main() {}
pub fn add_two(a: i32) -> i32 {
a + 2
}
Expand Down Expand Up @@ -327,6 +335,7 @@ a large module, and so this is a common use of globs. Let's change our
`src/lib.rs` to make use of it:

```rust,ignore
# fn main() {}
pub fn add_two(a: i32) -> i32 {
a + 2
}
Expand Down Expand Up @@ -377,6 +386,7 @@ put a `tests/lib.rs` file inside, with this as its contents:
```rust,ignore
extern crate adder;

# fn main() {}
#[test]
fn it_works() {
assert_eq!(4, adder::add_two(2));
Expand Down Expand Up @@ -432,6 +442,7 @@ running examples in your documentation (**note:** this only works in library
crates, not binary crates). Here's a fleshed-out `src/lib.rs` with examples:

```rust,ignore
# fn main() {}
//! The `adder` crate provides functions that add numbers to other numbers.
//!
//! # Examples
Expand Down
25 changes: 25 additions & 0 deletions src/libstd/thread/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,26 @@ use mem;
/// assert_eq!(*f.borrow(), 2);
/// });
/// ```
///
/// # Platform-specific behavior
///
/// Note that a "best effort" is made to ensure that destructors for types
/// stored in thread local storage are run, but not all platforms can gurantee
/// that destructors will be run for all types in thread local storage. For
/// example, there are a number of known caveats where destructors are not run:
///
/// 1. On Unix systems when pthread-based TLS is being used, destructors will
/// not be run for TLS values on the main thread when it exits. Note that the
/// application will exit immediately after the main thread exits as well.
/// 2. On all platforms it's possible for TLS to re-initialize other TLS slots
/// during destruction. Some platforms ensure that this cannot happen
/// infinitely by preventing re-initialization of any slot that has been
/// destroyed, but not all platforms have this guard. Those platforms that do
/// not guard typically have a synthetic limit after which point no more
/// destructors are run.
/// 3. On OSX, initializing TLS during destruction of other TLS slots can
/// sometimes cancel *all* destructors for the current thread, whether or not
/// the slots have already had their destructors run or not.
#[stable(feature = "rust1", since = "1.0.0")]
pub struct LocalKey<T: 'static> {
// This outer `LocalKey<T>` type is what's going to be stored in statics,
Expand Down Expand Up @@ -602,7 +622,12 @@ mod tests {
}).join().ok().unwrap();
}

// Note that this test will deadlock if TLS destructors aren't run (this
// requires the destructor to be run to pass the test). OSX has a known bug
// where dtors-in-dtors may cancel other destructors, so we just ignore this
// test on OSX.
#[test]
#[cfg_attr(target_os = "macos", ignore)]
fn dtors_in_dtors_in_dtors() {
struct S1(Sender<()>);
thread_local!(static K1: UnsafeCell<Option<S1>> = UnsafeCell::new(None));
Expand Down
68 changes: 34 additions & 34 deletions src/libsyntax/parse/attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,25 @@ impl<'a> Parser<'a> {
pub fn parse_outer_attributes(&mut self) -> PResult<'a, Vec<ast::Attribute>> {
let mut attrs: Vec<ast::Attribute> = Vec::new();
loop {
debug!("parse_outer_attributes: self.token={:?}",
self.token);
debug!("parse_outer_attributes: self.token={:?}", self.token);
match self.token {
token::Pound => {
attrs.push(try!(self.parse_attribute(false)));
}
token::DocComment(s) => {
let attr = ::attr::mk_sugared_doc_attr(
token::Pound => {
attrs.push(try!(self.parse_attribute(false)));
}
token::DocComment(s) => {
let attr = ::attr::mk_sugared_doc_attr(
attr::mk_attr_id(),
self.id_to_interned_str(ast::Ident::with_empty_ctxt(s)),
self.span.lo,
self.span.hi
);
if attr.node.style != ast::AttrStyle::Outer {
return Err(self.fatal("expected outer comment"));
if attr.node.style != ast::AttrStyle::Outer {
return Err(self.fatal("expected outer comment"));
}
attrs.push(attr);
self.bump();
}
attrs.push(attr);
self.bump();
}
_ => break
_ => break,
}
}
return Ok(attrs);
Expand All @@ -53,24 +52,27 @@ impl<'a> Parser<'a> {
/// attribute
pub fn parse_attribute(&mut self, permit_inner: bool) -> PResult<'a, ast::Attribute> {
debug!("parse_attributes: permit_inner={:?} self.token={:?}",
permit_inner, self.token);
permit_inner,
self.token);
let (span, value, mut style) = match self.token {
token::Pound => {
let lo = self.span.lo;
self.bump();

if permit_inner { self.expected_tokens.push(TokenType::Token(token::Not)); }
if permit_inner {
self.expected_tokens.push(TokenType::Token(token::Not));
}
let style = if self.token == token::Not {
self.bump();
if !permit_inner {
let span = self.span;
self.diagnostic().struct_span_err(span,
"an inner attribute is not permitted in \
this context")
.fileline_help(span,
"place inner attribute at the top of \
the module or block")
.emit()
self.diagnostic()
.struct_span_err(span,
"an inner attribute is not permitted in this context")
.fileline_help(span,
"place inner attribute at the top of the module or \
block")
.emit()
}
ast::AttrStyle::Inner
} else {
Expand All @@ -92,8 +94,9 @@ impl<'a> Parser<'a> {

if permit_inner && self.token == token::Semi {
self.bump();
self.span_warn(span, "this inner attribute syntax is deprecated. \
The new syntax is `#![foo]`, with a bang and no semicolon");
self.span_warn(span,
"this inner attribute syntax is deprecated. The new syntax is \
`#![foo]`, with a bang and no semicolon");
style = ast::AttrStyle::Inner;
}

Expand All @@ -103,8 +106,8 @@ impl<'a> Parser<'a> {
id: attr::mk_attr_id(),
style: style,
value: value,
is_sugared_doc: false
}
is_sugared_doc: false,
},
})
}

Expand Down Expand Up @@ -139,7 +142,7 @@ impl<'a> Parser<'a> {
break;
}
}
_ => break
_ => break,
}
}
Ok(attrs)
Expand All @@ -150,10 +153,8 @@ impl<'a> Parser<'a> {
/// | IDENT meta_seq
pub fn parse_meta_item(&mut self) -> PResult<'a, P<ast::MetaItem>> {
let nt_meta = match self.token {
token::Interpolated(token::NtMeta(ref e)) => {
Some(e.clone())
}
_ => None
token::Interpolated(token::NtMeta(ref e)) => Some(e.clone()),
_ => None,
};

match nt_meta {
Expand All @@ -176,9 +177,8 @@ impl<'a> Parser<'a> {
match lit.node {
ast::LitStr(..) => {}
_ => {
self.span_err(
lit.span,
"non-string literals are not allowed in meta-items");
self.span_err(lit.span,
"non-string literals are not allowed in meta-items");
}
}
let hi = self.span.hi;
Expand Down
28 changes: 14 additions & 14 deletions src/libsyntax/parse/classify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,22 @@ use ast;
/// isn't parsed as (if true {...} else {...} | x) | 5
pub fn expr_requires_semi_to_be_stmt(e: &ast::Expr) -> bool {
match e.node {
ast::ExprIf(..)
| ast::ExprIfLet(..)
| ast::ExprMatch(..)
| ast::ExprBlock(_)
| ast::ExprWhile(..)
| ast::ExprWhileLet(..)
| ast::ExprLoop(..)
| ast::ExprForLoop(..) => false,
_ => true
ast::ExprIf(..) |
ast::ExprIfLet(..) |
ast::ExprMatch(..) |
ast::ExprBlock(_) |
ast::ExprWhile(..) |
ast::ExprWhileLet(..) |
ast::ExprLoop(..) |
ast::ExprForLoop(..) => false,
_ => true,
}
}

pub fn expr_is_simple_block(e: &ast::Expr) -> bool {
match e.node {
ast::ExprBlock(ref block) => block.rules == ast::DefaultBlock,
_ => false
_ => false,
}
}

Expand All @@ -50,11 +50,11 @@ pub fn stmt_ends_with_semi(stmt: &ast::Stmt_) -> bool {
ast::StmtDecl(ref d, _) => {
match d.node {
ast::DeclLocal(_) => true,
ast::DeclItem(_) => false
ast::DeclItem(_) => false,
}
}
ast::StmtExpr(ref e, _) => { expr_requires_semi_to_be_stmt(e) }
ast::StmtSemi(..) => { false }
ast::StmtMac(..) => { false }
ast::StmtExpr(ref e, _) => expr_requires_semi_to_be_stmt(e),
ast::StmtSemi(..) => false,
ast::StmtMac(..) => false,
}
}
2 changes: 1 addition & 1 deletion src/libsyntax/parse/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use parse::token;
/// and whether a trailing separator is allowed.
pub struct SeqSep {
pub sep: Option<token::Token>,
pub trailing_sep_allowed: bool
pub trailing_sep_allowed: bool,
}

pub fn seq_sep_trailing_allowed(t: token::Token) -> SeqSep {
Expand Down