Skip to content

Commit b26018c

Browse files
committed
librustc: De-@mut (and de-@) the pretty printer
1 parent 4d66af2 commit b26018c

File tree

4 files changed

+435
-411
lines changed

4 files changed

+435
-411
lines changed

src/librustc/driver/driver.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -517,20 +517,20 @@ impl pprust::pp_ann for IdentifiedAnnotation {
517517
fn post(&self, node: pprust::ann_node) {
518518
match node {
519519
pprust::node_item(s, item) => {
520-
pp::space(s.s);
520+
pp::space(&mut s.s);
521521
pprust::synth_comment(s, item.id.to_str());
522522
}
523-
pprust::node_block(s, ref blk) => {
524-
pp::space(s.s);
523+
pprust::node_block(s, blk) => {
524+
pp::space(&mut s.s);
525525
pprust::synth_comment(s, ~"block " + blk.id.to_str());
526526
}
527527
pprust::node_expr(s, expr) => {
528-
pp::space(s.s);
528+
pp::space(&mut s.s);
529529
pprust::synth_comment(s, expr.id.to_str());
530530
pprust::pclose(s);
531531
}
532532
pprust::node_pat(s, pat) => {
533-
pp::space(s.s);
533+
pp::space(&mut s.s);
534534
pprust::synth_comment(s, ~"pat " + pat.id.to_str());
535535
}
536536
}
@@ -552,10 +552,10 @@ impl pprust::pp_ann for TypedAnnotation {
552552
let tcx = self.analysis.ty_cx;
553553
match node {
554554
pprust::node_expr(s, expr) => {
555-
pp::space(s.s);
556-
pp::word(s.s, "as");
557-
pp::space(s.s);
558-
pp::word(s.s, ppaux::ty_to_str(tcx, ty::expr_ty(tcx, expr)));
555+
pp::space(&mut s.s);
556+
pp::word(&mut s.s, "as");
557+
pp::space(&mut s.s);
558+
pp::word(&mut s.s, ppaux::ty_to_str(tcx, ty::expr_ty(tcx, expr)));
559559
pprust::pclose(s);
560560
}
561561
_ => ()

src/librustc/middle/dataflow.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ impl<O:DataFlowOperator> pprust::pp_ann for DataFlowContext<O> {
118118
let comment_str = format!("id {}: {}{}{}",
119119
id, entry_str, gens_str, kills_str);
120120
pprust::synth_comment(ps, comment_str);
121-
pp::space(ps.s);
121+
pp::space(&mut ps.s);
122122
}
123123
}
124124
}
@@ -353,13 +353,13 @@ impl<O:DataFlowOperator+Clone+'static> DataFlowContext<O> {
353353
}
354354

355355
fn pretty_print_to(@self, wr: @mut io::Writer, blk: &ast::Block) {
356-
let ps = pprust::rust_printer_annotated(wr,
357-
self.tcx.sess.intr(),
358-
self as @pprust::pp_ann);
359-
pprust::cbox(ps, pprust::indent_unit);
360-
pprust::ibox(ps, 0u);
361-
pprust::print_block(ps, blk);
362-
pp::eof(ps.s);
356+
let mut ps = pprust::rust_printer_annotated(wr,
357+
self.tcx.sess.intr(),
358+
self as @pprust::pp_ann);
359+
pprust::cbox(&mut ps, pprust::indent_unit);
360+
pprust::ibox(&mut ps, 0u);
361+
pprust::print_block(&mut ps, blk);
362+
pp::eof(&mut ps.s);
363363
}
364364
}
365365

src/libsyntax/print/pp.rs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -148,15 +148,15 @@ pub struct print_stack_elt {
148148

149149
pub static size_infinity: int = 0xffff;
150150

151-
pub fn mk_printer(out: @mut io::Writer, linewidth: uint) -> @mut Printer {
151+
pub fn mk_printer(out: @mut io::Writer, linewidth: uint) -> Printer {
152152
// Yes 3, it makes the ring buffers big enough to never
153153
// fall behind.
154154
let n: uint = 3 * linewidth;
155155
debug!("mk_printer {}", linewidth);
156156
let token: ~[token] = vec::from_elem(n, EOF);
157157
let size: ~[int] = vec::from_elem(n, 0);
158158
let scan_stack: ~[uint] = vec::from_elem(n, 0u);
159-
@mut Printer {
159+
Printer {
160160
out: out,
161161
buf_len: n,
162162
margin: linewidth as int,
@@ -557,47 +557,47 @@ impl Printer {
557557
// Convenience functions to talk to the printer.
558558
//
559559
// "raw box"
560-
pub fn rbox(p: @mut Printer, indent: uint, b: breaks) {
560+
pub fn rbox(p: &mut Printer, indent: uint, b: breaks) {
561561
p.pretty_print(BEGIN(begin_t {
562562
offset: indent as int,
563563
breaks: b
564564
}));
565565
}
566566

567-
pub fn ibox(p: @mut Printer, indent: uint) { rbox(p, indent, inconsistent); }
567+
pub fn ibox(p: &mut Printer, indent: uint) { rbox(p, indent, inconsistent); }
568568

569-
pub fn cbox(p: @mut Printer, indent: uint) { rbox(p, indent, consistent); }
569+
pub fn cbox(p: &mut Printer, indent: uint) { rbox(p, indent, consistent); }
570570

571-
pub fn break_offset(p: @mut Printer, n: uint, off: int) {
571+
pub fn break_offset(p: &mut Printer, n: uint, off: int) {
572572
p.pretty_print(BREAK(break_t {
573573
offset: off,
574574
blank_space: n as int
575575
}));
576576
}
577577

578-
pub fn end(p: @mut Printer) { p.pretty_print(END); }
578+
pub fn end(p: &mut Printer) { p.pretty_print(END); }
579579

580-
pub fn eof(p: @mut Printer) { p.pretty_print(EOF); }
580+
pub fn eof(p: &mut Printer) { p.pretty_print(EOF); }
581581

582-
pub fn word(p: @mut Printer, wrd: &str) {
582+
pub fn word(p: &mut Printer, wrd: &str) {
583583
p.pretty_print(STRING(/* bad */ wrd.to_managed(), wrd.len() as int));
584584
}
585585

586-
pub fn huge_word(p: @mut Printer, wrd: &str) {
586+
pub fn huge_word(p: &mut Printer, wrd: &str) {
587587
p.pretty_print(STRING(/* bad */ wrd.to_managed(), size_infinity));
588588
}
589589

590-
pub fn zero_word(p: @mut Printer, wrd: &str) {
590+
pub fn zero_word(p: &mut Printer, wrd: &str) {
591591
p.pretty_print(STRING(/* bad */ wrd.to_managed(), 0));
592592
}
593593

594-
pub fn spaces(p: @mut Printer, n: uint) { break_offset(p, n, 0); }
594+
pub fn spaces(p: &mut Printer, n: uint) { break_offset(p, n, 0); }
595595

596-
pub fn zerobreak(p: @mut Printer) { spaces(p, 0u); }
596+
pub fn zerobreak(p: &mut Printer) { spaces(p, 0u); }
597597

598-
pub fn space(p: @mut Printer) { spaces(p, 1u); }
598+
pub fn space(p: &mut Printer) { spaces(p, 1u); }
599599

600-
pub fn hardbreak(p: @mut Printer) { spaces(p, size_infinity as uint); }
600+
pub fn hardbreak(p: &mut Printer) { spaces(p, size_infinity as uint); }
601601

602602
pub fn hardbreak_tok_offset(off: int) -> token {
603603
BREAK(break_t {offset: off, blank_space: size_infinity})

0 commit comments

Comments
 (0)