diff options
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/lib.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 140 |
2 files changed, 0 insertions, 142 deletions
diff --git a/src/libsyntax/lib.rs b/src/libsyntax/lib.rs index 53ee991385a..1ef376c6615 100644 --- a/src/libsyntax/lib.rs +++ b/src/libsyntax/lib.rs @@ -14,7 +14,6 @@ //! //! This API is completely unstable and subject to change. -#![crate_id = "syntax#0.11.0"] // NOTE: remove after stage0 #![crate_name = "syntax"] #![experimental] #![license = "MIT/ASL2"] @@ -27,7 +26,6 @@ #![feature(macro_rules, globs, managed_boxes, default_type_params, phase)] #![feature(quote, unsafe_destructor)] #![allow(deprecated)] -#![allow(unused_attribute)] // NOTE: remove after stage0 extern crate serialize; extern crate term; diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 170cb7a249c..9589a923485 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -245,146 +245,6 @@ pub fn arg_to_string(arg: &ast::Arg) -> String { to_string(|s| s.print_arg(arg)) } - - -#[cfg(stage0)] -pub fn to_str(f: |&mut State| -> IoResult<()>) -> String { - let mut s = rust_printer(box MemWriter::new()); - f(&mut s).unwrap(); - eof(&mut s.s).unwrap(); - unsafe { - // 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, Box<MemWriter>) = mem::transmute_copy(&s.s.out); - let result = - str::from_utf8_owned(Vec::from_slice(wr.get_ref())).unwrap(); - mem::forget(wr); - result.to_string() - } -} - -#[cfg(stage0)] -pub fn ty_to_str(ty: &ast::Ty) -> String { - to_str(|s| s.print_type(ty)) -} - -#[cfg(stage0)] -pub fn pat_to_str(pat: &ast::Pat) -> String { - to_str(|s| s.print_pat(pat)) -} - -#[cfg(stage0)] -pub fn expr_to_str(e: &ast::Expr) -> String { - to_str(|s| s.print_expr(e)) -} - -#[cfg(stage0)] -pub fn lifetime_to_str(e: &ast::Lifetime) -> String { - to_str(|s| s.print_lifetime(e)) -} - -#[cfg(stage0)] -pub fn tt_to_str(tt: &ast::TokenTree) -> String { - to_str(|s| s.print_tt(tt)) -} - -#[cfg(stage0)] -pub fn tts_to_str(tts: &[ast::TokenTree]) -> String { - to_str(|s| s.print_tts(tts)) -} - -#[cfg(stage0)] -pub fn stmt_to_str(stmt: &ast::Stmt) -> String { - to_str(|s| s.print_stmt(stmt)) -} - -#[cfg(stage0)] -pub fn item_to_str(i: &ast::Item) -> String { - to_str(|s| s.print_item(i)) -} - -#[cfg(stage0)] -pub fn generics_to_str(generics: &ast::Generics) -> String { - to_str(|s| s.print_generics(generics)) -} - -#[cfg(stage0)] -pub fn ty_method_to_str(p: &ast::TypeMethod) -> String { - to_str(|s| s.print_ty_method(p)) -} - -#[cfg(stage0)] -pub fn method_to_str(p: &ast::Method) -> String { - to_str(|s| s.print_method(p)) -} - -#[cfg(stage0)] -pub fn fn_block_to_str(p: &ast::FnDecl) -> String { - to_str(|s| s.print_fn_block_args(p)) -} - -#[cfg(stage0)] -pub fn path_to_str(p: &ast::Path) -> String { - to_str(|s| s.print_path(p, false)) -} - -#[cfg(stage0)] -pub fn fun_to_str(decl: &ast::FnDecl, fn_style: ast::FnStyle, name: ast::Ident, - opt_explicit_self: Option<ast::ExplicitSelf_>, - generics: &ast::Generics) -> String { - to_str(|s| { - try!(s.print_fn(decl, Some(fn_style), abi::Rust, - name, generics, opt_explicit_self, ast::Inherited)); - try!(s.end()); // Close the head box - s.end() // Close the outer box - }) -} - -#[cfg(stage0)] -pub fn block_to_str(blk: &ast::Block) -> String { - to_str(|s| { - // containing cbox, will be closed by print-block at } - try!(s.cbox(indent_unit)); - // head-ibox, will be closed by print-block after { - try!(s.ibox(0u)); - s.print_block(blk) - }) -} - -#[cfg(stage0)] -pub fn meta_item_to_str(mi: &ast::MetaItem) -> String { - to_str(|s| s.print_meta_item(mi)) -} - -#[cfg(stage0)] -pub fn attribute_to_str(attr: &ast::Attribute) -> String { - to_str(|s| s.print_attribute(attr)) -} - -#[cfg(stage0)] -pub fn lit_to_str(l: &ast::Lit) -> String { - to_str(|s| s.print_literal(l)) -} - -#[cfg(stage0)] -pub fn explicit_self_to_str(explicit_self: ast::ExplicitSelf_) -> String { - to_str(|s| s.print_explicit_self(explicit_self, ast::MutImmutable).map(|_| {})) -} - -#[cfg(stage0)] -pub fn variant_to_str(var: &ast::Variant) -> String { - to_str(|s| s.print_variant(var)) -} - -#[cfg(stage0)] -pub fn arg_to_str(arg: &ast::Arg) -> String { - to_str(|s| s.print_arg(arg)) -} - - - - pub fn visibility_qualified(vis: ast::Visibility, s: &str) -> String { match vis { ast::Public => format!("pub {}", s), |
