diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2014-05-05 18:56:44 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2014-05-06 23:12:54 -0700 |
| commit | 090040bf4037a094e50b03d79e4baf5cd89c912b (patch) | |
| tree | 27fa91d623889d59260d3db167abdfa8c4288849 /src/libsyntax/print | |
| parent | 24f6f26e633e50b5b59f9d0f6cca0b1e49e215d9 (diff) | |
| download | rust-090040bf4037a094e50b03d79e4baf5cd89c912b.tar.gz rust-090040bf4037a094e50b03d79e4baf5cd89c912b.zip | |
librustc: Remove `~EXPR`, `~TYPE`, and `~PAT` from the language, except
for `~str`/`~[]`. Note that `~self` still remains, since I forgot to add support for `Box<self>` before the snapshot. How to update your code: * Instead of `~EXPR`, you should write `box EXPR`. * Instead of `~TYPE`, you should write `Box<Type>`. * Instead of `~PATTERN`, you should write `box PATTERN`. [breaking-change]
Diffstat (limited to 'src/libsyntax/print')
| -rw-r--r-- | src/libsyntax/print/pp.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs index 21215748fb4..a32cad70175 100644 --- a/src/libsyntax/print/pp.rs +++ b/src/libsyntax/print/pp.rs @@ -155,7 +155,7 @@ pub struct PrintStackElem { static SIZE_INFINITY: int = 0xffff; -pub fn mk_printer(out: ~io::Writer, linewidth: uint) -> Printer { +pub fn mk_printer(out: Box<io::Writer>, linewidth: uint) -> Printer { // Yes 3, it makes the ring buffers big enough to never // fall behind. let n: uint = 3 * linewidth; @@ -262,7 +262,7 @@ pub fn mk_printer(out: ~io::Writer, linewidth: uint) -> Printer { * called 'print'. */ pub struct Printer { - pub out: ~io::Writer, + pub out: Box<io::Writer>, buf_len: uint, margin: int, // width of lines we're constrained to space: int, // number of spaces left on line diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index fb823522612..310ca18e4fa 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -65,12 +65,12 @@ pub struct State<'a> { ann: &'a PpAnn } -pub fn rust_printer(writer: ~io::Writer) -> State<'static> { +pub fn rust_printer(writer: Box<io::Writer>) -> State<'static> { static NO_ANN: NoAnn = NoAnn; rust_printer_annotated(writer, &NO_ANN) } -pub fn rust_printer_annotated<'a>(writer: ~io::Writer, +pub fn rust_printer_annotated<'a>(writer: Box<io::Writer>, ann: &'a PpAnn) -> State<'a> { State { s: pp::mk_printer(writer, default_columns), @@ -99,7 +99,7 @@ pub fn print_crate<'a>(cm: &'a CodeMap, krate: &ast::Crate, filename: ~str, input: &mut io::Reader, - out: ~io::Writer, + out: Box<io::Writer>, ann: &'a PpAnn, is_expanded: bool) -> IoResult<()> { let (cmnts, lits) = comments::gather_comments_and_literals( @@ -140,7 +140,7 @@ pub fn to_str(f: |&mut State| -> IoResult<()>) -> ~str { // FIXME(pcwalton): A nasty function to extract the string from an `io::Writer` // that we "know" to be a `MemWriter` that works around the lack of checked // downcasts. - let (_, wr): (uint, ~MemWriter) = cast::transmute_copy(&s.s.out); + let (_, wr): (uint, Box<MemWriter>) = cast::transmute_copy(&s.s.out); let result = str::from_utf8_owned(wr.get_ref().to_owned()).unwrap(); cast::forget(wr); result @@ -1113,7 +1113,7 @@ impl<'a> State<'a> { pub fn print_expr_vstore(&mut self, t: ast::ExprVstore) -> IoResult<()> { match t { - ast::ExprVstoreUniq => word(&mut self.s, "~"), + ast::ExprVstoreUniq => word(&mut self.s, "box "), ast::ExprVstoreSlice => word(&mut self.s, "&"), ast::ExprVstoreMutSlice => { try!(word(&mut self.s, "&")); @@ -1686,7 +1686,7 @@ impl<'a> State<'a> { try!(self.pclose()); } ast::PatUniq(inner) => { - try!(word(&mut self.s, "~")); + try!(word(&mut self.s, "box ")); try!(self.print_pat(inner)); } ast::PatRegion(inner) => { |
