Skip to content

Commit 664ebe7

Browse files
committed
---
yaml --- r: 147918 b: refs/heads/try2 c: 497b63d h: refs/heads/master v: v3
1 parent e5db47b commit 664ebe7

File tree

5 files changed

+39
-18
lines changed

5 files changed

+39
-18
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: b26018cc89681d979555f3405df71e370941ffd5
8+
refs/heads/try2: 497b63ddf044e43173f83110a4ffb4c61413c524
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/librustc/driver/driver.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ pub fn pretty_print_input(sess: Session,
600600
&crate,
601601
source_name(input),
602602
rdr as @mut io::Reader,
603-
@mut stdout as @mut io::Writer,
603+
~stdout as ~io::Writer,
604604
annotation,
605605
is_expanded);
606606
}

branches/try2/src/librustc/middle/dataflow.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,12 +347,12 @@ impl<O:DataFlowOperator+Clone+'static> DataFlowContext<O> {
347347
debug!("Dataflow result:");
348348
debug!("{}", {
349349
let this = @(*self).clone();
350-
this.pretty_print_to(@mut io::stderr() as @mut io::Writer, blk);
350+
this.pretty_print_to(~io::stderr() as ~io::Writer, blk);
351351
""
352352
});
353353
}
354354

355-
fn pretty_print_to(@self, wr: @mut io::Writer, blk: &ast::Block) {
355+
fn pretty_print_to(@self, wr: ~io::Writer, blk: &ast::Block) {
356356
let mut ps = pprust::rust_printer_annotated(wr,
357357
self.tcx.sess.intr(),
358358
self as @pprust::pp_ann);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ 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) -> Printer {
151+
pub fn mk_printer(out: ~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;
@@ -255,7 +255,7 @@ pub fn mk_printer(out: @mut io::Writer, linewidth: uint) -> Printer {
255255
* called 'print'.
256256
*/
257257
pub struct Printer {
258-
out: @mut io::Writer,
258+
out: ~io::Writer,
259259
buf_len: uint,
260260
margin: int, // width of lines we're constrained to
261261
space: int, // number of spaces left on line

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

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ use print::pp::{breaks, consistent, inconsistent, eof};
2727
use print::pp;
2828
use print::pprust;
2929

30+
use std::cast;
3031
use std::char;
3132
use std::str;
3233
use std::io;
@@ -86,11 +87,11 @@ pub fn end(s: &mut ps) {
8687
pp::end(&mut s.s);
8788
}
8889

89-
pub fn rust_printer(writer: @mut io::Writer, intr: @ident_interner) -> ps {
90+
pub fn rust_printer(writer: ~io::Writer, intr: @ident_interner) -> ps {
9091
return rust_printer_annotated(writer, intr, @no_ann::new() as @pp_ann);
9192
}
9293

93-
pub fn rust_printer_annotated(writer: @mut io::Writer,
94+
pub fn rust_printer_annotated(writer: ~io::Writer,
9495
intr: @ident_interner,
9596
ann: @pp_ann)
9697
-> ps {
@@ -122,7 +123,7 @@ pub fn print_crate(cm: @CodeMap,
122123
crate: &ast::Crate,
123124
filename: @str,
124125
input: @mut io::Reader,
125-
out: @mut io::Writer,
126+
out: ~io::Writer,
126127
ann: @pp_ann,
127128
is_expanded: bool) {
128129
let (cmnts, lits) = comments::gather_comments_and_literals(
@@ -203,26 +204,40 @@ pub fn path_to_str(p: &ast::Path, intr: @ident_interner) -> ~str {
203204
pub fn fun_to_str(decl: &ast::fn_decl, purity: ast::purity, name: ast::Ident,
204205
opt_explicit_self: Option<ast::explicit_self_>,
205206
generics: &ast::Generics, intr: @ident_interner) -> ~str {
206-
let wr = @mut MemWriter::new();
207-
let mut s = rust_printer(wr as @mut io::Writer, intr);
207+
let wr = ~MemWriter::new();
208+
let mut s = rust_printer(wr as ~io::Writer, intr);
208209
print_fn(&mut s, decl, Some(purity), AbiSet::Rust(),
209210
name, generics, opt_explicit_self, ast::inherited);
210211
end(&mut s); // Close the head box
211212
end(&mut s); // Close the outer box
212213
eof(&mut s.s);
213-
str::from_utf8_owned(wr.inner_ref().to_owned())
214+
215+
// XXX(pcwalton): Need checked downcasts.
216+
unsafe {
217+
let (_, wr): (uint, ~MemWriter) = cast::transmute(s.s.out);
218+
let result = str::from_utf8_owned(wr.inner_ref().to_owned());
219+
cast::forget(wr);
220+
result
221+
}
214222
}
215223

216224
pub fn block_to_str(blk: &ast::Block, intr: @ident_interner) -> ~str {
217-
let wr = @mut MemWriter::new();
218-
let mut s = rust_printer(wr as @mut io::Writer, intr);
225+
let wr = ~MemWriter::new();
226+
let mut s = rust_printer(wr as ~io::Writer, intr);
219227
// containing cbox, will be closed by print-block at }
220228
cbox(&mut s, indent_unit);
221229
// head-ibox, will be closed by print-block after {
222230
ibox(&mut s, 0u);
223231
print_block(&mut s, blk);
224232
eof(&mut s.s);
225-
str::from_utf8_owned(wr.inner_ref().to_owned())
233+
234+
// XXX(pcwalton): Need checked downcasts.
235+
unsafe {
236+
let (_, wr): (uint, ~MemWriter) = cast::transmute(s.s.out);
237+
let result = str::from_utf8_owned(wr.inner_ref().to_owned());
238+
cast::forget(wr);
239+
result
240+
}
226241
}
227242

228243
pub fn meta_item_to_str(mi: &ast::MetaItem, intr: @ident_interner) -> ~str {
@@ -2304,11 +2319,17 @@ pub fn print_string(s: &mut ps, st: &str, style: ast::StrStyle) {
23042319
}
23052320

23062321
pub fn to_str<T>(t: &T, f: |&mut ps, &T|, intr: @ident_interner) -> ~str {
2307-
let wr = @mut MemWriter::new();
2308-
let mut s = rust_printer(wr as @mut io::Writer, intr);
2322+
let wr = ~MemWriter::new();
2323+
let mut s = rust_printer(wr as ~io::Writer, intr);
23092324
f(&mut s, t);
23102325
eof(&mut s.s);
2311-
str::from_utf8_owned(wr.inner_ref().to_owned())
2326+
// XXX(pcwalton): Need checked downcasts.
2327+
unsafe {
2328+
let (_, wr): (uint, ~MemWriter) = cast::transmute(s.s.out);
2329+
let result = str::from_utf8_owned(wr.inner_ref().to_owned());
2330+
cast::forget(wr);
2331+
result
2332+
}
23122333
}
23132334

23142335
pub fn next_comment(s: &mut ps) -> Option<comments::cmnt> {

0 commit comments

Comments
 (0)