Skip to content

Commit 354d459

Browse files
committed
---
yaml --- r: 208575 b: refs/heads/snap-stage3 c: e10bd27 h: refs/heads/master i: 208573: ce6fcbd 208571: 52b3c2a 208567: db156f0 208559: 63aa6a0 208543: 088371a 208511: 175eda3 v: v3
1 parent ffbc2e9 commit 354d459

File tree

8 files changed

+72
-39
lines changed

8 files changed

+72
-39
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: 6149e32b0ba41b39d6d81b7f5d28908c86debf18
4+
refs/heads/snap-stage3: e10bd27f50cc37618fd364d50b5ef0bcffdd46d8
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: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# The Rust Programming Language
22

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.
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.
79

810
## Quick Start
911

branches/snap-stage3/src/doc/trpl/const-and-static.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,8 @@ static N: i32 = 5;
3131

3232
Unlike [`let`][let] bindings, you must annotate the type of a `static`.
3333

34-
[let]: variable-bindings.html
35-
3634
Statics live for the entire lifetime of a program, and therefore any
37-
reference stored in a constant has a [`static` lifetime][lifetimes]:
35+
reference stored in a constant has a [`'static` lifetime][lifetimes]:
3836

3937
```rust
4038
static NAME: &'static str = "Steve";

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/doc/trpl/traits.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ let result = f.write("whatever".as_bytes());
208208

209209
This will compile without error.
210210

211-
This means that even if someone does something bad like add methods to `int`,
211+
This means that even if someone does something bad like add methods to `i32`,
212212
it won’t affect you, unless you `use` that trait.
213213

214214
There’s one more restriction on implementing traits. Either the trait or the

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

Lines changed: 39 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -403,45 +403,51 @@ impl<'a> StringReader<'a> {
403403
Some('/') => {
404404
self.bump();
405405
self.bump();
406+
406407
// line comments starting with "///" or "//!" are doc-comments
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-
}
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");
420425
}
421-
_ => ()
422426
}
423-
self.bump();
427+
_ => ()
424428
}
425-
return self.with_str_from(start_bpos, |string| {
426-
// but comments with only more "/"s are not
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
427435
let tok = if is_doc_comment(string) {
428436
token::DocComment(token::intern(string))
429437
} else {
430438
token::Comment
431439
};
432440

433-
return Some(TokenAndSpan{
441+
Some(TokenAndSpan {
434442
tok: tok,
435443
sp: codemap::mk_sp(start_bpos, self.last_pos)
436-
});
437-
});
444+
})
445+
})
438446
} else {
439-
let start_bpos = self.last_pos - BytePos(2);
440-
while !self.curr_is('\n') && !self.is_eof() { self.bump(); }
441-
return Some(TokenAndSpan {
447+
Some(TokenAndSpan {
442448
tok: token::Comment,
443449
sp: codemap::mk_sp(start_bpos, self.last_pos)
444-
});
450+
})
445451
}
446452
}
447453
Some('*') => {
@@ -1563,4 +1569,13 @@ mod tests {
15631569
assert_eq!(lexer.next_token().tok, token::Literal(token::Char(token::intern("a")), None));
15641570
}
15651571

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+
}
15661581
}

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2026,7 +2026,8 @@ impl<'a> Parser<'a> {
20262026
return self.parse_block_expr(lo, DefaultBlock);
20272027
},
20282028
token::BinOp(token::Or) | token::OrOr => {
2029-
return self.parse_lambda_expr(CaptureByRef);
2029+
let lo = self.span.lo;
2030+
return self.parse_lambda_expr(lo, CaptureByRef);
20302031
},
20312032
token::Ident(id @ ast::Ident {
20322033
name: token::SELF_KEYWORD_NAME,
@@ -2081,7 +2082,8 @@ impl<'a> Parser<'a> {
20812082
return Ok(self.mk_expr(lo, hi, ExprPath(Some(qself), path)));
20822083
}
20832084
if try!(self.eat_keyword(keywords::Move) ){
2084-
return self.parse_lambda_expr(CaptureByValue);
2085+
let lo = self.last_span.lo;
2086+
return self.parse_lambda_expr(lo, CaptureByValue);
20852087
}
20862088
if try!(self.eat_keyword(keywords::If)) {
20872089
return self.parse_if_expr();
@@ -2840,10 +2842,9 @@ impl<'a> Parser<'a> {
28402842
}
28412843

28422844
// `|args| expr`
2843-
pub fn parse_lambda_expr(&mut self, capture_clause: CaptureClause)
2845+
pub fn parse_lambda_expr(&mut self, lo: BytePos, capture_clause: CaptureClause)
28442846
-> PResult<P<Expr>>
28452847
{
2846-
let lo = self.span.lo;
28472848
let decl = try!(self.parse_fn_block_decl());
28482849
let body = match decl.output {
28492850
DefaultReturn(_) => {
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
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+
// Make sure that the span of a closure marked `move` begins at the `move` keyword.
12+
13+
fn main() {
14+
let x: () =
15+
move //~ ERROR mismatched types
16+
|| ();
17+
}

0 commit comments

Comments
 (0)