Skip to content

Commit 9848b77

Browse files
Z1Z1
authored andcommitted
---
yaml --- r: 208565 b: refs/heads/snap-stage3 c: 26560e7 h: refs/heads/master i: 208563: c4d3094 v: v3
1 parent 9d7f622 commit 9848b77

File tree

12 files changed

+54
-110
lines changed

12 files changed

+54
-110
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 38a97becdf3e6a6157f6f7ec2d98ade8d8edc193
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 716f920b7e234b450f272346fea961832505c06e
4+
refs/heads/snap-stage3: 26560e75b702c2254bb8a031276fcffda9bc1bde
55
refs/heads/try: 7b4ef47b7805a402d756fb8157101f64880a522f
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
# The Rust Programming Language
22

3-
Rust is a systems programming language that is fast, memory safe and
4-
multithreaded, but does not employ a garbage collector or otherwise
5-
impose significant runtime overhead.
6-
7-
This repo contains the code for `rustc`, the Rust compiler, as well
8-
as standard libraries, tools and documentation for Rust.
3+
This is a compiler for Rust, including standard libraries, tools and
4+
documentation. Rust is a systems programming language that is fast,
5+
memory safe and multithreaded, but does not employ a garbage collector
6+
or otherwise impose significant runtime overhead.
97

108
## Quick Start
119

branches/snap-stage3/src/doc/trpl/dining-philosophers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ let handles: Vec<_> = philosophers.into_iter().map(|p| {
396396
}).collect();
397397
```
398398

399-
While this is only five lines, they’re a dense five. Let’s break it down.
399+
While this is only five lines, they’re a dense four. Let’s break it down.
400400

401401
```rust,ignore
402402
let handles: Vec<_> =

branches/snap-stage3/src/doc/trpl/guessing-game.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Check out the generated `Cargo.toml`:
2727
[package]
2828

2929
name = "guessing_game"
30-
version = "0.1.0"
30+
version = "0.0.1"
3131
authors = ["Your Name <[email protected]>"]
3232
```
3333

@@ -46,7 +46,7 @@ Let’s try compiling what Cargo gave us:
4646

4747
```{bash}
4848
$ cargo build
49-
Compiling guessing_game v0.1.0 (file:///home/you/projects/guessing_game)
49+
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
5050
```
5151

5252
Excellent! Open up your `src/main.rs` again. We’ll be writing all of
@@ -58,7 +58,7 @@ Try it out:
5858

5959
```bash
6060
$ cargo run
61-
Compiling guessing_game v0.1.0 (file:///home/you/projects/guessing_game)
61+
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
6262
Running `target/debug/guessing_game`
6363
Hello, world!
6464
```
@@ -727,7 +727,7 @@ Let’s try our program out!
727727
728728
```bash
729729
$ cargo run
730-
Compiling guessing_game v0.1.0 (file:///home/you/projects/guessing_game)
730+
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
731731
Running `target/guessing_game`
732732
Guess the number!
733733
The secret number is: 58
@@ -792,7 +792,7 @@ and quit. Observe:
792792
793793
```bash
794794
$ cargo run
795-
Compiling guessing_game v0.1.0 (file:///home/you/projects/guessing_game)
795+
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
796796
Running `target/guessing_game`
797797
Guess the number!
798798
The secret number is: 59
@@ -929,7 +929,7 @@ Now we should be good! Let’s try:
929929
930930
```bash
931931
$ cargo run
932-
Compiling guessing_game v0.1.0 (file:///home/you/projects/guessing_game)
932+
Compiling guessing_game v0.0.1 (file:///home/you/projects/guessing_game)
933933
Running `target/guessing_game`
934934
Guess the number!
935935
The secret number is: 61

branches/snap-stage3/src/doc/trpl/nightly-rust.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ $ sh rustup.sh --channel=nightly
2626
If you're on Windows, please download either the [32-bit installer][win32] or
2727
the [64-bit installer][win64] and run it.
2828

29-
[win32]: https://static.rust-lang.org/dist/rust-1.0.0-beta-i686-pc-windows-gnu.msi
30-
[win64]: https://static.rust-lang.org/dist/rust-1.0.0-beta-x86_64-pc-windows-gnu.msi
29+
[win32]: https://static.rust-lang.org/dist/rust-nightly-i686-pc-windows-gnu.msi
30+
[win64]: https://static.rust-lang.org/dist/rust-nightly-x86_64-pc-windows-gnu.msi
3131

3232
## Uninstalling
3333

branches/snap-stage3/src/libsyntax/ext/quote.rs

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ pub mod rt {
2828
use ast;
2929
use codemap::Spanned;
3030
use ext::base::ExtCtxt;
31-
use parse::{self, token, classify};
31+
use parse::token;
32+
use parse;
3233
use ptr::P;
3334
use std::rc::Rc;
3435

@@ -93,18 +94,6 @@ pub mod rt {
9394
}
9495
}
9596

96-
impl ToTokens for ast::Generics {
97-
fn to_tokens(&self, _cx: &ExtCtxt) -> Vec<TokenTree> {
98-
vec![ast::TtToken(DUMMY_SP, token::Interpolated(token::NtGenerics(self.clone())))]
99-
}
100-
}
101-
102-
impl ToTokens for ast::WhereClause {
103-
fn to_tokens(&self, _cx: &ExtCtxt) -> Vec<TokenTree> {
104-
vec![ast::TtToken(DUMMY_SP, token::Interpolated(token::NtWhereClause(self.clone())))]
105-
}
106-
}
107-
10897
impl ToTokens for P<ast::Item> {
10998
fn to_tokens(&self, _cx: &ExtCtxt) -> Vec<TokenTree> {
11099
vec![ast::TtToken(self.span, token::Interpolated(token::NtItem(self.clone())))]
@@ -125,16 +114,7 @@ pub mod rt {
125114

126115
impl ToTokens for P<ast::Stmt> {
127116
fn to_tokens(&self, _cx: &ExtCtxt) -> Vec<TokenTree> {
128-
let mut tts = vec![
129-
ast::TtToken(self.span, token::Interpolated(token::NtStmt(self.clone())))
130-
];
131-
132-
// Some statements require a trailing semicolon.
133-
if classify::stmt_ends_with_semi(&self.node) {
134-
tts.push(ast::TtToken(self.span, token::Semi));
135-
}
136-
137-
tts
117+
vec![ast::TtToken(self.span, token::Interpolated(token::NtStmt(self.clone())))]
138118
}
139119
}
140120

branches/snap-stage3/src/libsyntax/fold.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -689,9 +689,6 @@ pub fn noop_fold_interpolated<T: Folder>(nt: token::Nonterminal, fld: &mut T)
689689
token::NtTraitItem(arm) =>
690690
token::NtTraitItem(fld.fold_trait_item(arm)
691691
.expect_one("expected fold to produce exactly one item")),
692-
token::NtGenerics(generics) => token::NtGenerics(fld.fold_generics(generics)),
693-
token::NtWhereClause(where_clause) =>
694-
token::NtWhereClause(fld.fold_where_clause(where_clause)),
695692
}
696693
}
697694

branches/snap-stage3/src/libsyntax/parse/lexer/mod.rs

Lines changed: 24 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -403,51 +403,45 @@ impl<'a> StringReader<'a> {
403403
Some('/') => {
404404
self.bump();
405405
self.bump();
406-
407406
// line comments starting with "///" or "//!" are doc-comments
408-
let doc_comment = self.curr_is('/') || self.curr_is('!');
409-
let start_bpos = if doc_comment {
410-
self.pos - BytePos(3)
411-
} else {
412-
self.last_pos - BytePos(2)
413-
};
414-
415-
while !self.is_eof() {
416-
match self.curr.unwrap() {
417-
'\n' => break,
418-
'\r' => {
419-
if self.nextch_is('\n') {
420-
// CRLF
421-
break
422-
} else if doc_comment {
423-
self.err_span_(self.last_pos, self.pos,
424-
"bare CR not allowed in doc-comment");
407+
if self.curr_is('/') || self.curr_is('!') {
408+
let start_bpos = self.pos - BytePos(3);
409+
while !self.is_eof() {
410+
match self.curr.unwrap() {
411+
'\n' => break,
412+
'\r' => {
413+
if self.nextch_is('\n') {
414+
// CRLF
415+
break
416+
} else {
417+
self.err_span_(self.last_pos, self.pos,
418+
"bare CR not allowed in doc-comment");
419+
}
425420
}
421+
_ => ()
426422
}
427-
_ => ()
423+
self.bump();
428424
}
429-
self.bump();
430-
}
431-
432-
return if doc_comment {
433-
self.with_str_from(start_bpos, |string| {
434-
// comments with only more "/"s are not doc comments
425+
return self.with_str_from(start_bpos, |string| {
426+
// but comments with only more "/"s are not
435427
let tok = if is_doc_comment(string) {
436428
token::DocComment(token::intern(string))
437429
} else {
438430
token::Comment
439431
};
440432

441-
Some(TokenAndSpan {
433+
return Some(TokenAndSpan{
442434
tok: tok,
443435
sp: codemap::mk_sp(start_bpos, self.last_pos)
444-
})
445-
})
436+
});
437+
});
446438
} else {
447-
Some(TokenAndSpan {
439+
let start_bpos = self.last_pos - BytePos(2);
440+
while !self.curr_is('\n') && !self.is_eof() { self.bump(); }
441+
return Some(TokenAndSpan {
448442
tok: token::Comment,
449443
sp: codemap::mk_sp(start_bpos, self.last_pos)
450-
})
444+
});
451445
}
452446
}
453447
Some('*') => {
@@ -1569,13 +1563,4 @@ mod tests {
15691563
assert_eq!(lexer.next_token().tok, token::Literal(token::Char(token::intern("a")), None));
15701564
}
15711565

1572-
#[test] fn crlf_comments() {
1573-
let sh = mk_sh();
1574-
let mut lexer = setup(&sh, "// test\r\n/// test\r\n".to_string());
1575-
let comment = lexer.next_token();
1576-
assert_eq!(comment.tok, token::Comment);
1577-
assert_eq!(comment.sp, ::codemap::mk_sp(BytePos(0), BytePos(7)));
1578-
assert_eq!(lexer.next_token().tok, token::Whitespace);
1579-
assert_eq!(lexer.next_token().tok, token::DocComment(token::intern("/// test")));
1580-
}
15811566
}

branches/snap-stage3/src/libsyntax/parse/parser.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3808,8 +3808,6 @@ impl<'a> Parser<'a> {
38083808
/// | ( < lifetimes , typaramseq ( , )? > )
38093809
/// where typaramseq = ( typaram ) | ( typaram , typaramseq )
38103810
pub fn parse_generics(&mut self) -> PResult<ast::Generics> {
3811-
maybe_whole!(self, NtGenerics);
3812-
38133811
if try!(self.eat(&token::Lt) ){
38143812
let lifetime_defs = try!(self.parse_lifetime_defs());
38153813
let mut seen_default = false;
@@ -3930,8 +3928,6 @@ impl<'a> Parser<'a> {
39303928
/// where T : Trait<U, V> + 'b, 'a : 'b
39313929
/// ```
39323930
pub fn parse_where_clause(&mut self) -> PResult<ast::WhereClause> {
3933-
maybe_whole!(self, NtWhereClause);
3934-
39353931
let mut where_clause = WhereClause {
39363932
id: ast::DUMMY_NODE_ID,
39373933
predicates: Vec::new(),

branches/snap-stage3/src/libsyntax/parse/token.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -385,8 +385,6 @@ pub enum Nonterminal {
385385
NtArm(ast::Arm),
386386
NtImplItem(P<ast::ImplItem>),
387387
NtTraitItem(P<ast::TraitItem>),
388-
NtGenerics(ast::Generics),
389-
NtWhereClause(ast::WhereClause),
390388
}
391389

392390
impl fmt::Debug for Nonterminal {
@@ -405,8 +403,6 @@ impl fmt::Debug for Nonterminal {
405403
NtArm(..) => f.pad("NtArm(..)"),
406404
NtImplItem(..) => f.pad("NtImplItem(..)"),
407405
NtTraitItem(..) => f.pad("NtTraitItem(..)"),
408-
NtGenerics(..) => f.pad("NtGenerics(..)"),
409-
NtWhereClause(..) => f.pad("NtWhereClause(..)"),
410406
}
411407
}
412408
}

branches/snap-stage3/src/libsyntax/print/pprust.rs

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -287,21 +287,19 @@ pub fn token_to_string(tok: &Token) -> String {
287287
token::SpecialVarNt(var) => format!("${}", var.as_str()),
288288

289289
token::Interpolated(ref nt) => match *nt {
290-
token::NtExpr(ref e) => expr_to_string(&**e),
291-
token::NtMeta(ref e) => meta_item_to_string(&**e),
292-
token::NtTy(ref e) => ty_to_string(&**e),
293-
token::NtPath(ref e) => path_to_string(&**e),
294-
token::NtItem(ref e) => item_to_string(&**e),
295-
token::NtBlock(ref e) => block_to_string(&**e),
296-
token::NtStmt(ref e) => stmt_to_string(&**e),
297-
token::NtPat(ref e) => pat_to_string(&**e),
298-
token::NtIdent(ref e, _) => ident_to_string(&**e),
299-
token::NtTT(ref e) => tt_to_string(&**e),
300-
token::NtArm(ref e) => arm_to_string(&*e),
301-
token::NtImplItem(ref e) => impl_item_to_string(&**e),
302-
token::NtTraitItem(ref e) => trait_item_to_string(&**e),
303-
token::NtGenerics(ref e) => generics_to_string(&*e),
304-
token::NtWhereClause(ref e) => where_clause_to_string(&*e),
290+
token::NtExpr(ref e) => expr_to_string(&**e),
291+
token::NtMeta(ref e) => meta_item_to_string(&**e),
292+
token::NtTy(ref e) => ty_to_string(&**e),
293+
token::NtPath(ref e) => path_to_string(&**e),
294+
token::NtItem(..) => "an interpolated item".to_string(),
295+
token::NtBlock(..) => "an interpolated block".to_string(),
296+
token::NtStmt(..) => "an interpolated statement".to_string(),
297+
token::NtPat(..) => "an interpolated pattern".to_string(),
298+
token::NtIdent(..) => "an interpolated identifier".to_string(),
299+
token::NtTT(..) => "an interpolated tt".to_string(),
300+
token::NtArm(..) => "an interpolated arm".to_string(),
301+
token::NtImplItem(..) => "an interpolated impl item".to_string(),
302+
token::NtTraitItem(..) => "an interpolated trait item".to_string(),
305303
}
306304
}
307305
}

branches/snap-stage3/src/test/run-pass-fulldeps/quote-tokens.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,6 @@ fn syntax_extension(cx: &ExtCtxt) {
4343
let _n: syntax::ast::Attribute = quote_attr!(cx, #![cfg(foo, bar = "baz")]);
4444

4545
let _o: Option<P<syntax::ast::Item>> = quote_item!(cx, fn foo<T: ?Sized>() {});
46-
47-
let stmts = vec![
48-
quote_stmt!(cx, let x = 1;).unwrap(),
49-
quote_stmt!(cx, let y = 2;).unwrap(),
50-
];
51-
let expr: P<syntax::ast::Expr> = quote_expr!(cx, x + y);
5246
}
5347

5448
fn main() {

0 commit comments

Comments
 (0)