Skip to content

Commit c0aee62

Browse files
committed
---
yaml --- r: 83758 b: refs/heads/try c: b17dc4a h: refs/heads/master v: v3
1 parent e7a43dc commit c0aee62

File tree

15 files changed

+11
-188
lines changed

15 files changed

+11
-188
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: 0e4d1fc8cae42e15e00f71d9f439b01bb25a86ae
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 6c08cc2db4f98e9f07ae7d50338396c4123c2f0a
5-
refs/heads/try: 97878725532c4d1dd1af07e88175462178d78cdb
5+
refs/heads/try: b17dc4a946838a7f0a1d8eb752536243e322e8de
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/doc/rust.md

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -239,14 +239,13 @@ literal : string_lit | char_lit | num_lit ;
239239

240240
~~~~~~~~ {.ebnf .gram}
241241
char_lit : '\x27' char_body '\x27' ;
242-
string_lit : '"' string_body * '"' | 'r' raw_string ;
242+
string_lit : '"' string_body * '"' ;
243243
244244
char_body : non_single_quote
245245
| '\x5c' [ '\x27' | common_escape ] ;
246246
247247
string_body : non_double_quote
248248
| '\x5c' [ '\x22' | common_escape ] ;
249-
raw_string : '"' raw_string_body '"' | '#' raw_string '#' ;
250249
251250
common_escape : '\x5c'
252251
| 'n' | 'r' | 't' | '0'
@@ -268,10 +267,9 @@ which must be _escaped_ by a preceding U+005C character (`\`).
268267

269268
A _string literal_ is a sequence of any Unicode characters enclosed within
270269
two `U+0022` (double-quote) characters, with the exception of `U+0022`
271-
itself, which must be _escaped_ by a preceding `U+005C` character (`\`),
272-
or a _raw string literal_.
270+
itself, which must be _escaped_ by a preceding `U+005C` character (`\`).
273271

274-
Some additional _escapes_ are available in either character or non-raw string
272+
Some additional _escapes_ are available in either character or string
275273
literals. An escape starts with a `U+005C` (`\`) and continues with one of
276274
the following forms:
277275

@@ -287,35 +285,9 @@ the following forms:
287285
* A _whitespace escape_ is one of the characters `U+006E` (`n`), `U+0072`
288286
(`r`), or `U+0074` (`t`), denoting the unicode values `U+000A` (LF),
289287
`U+000D` (CR) or `U+0009` (HT) respectively.
290-
* The _backslash escape_ is the character `U+005C` (`\`) which must be
288+
* The _backslash escape_ is the character U+005C (`\`) which must be
291289
escaped in order to denote *itself*.
292290

293-
Raw string literals do not process any escapes. They start with the character
294-
`U+0072` (`r`), followed zero or more of the character `U+0023` (`#`) and a
295-
`U+0022` (double-quote) character. The _raw string body_ is not defined in the
296-
EBNF grammar above: it can contain any sequence of Unicode characters and is
297-
terminated only by another `U+0022` (double-quote) character, followed by the
298-
same number of `U+0023` (`#`) characters that preceeded the opening `U+0022`
299-
(double-quote) character.
300-
301-
All Unicode characters contained in the raw string body represent themselves,
302-
the characters `U+0022` (double-quote) (except when followed by at least as
303-
many `U+0023` (`#`) characters as were used to start the raw string literal) or
304-
`U+005C` (`\`) do not have any special meaning.
305-
306-
Examples for string literals:
307-
308-
~~~
309-
"foo"; r"foo"; // foo
310-
"\"foo\""; r#""foo""#; // "foo"
311-
312-
"foo #\"# bar";
313-
r##"foo #"# bar"##; // foo #"# bar
314-
315-
"\x52"; "R"; r"R"; // R
316-
"\\x52"; r"\x52"; // \x52
317-
~~~
318-
319291
#### Number literals
320292

321293
~~~~~~~~ {.ebnf .gram}

branches/try/doc/tutorial.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -353,12 +353,7 @@ whose literals are written between single quotes, as in `'x'`.
353353
Just like C, Rust understands a number of character escapes, using the backslash
354354
character, such as `\n`, `\r`, and `\t`. String literals,
355355
written between double quotes, allow the same escape sequences.
356-
357-
On the other hand, raw string literals do not process any escape sequences.
358-
They are written as `r##"blah"##`, with a matching number of zero or more `#`
359-
before the opening and after the closing quote, and can contain any sequence of
360-
characters except their closing delimiter. More on strings
361-
[later](#vectors-and-strings).
356+
More on strings [later](#vectors-and-strings).
362357

363358
The nil type, written `()`, has a single value, also written `()`.
364359

branches/try/src/etc/vim/syntax/rust.vim

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ syn match rustFormat display "%%" contained
148148
syn match rustSpecial display contained /\\\([nrt\\'"]\|x\x\{2}\|u\x\{4}\|U\x\{8}\)/
149149
syn match rustStringContinuation display contained /\\\n\s*/
150150
syn region rustString start=+"+ skip=+\\\\\|\\"+ end=+"+ contains=rustTodo,rustFormat,rustSpecial,rustStringContinuation
151-
syn region rustString start='r\z(#*\)"' end='"\z1'
152151

153152
syn region rustAttribute start="#\[" end="\]" contains=rustString,rustDeriving
154153
syn region rustDeriving start="deriving(" end=")" contained contains=rustTrait

branches/try/src/librustc/middle/trans/glue.rs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,6 @@ pub fn trans_struct_drop_flag(bcx: @mut Block, t: ty::t, v0: ValueRef, dtor_did:
423423
bcx = drop_ty(bcx, llfld_a, fld.mt.ty);
424424
}
425425

426-
Store(bcx, C_u8(0), drop_flag);
427426
bcx
428427
}
429428
}
@@ -595,23 +594,6 @@ pub fn make_take_glue(bcx: @mut Block, v: ValueRef, t: ty::t) -> @mut Block {
595594
bcx
596595
}
597596
ty::ty_opaque_closure_ptr(_) => bcx,
598-
ty::ty_struct(did, _) => {
599-
let tcx = bcx.tcx();
600-
let bcx = iter_structural_ty(bcx, v, t, take_ty);
601-
602-
match ty::ty_dtor(tcx, did) {
603-
ty::TraitDtor(_, false) => {
604-
// Zero out the struct
605-
unsafe {
606-
let ty = Type::from_ref(llvm::LLVMTypeOf(v));
607-
memzero(&B(bcx), v, ty);
608-
}
609-
610-
}
611-
_ => { }
612-
}
613-
bcx
614-
}
615597
_ if ty::type_is_structural(t) => {
616598
iter_structural_ty(bcx, v, t, take_ty)
617599
}

branches/try/src/libsyntax/ext/base.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,8 +437,7 @@ pub fn get_single_str_from_tts(cx: @ExtCtxt,
437437
}
438438

439439
match tts[0] {
440-
ast::tt_tok(_, token::LIT_STR(ident))
441-
| ast::tt_tok(_, token::LIT_STR_RAW(ident, _)) => cx.str_of(ident),
440+
ast::tt_tok(_, token::LIT_STR(ident)) => cx.str_of(ident),
442441
_ => cx.span_fatal(sp, format!("{} requires a string.", name)),
443442
}
444443
}

branches/try/src/libsyntax/ext/quote.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -464,13 +464,6 @@ fn mk_token(cx: @ExtCtxt, sp: Span, tok: &token::Token) -> @ast::Expr {
464464
~[mk_ident(cx, sp, ident)]);
465465
}
466466

467-
LIT_STR_RAW(ident, n) => {
468-
return cx.expr_call_ident(sp,
469-
id_ext("LIT_STR_RAW"),
470-
~[mk_ident(cx, sp, ident),
471-
cx.expr_uint(sp, n)]);
472-
}
473-
474467
IDENT(ident, b) => {
475468
return cx.expr_call_ident(sp,
476469
id_ext("IDENT"),

branches/try/src/libsyntax/parse/lexer.rs

Lines changed: 2 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -213,22 +213,10 @@ fn byte_offset(rdr: &StringReader, pos: BytePos) -> BytePos {
213213
(pos - rdr.filemap.start_pos)
214214
}
215215

216-
/// Calls `f` with a string slice of the source text spanning from `start`
217-
/// up to but excluding `rdr.last_pos`, meaning the slice does not include
218-
/// the character `rdr.curr`.
219216
pub fn with_str_from<T>(rdr: @mut StringReader, start: BytePos, f: &fn(s: &str) -> T) -> T {
220-
with_str_from_to(rdr, start, rdr.last_pos, f)
221-
}
222-
223-
/// Calls `f` with astring slice of the source text spanning from `start`
224-
/// up to but excluding `end`.
225-
fn with_str_from_to<T>(rdr: @mut StringReader,
226-
start: BytePos,
227-
end: BytePos,
228-
f: &fn(s: &str) -> T) -> T {
229217
f(rdr.src.slice(
230218
byte_offset(rdr, start).to_uint(),
231-
byte_offset(rdr, end).to_uint()))
219+
byte_offset(rdr, rdr.last_pos).to_uint()))
232220
}
233221

234222
// EFFECT: advance the StringReader by one character. If a newline is
@@ -624,10 +612,7 @@ fn ident_continue(c: char) -> bool {
624612
// EFFECT: updates the interner
625613
fn next_token_inner(rdr: @mut StringReader) -> token::Token {
626614
let c = rdr.curr;
627-
if ident_start(c) && nextch(rdr) != '"' && nextch(rdr) != '#' {
628-
// Note: r as in r" or r#" is part of a raw string literal,
629-
// not an identifier, and is handled further down.
630-
615+
if ident_start(c) {
631616
let start = rdr.last_pos;
632617
while ident_continue(rdr.curr) {
633618
bump(rdr);
@@ -844,47 +829,6 @@ fn next_token_inner(rdr: @mut StringReader) -> token::Token {
844829
bump(rdr);
845830
return token::LIT_STR(str_to_ident(accum_str));
846831
}
847-
'r' => {
848-
let start_bpos = rdr.last_pos;
849-
bump(rdr);
850-
let mut hash_count = 0u;
851-
while rdr.curr == '#' {
852-
bump(rdr);
853-
hash_count += 1;
854-
}
855-
if rdr.curr != '"' {
856-
fatal_span_char(rdr, start_bpos, rdr.last_pos,
857-
~"only `#` is allowed in raw string delimitation; \
858-
found illegal character",
859-
rdr.curr);
860-
}
861-
bump(rdr);
862-
let content_start_bpos = rdr.last_pos;
863-
let mut content_end_bpos;
864-
'outer: loop {
865-
if is_eof(rdr) {
866-
fatal_span(rdr, start_bpos, rdr.last_pos,
867-
~"unterminated raw string");
868-
}
869-
if rdr.curr == '"' {
870-
content_end_bpos = rdr.last_pos;
871-
for _ in range(0, hash_count) {
872-
bump(rdr);
873-
if rdr.curr != '#' {
874-
continue 'outer;
875-
}
876-
}
877-
break;
878-
}
879-
bump(rdr);
880-
}
881-
bump(rdr);
882-
let str_content = with_str_from_to(rdr,
883-
content_start_bpos,
884-
content_end_bpos,
885-
str_to_ident);
886-
return token::LIT_STR_RAW(str_content, hash_count);
887-
}
888832
'-' => {
889833
if nextch(rdr) == '>' {
890834
bump(rdr);
@@ -1043,14 +987,6 @@ mod test {
1043987
assert_eq!(tok, token::LIFETIME(id));
1044988
}
1045989

1046-
#[test] fn raw_string() {
1047-
let env = setup(@"r###\"\"#a\\b\x00c\"\"###");
1048-
let TokenAndSpan {tok, sp: _} =
1049-
env.string_reader.next_token();
1050-
let id = token::str_to_ident("\"#a\\b\x00c\"");
1051-
assert_eq!(tok, token::LIT_STR_RAW(id, 3));
1052-
}
1053-
1054990
#[test] fn line_doc_comments() {
1055991
assert!(!is_line_non_doc_comment("///"));
1056992
assert!(!is_line_non_doc_comment("/// blah"));

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,7 +1283,6 @@ impl Parser {
12831283
token::LIT_FLOAT_UNSUFFIXED(s) =>
12841284
lit_float_unsuffixed(self.id_to_str(s)),
12851285
token::LIT_STR(s) => lit_str(self.id_to_str(s)),
1286-
token::LIT_STR_RAW(s, _) => lit_str(self.id_to_str(s)),
12871286
token::LPAREN => { self.expect(&token::RPAREN); lit_nil },
12881287
_ => { self.unexpected_last(tok); }
12891288
}
@@ -4346,8 +4345,7 @@ impl Parser {
43464345
// parse a string as an ABI spec on an extern type or module
43474346
fn parse_opt_abis(&self) -> Option<AbiSet> {
43484347
match *self.token {
4349-
token::LIT_STR(s)
4350-
| token::LIT_STR_RAW(s, _) => {
4348+
token::LIT_STR(s) => {
43514349
self.bump();
43524350
let the_string = ident_to_str(&s);
43534351
let mut abis = AbiSet::empty();
@@ -4934,8 +4932,7 @@ impl Parser {
49344932

49354933
pub fn parse_optional_str(&self) -> Option<@str> {
49364934
match *self.token {
4937-
token::LIT_STR(s)
4938-
| token::LIT_STR_RAW(s, _) => {
4935+
token::LIT_STR(s) => {
49394936
self.bump();
49404937
Some(ident_to_str(&s))
49414938
}

branches/try/src/libsyntax/parse/token.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ pub enum Token {
7979
LIT_FLOAT(ast::Ident, ast::float_ty),
8080
LIT_FLOAT_UNSUFFIXED(ast::Ident),
8181
LIT_STR(ast::Ident),
82-
LIT_STR_RAW(ast::Ident, uint), /* raw str delimited by n hash symbols */
8382

8483
/* Name components */
8584
// an identifier contains an "is_mod_name" boolean,
@@ -195,10 +194,6 @@ pub fn to_str(input: @ident_interner, t: &Token) -> ~str {
195194
body
196195
}
197196
LIT_STR(ref s) => { format!("\"{}\"", ident_to_str(s).escape_default()) }
198-
LIT_STR_RAW(ref s, n) => {
199-
format!("r{delim}\"{string}\"{delim}",
200-
delim="#".repeat(n), string=ident_to_str(s))
201-
}
202197

203198
/* Name components */
204199
IDENT(s, _) => input.get(s.name).to_owned(),
@@ -248,7 +243,6 @@ pub fn can_begin_expr(t: &Token) -> bool {
248243
LIT_FLOAT(_, _) => true,
249244
LIT_FLOAT_UNSUFFIXED(_) => true,
250245
LIT_STR(_) => true,
251-
LIT_STR_RAW(_, _) => true,
252246
POUND => true,
253247
AT => true,
254248
NOT => true,
@@ -290,7 +284,6 @@ pub fn is_lit(t: &Token) -> bool {
290284
LIT_FLOAT(_, _) => true,
291285
LIT_FLOAT_UNSUFFIXED(_) => true,
292286
LIT_STR(_) => true,
293-
LIT_STR_RAW(_, _) => true,
294287
_ => false
295288
}
296289
}

branches/try/src/libsyntax/print/pprust.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1895,9 +1895,7 @@ pub fn print_view_item(s: @ps, item: &ast::view_item) {
18951895
head(s, "extern mod");
18961896
print_ident(s, id);
18971897
for p in optional_path.iter() {
1898-
space(s.s);
18991898
word(s.s, "=");
1900-
space(s.s);
19011899
print_string(s, *p);
19021900
}
19031901
if !mta.is_empty() {

branches/try/src/test/compile-fail/raw-str-delim.rs

Lines changed: 0 additions & 13 deletions
This file was deleted.

branches/try/src/test/compile-fail/raw-str-unbalanced.rs

Lines changed: 0 additions & 14 deletions
This file was deleted.

branches/try/src/test/compile-fail/raw-str-unterminated.rs

Lines changed: 0 additions & 14 deletions
This file was deleted.
-1.28 KB
Binary file not shown.

0 commit comments

Comments
 (0)