use syntax::abi;
use syntax::ast;
-use syntax::owned_slice::OwnedSlice;
use syntax::codemap::{self, CodeMap, BytePos, Spanned};
-use syntax::diagnostic;
+use syntax::errors;
use syntax::parse::token::{self, BinOpToken};
use syntax::parse::lexer::comments;
use syntax::parse;
rust_printer_annotated(writer, &NO_ANN, krate)
}
-pub fn rust_printer_annotated<'a>(writer: Box<Write + 'a>, ann: &'a PpAnn, krate: Option<&'a Crate>) -> State<'a> {
+pub fn rust_printer_annotated<'a>(writer: Box<Write + 'a>,
+ ann: &'a PpAnn,
+ krate: Option<&'a Crate>)
+ -> State<'a> {
State {
krate: krate,
s: pp::mk_printer(writer, default_columns),
/// it can scan the input text for comments and literals to
/// copy forward.
pub fn print_crate<'a>(cm: &'a CodeMap,
- span_diagnostic: &diagnostic::SpanHandler,
+ span_diagnostic: &errors::Handler,
krate: &hir::Crate,
filename: String,
input: &mut Read,
ann: &'a PpAnn,
is_expanded: bool)
-> io::Result<()> {
- let mut s = State::new_from_input(cm, span_diagnostic, filename, input, out, ann, is_expanded, Some(krate));
+ let mut s = State::new_from_input(cm, span_diagnostic, filename, input,
+ out, ann, is_expanded, Some(krate));
// When printing the AST, we sometimes need to inject `#[no_std]` here.
// Since you can't compile the HIR, it's not necessary.
impl<'a> State<'a> {
pub fn new_from_input(cm: &'a CodeMap,
- span_diagnostic: &diagnostic::SpanHandler,
+ span_diagnostic: &errors::Handler,
filename: String,
input: &mut Read,
out: Box<Write + 'a>,
-> io::Result<()> {
try!(self.print_inner_attributes(attrs));
for item in &nmod.items {
- try!(self.print_foreign_item(&**item));
+ try!(self.print_foreign_item(item));
}
Ok(())
}
hir::TyBareFn(ref f) => {
let generics = hir::Generics {
lifetimes: f.lifetimes.clone(),
- ty_params: OwnedSlice::empty(),
+ ty_params: P::empty(),
where_clause: hir::WhereClause {
id: ast::DUMMY_NODE_ID,
- predicates: Vec::new(),
+ predicates: hir::HirVec::new(),
},
};
try!(self.print_ty_fn(f.abi, f.unsafety, &*f.decl, None, &generics, None));
}
pub fn print_variants(&mut self,
- variants: &[P<hir::Variant>],
+ variants: &[hir::Variant],
span: codemap::Span)
-> io::Result<()> {
try!(self.bopen());
try!(self.maybe_print_comment(v.span.lo));
try!(self.print_outer_attributes(&v.node.attrs));
try!(self.ibox(indent_unit));
- try!(self.print_variant(&**v));
+ try!(self.print_variant(v));
try!(word(&mut self.s, ","));
try!(self.end());
try!(self.maybe_print_trailing_comment(v.span, None));
try!(self.print_inner_attributes(attrs));
for st in &blk.stmts {
- try!(self.print_stmt(&**st));
+ try!(self.print_stmt(st));
}
match blk.expr {
Some(ref expr) => {
try!(self.print_string(&a.asm, a.asm_str_style));
try!(self.word_space(":"));
- try!(self.commasep(Inconsistent, &a.outputs, |s, &(ref co, ref o, is_rw)| {
- match co.slice_shift_char() {
- Some(('=', operand)) if is_rw => {
+ try!(self.commasep(Inconsistent, &a.outputs, |s, out| {
+ match out.constraint.slice_shift_char() {
+ Some(('=', operand)) if out.is_rw => {
try!(s.print_string(&format!("+{}", operand), ast::CookedStr))
}
- _ => try!(s.print_string(&co, ast::CookedStr)),
+ _ => try!(s.print_string(&out.constraint, ast::CookedStr)),
}
try!(s.popen());
- try!(s.print_expr(&**o));
+ try!(s.print_expr(&*out.expr));
try!(s.pclose());
Ok(())
}));
try!(self.print_generics(generics));
}
let generics = hir::Generics {
- lifetimes: Vec::new(),
- ty_params: OwnedSlice::empty(),
+ lifetimes: hir::HirVec::new(),
+ ty_params: P::empty(),
where_clause: hir::WhereClause {
id: ast::DUMMY_NODE_ID,
- predicates: Vec::new(),
+ predicates: hir::HirVec::new(),
},
};
try!(self.print_fn(decl,