Skip to content

Commit eda2009

Browse files
committed
---
yaml --- r: 210823 b: refs/heads/try c: 072cba9 h: refs/heads/master i: 210821: 33f6c30 210819: cc3f9e5 210815: a3bb327 v: v3
1 parent 225ec4f commit eda2009

File tree

17 files changed

+71
-31
lines changed

17 files changed

+71
-31
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 3e561f05c00cd180ec02db4ccab2840a4aba93d2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: ba0e1cd8147d452c356aacb29fb87568ca26f111
5-
refs/heads/try: 190de695f58e9cb71d9b799b13570b33f4422363
5+
refs/heads/try: 072cba9a536013534352bceddbb417b3df41e8da
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/src/doc/trpl/concurrency.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ and more cores, yet many programmers aren't prepared to fully utilize them.
66

77
Rust's memory safety features also apply to its concurrency story too. Even
88
concurrent Rust programs must be memory safe, having no data races. Rust's type
9-
system is up to the thread, and gives you powerful ways to reason about
9+
system is up to the task, and gives you powerful ways to reason about
1010
concurrent code at compile time.
1111

1212
Before we talk about the concurrency features that come with Rust, it's important

branches/try/src/doc/trpl/dining-philosophers.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ a name is all we need. We choose the [`String`][string] type for the name,
7373
rather than `&str`. Generally speaking, working with a type which owns its
7474
data is easier than working with one that uses references.
7575

76+
[struct]: structs.html
77+
[string]: strings.html
78+
7679
Let’s continue:
7780

7881
```rust

branches/try/src/doc/trpl/enums.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,6 @@ fn process_color_change(msg: Message) {
5555
}
5656
```
5757

58-
Both variants are named `Digit`, but since they’re scoped to the `enum` name
59-
there's no ambiguity.
60-
6158
Not supporting these operations may seem rather limiting, but it’s a limitation
6259
which we can overcome. There are two ways: by implementing equality ourselves,
6360
or by pattern matching variants with [`match`][match] expressions, which you’ll
@@ -66,3 +63,4 @@ equality yet, but we’ll find out in the [`traits`][traits] section.
6663

6764
[match]: match.html
6865
[if-let]: if-let.html
66+
[traits]: traits.html

branches/try/src/doc/trpl/guessing-game.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,12 +213,12 @@ The next part will use this handle to get input from the user:
213213
```
214214

215215
Here, we call the [`read_line()`][read_line] method on our handle.
216-
[Method][method]s are like associated functions, but are only available on a
216+
[Methods][method] are like associated functions, but are only available on a
217217
particular instance of a type, rather than the type itself. We’re also passing
218218
one argument to `read_line()`: `&mut guess`.
219219

220220
[read_line]: ../std/io/struct.Stdin.html#method.read_line
221-
[method]: methods.html
221+
[method]: method-syntax.html
222222

223223
Remember how we bound `guess` above? We said it was mutable. However,
224224
`read_line` doesn’t take a `String` as an argument: it takes a `&mut String`.

branches/try/src/doc/trpl/match.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,4 @@ Unlike the previous uses of `match`, you can’t use the normal `if`
9797
statement to do this. You can use the [`if let`][if-let] statement,
9898
which can be seen as an abbreviated form of `match`.
9999

100-
[if-let][if-let.html]
100+
[if-let]: if-let.html

branches/try/src/doc/trpl/mutability.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ let y = &mut x;
3535

3636
`y` is an immutable binding to a mutable reference, which means that you can’t
3737
bind `y` to something else (`y = &mut z`), but you can mutate the thing that’s
38-
bound to `y`. (`*y = 5`) A subtle distinction.
38+
bound to `y` (`*y = 5`). A subtle distinction.
3939

4040
Of course, if you need both:
4141

branches/try/src/doc/trpl/patterns.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ match x {
6666
}
6767
```
6868

69-
This prints `something else`
69+
This prints `something else`.
7070

7171
# Bindings
7272

@@ -152,7 +152,7 @@ match x {
152152
}
153153
```
154154

155-
This prints `Got an int!`
155+
This prints `Got an int!`.
156156

157157
# ref and ref mut
158158

branches/try/src/doc/trpl/structs.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,3 +196,5 @@ useful. For instance, a library may ask you to create a structure that
196196
implements a certain [trait][trait] to handle events. If you don’t have
197197
any data you need to store in the structure, you can just create a
198198
unit-like struct.
199+
200+
[trait]: traits.html

branches/try/src/doc/trpl/the-stack-and-the-heap.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ Next, `foo()` calls `bar()` with `x` and `z`:
430430
| 2<sup>30</sup> | | 20 |
431431
| (2<sup>30</sup>) - 1 | | 5 |
432432
| ... | ... | ... |
433-
| 10 | e | 4 |
433+
| 10 | e | 9 |
434434
| 9 | d | (2<sup>30</sup>) - 1 |
435435
| 8 | c | 5 |
436436
| 7 | b | 4 |
@@ -455,7 +455,7 @@ At the end of `bar()`, it calls `baz()`:
455455
| ... | ... | ... |
456456
| 12 | g | 100 |
457457
| 11 | f | 4 |
458-
| 10 | e | 4 |
458+
| 10 | e | 9 |
459459
| 9 | d | (2<sup>30</sup>) - 1 |
460460
| 8 | c | 5 |
461461
| 7 | b | 4 |
@@ -477,7 +477,7 @@ After `baz()` is over, we get rid of `f` and `g`:
477477
| 2<sup>30</sup> | | 20 |
478478
| (2<sup>30</sup>) - 1 | | 5 |
479479
| ... | ... | ... |
480-
| 10 | e | 4 |
480+
| 10 | e | 9 |
481481
| 9 | d | (2<sup>30</sup>) - 1 |
482482
| 8 | c | 5 |
483483
| 7 | b | 4 |

branches/try/src/doc/trpl/while-loops.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Rust also has a `while` loop. It looks like this:
44

55
```{rust}
6-
let mut x = 5; // mut x: u32
6+
let mut x = 5; // mut x: i32
77
let mut done = false; // mut done: bool
88
99
while !done {

branches/try/src/libcollections/str.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,7 @@ macro_rules! utf8_acc_cont_byte {
396396

397397
#[stable(feature = "rust1", since = "1.0.0")]
398398
impl Borrow<str> for String {
399+
#[inline]
399400
fn borrow(&self) -> &str { &self[..] }
400401
}
401402

branches/try/src/librustc/util/common.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,24 @@ pub fn time<T, U, F>(do_it: bool, what: &str, u: U, f: F) -> T where
4444
r
4545
});
4646

47-
let mut u = Some(u);
4847
let mut rv = None;
4948
let dur = {
5049
let ref mut rvp = rv;
5150

5251
Duration::span(move || {
53-
*rvp = Some(f(u.take().unwrap()))
52+
*rvp = Some(f(u))
5453
})
5554
};
5655
let rv = rv.unwrap();
5756

58-
println!("{}time: {} \t{}", repeat(" ").take(old).collect::<String>(),
59-
dur, what);
57+
// Hack up our own formatting for the duration to make it easier for scripts
58+
// to parse (always use the same number of decimal places and the same unit).
59+
const NANOS_PER_SEC: f64 = 1_000_000_000.0;
60+
let secs = dur.secs() as f64;
61+
let secs = secs + dur.extra_nanos() as f64 / NANOS_PER_SEC;
62+
println!("{}time: {:.3} \t{}", repeat(" ").take(old).collect::<String>(),
63+
secs, what);
64+
6065
DEPTH.with(|slot| slot.set(old));
6166

6267
rv

branches/try/src/librustc_driver/driver.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -383,17 +383,8 @@ pub fn phase_2_configure_and_expand(sess: &Session,
383383
-> Option<ast::Crate> {
384384
let time_passes = sess.time_passes();
385385

386-
*sess.crate_types.borrow_mut() =
387-
collect_crate_types(sess, &krate.attrs);
388-
*sess.crate_metadata.borrow_mut() =
389-
collect_crate_metadata(sess, &krate.attrs);
390-
391-
time(time_passes, "recursion limit", (), |_| {
392-
middle::recursion_limit::update_recursion_limit(sess, &krate);
393-
});
394-
395-
// strip before expansion to allow macros to depend on
396-
// configuration variables e.g/ in
386+
// strip before anything else because crate metadata may use #[cfg_attr]
387+
// and so macros can depend on configuration variables, such as
397388
//
398389
// #[macro_use] #[cfg(foo)]
399390
// mod bar { macro_rules! baz!(() => {{}}) }
@@ -403,6 +394,15 @@ pub fn phase_2_configure_and_expand(sess: &Session,
403394
krate = time(time_passes, "configuration 1", krate, |krate|
404395
syntax::config::strip_unconfigured_items(sess.diagnostic(), krate));
405396

397+
*sess.crate_types.borrow_mut() =
398+
collect_crate_types(sess, &krate.attrs);
399+
*sess.crate_metadata.borrow_mut() =
400+
collect_crate_metadata(sess, &krate.attrs);
401+
402+
time(time_passes, "recursion limit", (), |_| {
403+
middle::recursion_limit::update_recursion_limit(sess, &krate);
404+
});
405+
406406
time(time_passes, "gated macro checking", (), |_| {
407407
let features =
408408
syntax::feature_gate::check_crate_macros(sess.codemap(),

branches/try/src/libstd/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
//! [`result`](result/index.html) modules define optional and
4141
//! error-handling types, `Option` and `Result`. The
4242
//! [`iter`](iter/index.html) module defines Rust's iterator trait,
43-
//! [`Iterater`](iter/trait.Iterator.html), which works with the `for`
43+
//! [`Iterator`](iter/trait.Iterator.html), which works with the `for`
4444
//! loop to access collections.
4545
//!
4646
//! The common container type, `Vec`, a growable vector backed by an array,
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
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+
// no-prefer-dynamic
12+
// compile-flags: --cfg foo
13+
14+
#![cfg_attr(foo, crate_type="lib")]
15+
16+
pub fn foo() {}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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+
// aux-build:crate-attributes-using-cfg_attr.rs
12+
13+
extern crate crate_attributes_using_cfg_attr;
14+
15+
pub fn main() {}

0 commit comments

Comments
 (0)