Skip to content

Commit 97b7f66

Browse files
committed
---
yaml --- r: 110254 b: refs/heads/try c: 8f226e5 h: refs/heads/master v: v3
1 parent b38d461 commit 97b7f66

File tree

8 files changed

+27
-18
lines changed

8 files changed

+27
-18
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: e415c25bcd81dc1f9a5a3d25d9b48ed2d545336b
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: c7fac4471201977fdb1c0c0a26c87287e12dc644
5-
refs/heads/try: 7cf4d8bc446177204e9e12b1efb199a5dbc956b5
5+
refs/heads/try: 8f226e56946d20acfdf8c0c48c57fd7ba3571157
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/libsyntax/ast.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -581,14 +581,16 @@ pub enum TokenTree {
581581
TTTok(Span, ::parse::token::Token),
582582
// a delimited sequence (the delimiters appear as the first
583583
// and last elements of the vector)
584-
TTDelim(@Vec<TokenTree> ),
584+
// FIXME(eddyb) #6308 Use Rc<[TokenTree]> after DST.
585+
TTDelim(Rc<Vec<TokenTree>>),
585586

586587
// These only make sense for right-hand-sides of MBE macros:
587588

588589
// a kleene-style repetition sequence with a span, a TTForest,
589590
// an optional separator, and a boolean where true indicates
590591
// zero or more (..), and false indicates one or more (+).
591-
TTSeq(Span, @Vec<TokenTree> , Option<::parse::token::Token>, bool),
592+
// FIXME(eddyb) #6308 Use Rc<[TokenTree]> after DST.
593+
TTSeq(Span, Rc<Vec<TokenTree>>, Option<::parse::token::Token>, bool),
592594

593595
// a syntactic variable that will be filled in by macro expansion.
594596
TTNonterminal(Span, Ident)

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,16 @@ use codemap;
1313
use ext::base;
1414
use print;
1515

16+
use std::rc::Rc;
17+
1618
pub fn expand_syntax_ext(cx: &mut base::ExtCtxt,
1719
sp: codemap::Span,
1820
tt: &[ast::TokenTree])
1921
-> base::MacResult {
2022

2123
cx.print_backtrace();
2224
println!("{}", print::pprust::tt_to_str(&ast::TTDelim(
23-
@tt.iter().map(|x| (*x).clone()).collect())));
25+
Rc::new(tt.iter().map(|x| (*x).clone()).collect()))));
2426

2527
// any so that `log_syntax` can be invoked as an expression and item.
2628
base::MacResult::dummy_any(sp)

branches/try/src/libsyntax/ext/tt/macro_rules.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ use print;
2828
use util::small_vector::SmallVector;
2929

3030
use std::cell::RefCell;
31+
use std::rc::Rc;
3132

3233
struct ParserAnyMacro<'a> {
3334
parser: RefCell<Parser<'a>>,
@@ -115,9 +116,9 @@ fn generic_extension(cx: &ExtCtxt,
115116
if cx.trace_macros() {
116117
println!("{}! \\{ {} \\}",
117118
token::get_ident(name),
118-
print::pprust::tt_to_str(&TTDelim(@arg.iter()
119-
.map(|x| (*x).clone())
120-
.collect())));
119+
print::pprust::tt_to_str(&TTDelim(Rc::new(arg.iter()
120+
.map(|x| (*x).clone())
121+
.collect()))));
121122
}
122123

123124
// Which arm's failure should we report? (the one furthest along)

branches/try/src/libsyntax/ext/tt/transcribe.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ use parse::token::{EOF, INTERPOLATED, IDENT, Token, NtIdent};
1717
use parse::token;
1818
use parse::lexer::TokenAndSpan;
1919

20+
use std::rc::Rc;
2021
use collections::HashMap;
2122

2223
///an unzipping of `TokenTree`s
2324
#[deriving(Clone)]
2425
struct TtFrame {
25-
forest: @Vec<ast::TokenTree>,
26+
forest: Rc<Vec<ast::TokenTree>>,
2627
idx: uint,
2728
dotdotdoted: bool,
2829
sep: Option<Token>,
@@ -52,7 +53,7 @@ pub fn new_tt_reader<'a>(sp_diag: &'a SpanHandler,
5253
let mut r = TtReader {
5354
sp_diag: sp_diag,
5455
stack: vec!(TtFrame {
55-
forest: @src,
56+
forest: Rc::new(src),
5657
idx: 0,
5758
dotdotdoted: false,
5859
sep: None,
@@ -212,7 +213,7 @@ pub fn tt_next_token(r: &mut TtReader) -> TokenAndSpan {
212213
}
213214
TTSeq(sp, tts, sep, zerok) => {
214215
// FIXME(pcwalton): Bad copy.
215-
match lockstep_iter_size(&TTSeq(sp, tts, sep.clone(), zerok), r) {
216+
match lockstep_iter_size(&TTSeq(sp, tts.clone(), sep.clone(), zerok), r) {
216217
LisUnconstrained => {
217218
r.sp_diag.span_fatal(
218219
sp.clone(), /* blame macro writer */

branches/try/src/libsyntax/fold.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ use parse::token;
1616
use owned_slice::OwnedSlice;
1717
use util::small_vector::SmallVector;
1818

19+
use std::rc::Rc;
20+
1921
// We may eventually want to be able to fold over type parameters, too.
2022
pub trait Folder {
2123
fn fold_crate(&mut self, c: Crate) -> Crate {
@@ -375,10 +377,10 @@ pub fn fold_tts<T: Folder>(tts: &[TokenTree], fld: &mut T) -> Vec<TokenTree> {
375377
match *tt {
376378
TTTok(span, ref tok) =>
377379
TTTok(span,maybe_fold_ident(tok,fld)),
378-
TTDelim(tts) => TTDelim(@fold_tts(tts.as_slice(), fld)),
379-
TTSeq(span, pattern, ref sep, is_optional) =>
380+
TTDelim(ref tts) => TTDelim(Rc::new(fold_tts(tts.as_slice(), fld))),
381+
TTSeq(span, ref pattern, ref sep, is_optional) =>
380382
TTSeq(span,
381-
@fold_tts(pattern.as_slice(), fld),
383+
Rc::new(fold_tts(pattern.as_slice(), fld)),
382384
sep.as_ref().map(|tok|maybe_fold_ident(tok,fld)),
383385
is_optional),
384386
TTNonterminal(sp,ref ident) =>

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,13 +366,13 @@ mod test {
366366
[ast::TTTok(_,_),
367367
ast::TTTok(_,token::NOT),
368368
ast::TTTok(_,_),
369-
ast::TTDelim(delim_elts)] => {
369+
ast::TTDelim(ref delim_elts)] => {
370370
let delim_elts: &[ast::TokenTree] = delim_elts.as_slice();
371371
match delim_elts {
372372
[ast::TTTok(_,token::LPAREN),
373-
ast::TTDelim(first_set),
373+
ast::TTDelim(ref first_set),
374374
ast::TTTok(_,token::FAT_ARROW),
375-
ast::TTDelim(second_set),
375+
ast::TTDelim(ref second_set),
376376
ast::TTTok(_,token::RPAREN)] => {
377377
let first_set: &[ast::TokenTree] =
378378
first_set.as_slice();

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ use owned_slice::OwnedSlice;
8080
use collections::HashSet;
8181
use std::kinds::marker;
8282
use std::mem::replace;
83+
use std::rc::Rc;
8384
use std::vec;
8485

8586
#[allow(non_camel_case_types)]
@@ -2101,7 +2102,7 @@ impl<'a> Parser<'a> {
21012102
let seq = match seq {
21022103
Spanned { node, .. } => node,
21032104
};
2104-
TTSeq(mk_sp(sp.lo, p.span.hi), @seq, s, z)
2105+
TTSeq(mk_sp(sp.lo, p.span.hi), Rc::new(seq), s, z)
21052106
} else {
21062107
TTNonterminal(sp, p.parse_ident())
21072108
}
@@ -2144,7 +2145,7 @@ impl<'a> Parser<'a> {
21442145
result.push(parse_any_tt_tok(self));
21452146
self.open_braces.pop().unwrap();
21462147

2147-
TTDelim(@result)
2148+
TTDelim(Rc::new(result))
21482149
}
21492150
_ => parse_non_delim_tt_tok(self)
21502151
}

0 commit comments

Comments
 (0)