Skip to content

Commit 66a9b7d

Browse files
committed
libsyntax: Remove some multi-gigabyte clones that were preventing bootstrapping on Windows.
1 parent dc4bf17 commit 66a9b7d

File tree

9 files changed

+44
-38
lines changed

9 files changed

+44
-38
lines changed

src/libextra/serialize.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,18 @@ impl<D:Decoder,T:Decodable<D>> Decodable<D> for @T {
429429
}
430430
}
431431

432+
impl<S:Encoder,T:Encodable<S>> Encodable<S> for @mut T {
433+
fn encode(&self, s: &mut S) {
434+
(**self).encode(s)
435+
}
436+
}
437+
438+
impl<D:Decoder,T:Decodable<D>> Decodable<D> for @mut T {
439+
fn decode(d: &mut D) -> @mut T {
440+
@mut Decodable::decode(d)
441+
}
442+
}
443+
432444
impl<'self, S:Encoder,T:Encodable<S>> Encodable<S> for &'self [T] {
433445
fn encode(&self, s: &mut S) {
434446
do s.emit_seq(self.len()) |s| {
@@ -650,18 +662,6 @@ impl<
650662
}
651663
}
652664

653-
impl<S: Encoder, T: Encodable<S>> Encodable<S> for @mut DList<T> {
654-
fn encode(&self, s: &mut S) {
655-
do s.emit_seq(self.len()) |s| {
656-
let mut i = 0;
657-
for self.iter().advance |e| {
658-
s.emit_seq_elt(i, |s| e.encode(s));
659-
i += 1;
660-
}
661-
}
662-
}
663-
}
664-
665665
impl<D:Decoder,T:Decodable<D>> Decodable<D> for DList<T> {
666666
fn decode(d: &mut D) -> DList<T> {
667667
let mut list = DList::new();

src/libstd/to_bytes.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,13 @@ impl<A:IterBytes> IterBytes for @A {
319319
}
320320
}
321321

322+
impl<A:IterBytes> IterBytes for @mut A {
323+
#[inline]
324+
fn iter_bytes(&self, lsb0: bool, f: Cb) -> bool {
325+
(**self).iter_bytes(lsb0, f)
326+
}
327+
}
328+
322329
impl<A:IterBytes> IterBytes for ~A {
323330
#[inline]
324331
fn iter_bytes(&self, lsb0: bool, f: Cb) -> bool {

src/libsyntax/ast.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -505,13 +505,13 @@ pub enum token_tree {
505505
tt_tok(span, ::parse::token::Token),
506506
// a delimited sequence (the delimiters appear as the first
507507
// and last elements of the vector)
508-
tt_delim(~[token_tree]),
508+
tt_delim(@mut ~[token_tree]),
509509
// These only make sense for right-hand-sides of MBE macros:
510510

511511
// a kleene-style repetition sequence with a span, a tt_forest,
512512
// an optional separator (?), and a boolean where true indicates
513513
// zero or more (*), and false indicates one or more (+).
514-
tt_seq(span, ~[token_tree], Option<::parse::token::Token>, bool),
514+
tt_seq(span, @mut ~[token_tree], Option<::parse::token::Token>, bool),
515515

516516
// a syntactic variable that will be filled in by macro expansion.
517517
tt_nonterminal(span, ident)

src/libsyntax/ext/log_syntax.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub fn expand_syntax_ext(cx: @ExtCtxt,
2525
cx.print_backtrace();
2626
io::stdout().write_line(
2727
print::pprust::tt_to_str(
28-
&ast::tt_delim(tt.to_owned()),
28+
&ast::tt_delim(@mut tt.to_owned()),
2929
get_ident_interner()));
3030

3131
//trivial expression

src/libsyntax/ext/quote.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ fn mk_tt(cx: @ExtCtxt, sp: span, tt: &ast::token_tree)
605605
~[cx.stmt_expr(e_push)]
606606
}
607607

608-
ast::tt_delim(ref tts) => mk_tts(cx, sp, *tts),
608+
ast::tt_delim(ref tts) => mk_tts(cx, sp, **tts),
609609
ast::tt_seq(*) => fail!("tt_seq in quote!"),
610610

611611
ast::tt_nonterminal(sp, ident) => {

src/libsyntax/ext/tt/macro_rules.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ pub fn add_new_extension(cx: @ExtCtxt,
8585
io::println(fmt!("%s! { %s }",
8686
cx.str_of(name),
8787
print::pprust::tt_to_str(
88-
&ast::tt_delim(arg.to_owned()),
88+
&ast::tt_delim(@mut arg.to_owned()),
8989
get_ident_interner())));
9090
}
9191

src/libsyntax/ext/tt/transcribe.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ pub fn tt_next_token(r: &mut TtReader) -> TokenAndSpan {
219219
match r.stack.forest[r.stack.idx].clone() {
220220
tt_delim(tts) => {
221221
r.stack = @mut TtFrame {
222-
forest: @mut tts,
222+
forest: tts,
223223
idx: 0u,
224224
dotdotdoted: false,
225225
sep: None,
@@ -235,7 +235,7 @@ pub fn tt_next_token(r: &mut TtReader) -> TokenAndSpan {
235235
}
236236
tt_seq(sp, tts, sep, zerok) => {
237237
// XXX(pcwalton): Bad copy.
238-
let t = tt_seq(sp, tts.clone(), sep.clone(), zerok);
238+
let t = tt_seq(sp, tts, sep.clone(), zerok);
239239
match lockstep_iter_size(&t, r) {
240240
lis_unconstrained => {
241241
r.sp_diag.span_fatal(
@@ -263,7 +263,7 @@ pub fn tt_next_token(r: &mut TtReader) -> TokenAndSpan {
263263
r.repeat_len.push(len);
264264
r.repeat_idx.push(0u);
265265
r.stack = @mut TtFrame {
266-
forest: @mut tts,
266+
forest: tts,
267267
idx: 0u,
268268
dotdotdoted: true,
269269
sep: sep,

src/libsyntax/fold.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,10 @@ fn fold_tts(tts : &[token_tree], fld: @ast_fold) -> ~[token_tree] {
131131
tt_tok(span, ref tok) =>
132132
tt_tok(span,maybe_fold_ident(tok,fld)),
133133
tt_delim(ref tts) =>
134-
tt_delim(fold_tts(*tts,fld)),
134+
tt_delim(@mut fold_tts(**tts, fld)),
135135
tt_seq(span, ref pattern, ref sep, is_optional) =>
136136
tt_seq(span,
137-
fold_tts(*pattern,fld),
137+
@mut fold_tts(**pattern, fld),
138138
sep.map(|tok|maybe_fold_ident(tok,fld)),
139139
is_optional),
140140
tt_nonterminal(sp,ref ident) =>

src/libsyntax/parse/parser.rs

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1925,7 +1925,7 @@ impl Parser {
19251925
};
19261926
tt_seq(
19271927
mk_sp(sp.lo, p.span.hi),
1928-
seq,
1928+
@mut seq,
19291929
s,
19301930
z
19311931
)
@@ -1950,21 +1950,20 @@ impl Parser {
19501950
}
19511951
token::LPAREN | token::LBRACE | token::LBRACKET => {
19521952
let close_delim = token::flip_delimiter(&*self.token);
1953-
tt_delim(
1954-
vec::append(
1955-
// the open delimiter:
1956-
~[parse_any_tt_tok(self)],
1957-
vec::append(
1958-
self.parse_seq_to_before_end(
1959-
&close_delim,
1960-
seq_sep_none(),
1961-
|p| p.parse_token_tree()
1962-
),
1963-
// the close delimiter:
1964-
[parse_any_tt_tok(self)]
1965-
)
1966-
)
1967-
)
1953+
1954+
// Parse the open delimiter.
1955+
let mut result = ~[parse_any_tt_tok(self)];
1956+
1957+
let trees =
1958+
self.parse_seq_to_before_end(&close_delim,
1959+
seq_sep_none(),
1960+
|p| p.parse_token_tree());
1961+
result.push_all_move(trees);
1962+
1963+
// Parse the close delimiter.
1964+
result.push(parse_any_tt_tok(self));
1965+
1966+
tt_delim(@mut result)
19681967
}
19691968
_ => parse_non_delim_tt_tok(self)
19701969
}

0 commit comments

Comments
 (0)