Skip to content

Commit dd54ea6

Browse files
committed
---
yaml --- r: 129612 b: refs/heads/auto c: da9da328432d65b2cacc806a535669796ad33c9b h: refs/heads/master v: v3
1 parent ff48def commit dd54ea6

File tree

84 files changed

+314
-649
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+314
-649
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: 0db6f4cb57e6209dcd6e6d66732c190b652f6485
16+
refs/heads/auto: da9da328432d65b2cacc806a535669796ad33c9b
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/doc/guide-tasks.md

Lines changed: 125 additions & 274 deletions
Large diffs are not rendered by default.

branches/auto/src/doc/guide.md

Lines changed: 22 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1801,7 +1801,6 @@ Let's try compiling what Cargo gave us:
18011801
```{bash}
18021802
$ cargo build
18031803
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
1804-
$
18051804
```
18061805

18071806
Excellent! Open up your `src/main.rs` again. We'll be writing all of
@@ -1814,10 +1813,9 @@ Try it out:
18141813

18151814
```{notrust,ignore}
18161815
$ cargo run
1817-
Compiling guessing_game v0.1.0 (file:/home/you/projects/guessing_game)
1816+
Compiling guessing_game v0.1.0 (file:///home/you/projects/guessing_game)
18181817
Running `target/guessing_game`
18191818
Hello, world!
1820-
$
18211819
```
18221820

18231821
Great! The `run` command comes in handy when you need to rapidly iterate on a project.
@@ -1957,18 +1955,12 @@ fn main() {
19571955
}
19581956
```
19591957

1960-
... and then recompile:
1958+
Try running our new program a few times:
19611959

19621960
```{notrust,ignore}
1963-
$ cargo build
1964-
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
1965-
$
1966-
```
1967-
1968-
Excellent! Try running our new program a few times:
1969-
1970-
```{notrust,ignore}
1971-
$ ./target/guessing_game
1961+
$ cargo run
1962+
Compiling guessing_game v0.1.0 (file:///home/you/projects/guessing_game)
1963+
Running `target/guessing_game`
19721964
Guess the number!
19731965
The secret number is: 7
19741966
Please input your guess.
@@ -2019,9 +2011,9 @@ fn main() {
20192011
And trying it out:
20202012

20212013
```{notrust,ignore}
2022-
$ cargo build
2023-
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
2024-
$ ./target/guessing_game
2014+
$ cargo run
2015+
Compiling guessing_game v0.1.0 (file:///home/you/projects/guessing_game)
2016+
Running `target/guessing_game`
20252017
Guess the number!
20262018
The secret number is: 57
20272019
Please input your guess.
@@ -2290,15 +2282,14 @@ We use a `match` to either give us the `uint` inside of the `Option`, or we
22902282
print an error message and return. Let's give this a shot:
22912283

22922284
```{notrust,ignore}
2293-
$ cargo build
2294-
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
2295-
$ ./target/guessing_game
2285+
$ cargo run
2286+
Compiling guessing_game v0.1.0 (file:///home/you/projects/guessing_game)
2287+
Running `target/guessing_game`
22962288
Guess the number!
22972289
The secret number is: 17
22982290
Please input your guess.
22992291
5
23002292
Please input a number!
2301-
$
23022293
```
23032294

23042295
Uh, what? But we did!
@@ -2356,16 +2347,15 @@ fn cmp(a: uint, b: uint) -> Ordering {
23562347
Let's try it!
23572348

23582349
```{notrust,ignore}
2359-
$ cargo build
2360-
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
2361-
$ ./target/guessing_game
2350+
$ cargo run
2351+
Compiling guessing_game v0.1.0 (file:///home/you/projects/guessing_game)
2352+
Running `target/guessing_game`
23622353
Guess the number!
23632354
The secret number is: 58
23642355
Please input your guess.
23652356
76
23662357
You guessed: 76
23672358
Too big!
2368-
$
23692359
```
23702360

23712361
Nice! You can see I even added spaces before my guess, and it still figured
@@ -2434,9 +2424,9 @@ And try it out. But wait, didn't we just add an infinite loop? Yup. Remember
24342424
that `return`? If we give a non-number answer, we'll `return` and quit. Observe:
24352425

24362426
```{notrust,ignore}
2437-
$ cargo build
2438-
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
2439-
$ ./target/guessing_game
2427+
$ cargo run
2428+
Compiling guessing_game v0.1.0 (file:///home/you/projects/guessing_game)
2429+
Running `target/guessing_game`
24402430
Guess the number!
24412431
The secret number is: 59
24422432
Please input your guess.
@@ -2454,7 +2444,6 @@ You win!
24542444
Please input your guess.
24552445
quit
24562446
Please input a number!
2457-
$
24582447
```
24592448

24602449
Ha! `quit` actually quits. As does any other non-number input. Well, this is
@@ -2566,10 +2555,10 @@ fn cmp(a: uint, b: uint) -> Ordering {
25662555

25672556
Now we should be good! Let's try:
25682557

2569-
```{rust,ignore}
2570-
$ cargo build
2571-
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
2572-
$ ./target/guessing_game
2558+
```{notrust,ignore}
2559+
$ cargo run
2560+
Compiling guessing_game v0.1.0 (file:///home/you/projects/guessing_game)
2561+
Running `target/guessing_game`
25732562
Guess the number!
25742563
The secret number is: 61
25752564
Please input your guess.
@@ -2771,7 +2760,6 @@ $ cargo run
27712760
Compiling modules v0.0.1 (file:///home/you/projects/modules)
27722761
Running `target/modules`
27732762
Hello, world!
2774-
$
27752763
```
27762764

27772765
Nice!
@@ -2811,8 +2799,7 @@ be named, by convention.
28112799
Next, we added an `extern crate modules` to the top of our `src/main.rs`. This,
28122800
as you can guess, lets Rust know that our crate relies on another, external
28132801
crate. We also had to modify our call to `print_hello`: now that it's in
2814-
another crate, we need to first specify the crate, then the module inside of it,
2815-
then the function name.
2802+
another crate, we need to specify that crate first.
28162803

28172804
This doesn't _quite_ work yet. Try it:
28182805

@@ -2923,7 +2910,6 @@ This should all compile as usual:
29232910
```{notrust,ignore}
29242911
$ cargo build
29252912
Compiling modules v0.0.1 (file:///home/you/projects/modules)
2926-
$
29272913
```
29282914

29292915
We've seen how the `::` operator can be used to call into modules, but when
@@ -3097,7 +3083,6 @@ $ cargo run
30973083
Compiling testing v0.0.1 (file:///home/you/projects/testing)
30983084
Running `target/testing`
30993085
Hello, world!
3100-
$
31013086
```
31023087

31033088
Great. Rust's infrastructure supports tests in two sorts of places, and they're
@@ -3250,7 +3235,6 @@ running 1 test
32503235
test foo ... ok
32513236
32523237
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
3253-
$
32543238
```
32553239

32563240
Nice! Our test passes, as we expected. Let's get rid of that warning for our `main`

branches/auto/src/doc/rust.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -891,9 +891,8 @@ There are several kinds of view item:
891891
##### Extern crate declarations
892892

893893
~~~~ {.ebnf .gram}
894-
extern_crate_decl : "extern" "crate" ident [ '(' link_attrs ')' ] ? [ '=' string_lit ] ? ;
895-
link_attrs : link_attr [ ',' link_attrs ] + ;
896-
link_attr : ident '=' literal ;
894+
extern_crate_decl : "extern" "crate" crate_name
895+
crate_name: ident | ( string_lit as ident )
897896
~~~~
898897

899898
An _`extern crate` declaration_ specifies a dependency on an external crate.
@@ -913,11 +912,9 @@ Four examples of `extern crate` declarations:
913912
~~~~ {.ignore}
914913
extern crate pcre;
915914
916-
extern crate std; // equivalent to: extern crate std = "std";
915+
extern crate std; // equivalent to: extern crate std as std;
917916
918-
extern crate ruststd = "std"; // linking to 'std' under another name
919-
920-
extern crate foo = "some/where/rust-foo#foo:1.0"; // a full crate ID for external tools
917+
extern crate "std" as ruststd; // linking to 'std' under another name
921918
~~~~
922919

923920
##### Use declarations

branches/auto/src/libglob/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,16 @@
2424
*/
2525

2626
#![crate_name = "glob"]
27-
#![experimental]
27+
#![deprecated = "This is now a cargo package located at: \
28+
https://github.com/rust-lang/glob"]
2829
#![crate_type = "rlib"]
2930
#![crate_type = "dylib"]
3031
#![license = "MIT/ASL2"]
3132
#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
3233
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
3334
html_root_url = "http://doc.rust-lang.org/master/",
3435
html_playground_url = "http://play.rust-lang.org/")]
36+
#![allow(deprecated)]
3537

3638
use std::cell::Cell;
3739
use std::{cmp, os, path};
@@ -64,6 +66,7 @@ pub struct Paths {
6466
/// `puppies.jpg` and `hamsters.gif`:
6567
///
6668
/// ```rust
69+
/// # #![allow(deprecated)]
6770
/// use glob::glob;
6871
///
6972
/// for path in glob("/media/pictures/*.jpg") {

branches/auto/src/librustc/lint/builtin.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ impl LintPass for NonCamelCaseTypes {
754754

755755
// start with a non-lowercase letter rather than non-uppercase
756756
// ones (some scripts don't have a concept of upper/lowercase)
757-
!ident.char_at(0).is_lowercase() && !ident.contains_char('_')
757+
ident.len() > 0 && !ident.char_at(0).is_lowercase() && !ident.contains_char('_')
758758
}
759759

760760
fn to_camel_case(s: &str) -> String {
@@ -768,9 +768,13 @@ impl LintPass for NonCamelCaseTypes {
768768
let s = token::get_ident(ident);
769769

770770
if !is_camel_case(ident) {
771-
cx.span_lint(NON_CAMEL_CASE_TYPES, span,
772-
format!("{} `{}` should have a camel case name such as `{}`",
773-
sort, s, to_camel_case(s.get())).as_slice());
771+
let c = to_camel_case(s.get());
772+
let m = if c.is_empty() {
773+
format!("{} `{}` should have a camel case name such as `CamelCase`", sort, s)
774+
} else {
775+
format!("{} `{}` should have a camel case name such as `{}`", sort, s, c)
776+
};
777+
cx.span_lint(NON_CAMEL_CASE_TYPES, span, m.as_slice());
774778
}
775779
}
776780

branches/auto/src/librustc/middle/intrinsicck.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,21 +73,25 @@ struct IntrinsicCheckingVisitor<'a> {
7373

7474
impl<'a> IntrinsicCheckingVisitor<'a> {
7575
fn def_id_is_transmute(&self, def_id: DefId) -> bool {
76+
let intrinsic = match ty::get(ty::lookup_item_type(self.tcx, def_id).ty).sty {
77+
ty::ty_bare_fn(ref bfty) => bfty.abi == RustIntrinsic,
78+
_ => return false
79+
};
7680
if def_id.krate == ast::LOCAL_CRATE {
7781
match self.tcx.map.get(def_id.node) {
78-
NodeForeignItem(ref item) => {
82+
NodeForeignItem(ref item) if intrinsic => {
7983
token::get_ident(item.ident) ==
8084
token::intern_and_get_ident("transmute")
8185
}
8286
_ => false,
8387
}
8488
} else {
8589
match csearch::get_item_path(self.tcx, def_id).last() {
86-
None => false,
87-
Some(ref last) => {
90+
Some(ref last) if intrinsic => {
8891
token::get_name(last.name()) ==
8992
token::intern_and_get_ident("transmute")
9093
}
94+
_ => false,
9195
}
9296
}
9397
}

branches/auto/src/librustdoc/clean/inline.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,7 @@ fn try_inline_def(cx: &core::DocContext,
124124
pub fn load_attrs(tcx: &ty::ctxt, did: ast::DefId) -> Vec<clean::Attribute> {
125125
let mut attrs = Vec::new();
126126
csearch::get_item_attrs(&tcx.sess.cstore, did, |v| {
127-
attrs.extend(v.move_iter().map(|mut a| {
128-
// FIXME this isn't quite always true, it's just true about 99% of
129-
// the time when dealing with documentation. For example,
130-
// this would treat doc comments of the form `#[doc = "foo"]`
131-
// incorrectly.
132-
if a.name().get() == "doc" && a.value_str().is_some() {
133-
a.node.is_sugared_doc = true;
134-
}
127+
attrs.extend(v.move_iter().map(|a| {
135128
a.clean()
136129
}));
137130
});

branches/auto/src/libstd/rand/os.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ mod imp {
8585
marker: marker::NoCopy
8686
}
8787

88+
#[repr(C)]
8889
struct SecRandom;
8990

9091
static kSecRandomDefault: *const SecRandom = 0 as *const SecRandom;

branches/auto/src/libsync/comm/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@
8686
//!
8787
//! ```
8888
//! // Create a shared channel which can be sent along from many tasks
89+
//! // where tx is the sending half (tx for transmission), and rx is the receiving
90+
//! // half (rx for receiving).
8991
//! let (tx, rx) = channel();
9092
//! for i in range(0i, 10i) {
9193
//! let tx = tx.clone();
@@ -473,6 +475,8 @@ impl<T> UnsafeFlavor<T> for Receiver<T> {
473475
/// # Example
474476
///
475477
/// ```
478+
/// // tx is is the sending half (tx for transmission), and rx is the receiving
479+
/// // half (rx for receiving).
476480
/// let (tx, rx) = channel();
477481
///
478482
/// // Spawn off an expensive computation

branches/auto/src/libsync/spsc_queue.rs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -315,27 +315,6 @@ mod test {
315315
assert_eq!(consumer.pop(), None);
316316
}
317317

318-
// This behaviour is blocked by the type system if using the safe constructor
319-
#[test]
320-
fn pop_peeked_unchecked() {
321-
let q = unsafe { Queue::new(0) };
322-
q.push(vec![1i]);
323-
q.push(vec![2]);
324-
let peeked = q.peek().unwrap();
325-
326-
assert_eq!(*peeked, vec![1]);
327-
assert_eq!(q.pop(), Some(vec![1]));
328-
329-
assert_eq!(*peeked, vec![1]);
330-
q.push(vec![7]);
331-
332-
// Note: This should actually expect 1, but this test is to highlight
333-
// the unsafety allowed by the unchecked usage. A Rust user would not
334-
// expect their peeked value to mutate like this without the type system
335-
// complaining.
336-
assert_eq!(*peeked, vec![7]);
337-
}
338-
339318
#[test]
340319
fn peek() {
341320
let (mut consumer, mut producer) = queue(0);

branches/auto/src/libsyntax/parse/parser.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4807,7 +4807,8 @@ impl<'a> Parser<'a> {
48074807
/// # Example
48084808
///
48094809
/// extern crate url;
4810-
/// extern crate foo = "bar";
4810+
/// extern crate foo = "bar"; //deprecated
4811+
/// extern crate "bar" as foo;
48114812
fn parse_item_extern_crate(&mut self,
48124813
lo: BytePos,
48134814
visibility: Visibility,
@@ -4818,14 +4819,23 @@ impl<'a> Parser<'a> {
48184819
token::IDENT(..) => {
48194820
let the_ident = self.parse_ident();
48204821
self.expect_one_of(&[], &[token::EQ, token::SEMI]);
4822+
// NOTE - #16689 change this to a warning once
4823+
// the 'as' support is in stage0
48214824
let path = if self.token == token::EQ {
48224825
self.bump();
48234826
Some(self.parse_str())
48244827
} else {None};
48254828

48264829
self.expect(&token::SEMI);
48274830
(path, the_ident)
4828-
}
4831+
},
4832+
token::LIT_STR(..) | token::LIT_STR_RAW(..) => {
4833+
let path = self.parse_str();
4834+
self.expect_keyword(keywords::As);
4835+
let the_ident = self.parse_ident();
4836+
self.expect(&token::SEMI);
4837+
(Some(path), the_ident)
4838+
},
48294839
_ => {
48304840
let span = self.span;
48314841
let token_str = self.this_token_to_string();

0 commit comments

Comments
 (0)