Skip to content

Commit 27380a3

Browse files
committed
Auto merge of rust-lang#31305 - Manishearth:rollup, r=Manishearth
- Successful merges: rust-lang#31099, rust-lang#31244, rust-lang#31280, rust-lang#31290, rust-lang#31292, rust-lang#31294, rust-lang#31295, rust-lang#31296 - Failed merges:
2 parents b16fbe7 + f66d3c5 commit 27380a3

11 files changed

+449
-55
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ and documentation.
99

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

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

1515
## Building from Source

RELEASES.md

Lines changed: 352 additions & 0 deletions
Large diffs are not rendered by default.

mk/cfg/armv7-unknown-linux-gnueabihf.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# armv7-unknown-linux-gnueabihf configuration
2-
CROSS_PREFIX_armv7-unknown-linux-gnueabihf=armv7-unknown-linux-gnueabihf-
2+
CROSS_PREFIX_armv7-unknown-linux-gnueabihf=arm-linux-gnueabihf-
33
CC_armv7-unknown-linux-gnueabihf=gcc
44
CXX_armv7-unknown-linux-gnueabihf=g++
55
CPP_armv7-unknown-linux-gnueabihf=gcc -E
@@ -8,8 +8,8 @@ CFG_LIB_NAME_armv7-unknown-linux-gnueabihf=lib$(1).so
88
CFG_STATIC_LIB_NAME_armv7-unknown-linux-gnueabihf=lib$(1).a
99
CFG_LIB_GLOB_armv7-unknown-linux-gnueabihf=lib$(1)-*.so
1010
CFG_LIB_DSYM_GLOB_armv7-unknown-linux-gnueabihf=lib$(1)-*.dylib.dSYM
11-
CFG_JEMALLOC_CFLAGS_armv7-unknown-linux-gnueabihf := -D__arm__ $(CFLAGS)
12-
CFG_GCCISH_CFLAGS_armv7-unknown-linux-gnueabihf := -Wall -g -fPIC -D__arm__ $(CFLAGS)
11+
CFG_JEMALLOC_CFLAGS_armv7-unknown-linux-gnueabihf := -D__arm__ $(CFLAGS) -march=armv7
12+
CFG_GCCISH_CFLAGS_armv7-unknown-linux-gnueabihf := -Wall -g -fPIC -D__arm__ $(CFLAGS) -march=armv7
1313
CFG_GCCISH_CXXFLAGS_armv7-unknown-linux-gnueabihf := -fno-rtti $(CXXFLAGS)
1414
CFG_GCCISH_LINK_FLAGS_armv7-unknown-linux-gnueabihf := -shared -fPIC -g
1515
CFG_GCCISH_DEF_FLAG_armv7-unknown-linux-gnueabihf := -Wl,--export-dynamic,--dynamic-list=

mk/cfg/powerpc64-unknown-linux-gnu.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ CFG_LIB_NAME_powerpc64-unknown-linux-gnu=lib$(1).so
88
CFG_STATIC_LIB_NAME_powerpc64-unknown-linux-gnu=lib$(1).a
99
CFG_LIB_GLOB_powerpc64-unknown-linux-gnu=lib$(1)-*.so
1010
CFG_LIB_DSYM_GLOB_powerpc64-unknown-linux-gnu=lib$(1)-*.dylib.dSYM
11+
CFG_JEMALLOC_CFLAGS_powerpc64-unknown-linux-gnu := -m64
1112
CFG_CFLAGS_powerpc64-unknown-linux-gnu := -m64 $(CFLAGS)
1213
CFG_GCCISH_CFLAGS_powerpc64-unknown-linux-gnu := -Wall -Werror -g -fPIC -m64 $(CFLAGS)
1314
CFG_GCCISH_CXXFLAGS_powerpc64-unknown-linux-gnu := -fno-rtti $(CXXFLAGS)

src/doc/book/error-handling.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,8 @@ fn map<F, T, A>(option: Option<T>, f: F) -> Option<A> where F: FnOnce(T) -> A {
265265
```
266266

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

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

299+
Like with `map` above, the standard library implementation is a method instead
300+
of a free function.
301+
297302
The trick here is that the default value must have the same type as the value
298303
that might be inside the `Option<T>`. Using it is dead simple in our case:
299304

src/doc/book/guessing-game.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ displaying the message.
279279
[expect]: ../std/option/enum.Option.html#method.expect
280280
[panic]: error-handling.html
281281

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

285285
```bash
@@ -680,7 +680,7 @@ fn main() {
680680
}
681681
```
682682
683-
The new three lines:
683+
The new two lines:
684684
685685
```rust,ignore
686686
let guess: u32 = guess.trim().parse()

src/doc/book/testing.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Cargo will automatically generate a simple test when you make a new project.
2424
Here's the contents of `src/lib.rs`:
2525

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

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

147149
```rust
150+
# fn main() {}
148151
#[test]
149152
#[should_panic]
150153
fn it_works() {
@@ -175,6 +178,7 @@ Rust provides another macro, `assert_eq!`, that compares two arguments for
175178
equality:
176179

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

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

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

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

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

329337
```rust,ignore
338+
# fn main() {}
330339
pub fn add_two(a: i32) -> i32 {
331340
a + 2
332341
}
@@ -377,6 +386,7 @@ put a `tests/lib.rs` file inside, with this as its contents:
377386
```rust,ignore
378387
extern crate adder;
379388
389+
# fn main() {}
380390
#[test]
381391
fn it_works() {
382392
assert_eq!(4, adder::add_two(2));
@@ -432,6 +442,7 @@ running examples in your documentation (**note:** this only works in library
432442
crates, not binary crates). Here's a fleshed-out `src/lib.rs` with examples:
433443

434444
```rust,ignore
445+
# fn main() {}
435446
//! The `adder` crate provides functions that add numbers to other numbers.
436447
//!
437448
//! # Examples

src/libstd/thread/local.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,26 @@ use mem;
5656
/// assert_eq!(*f.borrow(), 2);
5757
/// });
5858
/// ```
59+
///
60+
/// # Platform-specific behavior
61+
///
62+
/// Note that a "best effort" is made to ensure that destructors for types
63+
/// stored in thread local storage are run, but not all platforms can gurantee
64+
/// that destructors will be run for all types in thread local storage. For
65+
/// example, there are a number of known caveats where destructors are not run:
66+
///
67+
/// 1. On Unix systems when pthread-based TLS is being used, destructors will
68+
/// not be run for TLS values on the main thread when it exits. Note that the
69+
/// application will exit immediately after the main thread exits as well.
70+
/// 2. On all platforms it's possible for TLS to re-initialize other TLS slots
71+
/// during destruction. Some platforms ensure that this cannot happen
72+
/// infinitely by preventing re-initialization of any slot that has been
73+
/// destroyed, but not all platforms have this guard. Those platforms that do
74+
/// not guard typically have a synthetic limit after which point no more
75+
/// destructors are run.
76+
/// 3. On OSX, initializing TLS during destruction of other TLS slots can
77+
/// sometimes cancel *all* destructors for the current thread, whether or not
78+
/// the slots have already had their destructors run or not.
5979
#[stable(feature = "rust1", since = "1.0.0")]
6080
pub struct LocalKey<T: 'static> {
6181
// This outer `LocalKey<T>` type is what's going to be stored in statics,
@@ -602,7 +622,12 @@ mod tests {
602622
}).join().ok().unwrap();
603623
}
604624

625+
// Note that this test will deadlock if TLS destructors aren't run (this
626+
// requires the destructor to be run to pass the test). OSX has a known bug
627+
// where dtors-in-dtors may cancel other destructors, so we just ignore this
628+
// test on OSX.
605629
#[test]
630+
#[cfg_attr(target_os = "macos", ignore)]
606631
fn dtors_in_dtors_in_dtors() {
607632
struct S1(Sender<()>);
608633
thread_local!(static K1: UnsafeCell<Option<S1>> = UnsafeCell::new(None));

src/libsyntax/parse/attr.rs

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,25 @@ impl<'a> Parser<'a> {
2222
pub fn parse_outer_attributes(&mut self) -> PResult<'a, Vec<ast::Attribute>> {
2323
let mut attrs: Vec<ast::Attribute> = Vec::new();
2424
loop {
25-
debug!("parse_outer_attributes: self.token={:?}",
26-
self.token);
25+
debug!("parse_outer_attributes: self.token={:?}", self.token);
2726
match self.token {
28-
token::Pound => {
29-
attrs.push(try!(self.parse_attribute(false)));
30-
}
31-
token::DocComment(s) => {
32-
let attr = ::attr::mk_sugared_doc_attr(
27+
token::Pound => {
28+
attrs.push(try!(self.parse_attribute(false)));
29+
}
30+
token::DocComment(s) => {
31+
let attr = ::attr::mk_sugared_doc_attr(
3332
attr::mk_attr_id(),
3433
self.id_to_interned_str(ast::Ident::with_empty_ctxt(s)),
3534
self.span.lo,
3635
self.span.hi
3736
);
38-
if attr.node.style != ast::AttrStyle::Outer {
39-
return Err(self.fatal("expected outer comment"));
37+
if attr.node.style != ast::AttrStyle::Outer {
38+
return Err(self.fatal("expected outer comment"));
39+
}
40+
attrs.push(attr);
41+
self.bump();
4042
}
41-
attrs.push(attr);
42-
self.bump();
43-
}
44-
_ => break
43+
_ => break,
4544
}
4645
}
4746
return Ok(attrs);
@@ -53,24 +52,27 @@ impl<'a> Parser<'a> {
5352
/// attribute
5453
pub fn parse_attribute(&mut self, permit_inner: bool) -> PResult<'a, ast::Attribute> {
5554
debug!("parse_attributes: permit_inner={:?} self.token={:?}",
56-
permit_inner, self.token);
55+
permit_inner,
56+
self.token);
5757
let (span, value, mut style) = match self.token {
5858
token::Pound => {
5959
let lo = self.span.lo;
6060
self.bump();
6161

62-
if permit_inner { self.expected_tokens.push(TokenType::Token(token::Not)); }
62+
if permit_inner {
63+
self.expected_tokens.push(TokenType::Token(token::Not));
64+
}
6365
let style = if self.token == token::Not {
6466
self.bump();
6567
if !permit_inner {
6668
let span = self.span;
67-
self.diagnostic().struct_span_err(span,
68-
"an inner attribute is not permitted in \
69-
this context")
70-
.fileline_help(span,
71-
"place inner attribute at the top of \
72-
the module or block")
73-
.emit()
69+
self.diagnostic()
70+
.struct_span_err(span,
71+
"an inner attribute is not permitted in this context")
72+
.fileline_help(span,
73+
"place inner attribute at the top of the module or \
74+
block")
75+
.emit()
7476
}
7577
ast::AttrStyle::Inner
7678
} else {
@@ -92,8 +94,9 @@ impl<'a> Parser<'a> {
9294

9395
if permit_inner && self.token == token::Semi {
9496
self.bump();
95-
self.span_warn(span, "this inner attribute syntax is deprecated. \
96-
The new syntax is `#![foo]`, with a bang and no semicolon");
97+
self.span_warn(span,
98+
"this inner attribute syntax is deprecated. The new syntax is \
99+
`#![foo]`, with a bang and no semicolon");
97100
style = ast::AttrStyle::Inner;
98101
}
99102

@@ -103,8 +106,8 @@ impl<'a> Parser<'a> {
103106
id: attr::mk_attr_id(),
104107
style: style,
105108
value: value,
106-
is_sugared_doc: false
107-
}
109+
is_sugared_doc: false,
110+
},
108111
})
109112
}
110113

@@ -139,7 +142,7 @@ impl<'a> Parser<'a> {
139142
break;
140143
}
141144
}
142-
_ => break
145+
_ => break,
143146
}
144147
}
145148
Ok(attrs)
@@ -150,10 +153,8 @@ impl<'a> Parser<'a> {
150153
/// | IDENT meta_seq
151154
pub fn parse_meta_item(&mut self) -> PResult<'a, P<ast::MetaItem>> {
152155
let nt_meta = match self.token {
153-
token::Interpolated(token::NtMeta(ref e)) => {
154-
Some(e.clone())
155-
}
156-
_ => None
156+
token::Interpolated(token::NtMeta(ref e)) => Some(e.clone()),
157+
_ => None,
157158
};
158159

159160
match nt_meta {
@@ -176,9 +177,8 @@ impl<'a> Parser<'a> {
176177
match lit.node {
177178
ast::LitStr(..) => {}
178179
_ => {
179-
self.span_err(
180-
lit.span,
181-
"non-string literals are not allowed in meta-items");
180+
self.span_err(lit.span,
181+
"non-string literals are not allowed in meta-items");
182182
}
183183
}
184184
let hi = self.span.hi;

src/libsyntax/parse/classify.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,22 @@ use ast;
2323
/// isn't parsed as (if true {...} else {...} | x) | 5
2424
pub fn expr_requires_semi_to_be_stmt(e: &ast::Expr) -> bool {
2525
match e.node {
26-
ast::ExprIf(..)
27-
| ast::ExprIfLet(..)
28-
| ast::ExprMatch(..)
29-
| ast::ExprBlock(_)
30-
| ast::ExprWhile(..)
31-
| ast::ExprWhileLet(..)
32-
| ast::ExprLoop(..)
33-
| ast::ExprForLoop(..) => false,
34-
_ => true
26+
ast::ExprIf(..) |
27+
ast::ExprIfLet(..) |
28+
ast::ExprMatch(..) |
29+
ast::ExprBlock(_) |
30+
ast::ExprWhile(..) |
31+
ast::ExprWhileLet(..) |
32+
ast::ExprLoop(..) |
33+
ast::ExprForLoop(..) => false,
34+
_ => true,
3535
}
3636
}
3737

3838
pub fn expr_is_simple_block(e: &ast::Expr) -> bool {
3939
match e.node {
4040
ast::ExprBlock(ref block) => block.rules == ast::DefaultBlock,
41-
_ => false
41+
_ => false,
4242
}
4343
}
4444

@@ -50,11 +50,11 @@ pub fn stmt_ends_with_semi(stmt: &ast::Stmt_) -> bool {
5050
ast::StmtDecl(ref d, _) => {
5151
match d.node {
5252
ast::DeclLocal(_) => true,
53-
ast::DeclItem(_) => false
53+
ast::DeclItem(_) => false,
5454
}
5555
}
56-
ast::StmtExpr(ref e, _) => { expr_requires_semi_to_be_stmt(e) }
57-
ast::StmtSemi(..) => { false }
58-
ast::StmtMac(..) => { false }
56+
ast::StmtExpr(ref e, _) => expr_requires_semi_to_be_stmt(e),
57+
ast::StmtSemi(..) => false,
58+
ast::StmtMac(..) => false,
5959
}
6060
}

src/libsyntax/parse/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use parse::token;
1616
/// and whether a trailing separator is allowed.
1717
pub struct SeqSep {
1818
pub sep: Option<token::Token>,
19-
pub trailing_sep_allowed: bool
19+
pub trailing_sep_allowed: bool,
2020
}
2121

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

0 commit comments

Comments
 (0)