Skip to content

Commit e862737

Browse files
committed
---
yaml --- r: 46570 b: refs/heads/auto c: 5f1652f h: refs/heads/master v: v3
1 parent f837275 commit e862737

File tree

3 files changed

+27
-26
lines changed

3 files changed

+27
-26
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: 4ae91e2961ac7be50a346a6b0d724601878a9cd0
17+
refs/heads/auto: 5f1652f34fee38f3d88f5944c86f159c0f7d7fee

branches/auto/src/libsyntax/print/pp.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -568,15 +568,15 @@ pub fn end(p: @mut Printer) { p.pretty_print(END); }
568568
pub fn eof(p: @mut Printer) { p.pretty_print(EOF); }
569569

570570
pub fn word(p: @mut Printer, wrd: ~str) {
571-
p.pretty_print(STRING(@wrd, str::len(wrd) as int));
571+
p.pretty_print(STRING(@/*bad*/ copy wrd, wrd.len() as int));
572572
}
573573

574574
pub fn huge_word(p: @mut Printer, wrd: ~str) {
575-
p.pretty_print(STRING(@wrd, size_infinity));
575+
p.pretty_print(STRING(@/*bad*/ copy wrd, size_infinity));
576576
}
577577

578578
pub fn zero_word(p: @mut Printer, wrd: ~str) {
579-
p.pretty_print(STRING(@wrd, 0));
579+
p.pretty_print(STRING(@/*bad*/ copy wrd, 0));
580580
}
581581

582582
pub fn spaces(p: @mut Printer, n: uint) { break_offset(p, n, 0); }

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

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -108,18 +108,20 @@ pub fn print_crate(cm: @CodeMap, intr: @ident_interner,
108108
span_diagnostic: diagnostic::span_handler,
109109
crate: @ast::crate, filename: ~str, in: io::Reader,
110110
out: io::Writer, ann: pp_ann, is_expanded: bool) {
111-
let (cmnts, lits) =
112-
comments::gather_comments_and_literals(span_diagnostic,
113-
filename, in);
111+
let (cmnts, lits) = comments::gather_comments_and_literals(
112+
span_diagnostic,
113+
copy filename,
114+
in
115+
);
114116
let s = @ps {
115117
s: pp::mk_printer(out, default_columns),
116118
cm: Some(cm),
117119
intr: intr,
118-
comments: Some(cmnts),
120+
comments: Some(copy cmnts),
119121
// If the code is post expansion, don't use the table of
120122
// literals, since it doesn't correspond with the literals
121123
// in the AST anymore.
122-
literals: if is_expanded { None } else { Some(lits) },
124+
literals: if is_expanded { None } else { Some(copy lits) },
123125
cur_cmnt_and_lit: @mut CurrentCommentAndLiteral {
124126
cur_cmnt: 0,
125127
cur_lit: 0
@@ -378,7 +380,7 @@ pub fn print_type(s: @ps, &&ty: @ast::Ty) {
378380
pub fn print_type_ex(s: @ps, &&ty: @ast::Ty, print_colons: bool) {
379381
maybe_print_comment(s, ty.span.lo);
380382
ibox(s, 0u);
381-
match ty.node {
383+
match /*bad*/ copy ty.node {
382384
ast::ty_nil => word(s.s, ~"()"),
383385
ast::ty_bot => word(s.s, ~"!"),
384386
ast::ty_box(mt) => { word(s.s, ~"@"); print_mt(s, mt); }
@@ -458,7 +460,7 @@ pub fn print_foreign_item(s: @ps, item: @ast::foreign_item) {
458460
hardbreak_if_not_bol(s);
459461
maybe_print_comment(s, item.span.lo);
460462
print_outer_attributes(s, item.attrs);
461-
match item.node {
463+
match /*bad*/ copy item.node {
462464
ast::foreign_item_fn(decl, purity, typarams) => {
463465
print_fn(s, decl, Some(purity), item.ident, typarams, None,
464466
ast::inherited);
@@ -484,7 +486,7 @@ pub fn print_item(s: @ps, &&item: @ast::item) {
484486
print_outer_attributes(s, item.attrs);
485487
let ann_node = node_item(s, item);
486488
(s.ann.pre)(ann_node);
487-
match item.node {
489+
match /*bad*/ copy item.node {
488490
ast::item_const(ty, expr) => {
489491
head(s, visibility_qualified(item.vis, ~"const"));
490492
print_ident(s, item.ident);
@@ -652,7 +654,7 @@ pub fn print_enum_def(s: @ps, enum_definition: ast::enum_def,
652654
space(s.s);
653655
if newtype {
654656
word_space(s, ~"=");
655-
match enum_definition.variants[0].node.kind {
657+
match /*bad*/ copy enum_definition.variants[0].node.kind {
656658
ast::tuple_variant_kind(args) => print_type(s, args[0].ty),
657659
_ => fail!(~"newtype syntax with struct?")
658660
}
@@ -690,9 +692,8 @@ pub fn visibility_to_str(vis: ast::visibility) -> ~str {
690692
691693
pub fn visibility_qualified(vis: ast::visibility, s: ~str) -> ~str {
692694
match vis {
693-
ast::private | ast::public =>
694-
visibility_to_str(vis) + " " + s,
695-
ast::inherited => s
695+
ast::private | ast::public => visibility_to_str(vis) + " " + s,
696+
ast::inherited => copy s
696697
}
697698
}
698699
@@ -809,7 +810,7 @@ pub fn print_tts(s: @ps, &&tts: &[ast::token_tree]) {
809810
810811
pub fn print_variant(s: @ps, v: ast::variant) {
811812
print_visibility(s, v.node.vis);
812-
match v.node.kind {
813+
match /*bad*/ copy v.node.kind {
813814
ast::tuple_variant_kind(args) => {
814815
print_ident(s, v.node.name);
815816
if !args.is_empty() {
@@ -844,8 +845,8 @@ pub fn print_ty_method(s: @ps, m: &ast::ty_method) {
844845
maybe_print_comment(s, m.span.lo);
845846
print_outer_attributes(s, m.attrs);
846847
print_ty_fn(s, None, None, None, m.purity, ast::Many,
847-
m.decl, Some(m.ident), Some(m.tps),
848-
Some(m.self_ty.node));
848+
m.decl, Some(m.ident), Some(/*bad*/ copy m.tps),
849+
Some(/*bad*/ copy m.self_ty.node));
849850
word(s.s, ~";");
850851
}
851852
@@ -1141,7 +1142,7 @@ pub fn print_expr(s: @ps, &&expr: @ast::expr) {
11411142
ibox(s, indent_unit);
11421143
let ann_node = node_expr(s, expr);
11431144
(s.ann.pre)(ann_node);
1144-
match expr.node {
1145+
match /*bad*/ copy expr.node {
11451146
ast::expr_vstore(e, v) => match v {
11461147
ast::expr_vstore_fixed(_) => {
11471148
print_expr(s, e);
@@ -1490,7 +1491,7 @@ pub fn print_local_decl(s: @ps, loc: @ast::local) {
14901491
14911492
pub fn print_decl(s: @ps, decl: @ast::decl) {
14921493
maybe_print_comment(s, decl.span.lo);
1493-
match decl.node {
1494+
match /*bad*/ copy decl.node {
14941495
ast::decl_local(locs) => {
14951496
space_if_not_bol(s);
14961497
ibox(s, indent_unit);
@@ -1574,7 +1575,7 @@ pub fn print_pat(s: @ps, &&pat: @ast::pat, refutable: bool) {
15741575
(s.ann.pre)(ann_node);
15751576
/* Pat isn't normalized, but the beauty of it
15761577
is that it doesn't matter */
1577-
match pat.node {
1578+
match /*bad*/ copy pat.node {
15781579
ast::pat_wild => word(s.s, ~"_"),
15791580
ast::pat_ident(binding_mode, path, sub) => {
15801581
if refutable {
@@ -1886,7 +1887,7 @@ pub fn print_view_item(s: @ps, item: @ast::view_item) {
18861887
maybe_print_comment(s, item.span.lo);
18871888
print_outer_attributes(s, item.attrs);
18881889
print_visibility(s, item.vis);
1889-
match item.node {
1890+
match /*bad*/ copy item.node {
18901891
ast::view_item_extern_mod(id, mta, _) => {
18911892
head(s, ~"extern mod");
18921893
print_ident(s, id);
@@ -1968,7 +1969,7 @@ pub fn print_ty_fn(s: @ps,
19681969
print_onceness(s, onceness);
19691970
word(s.s, ~"fn");
19701971
match id { Some(id) => { word(s.s, ~" "); print_ident(s, id); } _ => () }
1971-
match tps { Some(tps) => print_type_params(s, tps), _ => () }
1972+
match /*bad*/ copy tps { Some(tps) => print_type_params(s, tps), _ => () }
19721973
zerobreak(s.s);
19731974
19741975
popen(s);
@@ -2095,7 +2096,7 @@ pub fn next_lit(s: @ps, pos: BytePos) -> Option<comments::lit> {
20952096
match s.literals {
20962097
Some(ref lits) => {
20972098
while s.cur_cmnt_and_lit.cur_lit < vec::len((*lits)) {
2098-
let ltrl = (*lits)[s.cur_cmnt_and_lit.cur_lit];
2099+
let ltrl = /*bad*/ copy (*lits)[s.cur_cmnt_and_lit.cur_lit];
20992100
if ltrl.pos > pos { return None; }
21002101
s.cur_cmnt_and_lit.cur_lit += 1u;
21012102
if ltrl.pos == pos { return Some(ltrl); }
@@ -2182,7 +2183,7 @@ pub fn next_comment(s: @ps) -> Option<comments::cmnt> {
21822183
match s.comments {
21832184
Some(ref cmnts) => {
21842185
if s.cur_cmnt_and_lit.cur_cmnt < vec::len((*cmnts)) {
2185-
return Some((*cmnts)[s.cur_cmnt_and_lit.cur_cmnt]);
2186+
return Some(copy cmnts[s.cur_cmnt_and_lit.cur_cmnt]);
21862187
} else { return None::<comments::cmnt>; }
21872188
}
21882189
_ => return None::<comments::cmnt>

0 commit comments

Comments
 (0)