From 090040bf4037a094e50b03d79e4baf5cd89c912b Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Mon, 5 May 2014 18:56:44 -0700 Subject: 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` before the snapshot. How to update your code: * Instead of `~EXPR`, you should write `box EXPR`. * Instead of `~TYPE`, you should write `Box`. * Instead of `~PATTERN`, you should write `box PATTERN`. [breaking-change] --- src/libsyntax/print/pprust.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/libsyntax/print/pprust.rs') 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) -> 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, 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, 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) = 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) => { -- cgit 1.4.1-3-g733a5