@@ -108,18 +108,20 @@ pub fn print_crate(cm: @CodeMap, intr: @ident_interner,
108
108
span_diagnostic : diagnostic:: span_handler ,
109
109
crate : @ast:: crate , filename : ~str , in : io:: Reader ,
110
110
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
+ ) ;
114
116
let s = @ps {
115
117
s : pp:: mk_printer ( out, default_columns) ,
116
118
cm : Some ( cm) ,
117
119
intr : intr,
118
- comments : Some ( cmnts) ,
120
+ comments : Some ( copy cmnts) ,
119
121
// If the code is post expansion, don't use the table of
120
122
// literals, since it doesn't correspond with the literals
121
123
// in the AST anymore.
122
- literals : if is_expanded { None } else { Some ( lits) } ,
124
+ literals : if is_expanded { None } else { Some ( copy lits) } ,
123
125
cur_cmnt_and_lit : @mut CurrentCommentAndLiteral {
124
126
cur_cmnt : 0 ,
125
127
cur_lit : 0
@@ -378,7 +380,7 @@ pub fn print_type(s: @ps, &&ty: @ast::Ty) {
378
380
pub fn print_type_ex( s : @ps , & & ty: @ast:: Ty , print_colons : bool ) {
379
381
maybe_print_comment ( s, ty. span . lo ) ;
380
382
ibox ( s, 0 u) ;
381
- match ty. node {
383
+ match /*bad*/ copy ty. node {
382
384
ast:: ty_nil => word ( s. s , ~"( ) ") ,
383
385
ast:: ty_bot => word ( s. s , ~"!") ,
384
386
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) {
458
460
hardbreak_if_not_bol(s);
459
461
maybe_print_comment(s, item.span.lo);
460
462
print_outer_attributes(s, item.attrs);
461
- match item.node {
463
+ match /*bad*/ copy item.node {
462
464
ast::foreign_item_fn(decl, purity, typarams) => {
463
465
print_fn(s, decl, Some(purity), item.ident, typarams, None,
464
466
ast::inherited);
@@ -484,7 +486,7 @@ pub fn print_item(s: @ps, &&item: @ast::item) {
484
486
print_outer_attributes(s, item.attrs);
485
487
let ann_node = node_item(s, item);
486
488
(s.ann.pre)(ann_node);
487
- match item.node {
489
+ match /*bad*/ copy item.node {
488
490
ast::item_const(ty, expr) => {
489
491
head(s, visibility_qualified(item.vis, ~" const "));
490
492
print_ident(s, item.ident);
@@ -652,7 +654,7 @@ pub fn print_enum_def(s: @ps, enum_definition: ast::enum_def,
652
654
space(s.s);
653
655
if newtype {
654
656
word_space(s, ~" =");
655
- match enum_definition.variants[0].node.kind {
657
+ match /*bad*/ copy enum_definition.variants[0].node.kind {
656
658
ast::tuple_variant_kind(args) => print_type(s, args[0].ty),
657
659
_ => fail!(~" newtype syntax with struct ?")
658
660
}
@@ -690,9 +692,8 @@ pub fn visibility_to_str(vis: ast::visibility) -> ~str {
690
692
691
693
pub fn visibility_qualified(vis: ast::visibility, s: ~str) -> ~str {
692
694
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
696
697
}
697
698
}
698
699
@@ -809,7 +810,7 @@ pub fn print_tts(s: @ps, &&tts: &[ast::token_tree]) {
809
810
810
811
pub fn print_variant(s: @ps, v: ast::variant) {
811
812
print_visibility(s, v.node.vis);
812
- match v.node.kind {
813
+ match /*bad*/ copy v.node.kind {
813
814
ast::tuple_variant_kind(args) => {
814
815
print_ident(s, v.node.name);
815
816
if !args.is_empty() {
@@ -844,8 +845,8 @@ pub fn print_ty_method(s: @ps, m: &ast::ty_method) {
844
845
maybe_print_comment(s, m.span.lo);
845
846
print_outer_attributes(s, m.attrs);
846
847
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));
849
850
word(s.s, ~" ; ");
850
851
}
851
852
@@ -1141,7 +1142,7 @@ pub fn print_expr(s: @ps, &&expr: @ast::expr) {
1141
1142
ibox(s, indent_unit);
1142
1143
let ann_node = node_expr(s, expr);
1143
1144
(s.ann.pre)(ann_node);
1144
- match expr.node {
1145
+ match /*bad*/ copy expr.node {
1145
1146
ast::expr_vstore(e, v) => match v {
1146
1147
ast::expr_vstore_fixed(_) => {
1147
1148
print_expr(s, e);
@@ -1490,7 +1491,7 @@ pub fn print_local_decl(s: @ps, loc: @ast::local) {
1490
1491
1491
1492
pub fn print_decl(s: @ps, decl: @ast::decl) {
1492
1493
maybe_print_comment(s, decl.span.lo);
1493
- match decl.node {
1494
+ match /*bad*/ copy decl.node {
1494
1495
ast::decl_local(locs) => {
1495
1496
space_if_not_bol(s);
1496
1497
ibox(s, indent_unit);
@@ -1574,7 +1575,7 @@ pub fn print_pat(s: @ps, &&pat: @ast::pat, refutable: bool) {
1574
1575
(s.ann.pre)(ann_node);
1575
1576
/* Pat isn't normalized, but the beauty of it
1576
1577
is that it doesn't matter */
1577
- match pat.node {
1578
+ match /*bad*/ copy pat.node {
1578
1579
ast::pat_wild => word(s.s, ~" _"),
1579
1580
ast::pat_ident(binding_mode, path, sub) => {
1580
1581
if refutable {
@@ -1886,7 +1887,7 @@ pub fn print_view_item(s: @ps, item: @ast::view_item) {
1886
1887
maybe_print_comment(s, item.span.lo);
1887
1888
print_outer_attributes(s, item.attrs);
1888
1889
print_visibility(s, item.vis);
1889
- match item.node {
1890
+ match /*bad*/ copy item.node {
1890
1891
ast::view_item_extern_mod(id, mta, _) => {
1891
1892
head(s, ~" extern mod ");
1892
1893
print_ident(s, id);
@@ -1968,7 +1969,7 @@ pub fn print_ty_fn(s: @ps,
1968
1969
print_onceness(s, onceness);
1969
1970
word(s.s, ~" fn ");
1970
1971
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), _ => () }
1972
1973
zerobreak(s.s);
1973
1974
1974
1975
popen(s);
@@ -2095,7 +2096,7 @@ pub fn next_lit(s: @ps, pos: BytePos) -> Option<comments::lit> {
2095
2096
match s.literals {
2096
2097
Some(ref lits) => {
2097
2098
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];
2099
2100
if ltrl.pos > pos { return None; }
2100
2101
s.cur_cmnt_and_lit.cur_lit += 1u;
2101
2102
if ltrl.pos == pos { return Some(ltrl); }
@@ -2182,7 +2183,7 @@ pub fn next_comment(s: @ps) -> Option<comments::cmnt> {
2182
2183
match s. comments {
2183
2184
Some ( ref cmnts) => {
2184
2185
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] ) ;
2186
2187
} else { return None :: <comments:: cmnt>; }
2187
2188
}
2188
2189
_ => return None :: <comments:: cmnt>
0 commit comments