about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-06-16 19:07:41 -0700
committerGitHub <noreply@github.com>2016-06-16 19:07:41 -0700
commit114be1e9f0db2c84e38b5ed96d4e4450771e8a44 (patch)
treecf17be35a47fd2c95f45392557ac094f2b206224 /src
parentf911d87b3b6ee3e484ca8dd7da4be85970d9230d (diff)
parent019c594c6aebada1cdbb4b7c3d947d9dc17088e1 (diff)
downloadrust-114be1e9f0db2c84e38b5ed96d4e4450771e8a44.tar.gz
rust-114be1e9f0db2c84e38b5ed96d4e4450771e8a44.zip
Auto merge of #34315 - Manishearth:rollup, r=Manishearth
Rollup of 4 pull requests

- Successful merges: #34298, #34302, #34307, #34312
- Failed merges:
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/build/cc.rs4
-rw-r--r--src/bootstrap/build/mod.rs8
-rw-r--r--src/bootstrap/build/sanity.rs4
-rw-r--r--src/build_helper/lib.rs12
-rw-r--r--src/liballoc_jemalloc/build.rs3
-rw-r--r--src/librustc_mir/build/scope.rs57
-rw-r--r--src/librustc_save_analysis/data.rs19
-rw-r--r--src/librustc_save_analysis/dump_visitor.rs71
-rw-r--r--src/librustc_save_analysis/external_data.rs20
-rw-r--r--src/librustc_save_analysis/json_dumper.rs47
-rw-r--r--src/librustc_save_analysis/lib.rs5
-rw-r--r--src/libstd/build.rs3
-rw-r--r--src/libsyntax/print/pprust.rs1718
13 files changed, 1037 insertions, 934 deletions
diff --git a/src/bootstrap/build/cc.rs b/src/bootstrap/build/cc.rs
index d0b0f1007c6..7eb50b8b86d 100644
--- a/src/bootstrap/build/cc.rs
+++ b/src/bootstrap/build/cc.rs
@@ -57,7 +57,9 @@ pub fn find(build: &mut Build) {
         let compiler = cfg.get_compiler();
         let ar = cc2ar(compiler.path(), target);
         build.verbose(&format!("CC_{} = {:?}", target, compiler.path()));
-        build.verbose(&format!("AR_{} = {:?}", target, ar));
+        if let Some(ref ar) = ar {
+            build.verbose(&format!("AR_{} = {:?}", target, ar));
+        }
         build.cc.insert(target.to_string(), (compiler, ar));
     }
 
diff --git a/src/bootstrap/build/mod.rs b/src/bootstrap/build/mod.rs
index 21d12d27d92..dadb0ffa6c9 100644
--- a/src/bootstrap/build/mod.rs
+++ b/src/bootstrap/build/mod.rs
@@ -119,7 +119,7 @@ pub struct Build {
     lldb_python_dir: Option<String>,
 
     // Runtime state filled in later on
-    cc: HashMap<String, (gcc::Tool, PathBuf)>,
+    cc: HashMap<String, (gcc::Tool, Option<PathBuf>)>,
     cxx: HashMap<String, gcc::Tool>,
     compiler_rt_built: RefCell<HashMap<String, PathBuf>>,
 }
@@ -549,7 +549,7 @@ impl Build {
         // FIXME: the guard against msvc shouldn't need to be here
         if !target.contains("msvc") {
             cargo.env(format!("CC_{}", target), self.cc(target))
-                 .env(format!("AR_{}", target), self.ar(target))
+                 .env(format!("AR_{}", target), self.ar(target).unwrap()) // only msvc is None
                  .env(format!("CFLAGS_{}", target), self.cflags(target).join(" "));
         }
 
@@ -825,8 +825,8 @@ impl Build {
     }
 
     /// Returns the path to the `ar` archive utility for the target specified.
-    fn ar(&self, target: &str) -> &Path {
-        &self.cc[target].1
+    fn ar(&self, target: &str) -> Option<&Path> {
+        self.cc[target].1.as_ref().map(|p| &**p)
     }
 
     /// Returns the path to the C++ compiler for the target specified, may panic
diff --git a/src/bootstrap/build/sanity.rs b/src/bootstrap/build/sanity.rs
index a2905277429..fd6cdc702cc 100644
--- a/src/bootstrap/build/sanity.rs
+++ b/src/bootstrap/build/sanity.rs
@@ -70,7 +70,9 @@ pub fn check(build: &mut Build) {
     // also build some C++ shims for LLVM so we need a C++ compiler.
     for target in build.config.target.iter() {
         need_cmd(build.cc(target).as_ref());
-        need_cmd(build.ar(target).as_ref());
+        if let Some(ar) = build.ar(target) {
+            need_cmd(ar.as_ref());
+        }
     }
     for host in build.config.host.iter() {
         need_cmd(build.cxx(host).as_ref());
diff --git a/src/build_helper/lib.rs b/src/build_helper/lib.rs
index 8e1da69cf02..838cc4f07a9 100644
--- a/src/build_helper/lib.rs
+++ b/src/build_helper/lib.rs
@@ -39,9 +39,11 @@ pub fn gnu_target(target: &str) -> String {
     }
 }
 
-pub fn cc2ar(cc: &Path, target: &str) -> PathBuf {
-    if target.contains("musl") || target.contains("msvc") {
-        PathBuf::from("ar")
+pub fn cc2ar(cc: &Path, target: &str) -> Option<PathBuf> {
+    if target.contains("msvc") {
+        None
+    } else if target.contains("musl") {
+        Some(PathBuf::from("ar"))
     } else {
         let parent = cc.parent().unwrap();
         let file = cc.file_name().unwrap().to_str().unwrap();
@@ -49,10 +51,10 @@ pub fn cc2ar(cc: &Path, target: &str) -> PathBuf {
             if let Some(idx) = file.rfind(suffix) {
                 let mut file = file[..idx].to_owned();
                 file.push_str("ar");
-                return parent.join(&file);
+                return Some(parent.join(&file));
             }
         }
-        parent.join(file)
+        Some(parent.join(file))
     }
 }
 
diff --git a/src/liballoc_jemalloc/build.rs b/src/liballoc_jemalloc/build.rs
index e43b9a9df1b..d1b3583d256 100644
--- a/src/liballoc_jemalloc/build.rs
+++ b/src/liballoc_jemalloc/build.rs
@@ -43,7 +43,8 @@ fn main() {
     }
 
     let compiler = gcc::Config::new().get_compiler();
-    let ar = build_helper::cc2ar(compiler.path(), &target);
+    // only msvc returns None for ar so unwrap is okay
+    let ar = build_helper::cc2ar(compiler.path(), &target).unwrap();
     let cflags = compiler.args()
                          .iter()
                          .map(|s| s.to_str().unwrap())
diff --git a/src/librustc_mir/build/scope.rs b/src/librustc_mir/build/scope.rs
index 9cc6b60eec0..65457a9cc80 100644
--- a/src/librustc_mir/build/scope.rs
+++ b/src/librustc_mir/build/scope.rs
@@ -94,6 +94,7 @@ use rustc::ty::{Ty, TyCtxt};
 use rustc::mir::repr::*;
 use syntax::codemap::Span;
 use rustc_data_structures::indexed_vec::Idx;
+use rustc_data_structures::fnv::FnvHashMap;
 
 pub struct Scope<'tcx> {
     /// the scope-id within the scope_auxiliary
@@ -127,12 +128,8 @@ pub struct Scope<'tcx> {
     /// stage.
     free: Option<FreeData<'tcx>>,
 
-    /// The cached block for the cleanups-on-diverge path. This block
-    /// contains a block that will just do a RESUME to an appropriate
-    /// place. This block does not execute any of the drops or free:
-    /// each of those has their own cached-blocks, which will branch
-    /// to this point.
-    cached_block: Option<BasicBlock>
+    /// The cache for drop chain on “normal” exit into a particular BasicBlock.
+    cached_exits: FnvHashMap<(BasicBlock, CodeExtent), BasicBlock>,
 }
 
 struct DropData<'tcx> {
@@ -172,7 +169,7 @@ pub struct LoopScope {
     pub continue_block: BasicBlock,
     /// Block to branch into when the loop terminates (either by being `break`-en out from, or by
     /// having its condition to become false)
-    pub break_block: BasicBlock, // where to go on a `break
+    pub break_block: BasicBlock,
     /// Indicates the reachability of the break_block for this loop
     pub might_break: bool
 }
@@ -183,7 +180,7 @@ impl<'tcx> Scope<'tcx> {
     /// Should always be run for all inner scopes when a drop is pushed into some scope enclosing a
     /// larger extent of code.
     fn invalidate_cache(&mut self) {
-        self.cached_block = None;
+        self.cached_exits = FnvHashMap();
         for dropdata in &mut self.drops {
             dropdata.cached_block = None;
         }
@@ -192,7 +189,7 @@ impl<'tcx> Scope<'tcx> {
         }
     }
 
-    /// Returns the cached block for this scope.
+    /// Returns the cached entrypoint for diverging exit from this scope.
     ///
     /// Precondition: the caches must be fully filled (i.e. diverge_cleanup is called) in order for
     /// this method to work correctly.
@@ -270,7 +267,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
             extent: extent,
             drops: vec![],
             free: None,
-            cached_block: None,
+            cached_exits: FnvHashMap()
         });
         self.scope_auxiliary.push(ScopeAuxiliary {
             extent: extent,
@@ -314,13 +311,25 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
                                                       .unwrap_or_else(||{
             span_bug!(span, "extent {:?} does not enclose", extent)
         });
-
+        let len = self.scopes.len();
+        assert!(scope_count < len, "should not use `exit_scope` to pop ALL scopes");
         let tmp = self.get_unit_temp();
-        for (idx, ref scope) in self.scopes.iter().enumerate().rev().take(scope_count) {
-            unpack!(block = build_scope_drops(&mut self.cfg,
-                                              scope,
-                                              &self.scopes[..idx],
-                                              block));
+        {
+        let mut rest = &mut self.scopes[(len - scope_count)..];
+        while let Some((scope, rest_)) = {rest}.split_last_mut() {
+            rest = rest_;
+            block = if let Some(&e) = scope.cached_exits.get(&(target, extent)) {
+                self.cfg.terminate(block, scope.source_info(span),
+                                   TerminatorKind::Goto { target: e });
+                return;
+            } else {
+                let b = self.cfg.start_new_block();
+                self.cfg.terminate(block, scope.source_info(span),
+                                   TerminatorKind::Goto { target: b });
+                scope.cached_exits.insert((target, extent), b);
+                b
+            };
+            unpack!(block = build_scope_drops(&mut self.cfg, scope, rest, block));
             if let Some(ref free_data) = scope.free {
                 let next = self.cfg.start_new_block();
                 let free = build_free(self.hir.tcx(), &tmp, free_data, next);
@@ -331,14 +340,9 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
                 .postdoms
                 .push(self.cfg.current_location(block));
         }
-
-        assert!(scope_count < self.scopes.len(),
-                "should never use `exit_scope` to pop *ALL* scopes");
-        let scope = self.scopes.iter().rev().skip(scope_count)
-                                            .next()
-                                            .unwrap();
-        self.cfg.terminate(block,
-                           scope.source_info(span),
+        }
+        let scope = &self.scopes[len - scope_count];
+        self.cfg.terminate(block, scope.source_info(span),
                            TerminatorKind::Goto { target: target });
     }
 
@@ -506,10 +510,9 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
             resumeblk
         };
 
-        for scope in scopes {
+        for scope in scopes.iter_mut().filter(|s| !s.drops.is_empty() || s.free.is_some()) {
             target = build_diverge_scope(hir.tcx(), cfg, &unit_temp, scope, target);
         }
-
         Some(target)
     }
 
@@ -534,7 +537,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
         next_target.unit()
     }
 
-
+    /// Utility function for *non*-scope code to build their own drops
     pub fn build_drop_and_replace(&mut self,
                                   block: BasicBlock,
                                   span: Span,
diff --git a/src/librustc_save_analysis/data.rs b/src/librustc_save_analysis/data.rs
index 2275a1c5c65..15aaa77cc35 100644
--- a/src/librustc_save_analysis/data.rs
+++ b/src/librustc_save_analysis/data.rs
@@ -102,6 +102,8 @@ pub struct EnumData {
     pub qualname: String,
     pub span: Span,
     pub scope: NodeId,
+    pub variants: Vec<NodeId>,
+
 }
 
 /// Data for extern crates.
@@ -212,6 +214,7 @@ pub struct MethodData {
     pub span: Span,
     pub scope: NodeId,
     pub value: String,
+    pub decl_id: Option<DefId>,
 }
 
 /// Data for modules.
@@ -223,6 +226,7 @@ pub struct ModData {
     pub span: Span,
     pub scope: NodeId,
     pub filename: String,
+    pub items: Vec<NodeId>,
 }
 
 /// Data for a reference to a module.
@@ -242,7 +246,8 @@ pub struct StructData {
     pub ctor_id: NodeId,
     pub qualname: String,
     pub scope: NodeId,
-    pub value: String
+    pub value: String,
+    pub fields: Vec<NodeId>,
 }
 
 #[derive(Debug, RustcEncodable)]
@@ -263,7 +268,8 @@ pub struct TraitData {
     pub name: String,
     pub qualname: String,
     pub scope: NodeId,
-    pub value: String
+    pub value: String,
+    pub items: Vec<NodeId>,
 }
 
 #[derive(Debug, RustcEncodable)]
@@ -317,6 +323,7 @@ pub struct UseGlobData {
 #[derive(Debug, RustcEncodable)]
 pub struct VariableData {
     pub id: NodeId,
+    pub kind: VariableKind,
     pub name: String,
     pub qualname: String,
     pub span: Span,
@@ -325,6 +332,14 @@ pub struct VariableData {
     pub type_value: String,
 }
 
+#[derive(Debug, RustcEncodable)]
+pub enum VariableKind {
+    Static,
+    Const,
+    Local,
+    Field,
+}
+
 /// Data for the use of some item (e.g., the use of a local variable, which
 /// will refer to that variables declaration (by ref_id)).
 #[derive(Debug, RustcEncodable)]
diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs
index 216d188a503..56c7436a8fe 100644
--- a/src/librustc_save_analysis/dump_visitor.rs
+++ b/src/librustc_save_analysis/dump_visitor.rs
@@ -30,7 +30,7 @@
 use rustc::hir::def::Def;
 use rustc::hir::def_id::DefId;
 use rustc::session::Session;
-use rustc::ty::{self, TyCtxt};
+use rustc::ty::{self, TyCtxt, ImplOrTraitItem, ImplOrTraitItemContainer};
 
 use std::collections::HashSet;
 use std::hash::*;
@@ -356,6 +356,7 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
                 if !self.span.filter_generated(sub_span, p.span) {
                     self.dumper.variable(VariableData {
                         id: id,
+                        kind: VariableKind::Local,
                         span: sub_span.expect("No span found for variable"),
                         name: path_to_string(p),
                         qualname: format!("{}::{}", qualname, path_to_string(p)),
@@ -380,24 +381,42 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
 
             let sig_str = ::make_signature(&sig.decl, &sig.generics);
             if body.is_some() {
-                if !self.span.filter_generated(Some(method_data.span), span) {
-                    let mut data = method_data.clone();
-                    data.value = sig_str;
-                    self.dumper.function(data.lower(self.tcx));
-                }
                 self.process_formals(&sig.decl.inputs, &method_data.qualname);
-            } else {
-                if !self.span.filter_generated(Some(method_data.span), span) {
-                    self.dumper.method(MethodData {
-                        id: method_data.id,
-                        name: method_data.name,
-                        span: method_data.span,
-                        scope: method_data.scope,
-                        qualname: method_data.qualname.clone(),
-                        value: sig_str,
-                    }.lower(self.tcx));
-                }
             }
+
+            // If the method is defined in an impl, then try and find the corresponding
+            // method decl in a trait, and if there is one, make a decl_id for it. This
+            // requires looking up the impl, then the trait, then searching for a method
+            // with the right name.
+            if !self.span.filter_generated(Some(method_data.span), span) {
+                let container =
+                    self.tcx.impl_or_trait_item(self.tcx.map.local_def_id(id)).container();
+                let decl_id = if let ImplOrTraitItemContainer::ImplContainer(id) = container {
+                    self.tcx.trait_id_of_impl(id).and_then(|id| {
+                        for item in &**self.tcx.trait_items(id) {
+                            if let &ImplOrTraitItem::MethodTraitItem(ref m) = item {
+                                if m.name == name {
+                                    return Some(m.def_id);
+                                }
+                            }
+                        }
+                        None
+                    })
+                } else {
+                    None
+                };
+
+                self.dumper.method(MethodData {
+                    id: method_data.id,
+                    name: method_data.name,
+                    span: method_data.span,
+                    scope: method_data.scope,
+                    qualname: method_data.qualname.clone(),
+                    value: sig_str,
+                    decl_id: decl_id,
+                }.lower(self.tcx));
+            }
+
             self.process_generic_params(&sig.generics, span, &method_data.qualname, id);
         }
 
@@ -519,6 +538,7 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
         if !self.span.filter_generated(sub_span, span) {
             self.dumper.variable(VariableData {
                 span: sub_span.expect("No span found for variable"),
+                kind: VariableKind::Const,
                 id: id,
                 name: name.to_string(),
                 qualname: qualname,
@@ -542,17 +562,18 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
         let qualname = format!("::{}", self.tcx.node_path_str(item.id));
 
         let sub_span = self.span.sub_span_after_keyword(item.span, keywords::Struct);
-        let val = if let ast::ItemKind::Struct(ast::VariantData::Struct(ref fields, _), _) =
-                    item.node {
+        let (val, fields) =
+            if let ast::ItemKind::Struct(ast::VariantData::Struct(ref fields, _), _) = item.node
+        {
             let fields_str = fields.iter()
                                    .enumerate()
                                    .map(|(i, f)| f.ident.map(|i| i.to_string())
                                                   .unwrap_or(i.to_string()))
                                    .collect::<Vec<_>>()
                                    .join(", ");
-            format!("{} {{ {} }}", name, fields_str)
+            (format!("{} {{ {} }}", name, fields_str), fields.iter().map(|f| f.id).collect())
         } else {
-            String::new()
+            (String::new(), vec![])
         };
 
         if !self.span.filter_generated(sub_span, item.span) {
@@ -563,7 +584,8 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
                 ctor_id: def.id(),
                 qualname: qualname.clone(),
                 scope: self.cur_scope,
-                value: val
+                value: val,
+                fields: fields,
             }.lower(self.tcx));
         }
 
@@ -718,7 +740,8 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
                 name: name,
                 qualname: qualname.clone(),
                 scope: self.cur_scope,
-                value: val
+                value: val,
+                items: methods.iter().map(|i| i.id).collect(),
             }.lower(self.tcx));
         }
 
@@ -958,6 +981,7 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
             if !self.span.filter_generated(sub_span, p.span) {
                 self.dumper.variable(VariableData {
                     span: sub_span.expect("No span found for variable"),
+                    kind: VariableKind::Local,
                     id: id,
                     name: path_to_string(p),
                     qualname: format!("{}${}", path_to_string(p), id),
@@ -1366,6 +1390,7 @@ impl<'v, 'l, 'tcx: 'l, 'll, D: Dump +'ll> Visitor<'v> for DumpVisitor<'l, 'tcx,
                     if !self.span.filter_generated(Some(p.span), p.span) {
                         self.dumper.variable(VariableData {
                             span: p.span,
+                            kind: VariableKind::Local,
                             id: id,
                             name: path_to_string(p),
                             qualname: format!("{}${}", path_to_string(p), id),
diff --git a/src/librustc_save_analysis/external_data.rs b/src/librustc_save_analysis/external_data.rs
index dc51c41f296..7efd2624561 100644
--- a/src/librustc_save_analysis/external_data.rs
+++ b/src/librustc_save_analysis/external_data.rs
@@ -14,7 +14,7 @@ use rustc::ty::TyCtxt;
 use syntax::ast::{CrateNum, NodeId};
 use syntax::codemap::{Span, CodeMap};
 
-use super::data;
+use data;
 
 // FIXME: this should be pub(crate), but the current snapshot doesn't allow it yet
 pub trait Lower {
@@ -90,6 +90,7 @@ pub struct EnumData {
     pub qualname: String,
     pub span: SpanData,
     pub scope: DefId,
+    pub variants: Vec<DefId>
 }
 
 impl Lower for data::EnumData {
@@ -103,6 +104,7 @@ impl Lower for data::EnumData {
             qualname: self.qualname,
             span: SpanData::from_span(self.span, tcx.sess.codemap()),
             scope: make_def_id(self.scope, &tcx.map),
+            variants: self.variants.into_iter().map(|id| make_def_id(id, &tcx.map)).collect(),
         }
     }
 }
@@ -319,6 +321,7 @@ pub struct MethodData {
     pub span: SpanData,
     pub scope: DefId,
     pub value: String,
+    pub decl_id: Option<DefId>,
 }
 
 impl Lower for data::MethodData {
@@ -332,6 +335,7 @@ impl Lower for data::MethodData {
             id: make_def_id(self.id, &tcx.map),
             qualname: self.qualname,
             value: self.value,
+            decl_id: self.decl_id,
         }
     }
 }
@@ -345,6 +349,7 @@ pub struct ModData {
     pub span: SpanData,
     pub scope: DefId,
     pub filename: String,
+    pub items: Vec<DefId>,
 }
 
 impl Lower for data::ModData {
@@ -358,6 +363,7 @@ impl Lower for data::ModData {
             span: SpanData::from_span(self.span, tcx.sess.codemap()),
             scope: make_def_id(self.scope, &tcx.map),
             filename: self.filename,
+            items: self.items.into_iter().map(|id| make_def_id(id, &tcx.map)).collect(),
         }
     }
 }
@@ -392,7 +398,8 @@ pub struct StructData {
     pub ctor_id: DefId,
     pub qualname: String,
     pub scope: DefId,
-    pub value: String
+    pub value: String,
+    pub fields: Vec<DefId>,
 }
 
 impl Lower for data::StructData {
@@ -406,7 +413,8 @@ impl Lower for data::StructData {
             ctor_id: make_def_id(self.ctor_id, &tcx.map),
             qualname: self.qualname,
             scope: make_def_id(self.scope, &tcx.map),
-            value: self.value
+            value: self.value,
+            fields: self.fields.into_iter().map(|id| make_def_id(id, &tcx.map)).collect(),
         }
     }
 }
@@ -445,7 +453,8 @@ pub struct TraitData {
     pub id: DefId,
     pub qualname: String,
     pub scope: DefId,
-    pub value: String
+    pub value: String,
+    pub items: Vec<DefId>,
 }
 
 impl Lower for data::TraitData {
@@ -459,6 +468,7 @@ impl Lower for data::TraitData {
             qualname: self.qualname,
             scope: make_def_id(self.scope, &tcx.map),
             value: self.value,
+            items: self.items.into_iter().map(|id| make_def_id(id, &tcx.map)).collect(),
         }
     }
 }
@@ -585,6 +595,7 @@ impl Lower for data::UseGlobData {
 pub struct VariableData {
     pub id: DefId,
     pub name: String,
+    pub kind: data::VariableKind,
     pub qualname: String,
     pub span: SpanData,
     pub scope: DefId,
@@ -598,6 +609,7 @@ impl Lower for data::VariableData {
     fn lower(self, tcx: TyCtxt) -> VariableData {
         VariableData {
             id: make_def_id(self.id, &tcx.map),
+            kind: self.kind,
             name: self.name,
             qualname: self.qualname,
             span: SpanData::from_span(self.span, tcx.sess.codemap()),
diff --git a/src/librustc_save_analysis/json_dumper.rs b/src/librustc_save_analysis/json_dumper.rs
index 610a9ac2ad6..b1955cbd7b8 100644
--- a/src/librustc_save_analysis/json_dumper.rs
+++ b/src/librustc_save_analysis/json_dumper.rs
@@ -13,8 +13,9 @@ use std::io::Write;
 use rustc::hir::def_id::DefId;
 use rustc_serialize::json::as_json;
 
-use super::external_data::*;
-use super::dump::Dump;
+use external_data::*;
+use data::VariableKind;
+use dump::Dump;
 
 pub struct JsonDumper<'b, W: Write + 'b> {
     output: &'b mut W,
@@ -180,6 +181,8 @@ struct Def {
     name: String,
     qualname: String,
     value: String,
+    children: Vec<Id>,
+    decl_id: Option<Id>,
 }
 
 #[derive(Debug, RustcEncodable)]
@@ -194,14 +197,19 @@ enum DefKind {
     Trait,
     // value = type + generics
     Function,
+    // value = type + generics
+    Method,
     // No id, no value.
     Macro,
     // value = file_name
     Mod,
     // value = aliased type
     Type,
-    // value = type and init expression
-    Variable,
+    // value = type and init expression (for all variable kinds).
+    Local,
+    Static,
+    Const,
+    Field,
 }
 
 impl From<EnumData> for Def {
@@ -213,6 +221,8 @@ impl From<EnumData> for Def {
             name: data.name,
             qualname: data.qualname,
             value: data.value,
+            children: data.variants.into_iter().map(|id| From::from(id)).collect(),
+            decl_id: None,
         }
     }
 }
@@ -226,6 +236,8 @@ impl From<TupleVariantData> for Def {
             name: data.name,
             qualname: data.qualname,
             value: data.value,
+            children: vec![],
+            decl_id: None,
         }
     }
 }
@@ -238,6 +250,8 @@ impl From<StructVariantData> for Def {
             name: data.name,
             qualname: data.qualname,
             value: data.value,
+            children: vec![],
+            decl_id: None,
         }
     }
 }
@@ -250,6 +264,8 @@ impl From<StructData> for Def {
             name: data.name,
             qualname: data.qualname,
             value: data.value,
+            children: data.fields.into_iter().map(|id| From::from(id)).collect(),
+            decl_id: None,
         }
     }
 }
@@ -262,6 +278,8 @@ impl From<TraitData> for Def {
             name: data.name,
             qualname: data.qualname,
             value: data.value,
+            children: data.items.into_iter().map(|id| From::from(id)).collect(),
+            decl_id: None,
         }
     }
 }
@@ -274,18 +292,22 @@ impl From<FunctionData> for Def {
             name: data.name,
             qualname: data.qualname,
             value: data.value,
+            children: vec![],
+            decl_id: None,
         }
     }
 }
 impl From<MethodData> for Def {
     fn from(data: MethodData) -> Def {
         Def {
-            kind: DefKind::Function,
+            kind: DefKind::Method,
             id: From::from(data.id),
             span: data.span,
             name: data.name,
             qualname: data.qualname,
             value: data.value,
+            children: vec![],
+            decl_id: data.decl_id.map(|id| From::from(id)),
         }
     }
 }
@@ -298,6 +320,8 @@ impl From<MacroData> for Def {
             name: data.name,
             qualname: data.qualname,
             value: String::new(),
+            children: vec![],
+            decl_id: None,
         }
     }
 }
@@ -310,6 +334,8 @@ impl From<ModData> for Def {
             name: data.name,
             qualname: data.qualname,
             value: data.filename,
+            children: data.items.into_iter().map(|id| From::from(id)).collect(),
+            decl_id: None,
         }
     }
 }
@@ -322,18 +348,27 @@ impl From<TypeDefData> for Def {
             name: data.name,
             qualname: data.qualname,
             value: data.value,
+            children: vec![],
+            decl_id: None,
         }
     }
 }
 impl From<VariableData> for Def {
     fn from(data: VariableData) -> Def {
         Def {
-            kind: DefKind::Variable,
+            kind: match data.kind {
+                VariableKind::Static => DefKind::Static,
+                VariableKind::Const => DefKind::Const,
+                VariableKind::Local => DefKind::Local,
+                VariableKind::Field => DefKind::Field,
+            },
             id: From::from(data.id),
             span: data.span,
             name: data.name,
             qualname: data.qualname,
             value: data.value,
+            children: vec![],
+            decl_id: None,
         }
     }
 }
diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs
index 27f15756a91..33351338160 100644
--- a/src/librustc_save_analysis/lib.rs
+++ b/src/librustc_save_analysis/lib.rs
@@ -153,6 +153,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
                 filter!(self.span_utils, sub_span, item.span, None);
                 Some(Data::VariableData(VariableData {
                     id: item.id,
+                    kind: VariableKind::Static,
                     name: item.ident.to_string(),
                     qualname: qualname,
                     span: sub_span.unwrap(),
@@ -167,6 +168,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
                 filter!(self.span_utils, sub_span, item.span, None);
                 Some(Data::VariableData(VariableData {
                     id: item.id,
+                    kind: VariableKind::Const,
                     name: item.ident.to_string(),
                     qualname: qualname,
                     span: sub_span.unwrap(),
@@ -190,6 +192,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
                     span: sub_span.unwrap(),
                     scope: self.enclosing_scope(item.id),
                     filename: filename,
+                    items: m.items.iter().map(|i| i.id).collect(),
                 }))
             }
             ast::ItemKind::Enum(ref def, _) => {
@@ -209,6 +212,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
                     span: sub_span.unwrap(),
                     qualname: qualname,
                     scope: self.enclosing_scope(item.id),
+                    variants: def.variants.iter().map(|v| v.node.data.id()).collect(),
                 }))
             }
             ast::ItemKind::Impl(_, _, _, ref trait_ref, ref typ, _) => {
@@ -266,6 +270,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
             filter!(self.span_utils, sub_span, field.span, None);
             Some(VariableData {
                 id: field.id,
+                kind: VariableKind::Field,
                 name: ident.to_string(),
                 qualname: qualname,
                 span: sub_span.unwrap(),
diff --git a/src/libstd/build.rs b/src/libstd/build.rs
index ff9dacbb679..9c408366f8b 100644
--- a/src/libstd/build.rs
+++ b/src/libstd/build.rs
@@ -80,7 +80,8 @@ fn build_libbacktrace(host: &str, target: &str) {
     }
 
     let compiler = gcc::Config::new().get_compiler();
-    let ar = build_helper::cc2ar(compiler.path(), target);
+    // only msvc returns None for ar so unwrap is okay
+    let ar = build_helper::cc2ar(compiler.path(), target).unwrap();
     let cflags = compiler.args().iter().map(|s| s.to_str().unwrap())
                          .collect::<Vec<_>>().join(" ");
     run(Command::new("sh")
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs
index 8818acf9aef..0c90e102f34 100644
--- a/src/libsyntax/print/pprust.rs
+++ b/src/libsyntax/print/pprust.rs
@@ -123,16 +123,16 @@ pub fn print_crate<'a>(cm: &'a CodeMap,
         let list = attr::mk_list_item(InternedString::new("feature"),
                                       vec![prelude_import_meta]);
         let fake_attr = attr::mk_attr_inner(attr::mk_attr_id(), list);
-        s.print_attribute(&fake_attr)?;
+        try!(s.print_attribute(&fake_attr));
 
         // #![no_std]
         let no_std_meta = attr::mk_word_item(InternedString::new("no_std"));
         let fake_attr = attr::mk_attr_inner(attr::mk_attr_id(), no_std_meta);
-        s.print_attribute(&fake_attr)?;
+        try!(s.print_attribute(&fake_attr));
     }
 
-    s.print_mod(&krate.module, &krate.attrs)?;
-    s.print_remaining_comments()?;
+    try!(s.print_mod(&krate.module, &krate.attrs));
+    try!(s.print_remaining_comments());
     eof(&mut s.s)
 }
 
@@ -385,10 +385,10 @@ pub fn fun_to_string(decl: &ast::FnDecl,
                      generics: &ast::Generics)
                      -> String {
     to_string(|s| {
-        s.head("")?;
-        s.print_fn(decl, unsafety, constness, Abi::Rust, Some(name),
-                   generics, &ast::Visibility::Inherited)?;
-        s.end()?; // Close the head box
+        try!(s.head(""));
+        try!(s.print_fn(decl, unsafety, constness, Abi::Rust, Some(name),
+                   generics, &ast::Visibility::Inherited));
+        try!(s.end()); // Close the head box
         s.end() // Close the outer box
     })
 }
@@ -396,9 +396,9 @@ pub fn fun_to_string(decl: &ast::FnDecl,
 pub fn block_to_string(blk: &ast::Block) -> String {
     to_string(|s| {
         // containing cbox, will be closed by print-block at }
-        s.cbox(INDENT_UNIT)?;
+        try!(s.cbox(INDENT_UNIT));
         // head-ibox, will be closed by print-block after {
-        s.ibox(0)?;
+        try!(s.ibox(0));
         s.print_block(blk)
     })
 }
@@ -454,7 +454,7 @@ pub trait PrintState<'a> {
     fn literals(&self) -> &Option<Vec<comments::Literal>>;
 
     fn word_space(&mut self, w: &str) -> io::Result<()> {
-        word(self.writer(), w)?;
+        try!(word(self.writer(), w));
         space(self.writer())
     }
 
@@ -483,7 +483,7 @@ pub trait PrintState<'a> {
 
     fn hardbreak_if_not_bol(&mut self) -> io::Result<()> {
         if !self.is_bol() {
-            hardbreak(self.writer())?
+            try!(hardbreak(self.writer()))
         }
         Ok(())
     }
@@ -507,11 +507,11 @@ pub trait PrintState<'a> {
     fn commasep<T, F>(&mut self, b: Breaks, elts: &[T], mut op: F) -> io::Result<()>
         where F: FnMut(&mut Self, &T) -> io::Result<()>,
     {
-        self.rbox(0, b)?;
+        try!(self.rbox(0, b));
         let mut first = true;
         for elt in elts {
-            if first { first = false; } else { self.word_space(",")?; }
-            op(self, elt)?;
+            if first { first = false; } else { try!(self.word_space(",")); }
+            try!(op(self, elt));
         }
         self.end()
     }
@@ -543,7 +543,7 @@ pub trait PrintState<'a> {
             match self.next_comment() {
                 Some(ref cmnt) => {
                     if (*cmnt).pos < pos {
-                        self.print_comment(cmnt)?;
+                        try!(self.print_comment(cmnt));
                         self.cur_cmnt_and_lit().cur_cmnt += 1;
                     } else { break; }
                 }
@@ -558,34 +558,34 @@ pub trait PrintState<'a> {
         match cmnt.style {
             comments::Mixed => {
                 assert_eq!(cmnt.lines.len(), 1);
-                zerobreak(self.writer())?;
-                word(self.writer(), &cmnt.lines[0])?;
+                try!(zerobreak(self.writer()));
+                try!(word(self.writer(), &cmnt.lines[0]));
                 zerobreak(self.writer())
             }
             comments::Isolated => {
-                self.hardbreak_if_not_bol()?;
+                try!(self.hardbreak_if_not_bol());
                 for line in &cmnt.lines {
                     // Don't print empty lines because they will end up as trailing
                     // whitespace
                     if !line.is_empty() {
-                        word(self.writer(), &line[..])?;
+                        try!(word(self.writer(), &line[..]));
                     }
-                    hardbreak(self.writer())?;
+                    try!(hardbreak(self.writer()));
                 }
                 Ok(())
             }
             comments::Trailing => {
-                word(self.writer(), " ")?;
+                try!(word(self.writer(), " "));
                 if cmnt.lines.len() == 1 {
-                    word(self.writer(), &cmnt.lines[0])?;
+                    try!(word(self.writer(), &cmnt.lines[0]));
                     hardbreak(self.writer())
                 } else {
-                    self.ibox(0)?;
+                    try!(self.ibox(0));
                     for line in &cmnt.lines {
                         if !line.is_empty() {
-                            word(self.writer(), &line[..])?;
+                            try!(word(self.writer(), &line[..]));
                         }
-                        hardbreak(self.writer())?;
+                        try!(hardbreak(self.writer()));
                     }
                     self.end()
                 }
@@ -597,7 +597,7 @@ pub trait PrintState<'a> {
                     _ => false
                 };
                 if is_semi || self.is_begin() || self.is_end() {
-                    hardbreak(self.writer())?;
+                    try!(hardbreak(self.writer()));
                 }
                 hardbreak(self.writer())
             }
@@ -619,7 +619,7 @@ pub trait PrintState<'a> {
     }
 
     fn print_literal(&mut self, lit: &ast::Lit) -> io::Result<()> {
-        self.maybe_print_comment(lit.span.lo)?;
+        try!(self.maybe_print_comment(lit.span.lo));
         match self.next_lit(lit.span.lo) {
             Some(ref ltrl) => {
                 return word(self.writer(), &(*ltrl).lit);
@@ -725,15 +725,15 @@ pub trait PrintState<'a> {
         let mut count = 0;
         for attr in attrs {
             if attr.node.style == kind {
-                    self.print_attribute_inline(attr, is_inline)?;
-                    if is_inline {
-                        self.nbsp()?;
-                    }
-                    count += 1;
+                try!(self.print_attribute_inline(attr, is_inline));
+                if is_inline {
+                    try!(self.nbsp());
+                }
+                count += 1;
             }
         }
         if count > 0 && trailing_hardbreak && !is_inline {
-            self.hardbreak_if_not_bol()?;
+            try!(self.hardbreak_if_not_bol());
         }
         Ok(())
     }
@@ -745,47 +745,47 @@ pub trait PrintState<'a> {
     fn print_attribute_inline(&mut self, attr: &ast::Attribute,
                               is_inline: bool) -> io::Result<()> {
         if !is_inline {
-            self.hardbreak_if_not_bol()?;
+            try!(self.hardbreak_if_not_bol());
         }
-        self.maybe_print_comment(attr.span.lo)?;
+        try!(self.maybe_print_comment(attr.span.lo));
         if attr.node.is_sugared_doc {
-            word(self.writer(), &attr.value_str().unwrap())?;
+            try!(word(self.writer(), &attr.value_str().unwrap()));
             hardbreak(self.writer())
         } else {
             match attr.node.style {
-                ast::AttrStyle::Inner => word(self.writer(), "#![")?,
-                ast::AttrStyle::Outer => word(self.writer(), "#[")?,
+                ast::AttrStyle::Inner => try!(word(self.writer(), "#![")),
+                ast::AttrStyle::Outer => try!(word(self.writer(), "#[")),
             }
-            self.print_meta_item(&attr.meta())?;
+            try!(self.print_meta_item(&attr.meta()));
             word(self.writer(), "]")
         }
     }
 
     fn print_meta_item(&mut self, item: &ast::MetaItem) -> io::Result<()> {
-        self.ibox(INDENT_UNIT)?;
+        try!(self.ibox(INDENT_UNIT));
         match item.node {
             ast::MetaItemKind::Word(ref name) => {
-                word(self.writer(), &name)?;
+                try!(word(self.writer(), &name));
             }
             ast::MetaItemKind::NameValue(ref name, ref value) => {
-                self.word_space(&name[..])?;
-                self.word_space("=")?;
-                self.print_literal(value)?;
+                try!(self.word_space(&name[..]));
+                try!(self.word_space("="));
+                try!(self.print_literal(value));
             }
             ast::MetaItemKind::List(ref name, ref items) => {
-                word(self.writer(), &name)?;
-                self.popen()?;
-                self.commasep(Consistent,
+                try!(word(self.writer(), &name));
+                try!(self.popen());
+                try!(self.commasep(Consistent,
                               &items[..],
-                              |s, i| s.print_meta_item(&i))?;
-                self.pclose()?;
+                              |s, i| s.print_meta_item(&i)));
+                try!(self.pclose());
             }
         }
         self.end()
     }
 
     fn space_if_not_bol(&mut self) -> io::Result<()> {
-        if !self.is_bol() { space(self.writer())?; }
+        if !self.is_bol() { try!(space(self.writer())); }
         Ok(())
     }
 
@@ -821,24 +821,24 @@ impl<'a> State<'a> {
     }
 
     pub fn word_nbsp(&mut self, w: &str) -> io::Result<()> {
-        word(&mut self.s, w)?;
+        try!(word(&mut self.s, w));
         self.nbsp()
     }
 
     pub fn head(&mut self, w: &str) -> io::Result<()> {
         // outer-box is consistent
-        self.cbox(INDENT_UNIT)?;
+        try!(self.cbox(INDENT_UNIT));
         // head-box is inconsistent
-        self.ibox(w.len() + 1)?;
+        try!(self.ibox(w.len() + 1));
         // keyword that starts the head
         if !w.is_empty() {
-            self.word_nbsp(w)?;
+            try!(self.word_nbsp(w));
         }
         Ok(())
     }
 
     pub fn bopen(&mut self) -> io::Result<()> {
-        word(&mut self.s, "{")?;
+        try!(word(&mut self.s, "{"));
         self.end() // close the head-box
     }
 
@@ -848,11 +848,11 @@ impl<'a> State<'a> {
     }
     pub fn bclose_maybe_open(&mut self, span: codemap::Span,
                              indented: usize, close_box: bool) -> io::Result<()> {
-        self.maybe_print_comment(span.hi)?;
-        self.break_offset_if_not_bol(1, -(indented as isize))?;
-        word(&mut self.s, "}")?;
+        try!(self.maybe_print_comment(span.hi));
+        try!(self.break_offset_if_not_bol(1, -(indented as isize)));
+        try!(word(&mut self.s, "}"));
         if close_box {
-            self.end()?; // close the outer-box
+            try!(self.end()); // close the outer-box
         }
         Ok(())
     }
@@ -885,10 +885,10 @@ impl<'a> State<'a> {
     // Synthesizes a comment that was not textually present in the original source
     // file.
     pub fn synth_comment(&mut self, text: String) -> io::Result<()> {
-        word(&mut self.s, "/*")?;
-        space(&mut self.s)?;
-        word(&mut self.s, &text[..])?;
-        space(&mut self.s)?;
+        try!(word(&mut self.s, "/*"));
+        try!(space(&mut self.s));
+        try!(word(&mut self.s, &text[..]));
+        try!(space(&mut self.s));
         word(&mut self.s, "*/")
     }
 
@@ -902,18 +902,18 @@ impl<'a> State<'a> {
         F: FnMut(&mut State, &T) -> io::Result<()>,
         G: FnMut(&T) -> codemap::Span,
     {
-        self.rbox(0, b)?;
+        try!(self.rbox(0, b));
         let len = elts.len();
         let mut i = 0;
         for elt in elts {
-            self.maybe_print_comment(get_span(elt).hi)?;
-            op(self, elt)?;
+            try!(self.maybe_print_comment(get_span(elt).hi));
+            try!(op(self, elt));
             i += 1;
             if i < len {
-                word(&mut self.s, ",")?;
-                self.maybe_print_trailing_comment(get_span(elt),
-                                                  Some(get_span(&elts[i]).hi))?;
-                self.space_if_not_bol()?;
+                try!(word(&mut self.s, ","));
+                try!(self.maybe_print_trailing_comment(get_span(elt),
+                                                  Some(get_span(&elts[i]).hi)));
+                try!(self.space_if_not_bol());
             }
         }
         self.end()
@@ -926,18 +926,18 @@ impl<'a> State<'a> {
 
     pub fn print_mod(&mut self, _mod: &ast::Mod,
                      attrs: &[ast::Attribute]) -> io::Result<()> {
-        self.print_inner_attributes(attrs)?;
+        try!(self.print_inner_attributes(attrs));
         for item in &_mod.items {
-            self.print_item(&item)?;
+            try!(self.print_item(&item));
         }
         Ok(())
     }
 
     pub fn print_foreign_mod(&mut self, nmod: &ast::ForeignMod,
                              attrs: &[ast::Attribute]) -> io::Result<()> {
-        self.print_inner_attributes(attrs)?;
+        try!(self.print_inner_attributes(attrs));
         for item in &nmod.items {
-            self.print_foreign_item(item)?;
+            try!(self.print_foreign_item(item));
         }
         Ok(())
     }
@@ -945,47 +945,47 @@ impl<'a> State<'a> {
     pub fn print_opt_lifetime(&mut self,
                               lifetime: &Option<ast::Lifetime>) -> io::Result<()> {
         if let Some(l) = *lifetime {
-            self.print_lifetime(&l)?;
-            self.nbsp()?;
+            try!(self.print_lifetime(&l));
+            try!(self.nbsp());
         }
         Ok(())
     }
 
     pub fn print_type(&mut self, ty: &ast::Ty) -> io::Result<()> {
-        self.maybe_print_comment(ty.span.lo)?;
-        self.ibox(0)?;
+        try!(self.maybe_print_comment(ty.span.lo));
+        try!(self.ibox(0));
         match ty.node {
             ast::TyKind::Vec(ref ty) => {
-                word(&mut self.s, "[")?;
-                self.print_type(&ty)?;
-                word(&mut self.s, "]")?;
+                try!(word(&mut self.s, "["));
+                try!(self.print_type(&ty));
+                try!(word(&mut self.s, "]"));
             }
             ast::TyKind::Ptr(ref mt) => {
-                word(&mut self.s, "*")?;
+                try!(word(&mut self.s, "*"));
                 match mt.mutbl {
-                    ast::Mutability::Mutable => self.word_nbsp("mut")?,
-                    ast::Mutability::Immutable => self.word_nbsp("const")?,
+                    ast::Mutability::Mutable => try!(self.word_nbsp("mut")),
+                    ast::Mutability::Immutable => try!(self.word_nbsp("const")),
                 }
-                self.print_type(&mt.ty)?;
+                try!(self.print_type(&mt.ty));
             }
             ast::TyKind::Rptr(ref lifetime, ref mt) => {
-                word(&mut self.s, "&")?;
-                self.print_opt_lifetime(lifetime)?;
-                self.print_mt(mt)?;
+                try!(word(&mut self.s, "&"));
+                try!(self.print_opt_lifetime(lifetime));
+                try!(self.print_mt(mt));
             }
             ast::TyKind::Tup(ref elts) => {
-                self.popen()?;
-                self.commasep(Inconsistent, &elts[..],
-                              |s, ty| s.print_type(&ty))?;
+                try!(self.popen());
+                try!(self.commasep(Inconsistent, &elts[..],
+                              |s, ty| s.print_type(&ty)));
                 if elts.len() == 1 {
-                    word(&mut self.s, ",")?;
+                    try!(word(&mut self.s, ","));
                 }
-                self.pclose()?;
+                try!(self.pclose());
             }
             ast::TyKind::Paren(ref typ) => {
-                self.popen()?;
-                self.print_type(&typ)?;
-                self.pclose()?;
+                try!(self.popen());
+                try!(self.print_type(&typ));
+                try!(self.pclose());
             }
             ast::TyKind::BareFn(ref f) => {
                 let generics = ast::Generics {
@@ -996,45 +996,45 @@ impl<'a> State<'a> {
                         predicates: Vec::new(),
                     },
                 };
-                self.print_ty_fn(f.abi,
+                try!(self.print_ty_fn(f.abi,
                                  f.unsafety,
                                  &f.decl,
                                  None,
-                                 &generics)?;
+                                 &generics));
             }
             ast::TyKind::Path(None, ref path) => {
-                self.print_path(path, false, 0)?;
+                try!(self.print_path(path, false, 0));
             }
             ast::TyKind::Path(Some(ref qself), ref path) => {
-                self.print_qpath(path, qself, false)?
+                try!(self.print_qpath(path, qself, false))
             }
             ast::TyKind::ObjectSum(ref ty, ref bounds) => {
-                self.print_type(&ty)?;
-                self.print_bounds("+", &bounds[..])?;
+                try!(self.print_type(&ty));
+                try!(self.print_bounds("+", &bounds[..]));
             }
             ast::TyKind::PolyTraitRef(ref bounds) => {
-                self.print_bounds("", &bounds[..])?;
+                try!(self.print_bounds("", &bounds[..]));
             }
             ast::TyKind::FixedLengthVec(ref ty, ref v) => {
-                word(&mut self.s, "[")?;
-                self.print_type(&ty)?;
-                word(&mut self.s, "; ")?;
-                self.print_expr(&v)?;
-                word(&mut self.s, "]")?;
+                try!(word(&mut self.s, "["));
+                try!(self.print_type(&ty));
+                try!(word(&mut self.s, "; "));
+                try!(self.print_expr(&v));
+                try!(word(&mut self.s, "]"));
             }
             ast::TyKind::Typeof(ref e) => {
-                word(&mut self.s, "typeof(")?;
-                self.print_expr(&e)?;
-                word(&mut self.s, ")")?;
+                try!(word(&mut self.s, "typeof("));
+                try!(self.print_expr(&e));
+                try!(word(&mut self.s, ")"));
             }
             ast::TyKind::Infer => {
-                word(&mut self.s, "_")?;
+                try!(word(&mut self.s, "_"));
             }
             ast::TyKind::ImplicitSelf => {
                 unreachable!();
             }
             ast::TyKind::Mac(ref m) => {
-                self.print_mac(m, token::Paren)?;
+                try!(self.print_mac(m, token::Paren));
             }
         }
         self.end()
@@ -1042,30 +1042,30 @@ impl<'a> State<'a> {
 
     pub fn print_foreign_item(&mut self,
                               item: &ast::ForeignItem) -> io::Result<()> {
-        self.hardbreak_if_not_bol()?;
-        self.maybe_print_comment(item.span.lo)?;
-        self.print_outer_attributes(&item.attrs)?;
+        try!(self.hardbreak_if_not_bol());
+        try!(self.maybe_print_comment(item.span.lo));
+        try!(self.print_outer_attributes(&item.attrs));
         match item.node {
             ast::ForeignItemKind::Fn(ref decl, ref generics) => {
-                self.head("")?;
-                self.print_fn(decl, ast::Unsafety::Normal,
+                try!(self.head(""));
+                try!(self.print_fn(decl, ast::Unsafety::Normal,
                               ast::Constness::NotConst,
                               Abi::Rust, Some(item.ident),
-                              generics, &item.vis)?;
-                self.end()?; // end head-ibox
-                word(&mut self.s, ";")?;
+                              generics, &item.vis));
+                try!(self.end()); // end head-ibox
+                try!(word(&mut self.s, ";"));
                 self.end() // end the outer fn box
             }
             ast::ForeignItemKind::Static(ref t, m) => {
-                self.head(&visibility_qualified(&item.vis, "static"))?;
+                try!(self.head(&visibility_qualified(&item.vis, "static")));
                 if m {
-                    self.word_space("mut")?;
+                    try!(self.word_space("mut"));
                 }
-                self.print_ident(item.ident)?;
-                self.word_space(":")?;
-                self.print_type(&t)?;
-                word(&mut self.s, ";")?;
-                self.end()?; // end the head-ibox
+                try!(self.print_ident(item.ident));
+                try!(self.word_space(":"));
+                try!(self.print_type(&t));
+                try!(word(&mut self.s, ";"));
+                try!(self.end()); // end the head-ibox
                 self.end() // end the outer cbox
             }
         }
@@ -1078,15 +1078,15 @@ impl<'a> State<'a> {
                               vis: &ast::Visibility)
                               -> io::Result<()>
     {
-        word(&mut self.s, &visibility_qualified(vis, ""))?;
-        self.word_space("const")?;
-        self.print_ident(ident)?;
-        self.word_space(":")?;
-        self.print_type(ty)?;
+        try!(word(&mut self.s, &visibility_qualified(vis, "")));
+        try!(self.word_space("const"));
+        try!(self.print_ident(ident));
+        try!(self.word_space(":"));
+        try!(self.print_type(ty));
         if let Some(expr) = default {
-            space(&mut self.s)?;
-            self.word_space("=")?;
-            self.print_expr(expr)?;
+            try!(space(&mut self.s));
+            try!(self.word_space("="));
+            try!(self.print_expr(expr));
         }
         word(&mut self.s, ";")
     }
@@ -1096,83 +1096,83 @@ impl<'a> State<'a> {
                              bounds: Option<&ast::TyParamBounds>,
                              ty: Option<&ast::Ty>)
                              -> io::Result<()> {
-        self.word_space("type")?;
-        self.print_ident(ident)?;
+        try!(self.word_space("type"));
+        try!(self.print_ident(ident));
         if let Some(bounds) = bounds {
-            self.print_bounds(":", bounds)?;
+            try!(self.print_bounds(":", bounds));
         }
         if let Some(ty) = ty {
-            space(&mut self.s)?;
-            self.word_space("=")?;
-            self.print_type(ty)?;
+            try!(space(&mut self.s));
+            try!(self.word_space("="));
+            try!(self.print_type(ty));
         }
         word(&mut self.s, ";")
     }
 
     /// Pretty-print an item
     pub fn print_item(&mut self, item: &ast::Item) -> io::Result<()> {
-        self.hardbreak_if_not_bol()?;
-        self.maybe_print_comment(item.span.lo)?;
-        self.print_outer_attributes(&item.attrs)?;
-        self.ann.pre(self, NodeItem(item))?;
+        try!(self.hardbreak_if_not_bol());
+        try!(self.maybe_print_comment(item.span.lo));
+        try!(self.print_outer_attributes(&item.attrs));
+        try!(self.ann.pre(self, NodeItem(item)));
         match item.node {
             ast::ItemKind::ExternCrate(ref optional_path) => {
-                self.head(&visibility_qualified(&item.vis, "extern crate"))?;
+                try!(self.head(&visibility_qualified(&item.vis, "extern crate")));
                 if let Some(p) = *optional_path {
                     let val = p.as_str();
                     if val.contains("-") {
-                        self.print_string(&val, ast::StrStyle::Cooked)?;
+                        try!(self.print_string(&val, ast::StrStyle::Cooked));
                     } else {
-                        self.print_name(p)?;
+                        try!(self.print_name(p));
                     }
-                    space(&mut self.s)?;
-                    word(&mut self.s, "as")?;
-                    space(&mut self.s)?;
+                    try!(space(&mut self.s));
+                    try!(word(&mut self.s, "as"));
+                    try!(space(&mut self.s));
                 }
-                self.print_ident(item.ident)?;
-                word(&mut self.s, ";")?;
-                self.end()?; // end inner head-block
-                self.end()?; // end outer head-block
+                try!(self.print_ident(item.ident));
+                try!(word(&mut self.s, ";"));
+                try!(self.end()); // end inner head-block
+                try!(self.end()); // end outer head-block
             }
             ast::ItemKind::Use(ref vp) => {
-                self.head(&visibility_qualified(&item.vis, "use"))?;
-                self.print_view_path(&vp)?;
-                word(&mut self.s, ";")?;
-                self.end()?; // end inner head-block
-                self.end()?; // end outer head-block
+                try!(self.head(&visibility_qualified(&item.vis, "use")));
+                try!(self.print_view_path(&vp));
+                try!(word(&mut self.s, ";"));
+                try!(self.end()); // end inner head-block
+                try!(self.end()); // end outer head-block
             }
             ast::ItemKind::Static(ref ty, m, ref expr) => {
-                self.head(&visibility_qualified(&item.vis, "static"))?;
+                try!(self.head(&visibility_qualified(&item.vis, "static")));
                 if m == ast::Mutability::Mutable {
-                    self.word_space("mut")?;
+                    try!(self.word_space("mut"));
                 }
-                self.print_ident(item.ident)?;
-                self.word_space(":")?;
-                self.print_type(&ty)?;
-                space(&mut self.s)?;
-                self.end()?; // end the head-ibox
+                try!(self.print_ident(item.ident));
+                try!(self.word_space(":"));
+                try!(self.print_type(&ty));
+                try!(space(&mut self.s));
+                try!(self.end()); // end the head-ibox
 
-                self.word_space("=")?;
-                self.print_expr(&expr)?;
-                word(&mut self.s, ";")?;
-                self.end()?; // end the outer cbox
+                try!(self.word_space("="));
+                try!(self.print_expr(&expr));
+                try!(word(&mut self.s, ";"));
+                try!(self.end()); // end the outer cbox
             }
             ast::ItemKind::Const(ref ty, ref expr) => {
-                self.head(&visibility_qualified(&item.vis, "const"))?;
-                self.print_ident(item.ident)?;
-                self.word_space(":")?;
-                self.print_type(&ty)?;
-                space(&mut self.s)?;
-                self.end()?; // end the head-ibox
-
-                self.word_space("=")?;
-                self.print_expr(&expr)?;
-                word(&mut self.s, ";")?;
-                self.end()?; // end the outer cbox
+                try!(self.head(&visibility_qualified(&item.vis, "const")));
+                try!(self.print_ident(item.ident));
+                try!(self.word_space(":"));
+                try!(self.print_type(&ty));
+                try!(space(&mut self.s));
+                try!(self.end()); // end the head-ibox
+
+                try!(self.word_space("="));
+                try!(self.print_expr(&expr));
+                try!(word(&mut self.s, ";"));
+                try!(self.end()); // end the outer cbox
             }
             ast::ItemKind::Fn(ref decl, unsafety, constness, abi, ref typarams, ref body) => {
-                self.head("")?;
-                self.print_fn(
+                try!(self.head(""));
+                try!(self.print_fn(
                     decl,
                     unsafety,
                     constness,
@@ -1180,65 +1180,65 @@ impl<'a> State<'a> {
                     Some(item.ident),
                     typarams,
                     &item.vis
-                )?;
-                word(&mut self.s, " ")?;
-                self.print_block_with_attrs(&body, &item.attrs)?;
+                ));
+                try!(word(&mut self.s, " "));
+                try!(self.print_block_with_attrs(&body, &item.attrs));
             }
             ast::ItemKind::Mod(ref _mod) => {
-                self.head(&visibility_qualified(&item.vis, "mod"))?;
-                self.print_ident(item.ident)?;
-                self.nbsp()?;
-                self.bopen()?;
-                self.print_mod(_mod, &item.attrs)?;
-                self.bclose(item.span)?;
+                try!(self.head(&visibility_qualified(&item.vis, "mod")));
+                try!(self.print_ident(item.ident));
+                try!(self.nbsp());
+                try!(self.bopen());
+                try!(self.print_mod(_mod, &item.attrs));
+                try!(self.bclose(item.span));
             }
             ast::ItemKind::ForeignMod(ref nmod) => {
-                self.head("extern")?;
-                self.word_nbsp(&nmod.abi.to_string())?;
-                self.bopen()?;
-                self.print_foreign_mod(nmod, &item.attrs)?;
-                self.bclose(item.span)?;
+                try!(self.head("extern"));
+                try!(self.word_nbsp(&nmod.abi.to_string()));
+                try!(self.bopen());
+                try!(self.print_foreign_mod(nmod, &item.attrs));
+                try!(self.bclose(item.span));
             }
             ast::ItemKind::Ty(ref ty, ref params) => {
-                self.ibox(INDENT_UNIT)?;
-                self.ibox(0)?;
-                self.word_nbsp(&visibility_qualified(&item.vis, "type"))?;
-                self.print_ident(item.ident)?;
-                self.print_generics(params)?;
-                self.end()?; // end the inner ibox
-
-                self.print_where_clause(&params.where_clause)?;
-                space(&mut self.s)?;
-                self.word_space("=")?;
-                self.print_type(&ty)?;
-                word(&mut self.s, ";")?;
-                self.end()?; // end the outer ibox
+                try!(self.ibox(INDENT_UNIT));
+                try!(self.ibox(0));
+                try!(self.word_nbsp(&visibility_qualified(&item.vis, "type")));
+                try!(self.print_ident(item.ident));
+                try!(self.print_generics(params));
+                try!(self.end()); // end the inner ibox
+
+                try!(self.print_where_clause(&params.where_clause));
+                try!(space(&mut self.s));
+                try!(self.word_space("="));
+                try!(self.print_type(&ty));
+                try!(word(&mut self.s, ";"));
+                try!(self.end()); // end the outer ibox
             }
             ast::ItemKind::Enum(ref enum_definition, ref params) => {
-                self.print_enum_def(
+                try!(self.print_enum_def(
                     enum_definition,
                     params,
                     item.ident,
                     item.span,
                     &item.vis
-                )?;
+                ));
             }
             ast::ItemKind::Struct(ref struct_def, ref generics) => {
-                self.head(&visibility_qualified(&item.vis, "struct"))?;
-                self.print_struct(&struct_def, generics, item.ident, item.span, true)?;
+                try!(self.head(&visibility_qualified(&item.vis, "struct")));
+                try!(self.print_struct(&struct_def, generics, item.ident, item.span, true));
             }
 
             ast::ItemKind::DefaultImpl(unsafety, ref trait_ref) => {
-                self.head("")?;
-                self.print_visibility(&item.vis)?;
-                self.print_unsafety(unsafety)?;
-                self.word_nbsp("impl")?;
-                self.print_trait_ref(trait_ref)?;
-                space(&mut self.s)?;
-                self.word_space("for")?;
-                self.word_space("..")?;
-                self.bopen()?;
-                self.bclose(item.span)?;
+                try!(self.head(""));
+                try!(self.print_visibility(&item.vis));
+                try!(self.print_unsafety(unsafety));
+                try!(self.word_nbsp("impl"));
+                try!(self.print_trait_ref(trait_ref));
+                try!(space(&mut self.s));
+                try!(self.word_space("for"));
+                try!(self.word_space(".."));
+                try!(self.bopen());
+                try!(self.bclose(item.span));
             }
             ast::ItemKind::Impl(unsafety,
                           polarity,
@@ -1246,80 +1246,80 @@ impl<'a> State<'a> {
                           ref opt_trait,
                           ref ty,
                           ref impl_items) => {
-                self.head("")?;
-                self.print_visibility(&item.vis)?;
-                self.print_unsafety(unsafety)?;
-                self.word_nbsp("impl")?;
+                try!(self.head(""));
+                try!(self.print_visibility(&item.vis));
+                try!(self.print_unsafety(unsafety));
+                try!(self.word_nbsp("impl"));
 
                 if generics.is_parameterized() {
-                    self.print_generics(generics)?;
-                    space(&mut self.s)?;
+                    try!(self.print_generics(generics));
+                    try!(space(&mut self.s));
                 }
 
                 match polarity {
                     ast::ImplPolarity::Negative => {
-                        word(&mut self.s, "!")?;
+                        try!(word(&mut self.s, "!"));
                     },
                     _ => {}
                 }
 
                 match *opt_trait {
                     Some(ref t) => {
-                        self.print_trait_ref(t)?;
-                        space(&mut self.s)?;
-                        self.word_space("for")?;
+                        try!(self.print_trait_ref(t));
+                        try!(space(&mut self.s));
+                        try!(self.word_space("for"));
                     }
                     None => {}
                 }
 
-                self.print_type(&ty)?;
-                self.print_where_clause(&generics.where_clause)?;
+                try!(self.print_type(&ty));
+                try!(self.print_where_clause(&generics.where_clause));
 
-                space(&mut self.s)?;
-                self.bopen()?;
-                self.print_inner_attributes(&item.attrs)?;
+                try!(space(&mut self.s));
+                try!(self.bopen());
+                try!(self.print_inner_attributes(&item.attrs));
                 for impl_item in impl_items {
-                    self.print_impl_item(impl_item)?;
+                    try!(self.print_impl_item(impl_item));
                 }
-                self.bclose(item.span)?;
+                try!(self.bclose(item.span));
             }
             ast::ItemKind::Trait(unsafety, ref generics, ref bounds, ref trait_items) => {
-                self.head("")?;
-                self.print_visibility(&item.vis)?;
-                self.print_unsafety(unsafety)?;
-                self.word_nbsp("trait")?;
-                self.print_ident(item.ident)?;
-                self.print_generics(generics)?;
+                try!(self.head(""));
+                try!(self.print_visibility(&item.vis));
+                try!(self.print_unsafety(unsafety));
+                try!(self.word_nbsp("trait"));
+                try!(self.print_ident(item.ident));
+                try!(self.print_generics(generics));
                 let mut real_bounds = Vec::with_capacity(bounds.len());
                 for b in bounds.iter() {
                     if let TraitTyParamBound(ref ptr, ast::TraitBoundModifier::Maybe) = *b {
-                        space(&mut self.s)?;
-                        self.word_space("for ?")?;
-                        self.print_trait_ref(&ptr.trait_ref)?;
+                        try!(space(&mut self.s));
+                        try!(self.word_space("for ?"));
+                        try!(self.print_trait_ref(&ptr.trait_ref));
                     } else {
                         real_bounds.push(b.clone());
                     }
                 }
-                self.print_bounds(":", &real_bounds[..])?;
-                self.print_where_clause(&generics.where_clause)?;
-                word(&mut self.s, " ")?;
-                self.bopen()?;
+                try!(self.print_bounds(":", &real_bounds[..]));
+                try!(self.print_where_clause(&generics.where_clause));
+                try!(word(&mut self.s, " "));
+                try!(self.bopen());
                 for trait_item in trait_items {
-                    self.print_trait_item(trait_item)?;
+                    try!(self.print_trait_item(trait_item));
                 }
-                self.bclose(item.span)?;
+                try!(self.bclose(item.span));
             }
             ast::ItemKind::Mac(codemap::Spanned { ref node, .. }) => {
-                self.print_visibility(&item.vis)?;
-                self.print_path(&node.path, false, 0)?;
-                word(&mut self.s, "! ")?;
-                self.print_ident(item.ident)?;
-                self.cbox(INDENT_UNIT)?;
-                self.popen()?;
-                self.print_tts(&node.tts[..])?;
-                self.pclose()?;
-                word(&mut self.s, ";")?;
-                self.end()?;
+                try!(self.print_visibility(&item.vis));
+                try!(self.print_path(&node.path, false, 0));
+                try!(word(&mut self.s, "! "));
+                try!(self.print_ident(item.ident));
+                try!(self.cbox(INDENT_UNIT));
+                try!(self.popen());
+                try!(self.print_tts(&node.tts[..]));
+                try!(self.pclose());
+                try!(word(&mut self.s, ";"));
+                try!(self.end());
             }
         }
         self.ann.post(self, NodeItem(item))
@@ -1331,22 +1331,22 @@ impl<'a> State<'a> {
 
     fn print_formal_lifetime_list(&mut self, lifetimes: &[ast::LifetimeDef]) -> io::Result<()> {
         if !lifetimes.is_empty() {
-            word(&mut self.s, "for<")?;
+            try!(word(&mut self.s, "for<"));
             let mut comma = false;
             for lifetime_def in lifetimes {
                 if comma {
-                    self.word_space(",")?
+                    try!(self.word_space(","))
                 }
-                self.print_lifetime_def(lifetime_def)?;
+                try!(self.print_lifetime_def(lifetime_def));
                 comma = true;
             }
-            word(&mut self.s, ">")?;
+            try!(word(&mut self.s, ">"));
         }
         Ok(())
     }
 
     fn print_poly_trait_ref(&mut self, t: &ast::PolyTraitRef) -> io::Result<()> {
-        self.print_formal_lifetime_list(&t.bound_lifetimes)?;
+        try!(self.print_formal_lifetime_list(&t.bound_lifetimes));
         self.print_trait_ref(&t.trait_ref)
     }
 
@@ -1354,27 +1354,27 @@ impl<'a> State<'a> {
                           generics: &ast::Generics, ident: ast::Ident,
                           span: codemap::Span,
                           visibility: &ast::Visibility) -> io::Result<()> {
-        self.head(&visibility_qualified(visibility, "enum"))?;
-        self.print_ident(ident)?;
-        self.print_generics(generics)?;
-        self.print_where_clause(&generics.where_clause)?;
-        space(&mut self.s)?;
+        try!(self.head(&visibility_qualified(visibility, "enum")));
+        try!(self.print_ident(ident));
+        try!(self.print_generics(generics));
+        try!(self.print_where_clause(&generics.where_clause));
+        try!(space(&mut self.s));
         self.print_variants(&enum_definition.variants, span)
     }
 
     pub fn print_variants(&mut self,
                           variants: &[ast::Variant],
                           span: codemap::Span) -> io::Result<()> {
-        self.bopen()?;
+        try!(self.bopen());
         for v in variants {
-            self.space_if_not_bol()?;
-            self.maybe_print_comment(v.span.lo)?;
-            self.print_outer_attributes(&v.node.attrs)?;
-            self.ibox(INDENT_UNIT)?;
-            self.print_variant(v)?;
-            word(&mut self.s, ",")?;
-            self.end()?;
-            self.maybe_print_trailing_comment(v.span, None)?;
+            try!(self.space_if_not_bol());
+            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!(word(&mut self.s, ","));
+            try!(self.end());
+            try!(self.maybe_print_trailing_comment(v.span, None));
         }
         self.bclose(span)
     }
@@ -1395,42 +1395,42 @@ impl<'a> State<'a> {
                         ident: ast::Ident,
                         span: codemap::Span,
                         print_finalizer: bool) -> io::Result<()> {
-        self.print_ident(ident)?;
-        self.print_generics(generics)?;
+        try!(self.print_ident(ident));
+        try!(self.print_generics(generics));
         if !struct_def.is_struct() {
             if struct_def.is_tuple() {
-                self.popen()?;
-                self.commasep(
+                try!(self.popen());
+                try!(self.commasep(
                     Inconsistent, struct_def.fields(),
                     |s, field| {
-                        s.print_visibility(&field.vis)?;
-                        s.maybe_print_comment(field.span.lo)?;
+                        try!(s.print_visibility(&field.vis));
+                        try!(s.maybe_print_comment(field.span.lo));
                         s.print_type(&field.ty)
                     }
-                )?;
-                self.pclose()?;
+                ));
+                try!(self.pclose());
             }
-            self.print_where_clause(&generics.where_clause)?;
+            try!(self.print_where_clause(&generics.where_clause));
             if print_finalizer {
-                word(&mut self.s, ";")?;
+                try!(word(&mut self.s, ";"));
             }
-            self.end()?;
+            try!(self.end());
             self.end() // close the outer-box
         } else {
-            self.print_where_clause(&generics.where_clause)?;
-            self.nbsp()?;
-            self.bopen()?;
-            self.hardbreak_if_not_bol()?;
+            try!(self.print_where_clause(&generics.where_clause));
+            try!(self.nbsp());
+            try!(self.bopen());
+            try!(self.hardbreak_if_not_bol());
 
             for field in struct_def.fields() {
-                self.hardbreak_if_not_bol()?;
-                self.maybe_print_comment(field.span.lo)?;
-                self.print_outer_attributes(&field.attrs)?;
-                self.print_visibility(&field.vis)?;
-                self.print_ident(field.ident.unwrap())?;
-                self.word_nbsp(":")?;
-                self.print_type(&field.ty)?;
-                word(&mut self.s, ",")?;
+                try!(self.hardbreak_if_not_bol());
+                try!(self.maybe_print_comment(field.span.lo));
+                try!(self.print_outer_attributes(&field.attrs));
+                try!(self.print_visibility(&field.vis));
+                try!(self.print_ident(field.ident.unwrap()));
+                try!(self.word_nbsp(":"));
+                try!(self.print_type(&field.ty));
+                try!(word(&mut self.s, ","));
             }
 
             self.bclose(span)
@@ -1447,7 +1447,7 @@ impl<'a> State<'a> {
     pub fn print_tt(&mut self, tt: &ast::TokenTree) -> io::Result<()> {
         match *tt {
             TokenTree::Token(_, ref tk) => {
-                word(&mut self.s, &token_to_string(tk))?;
+                try!(word(&mut self.s, &token_to_string(tk)));
                 match *tk {
                     parse::token::DocComment(..) => {
                         hardbreak(&mut self.s)
@@ -1456,21 +1456,21 @@ impl<'a> State<'a> {
                 }
             }
             TokenTree::Delimited(_, ref delimed) => {
-                word(&mut self.s, &token_to_string(&delimed.open_token()))?;
-                space(&mut self.s)?;
-                self.print_tts(&delimed.tts)?;
-                space(&mut self.s)?;
+                try!(word(&mut self.s, &token_to_string(&delimed.open_token())));
+                try!(space(&mut self.s));
+                try!(self.print_tts(&delimed.tts));
+                try!(space(&mut self.s));
                 word(&mut self.s, &token_to_string(&delimed.close_token()))
             },
             TokenTree::Sequence(_, ref seq) => {
-                word(&mut self.s, "$(")?;
+                try!(word(&mut self.s, "$("));
                 for tt_elt in &seq.tts {
-                    self.print_tt(tt_elt)?;
+                    try!(self.print_tt(tt_elt));
                 }
-                word(&mut self.s, ")")?;
+                try!(word(&mut self.s, ")"));
                 match seq.separator {
                     Some(ref tk) => {
-                        word(&mut self.s, &token_to_string(tk))?;
+                        try!(word(&mut self.s, &token_to_string(tk)));
                     }
                     None => {},
                 }
@@ -1483,24 +1483,24 @@ impl<'a> State<'a> {
     }
 
     pub fn print_tts(&mut self, tts: &[ast::TokenTree]) -> io::Result<()> {
-        self.ibox(0)?;
+        try!(self.ibox(0));
         for (i, tt) in tts.iter().enumerate() {
             if i != 0 {
-                space(&mut self.s)?;
+                try!(space(&mut self.s));
             }
-            self.print_tt(tt)?;
+            try!(self.print_tt(tt));
         }
         self.end()
     }
 
     pub fn print_variant(&mut self, v: &ast::Variant) -> io::Result<()> {
-        self.head("")?;
+        try!(self.head(""));
         let generics = ast::Generics::default();
-        self.print_struct(&v.node.data, &generics, v.node.name, v.span, false)?;
+        try!(self.print_struct(&v.node.data, &generics, v.node.name, v.span, false));
         match v.node.disr_expr {
             Some(ref d) => {
-                space(&mut self.s)?;
-                self.word_space("=")?;
+                try!(space(&mut self.s));
+                try!(self.word_space("="));
                 self.print_expr(&d)
             }
             _ => Ok(())
@@ -1523,103 +1523,103 @@ impl<'a> State<'a> {
 
     pub fn print_trait_item(&mut self, ti: &ast::TraitItem)
                             -> io::Result<()> {
-        self.ann.pre(self, NodeSubItem(ti.id))?;
-        self.hardbreak_if_not_bol()?;
-        self.maybe_print_comment(ti.span.lo)?;
-        self.print_outer_attributes(&ti.attrs)?;
+        try!(self.ann.pre(self, NodeSubItem(ti.id)));
+        try!(self.hardbreak_if_not_bol());
+        try!(self.maybe_print_comment(ti.span.lo));
+        try!(self.print_outer_attributes(&ti.attrs));
         match ti.node {
             ast::TraitItemKind::Const(ref ty, ref default) => {
-                self.print_associated_const(ti.ident, &ty,
+                try!(self.print_associated_const(ti.ident, &ty,
                                             default.as_ref().map(|expr| &**expr),
-                                            &ast::Visibility::Inherited)?;
+                                            &ast::Visibility::Inherited));
             }
             ast::TraitItemKind::Method(ref sig, ref body) => {
                 if body.is_some() {
-                    self.head("")?;
+                    try!(self.head(""));
                 }
-                self.print_method_sig(ti.ident, sig, &ast::Visibility::Inherited)?;
+                try!(self.print_method_sig(ti.ident, sig, &ast::Visibility::Inherited));
                 if let Some(ref body) = *body {
-                    self.nbsp()?;
-                    self.print_block_with_attrs(body, &ti.attrs)?;
+                    try!(self.nbsp());
+                    try!(self.print_block_with_attrs(body, &ti.attrs));
                 } else {
-                    word(&mut self.s, ";")?;
+                    try!(word(&mut self.s, ";"));
                 }
             }
             ast::TraitItemKind::Type(ref bounds, ref default) => {
-                self.print_associated_type(ti.ident, Some(bounds),
-                                           default.as_ref().map(|ty| &**ty))?;
+                try!(self.print_associated_type(ti.ident, Some(bounds),
+                                           default.as_ref().map(|ty| &**ty)));
             }
         }
         self.ann.post(self, NodeSubItem(ti.id))
     }
 
     pub fn print_impl_item(&mut self, ii: &ast::ImplItem) -> io::Result<()> {
-        self.ann.pre(self, NodeSubItem(ii.id))?;
-        self.hardbreak_if_not_bol()?;
-        self.maybe_print_comment(ii.span.lo)?;
-        self.print_outer_attributes(&ii.attrs)?;
+        try!(self.ann.pre(self, NodeSubItem(ii.id)));
+        try!(self.hardbreak_if_not_bol());
+        try!(self.maybe_print_comment(ii.span.lo));
+        try!(self.print_outer_attributes(&ii.attrs));
         if let ast::Defaultness::Default = ii.defaultness {
-            self.word_nbsp("default")?;
+            try!(self.word_nbsp("default"));
         }
         match ii.node {
             ast::ImplItemKind::Const(ref ty, ref expr) => {
-                self.print_associated_const(ii.ident, &ty, Some(&expr), &ii.vis)?;
+                try!(self.print_associated_const(ii.ident, &ty, Some(&expr), &ii.vis));
             }
             ast::ImplItemKind::Method(ref sig, ref body) => {
-                self.head("")?;
-                self.print_method_sig(ii.ident, sig, &ii.vis)?;
-                self.nbsp()?;
-                self.print_block_with_attrs(body, &ii.attrs)?;
+                try!(self.head(""));
+                try!(self.print_method_sig(ii.ident, sig, &ii.vis));
+                try!(self.nbsp());
+                try!(self.print_block_with_attrs(body, &ii.attrs));
             }
             ast::ImplItemKind::Type(ref ty) => {
-                self.print_associated_type(ii.ident, None, Some(ty))?;
+                try!(self.print_associated_type(ii.ident, None, Some(ty)));
             }
             ast::ImplItemKind::Macro(codemap::Spanned { ref node, .. }) => {
                 // code copied from ItemKind::Mac:
-                self.print_path(&node.path, false, 0)?;
-                word(&mut self.s, "! ")?;
-                self.cbox(INDENT_UNIT)?;
-                self.popen()?;
-                self.print_tts(&node.tts[..])?;
-                self.pclose()?;
-                word(&mut self.s, ";")?;
-                self.end()?
+                try!(self.print_path(&node.path, false, 0));
+                try!(word(&mut self.s, "! "));
+                try!(self.cbox(INDENT_UNIT));
+                try!(self.popen());
+                try!(self.print_tts(&node.tts[..]));
+                try!(self.pclose());
+                try!(word(&mut self.s, ";"));
+                try!(self.end())
             }
         }
         self.ann.post(self, NodeSubItem(ii.id))
     }
 
     pub fn print_stmt(&mut self, st: &ast::Stmt) -> io::Result<()> {
-        self.maybe_print_comment(st.span.lo)?;
+        try!(self.maybe_print_comment(st.span.lo));
         match st.node {
             ast::StmtKind::Decl(ref decl, _) => {
-                self.print_decl(&decl)?;
+                try!(self.print_decl(&decl));
             }
             ast::StmtKind::Expr(ref expr, _) => {
-                self.space_if_not_bol()?;
-                self.print_expr_outer_attr_style(&expr, false)?;
+                try!(self.space_if_not_bol());
+                try!(self.print_expr_outer_attr_style(&expr, false));
             }
             ast::StmtKind::Semi(ref expr, _) => {
-                self.space_if_not_bol()?;
-                self.print_expr_outer_attr_style(&expr, false)?;
-                word(&mut self.s, ";")?;
+                try!(self.space_if_not_bol());
+                try!(self.print_expr_outer_attr_style(&expr, false));
+                try!(word(&mut self.s, ";"));
             }
             ast::StmtKind::Mac(ref mac, style, ref attrs) => {
-                self.space_if_not_bol()?;
-                self.print_outer_attributes(attrs.as_attr_slice())?;
+                try!(self.space_if_not_bol());
+                try!(self.print_outer_attributes(attrs.as_attr_slice()));
                 let delim = match style {
                     ast::MacStmtStyle::Braces => token::Brace,
                     _ => token::Paren
                 };
-                self.print_mac(&mac, delim)?;
+                try!(self.print_mac(&mac, delim));
                 match style {
                     ast::MacStmtStyle::Braces => {}
-                    _ => word(&mut self.s, ";")?,
+                    _ => try!(word(&mut self.s, ";")),
                 }
             }
         }
         if parse::classify::stmt_ends_with_semi(&st.node) {
-            word(&mut self.s, ";")?;
+            try!(word(&mut self.s, ";"));
         }
         self.maybe_print_trailing_comment(st.span, None)
     }
@@ -1655,27 +1655,27 @@ impl<'a> State<'a> {
                                       attrs: &[ast::Attribute],
                                       close_box: bool) -> io::Result<()> {
         match blk.rules {
-            BlockCheckMode::Unsafe(..) => self.word_space("unsafe")?,
+            BlockCheckMode::Unsafe(..) => try!(self.word_space("unsafe")),
             BlockCheckMode::Default => ()
         }
-        self.maybe_print_comment(blk.span.lo)?;
-        self.ann.pre(self, NodeBlock(blk))?;
-        self.bopen()?;
+        try!(self.maybe_print_comment(blk.span.lo));
+        try!(self.ann.pre(self, NodeBlock(blk)));
+        try!(self.bopen());
 
-        self.print_inner_attributes(attrs)?;
+        try!(self.print_inner_attributes(attrs));
 
         for st in &blk.stmts {
-            self.print_stmt(st)?;
+            try!(self.print_stmt(st));
         }
         match blk.expr {
             Some(ref expr) => {
-                self.space_if_not_bol()?;
-                self.print_expr_outer_attr_style(&expr, false)?;
-                self.maybe_print_trailing_comment(expr.span, Some(blk.span.hi))?;
+                try!(self.space_if_not_bol());
+                try!(self.print_expr_outer_attr_style(&expr, false));
+                try!(self.maybe_print_trailing_comment(expr.span, Some(blk.span.hi)));
             }
             _ => ()
         }
-        self.bclose_maybe_open(blk.span, indented, close_box)?;
+        try!(self.bclose_maybe_open(blk.span, indented, close_box));
         self.ann.post(self, NodeBlock(blk))
     }
 
@@ -1685,32 +1685,32 @@ impl<'a> State<'a> {
                 match _else.node {
                     // "another else-if"
                     ast::ExprKind::If(ref i, ref then, ref e) => {
-                        self.cbox(INDENT_UNIT - 1)?;
-                        self.ibox(0)?;
-                        word(&mut self.s, " else if ")?;
-                        self.print_expr(&i)?;
-                        space(&mut self.s)?;
-                        self.print_block(&then)?;
+                        try!(self.cbox(INDENT_UNIT - 1));
+                        try!(self.ibox(0));
+                        try!(word(&mut self.s, " else if "));
+                        try!(self.print_expr(&i));
+                        try!(space(&mut self.s));
+                        try!(self.print_block(&then));
                         self.print_else(e.as_ref().map(|e| &**e))
                     }
                     // "another else-if-let"
                     ast::ExprKind::IfLet(ref pat, ref expr, ref then, ref e) => {
-                        self.cbox(INDENT_UNIT - 1)?;
-                        self.ibox(0)?;
-                        word(&mut self.s, " else if let ")?;
-                        self.print_pat(&pat)?;
-                        space(&mut self.s)?;
-                        self.word_space("=")?;
-                        self.print_expr(&expr)?;
-                        space(&mut self.s)?;
-                        self.print_block(&then)?;
+                        try!(self.cbox(INDENT_UNIT - 1));
+                        try!(self.ibox(0));
+                        try!(word(&mut self.s, " else if let "));
+                        try!(self.print_pat(&pat));
+                        try!(space(&mut self.s));
+                        try!(self.word_space("="));
+                        try!(self.print_expr(&expr));
+                        try!(space(&mut self.s));
+                        try!(self.print_block(&then));
                         self.print_else(e.as_ref().map(|e| &**e))
                     }
                     // "final else"
                     ast::ExprKind::Block(ref b) => {
-                        self.cbox(INDENT_UNIT - 1)?;
-                        self.ibox(0)?;
-                        word(&mut self.s, " else ")?;
+                        try!(self.cbox(INDENT_UNIT - 1));
+                        try!(self.ibox(0));
+                        try!(word(&mut self.s, " else "));
                         self.print_block(&b)
                     }
                     // BLEAH, constraints would be great here
@@ -1725,38 +1725,38 @@ impl<'a> State<'a> {
 
     pub fn print_if(&mut self, test: &ast::Expr, blk: &ast::Block,
                     elseopt: Option<&ast::Expr>) -> io::Result<()> {
-        self.head("if")?;
-        self.print_expr(test)?;
-        space(&mut self.s)?;
-        self.print_block(blk)?;
+        try!(self.head("if"));
+        try!(self.print_expr(test));
+        try!(space(&mut self.s));
+        try!(self.print_block(blk));
         self.print_else(elseopt)
     }
 
     pub fn print_if_let(&mut self, pat: &ast::Pat, expr: &ast::Expr, blk: &ast::Block,
                         elseopt: Option<&ast::Expr>) -> io::Result<()> {
-        self.head("if let")?;
-        self.print_pat(pat)?;
-        space(&mut self.s)?;
-        self.word_space("=")?;
-        self.print_expr(expr)?;
-        space(&mut self.s)?;
-        self.print_block(blk)?;
+        try!(self.head("if let"));
+        try!(self.print_pat(pat));
+        try!(space(&mut self.s));
+        try!(self.word_space("="));
+        try!(self.print_expr(expr));
+        try!(space(&mut self.s));
+        try!(self.print_block(blk));
         self.print_else(elseopt)
     }
 
     pub fn print_mac(&mut self, m: &ast::Mac, delim: token::DelimToken)
                      -> io::Result<()> {
-        self.print_path(&m.node.path, false, 0)?;
-        word(&mut self.s, "!")?;
+        try!(self.print_path(&m.node.path, false, 0));
+        try!(word(&mut self.s, "!"));
         match delim {
-            token::Paren => self.popen()?,
-            token::Bracket => word(&mut self.s, "[")?,
+            token::Paren => try!(self.popen()),
+            token::Bracket => try!(word(&mut self.s, "[")),
             token::Brace => {
-                self.head("")?;
-                self.bopen()?;
+                try!(self.head(""));
+                try!(self.bopen());
             }
         }
-        self.print_tts(&m.node.tts)?;
+        try!(self.print_tts(&m.node.tts));
         match delim {
             token::Paren => self.pclose(),
             token::Bracket => word(&mut self.s, "]"),
@@ -1766,8 +1766,8 @@ impl<'a> State<'a> {
 
 
     fn print_call_post(&mut self, args: &[P<ast::Expr>]) -> io::Result<()> {
-        self.popen()?;
-        self.commasep_exprs(Inconsistent, args)?;
+        try!(self.popen());
+        try!(self.commasep_exprs(Inconsistent, args));
         self.pclose()
     }
 
@@ -1789,11 +1789,11 @@ impl<'a> State<'a> {
     pub fn print_expr_maybe_paren(&mut self, expr: &ast::Expr) -> io::Result<()> {
         let needs_par = needs_parentheses(expr);
         if needs_par {
-            self.popen()?;
+            try!(self.popen());
         }
-        self.print_expr(expr)?;
+        try!(self.print_expr(expr));
         if needs_par {
-            self.pclose()?;
+            try!(self.pclose());
         }
         Ok(())
     }
@@ -1801,19 +1801,19 @@ impl<'a> State<'a> {
     fn print_expr_in_place(&mut self,
                            place: &ast::Expr,
                            expr: &ast::Expr) -> io::Result<()> {
-        self.print_expr_maybe_paren(place)?;
-        space(&mut self.s)?;
-        self.word_space("<-")?;
+        try!(self.print_expr_maybe_paren(place));
+        try!(space(&mut self.s));
+        try!(self.word_space("<-"));
         self.print_expr_maybe_paren(expr)
     }
 
     fn print_expr_vec(&mut self, exprs: &[P<ast::Expr>],
                       attrs: &[Attribute]) -> io::Result<()> {
-        self.ibox(INDENT_UNIT)?;
-        word(&mut self.s, "[")?;
-        self.print_inner_attributes_inline(attrs)?;
-        self.commasep_exprs(Inconsistent, &exprs[..])?;
-        word(&mut self.s, "]")?;
+        try!(self.ibox(INDENT_UNIT));
+        try!(word(&mut self.s, "["));
+        try!(self.print_inner_attributes_inline(attrs));
+        try!(self.commasep_exprs(Inconsistent, &exprs[..]));
+        try!(word(&mut self.s, "]"));
         self.end()
     }
 
@@ -1821,13 +1821,13 @@ impl<'a> State<'a> {
                          element: &ast::Expr,
                          count: &ast::Expr,
                          attrs: &[Attribute]) -> io::Result<()> {
-        self.ibox(INDENT_UNIT)?;
-        word(&mut self.s, "[")?;
-        self.print_inner_attributes_inline(attrs)?;
-        self.print_expr(element)?;
-        self.word_space(";")?;
-        self.print_expr(count)?;
-        word(&mut self.s, "]")?;
+        try!(self.ibox(INDENT_UNIT));
+        try!(word(&mut self.s, "["));
+        try!(self.print_inner_attributes_inline(attrs));
+        try!(self.print_expr(element));
+        try!(self.word_space(";"));
+        try!(self.print_expr(count));
+        try!(word(&mut self.s, "]"));
         self.end()
     }
 
@@ -1836,46 +1836,46 @@ impl<'a> State<'a> {
                          fields: &[ast::Field],
                          wth: &Option<P<ast::Expr>>,
                          attrs: &[Attribute]) -> io::Result<()> {
-        self.print_path(path, true, 0)?;
-        word(&mut self.s, "{")?;
-        self.print_inner_attributes_inline(attrs)?;
-        self.commasep_cmnt(
+        try!(self.print_path(path, true, 0));
+        try!(word(&mut self.s, "{"));
+        try!(self.print_inner_attributes_inline(attrs));
+        try!(self.commasep_cmnt(
             Consistent,
             &fields[..],
             |s, field| {
-                s.ibox(INDENT_UNIT)?;
-                s.print_ident(field.ident.node)?;
-                s.word_space(":")?;
-                s.print_expr(&field.expr)?;
+                try!(s.ibox(INDENT_UNIT));
+                try!(s.print_ident(field.ident.node));
+                try!(s.word_space(":"));
+                try!(s.print_expr(&field.expr));
                 s.end()
             },
-            |f| f.span)?;
+            |f| f.span));
         match *wth {
             Some(ref expr) => {
-                self.ibox(INDENT_UNIT)?;
+                try!(self.ibox(INDENT_UNIT));
                 if !fields.is_empty() {
-                    word(&mut self.s, ",")?;
-                    space(&mut self.s)?;
+                    try!(word(&mut self.s, ","));
+                    try!(space(&mut self.s));
                 }
-                word(&mut self.s, "..")?;
-                self.print_expr(&expr)?;
-                self.end()?;
+                try!(word(&mut self.s, ".."));
+                try!(self.print_expr(&expr));
+                try!(self.end());
             }
             _ => if !fields.is_empty() {
-                word(&mut self.s, ",")?
+                try!(word(&mut self.s, ","))
             }
         }
-        word(&mut self.s, "}")?;
+        try!(word(&mut self.s, "}"));
         Ok(())
     }
 
     fn print_expr_tup(&mut self, exprs: &[P<ast::Expr>],
                       attrs: &[Attribute]) -> io::Result<()> {
-        self.popen()?;
-        self.print_inner_attributes_inline(attrs)?;
-        self.commasep_exprs(Inconsistent, &exprs[..])?;
+        try!(self.popen());
+        try!(self.print_inner_attributes_inline(attrs));
+        try!(self.commasep_exprs(Inconsistent, &exprs[..]));
         if exprs.len() == 1 {
-            word(&mut self.s, ",")?;
+            try!(word(&mut self.s, ","));
         }
         self.pclose()
     }
@@ -1883,7 +1883,7 @@ impl<'a> State<'a> {
     fn print_expr_call(&mut self,
                        func: &ast::Expr,
                        args: &[P<ast::Expr>]) -> io::Result<()> {
-        self.print_expr_maybe_paren(func)?;
+        try!(self.print_expr_maybe_paren(func));
         self.print_call_post(args)
     }
 
@@ -1892,14 +1892,14 @@ impl<'a> State<'a> {
                               tys: &[P<ast::Ty>],
                               args: &[P<ast::Expr>]) -> io::Result<()> {
         let base_args = &args[1..];
-        self.print_expr(&args[0])?;
-        word(&mut self.s, ".")?;
-        self.print_ident(ident.node)?;
+        try!(self.print_expr(&args[0]));
+        try!(word(&mut self.s, "."));
+        try!(self.print_ident(ident.node));
         if !tys.is_empty() {
-            word(&mut self.s, "::<")?;
-            self.commasep(Inconsistent, tys,
-                          |s, ty| s.print_type(&ty))?;
-            word(&mut self.s, ">")?;
+            try!(word(&mut self.s, "::<"));
+            try!(self.commasep(Inconsistent, tys,
+                          |s, ty| s.print_type(&ty)));
+            try!(word(&mut self.s, ">"));
         }
         self.print_call_post(base_args)
     }
@@ -1909,12 +1909,12 @@ impl<'a> State<'a> {
                          lhs: &ast::Expr,
                          rhs: &ast::Expr) -> io::Result<()> {
         if self.check_expr_bin_needs_paren(lhs, op) {
-            self.print_expr_maybe_paren(lhs)?;
+            try!(self.print_expr_maybe_paren(lhs));
         } else {
-            self.print_expr(lhs)?;
+            try!(self.print_expr(lhs));
         }
-        space(&mut self.s)?;
-        self.word_space(op.node.to_string())?;
+        try!(space(&mut self.s));
+        try!(self.word_space(op.node.to_string()));
         if self.check_expr_bin_needs_paren(rhs, op) {
             self.print_expr_maybe_paren(rhs)
         } else {
@@ -1925,15 +1925,15 @@ impl<'a> State<'a> {
     fn print_expr_unary(&mut self,
                         op: ast::UnOp,
                         expr: &ast::Expr) -> io::Result<()> {
-        word(&mut self.s, ast::UnOp::to_string(op))?;
+        try!(word(&mut self.s, ast::UnOp::to_string(op)));
         self.print_expr_maybe_paren(expr)
     }
 
     fn print_expr_addr_of(&mut self,
                           mutability: ast::Mutability,
                           expr: &ast::Expr) -> io::Result<()> {
-        word(&mut self.s, "&")?;
-        self.print_mutability(mutability)?;
+        try!(word(&mut self.s, "&"));
+        try!(self.print_mutability(mutability));
         self.print_expr_maybe_paren(expr)
     }
 
@@ -1944,139 +1944,139 @@ impl<'a> State<'a> {
     fn print_expr_outer_attr_style(&mut self,
                                   expr: &ast::Expr,
                                   is_inline: bool) -> io::Result<()> {
-        self.maybe_print_comment(expr.span.lo)?;
+        try!(self.maybe_print_comment(expr.span.lo));
 
         let attrs = expr.attrs.as_attr_slice();
         if is_inline {
-            self.print_outer_attributes_inline(attrs)?;
+            try!(self.print_outer_attributes_inline(attrs));
         } else {
-            self.print_outer_attributes(attrs)?;
+            try!(self.print_outer_attributes(attrs));
         }
 
-        self.ibox(INDENT_UNIT)?;
-        self.ann.pre(self, NodeExpr(expr))?;
+        try!(self.ibox(INDENT_UNIT));
+        try!(self.ann.pre(self, NodeExpr(expr)));
         match expr.node {
             ast::ExprKind::Box(ref expr) => {
-                self.word_space("box")?;
-                self.print_expr(expr)?;
+                try!(self.word_space("box"));
+                try!(self.print_expr(expr));
             }
             ast::ExprKind::InPlace(ref place, ref expr) => {
-                self.print_expr_in_place(place, expr)?;
+                try!(self.print_expr_in_place(place, expr));
             }
             ast::ExprKind::Vec(ref exprs) => {
-                self.print_expr_vec(&exprs[..], attrs)?;
+                try!(self.print_expr_vec(&exprs[..], attrs));
             }
             ast::ExprKind::Repeat(ref element, ref count) => {
-                self.print_expr_repeat(&element, &count, attrs)?;
+                try!(self.print_expr_repeat(&element, &count, attrs));
             }
             ast::ExprKind::Struct(ref path, ref fields, ref wth) => {
-                self.print_expr_struct(path, &fields[..], wth, attrs)?;
+                try!(self.print_expr_struct(path, &fields[..], wth, attrs));
             }
             ast::ExprKind::Tup(ref exprs) => {
-                self.print_expr_tup(&exprs[..], attrs)?;
+                try!(self.print_expr_tup(&exprs[..], attrs));
             }
             ast::ExprKind::Call(ref func, ref args) => {
-                self.print_expr_call(&func, &args[..])?;
+                try!(self.print_expr_call(&func, &args[..]));
             }
             ast::ExprKind::MethodCall(ident, ref tys, ref args) => {
-                self.print_expr_method_call(ident, &tys[..], &args[..])?;
+                try!(self.print_expr_method_call(ident, &tys[..], &args[..]));
             }
             ast::ExprKind::Binary(op, ref lhs, ref rhs) => {
-                self.print_expr_binary(op, &lhs, &rhs)?;
+                try!(self.print_expr_binary(op, &lhs, &rhs));
             }
             ast::ExprKind::Unary(op, ref expr) => {
-                self.print_expr_unary(op, &expr)?;
+                try!(self.print_expr_unary(op, &expr));
             }
             ast::ExprKind::AddrOf(m, ref expr) => {
-                self.print_expr_addr_of(m, &expr)?;
+                try!(self.print_expr_addr_of(m, &expr));
             }
             ast::ExprKind::Lit(ref lit) => {
-                self.print_literal(&lit)?;
+                try!(self.print_literal(&lit));
             }
             ast::ExprKind::Cast(ref expr, ref ty) => {
                 if let ast::ExprKind::Cast(..) = expr.node {
-                    self.print_expr(&expr)?;
+                    try!(self.print_expr(&expr));
                 } else {
-                    self.print_expr_maybe_paren(&expr)?;
+                    try!(self.print_expr_maybe_paren(&expr));
                 }
-                space(&mut self.s)?;
-                self.word_space("as")?;
-                self.print_type(&ty)?;
+                try!(space(&mut self.s));
+                try!(self.word_space("as"));
+                try!(self.print_type(&ty));
             }
             ast::ExprKind::Type(ref expr, ref ty) => {
-                self.print_expr(&expr)?;
-                self.word_space(":")?;
-                self.print_type(&ty)?;
+                try!(self.print_expr(&expr));
+                try!(self.word_space(":"));
+                try!(self.print_type(&ty));
             }
             ast::ExprKind::If(ref test, ref blk, ref elseopt) => {
-                self.print_if(&test, &blk, elseopt.as_ref().map(|e| &**e))?;
+                try!(self.print_if(&test, &blk, elseopt.as_ref().map(|e| &**e)));
             }
             ast::ExprKind::IfLet(ref pat, ref expr, ref blk, ref elseopt) => {
-                self.print_if_let(&pat, &expr, &blk, elseopt.as_ref().map(|e| &**e))?;
+                try!(self.print_if_let(&pat, &expr, &blk, elseopt.as_ref().map(|e| &**e)));
             }
             ast::ExprKind::While(ref test, ref blk, opt_ident) => {
                 if let Some(ident) = opt_ident {
-                    self.print_ident(ident.node)?;
-                    self.word_space(":")?;
+                    try!(self.print_ident(ident.node));
+                    try!(self.word_space(":"));
                 }
-                self.head("while")?;
-                self.print_expr(&test)?;
-                space(&mut self.s)?;
-                self.print_block_with_attrs(&blk, attrs)?;
+                try!(self.head("while"));
+                try!(self.print_expr(&test));
+                try!(space(&mut self.s));
+                try!(self.print_block_with_attrs(&blk, attrs));
             }
             ast::ExprKind::WhileLet(ref pat, ref expr, ref blk, opt_ident) => {
                 if let Some(ident) = opt_ident {
-                    self.print_ident(ident.node)?;
-                    self.word_space(":")?;
+                    try!(self.print_ident(ident.node));
+                    try!(self.word_space(":"));
                 }
-                self.head("while let")?;
-                self.print_pat(&pat)?;
-                space(&mut self.s)?;
-                self.word_space("=")?;
-                self.print_expr(&expr)?;
-                space(&mut self.s)?;
-                self.print_block_with_attrs(&blk, attrs)?;
+                try!(self.head("while let"));
+                try!(self.print_pat(&pat));
+                try!(space(&mut self.s));
+                try!(self.word_space("="));
+                try!(self.print_expr(&expr));
+                try!(space(&mut self.s));
+                try!(self.print_block_with_attrs(&blk, attrs));
             }
             ast::ExprKind::ForLoop(ref pat, ref iter, ref blk, opt_ident) => {
                 if let Some(ident) = opt_ident {
-                    self.print_ident(ident.node)?;
-                    self.word_space(":")?;
+                    try!(self.print_ident(ident.node));
+                    try!(self.word_space(":"));
                 }
-                self.head("for")?;
-                self.print_pat(&pat)?;
-                space(&mut self.s)?;
-                self.word_space("in")?;
-                self.print_expr(&iter)?;
-                space(&mut self.s)?;
-                self.print_block_with_attrs(&blk, attrs)?;
+                try!(self.head("for"));
+                try!(self.print_pat(&pat));
+                try!(space(&mut self.s));
+                try!(self.word_space("in"));
+                try!(self.print_expr(&iter));
+                try!(space(&mut self.s));
+                try!(self.print_block_with_attrs(&blk, attrs));
             }
             ast::ExprKind::Loop(ref blk, opt_ident) => {
                 if let Some(ident) = opt_ident {
-                    self.print_ident(ident.node)?;
-                    self.word_space(":")?;
+                    try!(self.print_ident(ident.node));
+                    try!(self.word_space(":"));
                 }
-                self.head("loop")?;
-                space(&mut self.s)?;
-                self.print_block_with_attrs(&blk, attrs)?;
+                try!(self.head("loop"));
+                try!(space(&mut self.s));
+                try!(self.print_block_with_attrs(&blk, attrs));
             }
             ast::ExprKind::Match(ref expr, ref arms) => {
-                self.cbox(INDENT_UNIT)?;
-                self.ibox(4)?;
-                self.word_nbsp("match")?;
-                self.print_expr(&expr)?;
-                space(&mut self.s)?;
-                self.bopen()?;
-                self.print_inner_attributes_no_trailing_hardbreak(attrs)?;
+                try!(self.cbox(INDENT_UNIT));
+                try!(self.ibox(4));
+                try!(self.word_nbsp("match"));
+                try!(self.print_expr(&expr));
+                try!(space(&mut self.s));
+                try!(self.bopen());
+                try!(self.print_inner_attributes_no_trailing_hardbreak(attrs));
                 for arm in arms {
-                    self.print_arm(arm)?;
+                    try!(self.print_arm(arm));
                 }
-                self.bclose_(expr.span, INDENT_UNIT)?;
+                try!(self.bclose_(expr.span, INDENT_UNIT));
             }
             ast::ExprKind::Closure(capture_clause, ref decl, ref body, _) => {
-                self.print_capture_clause(capture_clause)?;
+                try!(self.print_capture_clause(capture_clause));
 
-                self.print_fn_block_args(&decl)?;
-                space(&mut self.s)?;
+                try!(self.print_fn_block_args(&decl));
+                try!(space(&mut self.s));
 
                 let default_return = match decl.output {
                     ast::FunctionRetTy::Default(..) => true,
@@ -2084,150 +2084,150 @@ impl<'a> State<'a> {
                 };
 
                 if !default_return || !body.stmts.is_empty() || body.expr.is_none() {
-                    self.print_block_unclosed(&body)?;
+                    try!(self.print_block_unclosed(&body));
                 } else {
                     // we extract the block, so as not to create another set of boxes
                     let i_expr = body.expr.as_ref().unwrap();
                     match i_expr.node {
                         ast::ExprKind::Block(ref blk) => {
-                            self.print_block_unclosed_with_attrs(
+                            try!(self.print_block_unclosed_with_attrs(
                                 &blk,
-                                i_expr.attrs.as_attr_slice())?;
+                                i_expr.attrs.as_attr_slice()));
                         }
                         _ => {
                             // this is a bare expression
-                            self.print_expr(&i_expr)?;
-                            self.end()?; // need to close a box
+                            try!(self.print_expr(&i_expr));
+                            try!(self.end()); // need to close a box
                         }
                     }
                 }
                 // a box will be closed by print_expr, but we didn't want an overall
                 // wrapper so we closed the corresponding opening. so create an
                 // empty box to satisfy the close.
-                self.ibox(0)?;
+                try!(self.ibox(0));
             }
             ast::ExprKind::Block(ref blk) => {
                 // containing cbox, will be closed by print-block at }
-                self.cbox(INDENT_UNIT)?;
+                try!(self.cbox(INDENT_UNIT));
                 // head-box, will be closed by print-block after {
-                self.ibox(0)?;
-                self.print_block_with_attrs(&blk, attrs)?;
+                try!(self.ibox(0));
+                try!(self.print_block_with_attrs(&blk, attrs));
             }
             ast::ExprKind::Assign(ref lhs, ref rhs) => {
-                self.print_expr(&lhs)?;
-                space(&mut self.s)?;
-                self.word_space("=")?;
-                self.print_expr(&rhs)?;
+                try!(self.print_expr(&lhs));
+                try!(space(&mut self.s));
+                try!(self.word_space("="));
+                try!(self.print_expr(&rhs));
             }
             ast::ExprKind::AssignOp(op, ref lhs, ref rhs) => {
-                self.print_expr(&lhs)?;
-                space(&mut self.s)?;
-                word(&mut self.s, op.node.to_string())?;
-                self.word_space("=")?;
-                self.print_expr(&rhs)?;
+                try!(self.print_expr(&lhs));
+                try!(space(&mut self.s));
+                try!(word(&mut self.s, op.node.to_string()));
+                try!(self.word_space("="));
+                try!(self.print_expr(&rhs));
             }
             ast::ExprKind::Field(ref expr, id) => {
-                self.print_expr(&expr)?;
-                word(&mut self.s, ".")?;
-                self.print_ident(id.node)?;
+                try!(self.print_expr(&expr));
+                try!(word(&mut self.s, "."));
+                try!(self.print_ident(id.node));
             }
             ast::ExprKind::TupField(ref expr, id) => {
-                self.print_expr(&expr)?;
-                word(&mut self.s, ".")?;
-                self.print_usize(id.node)?;
+                try!(self.print_expr(&expr));
+                try!(word(&mut self.s, "."));
+                try!(self.print_usize(id.node));
             }
             ast::ExprKind::Index(ref expr, ref index) => {
-                self.print_expr(&expr)?;
-                word(&mut self.s, "[")?;
-                self.print_expr(&index)?;
-                word(&mut self.s, "]")?;
+                try!(self.print_expr(&expr));
+                try!(word(&mut self.s, "["));
+                try!(self.print_expr(&index));
+                try!(word(&mut self.s, "]"));
             }
             ast::ExprKind::Range(ref start, ref end, limits) => {
                 if let &Some(ref e) = start {
-                    self.print_expr(&e)?;
+                    try!(self.print_expr(&e));
                 }
                 if limits == ast::RangeLimits::HalfOpen {
-                    word(&mut self.s, "..")?;
+                    try!(word(&mut self.s, ".."));
                 } else {
-                    word(&mut self.s, "...")?;
+                    try!(word(&mut self.s, "..."));
                 }
                 if let &Some(ref e) = end {
-                    self.print_expr(&e)?;
+                    try!(self.print_expr(&e));
                 }
             }
             ast::ExprKind::Path(None, ref path) => {
-                self.print_path(path, true, 0)?
+                try!(self.print_path(path, true, 0))
             }
             ast::ExprKind::Path(Some(ref qself), ref path) => {
-                self.print_qpath(path, qself, true)?
+                try!(self.print_qpath(path, qself, true))
             }
             ast::ExprKind::Break(opt_ident) => {
-                word(&mut self.s, "break")?;
-                space(&mut self.s)?;
+                try!(word(&mut self.s, "break"));
+                try!(space(&mut self.s));
                 if let Some(ident) = opt_ident {
-                    self.print_ident(ident.node)?;
-                    space(&mut self.s)?;
+                    try!(self.print_ident(ident.node));
+                    try!(space(&mut self.s));
                 }
             }
             ast::ExprKind::Again(opt_ident) => {
-                word(&mut self.s, "continue")?;
-                space(&mut self.s)?;
+                try!(word(&mut self.s, "continue"));
+                try!(space(&mut self.s));
                 if let Some(ident) = opt_ident {
-                    self.print_ident(ident.node)?;
-                    space(&mut self.s)?
+                    try!(self.print_ident(ident.node));
+                    try!(space(&mut self.s))
                 }
             }
             ast::ExprKind::Ret(ref result) => {
-                word(&mut self.s, "return")?;
+                try!(word(&mut self.s, "return"));
                 match *result {
                     Some(ref expr) => {
-                        word(&mut self.s, " ")?;
-                        self.print_expr(&expr)?;
+                        try!(word(&mut self.s, " "));
+                        try!(self.print_expr(&expr));
                     }
                     _ => ()
                 }
             }
             ast::ExprKind::InlineAsm(ref a) => {
-                word(&mut self.s, "asm!")?;
-                self.popen()?;
-                self.print_string(&a.asm, a.asm_str_style)?;
-                self.word_space(":")?;
+                try!(word(&mut self.s, "asm!"));
+                try!(self.popen());
+                try!(self.print_string(&a.asm, a.asm_str_style));
+                try!(self.word_space(":"));
 
-                self.commasep(Inconsistent, &a.outputs,
+                try!(self.commasep(Inconsistent, &a.outputs,
                                    |s, out| {
                     let mut ch = out.constraint.chars();
                     match ch.next() {
                         Some('=') if out.is_rw => {
-                            s.print_string(&format!("+{}", ch.as_str()),
-                                           ast::StrStyle::Cooked)?
+                            try!(s.print_string(&format!("+{}", ch.as_str()),
+                                           ast::StrStyle::Cooked))
                         }
-                        _ => s.print_string(&out.constraint,
-                                            ast::StrStyle::Cooked)?
+                        _ => try!(s.print_string(&out.constraint,
+                                            ast::StrStyle::Cooked))
                     }
-                    s.popen()?;
-                    s.print_expr(&out.expr)?;
-                    s.pclose()?;
+                    try!(s.popen());
+                    try!(s.print_expr(&out.expr));
+                    try!(s.pclose());
                     Ok(())
-                })?;
-                space(&mut self.s)?;
-                self.word_space(":")?;
+                }));
+                try!(space(&mut self.s));
+                try!(self.word_space(":"));
 
-                self.commasep(Inconsistent, &a.inputs,
+                try!(self.commasep(Inconsistent, &a.inputs,
                                    |s, &(ref co, ref o)| {
-                    s.print_string(&co, ast::StrStyle::Cooked)?;
-                    s.popen()?;
-                    s.print_expr(&o)?;
-                    s.pclose()?;
+                    try!(s.print_string(&co, ast::StrStyle::Cooked));
+                    try!(s.popen());
+                    try!(s.print_expr(&o));
+                    try!(s.pclose());
                     Ok(())
-                })?;
-                space(&mut self.s)?;
-                self.word_space(":")?;
+                }));
+                try!(space(&mut self.s));
+                try!(self.word_space(":"));
 
-                self.commasep(Inconsistent, &a.clobbers,
+                try!(self.commasep(Inconsistent, &a.clobbers,
                                    |s, co| {
-                    s.print_string(&co, ast::StrStyle::Cooked)?;
+                    try!(s.print_string(&co, ast::StrStyle::Cooked));
                     Ok(())
-                })?;
+                }));
 
                 let mut options = vec!();
                 if a.volatile {
@@ -2241,58 +2241,58 @@ impl<'a> State<'a> {
                 }
 
                 if !options.is_empty() {
-                    space(&mut self.s)?;
-                    self.word_space(":")?;
-                    self.commasep(Inconsistent, &options,
+                    try!(space(&mut self.s));
+                    try!(self.word_space(":"));
+                    try!(self.commasep(Inconsistent, &options,
                                   |s, &co| {
-                                      s.print_string(co, ast::StrStyle::Cooked)?;
+                                      try!(s.print_string(co, ast::StrStyle::Cooked));
                                       Ok(())
-                                  })?;
+                                  }));
                 }
 
-                self.pclose()?;
+                try!(self.pclose());
             }
-            ast::ExprKind::Mac(ref m) => self.print_mac(m, token::Paren)?,
+            ast::ExprKind::Mac(ref m) => try!(self.print_mac(m, token::Paren)),
             ast::ExprKind::Paren(ref e) => {
-                self.popen()?;
-                self.print_inner_attributes_inline(attrs)?;
-                self.print_expr(&e)?;
-                self.pclose()?;
+                try!(self.popen());
+                try!(self.print_inner_attributes_inline(attrs));
+                try!(self.print_expr(&e));
+                try!(self.pclose());
             },
             ast::ExprKind::Try(ref e) => {
-                self.print_expr(e)?;
-                word(&mut self.s, "?")?
+                try!(self.print_expr(e));
+                try!(word(&mut self.s, "?"))
             }
         }
-        self.ann.post(self, NodeExpr(expr))?;
+        try!(self.ann.post(self, NodeExpr(expr)));
         self.end()
     }
 
     pub fn print_local_decl(&mut self, loc: &ast::Local) -> io::Result<()> {
-        self.print_pat(&loc.pat)?;
+        try!(self.print_pat(&loc.pat));
         if let Some(ref ty) = loc.ty {
-            self.word_space(":")?;
-            self.print_type(&ty)?;
+            try!(self.word_space(":"));
+            try!(self.print_type(&ty));
         }
         Ok(())
     }
 
     pub fn print_decl(&mut self, decl: &ast::Decl) -> io::Result<()> {
-        self.maybe_print_comment(decl.span.lo)?;
+        try!(self.maybe_print_comment(decl.span.lo));
         match decl.node {
             ast::DeclKind::Local(ref loc) => {
-                self.print_outer_attributes(loc.attrs.as_attr_slice())?;
-                self.space_if_not_bol()?;
-                self.ibox(INDENT_UNIT)?;
-                self.word_nbsp("let")?;
-
-                self.ibox(INDENT_UNIT)?;
-                self.print_local_decl(&loc)?;
-                self.end()?;
+                try!(self.print_outer_attributes(loc.attrs.as_attr_slice()));
+                try!(self.space_if_not_bol());
+                try!(self.ibox(INDENT_UNIT));
+                try!(self.word_nbsp("let"));
+
+                try!(self.ibox(INDENT_UNIT));
+                try!(self.print_local_decl(&loc));
+                try!(self.end());
                 if let Some(ref init) = loc.init {
-                    self.nbsp()?;
-                    self.word_space("=")?;
-                    self.print_expr(&init)?;
+                    try!(self.nbsp());
+                    try!(self.word_space("="));
+                    try!(self.print_expr(&init));
                 }
                 self.end()
             }
@@ -2301,7 +2301,7 @@ impl<'a> State<'a> {
     }
 
     pub fn print_ident(&mut self, ident: ast::Ident) -> io::Result<()> {
-        word(&mut self.s, &ident.name.as_str())?;
+        try!(word(&mut self.s, &ident.name.as_str()));
         self.ann.post(self, NodeIdent(&ident))
     }
 
@@ -2310,15 +2310,15 @@ impl<'a> State<'a> {
     }
 
     pub fn print_name(&mut self, name: ast::Name) -> io::Result<()> {
-        word(&mut self.s, &name.as_str())?;
+        try!(word(&mut self.s, &name.as_str()));
         self.ann.post(self, NodeName(&name))
     }
 
     pub fn print_for_decl(&mut self, loc: &ast::Local,
                           coll: &ast::Expr) -> io::Result<()> {
-        self.print_local_decl(loc)?;
-        space(&mut self.s)?;
-        self.word_space("in")?;
+        try!(self.print_local_decl(loc));
+        try!(space(&mut self.s));
+        try!(self.word_space("in"));
         self.print_expr(coll)
     }
 
@@ -2328,19 +2328,19 @@ impl<'a> State<'a> {
                   depth: usize)
                   -> io::Result<()>
     {
-        self.maybe_print_comment(path.span.lo)?;
+        try!(self.maybe_print_comment(path.span.lo));
 
         let mut first = !path.global;
         for segment in &path.segments[..path.segments.len()-depth] {
             if first {
                 first = false
             } else {
-                word(&mut self.s, "::")?
+                try!(word(&mut self.s, "::"))
             }
 
-            self.print_ident(segment.identifier)?;
+            try!(self.print_ident(segment.identifier));
 
-            self.print_path_parameters(&segment.parameters, colons_before_params)?;
+            try!(self.print_path_parameters(&segment.parameters, colons_before_params));
         }
 
         Ok(())
@@ -2352,18 +2352,18 @@ impl<'a> State<'a> {
                    colons_before_params: bool)
                    -> io::Result<()>
     {
-        word(&mut self.s, "<")?;
-        self.print_type(&qself.ty)?;
+        try!(word(&mut self.s, "<"));
+        try!(self.print_type(&qself.ty));
         if qself.position > 0 {
-            space(&mut self.s)?;
-            self.word_space("as")?;
+            try!(space(&mut self.s));
+            try!(self.word_space("as"));
             let depth = path.segments.len() - qself.position;
-            self.print_path(&path, false, depth)?;
+            try!(self.print_path(&path, false, depth));
         }
-        word(&mut self.s, ">")?;
-        word(&mut self.s, "::")?;
+        try!(word(&mut self.s, ">"));
+        try!(word(&mut self.s, "::"));
         let item_segment = path.segments.last().unwrap();
-        self.print_ident(item_segment.identifier)?;
+        try!(self.print_ident(item_segment.identifier));
         self.print_path_parameters(&item_segment.parameters, colons_before_params)
     }
 
@@ -2377,61 +2377,61 @@ impl<'a> State<'a> {
         }
 
         if colons_before_params {
-            word(&mut self.s, "::")?
+            try!(word(&mut self.s, "::"))
         }
 
         match *parameters {
             ast::PathParameters::AngleBracketed(ref data) => {
-                word(&mut self.s, "<")?;
+                try!(word(&mut self.s, "<"));
 
                 let mut comma = false;
                 for lifetime in &data.lifetimes {
                     if comma {
-                        self.word_space(",")?
+                        try!(self.word_space(","))
                     }
-                    self.print_lifetime(lifetime)?;
+                    try!(self.print_lifetime(lifetime));
                     comma = true;
                 }
 
                 if !data.types.is_empty() {
                     if comma {
-                        self.word_space(",")?
+                        try!(self.word_space(","))
                     }
-                    self.commasep(
+                    try!(self.commasep(
                         Inconsistent,
                         &data.types,
-                        |s, ty| s.print_type(&ty))?;
+                        |s, ty| s.print_type(&ty)));
                         comma = true;
                 }
 
                 for binding in data.bindings.iter() {
                     if comma {
-                        self.word_space(",")?
+                        try!(self.word_space(","))
                     }
-                    self.print_ident(binding.ident)?;
-                    space(&mut self.s)?;
-                    self.word_space("=")?;
-                    self.print_type(&binding.ty)?;
+                    try!(self.print_ident(binding.ident));
+                    try!(space(&mut self.s));
+                    try!(self.word_space("="));
+                    try!(self.print_type(&binding.ty));
                     comma = true;
                 }
 
-                word(&mut self.s, ">")?
+                try!(word(&mut self.s, ">"))
             }
 
             ast::PathParameters::Parenthesized(ref data) => {
-                word(&mut self.s, "(")?;
-                self.commasep(
+                try!(word(&mut self.s, "("));
+                try!(self.commasep(
                     Inconsistent,
                     &data.inputs,
-                    |s, ty| s.print_type(&ty))?;
-                word(&mut self.s, ")")?;
+                    |s, ty| s.print_type(&ty)));
+                try!(word(&mut self.s, ")"));
 
                 match data.output {
                     None => { }
                     Some(ref ty) => {
-                        self.space_if_not_bol()?;
-                        self.word_space("->")?;
-                        self.print_type(&ty)?;
+                        try!(self.space_if_not_bol());
+                        try!(self.word_space("->"));
+                        try!(self.print_type(&ty));
                     }
                 }
             }
@@ -2441,133 +2441,133 @@ impl<'a> State<'a> {
     }
 
     pub fn print_pat(&mut self, pat: &ast::Pat) -> io::Result<()> {
-        self.maybe_print_comment(pat.span.lo)?;
-        self.ann.pre(self, NodePat(pat))?;
+        try!(self.maybe_print_comment(pat.span.lo));
+        try!(self.ann.pre(self, NodePat(pat)));
         /* Pat isn't normalized, but the beauty of it
          is that it doesn't matter */
         match pat.node {
-            PatKind::Wild => word(&mut self.s, "_")?,
+            PatKind::Wild => try!(word(&mut self.s, "_")),
             PatKind::Ident(binding_mode, ref path1, ref sub) => {
                 match binding_mode {
                     ast::BindingMode::ByRef(mutbl) => {
-                        self.word_nbsp("ref")?;
-                        self.print_mutability(mutbl)?;
+                        try!(self.word_nbsp("ref"));
+                        try!(self.print_mutability(mutbl));
                     }
                     ast::BindingMode::ByValue(ast::Mutability::Immutable) => {}
                     ast::BindingMode::ByValue(ast::Mutability::Mutable) => {
-                        self.word_nbsp("mut")?;
+                        try!(self.word_nbsp("mut"));
                     }
                 }
-                self.print_ident(path1.node)?;
+                try!(self.print_ident(path1.node));
                 if let Some(ref p) = *sub {
-                    word(&mut self.s, "@")?;
-                    self.print_pat(&p)?;
+                    try!(word(&mut self.s, "@"));
+                    try!(self.print_pat(&p));
                 }
             }
             PatKind::TupleStruct(ref path, ref elts, ddpos) => {
-                self.print_path(path, true, 0)?;
-                self.popen()?;
+                try!(self.print_path(path, true, 0));
+                try!(self.popen());
                 if let Some(ddpos) = ddpos {
-                    self.commasep(Inconsistent, &elts[..ddpos], |s, p| s.print_pat(&p))?;
+                    try!(self.commasep(Inconsistent, &elts[..ddpos], |s, p| s.print_pat(&p)));
                     if ddpos != 0 {
-                        self.word_space(",")?;
+                        try!(self.word_space(","));
                     }
-                    word(&mut self.s, "..")?;
+                    try!(word(&mut self.s, ".."));
                     if ddpos != elts.len() {
-                        word(&mut self.s, ",")?;
-                        self.commasep(Inconsistent, &elts[ddpos..], |s, p| s.print_pat(&p))?;
+                        try!(word(&mut self.s, ","));
+                        try!(self.commasep(Inconsistent, &elts[ddpos..], |s, p| s.print_pat(&p)));
                     }
                 } else {
-                    self.commasep(Inconsistent, &elts[..], |s, p| s.print_pat(&p))?;
+                    try!(self.commasep(Inconsistent, &elts[..], |s, p| s.print_pat(&p)));
                 }
-                self.pclose()?;
+                try!(self.pclose());
             }
             PatKind::Path(ref path) => {
-                self.print_path(path, true, 0)?;
+                try!(self.print_path(path, true, 0));
             }
             PatKind::QPath(ref qself, ref path) => {
-                self.print_qpath(path, qself, false)?;
+                try!(self.print_qpath(path, qself, false));
             }
             PatKind::Struct(ref path, ref fields, etc) => {
-                self.print_path(path, true, 0)?;
-                self.nbsp()?;
-                self.word_space("{")?;
-                self.commasep_cmnt(
+                try!(self.print_path(path, true, 0));
+                try!(self.nbsp());
+                try!(self.word_space("{"));
+                try!(self.commasep_cmnt(
                     Consistent, &fields[..],
                     |s, f| {
-                        s.cbox(INDENT_UNIT)?;
+                        try!(s.cbox(INDENT_UNIT));
                         if !f.node.is_shorthand {
-                            s.print_ident(f.node.ident)?;
-                            s.word_nbsp(":")?;
+                            try!(s.print_ident(f.node.ident));
+                            try!(s.word_nbsp(":"));
                         }
-                        s.print_pat(&f.node.pat)?;
+                        try!(s.print_pat(&f.node.pat));
                         s.end()
                     },
-                    |f| f.node.pat.span)?;
+                    |f| f.node.pat.span));
                 if etc {
-                    if !fields.is_empty() { self.word_space(",")?; }
-                    word(&mut self.s, "..")?;
+                    if !fields.is_empty() { try!(self.word_space(",")); }
+                    try!(word(&mut self.s, ".."));
                 }
-                space(&mut self.s)?;
-                word(&mut self.s, "}")?;
+                try!(space(&mut self.s));
+                try!(word(&mut self.s, "}"));
             }
             PatKind::Tuple(ref elts, ddpos) => {
-                self.popen()?;
+                try!(self.popen());
                 if let Some(ddpos) = ddpos {
-                    self.commasep(Inconsistent, &elts[..ddpos], |s, p| s.print_pat(&p))?;
+                    try!(self.commasep(Inconsistent, &elts[..ddpos], |s, p| s.print_pat(&p)));
                     if ddpos != 0 {
-                        self.word_space(",")?;
+                        try!(self.word_space(","));
                     }
-                    word(&mut self.s, "..")?;
+                    try!(word(&mut self.s, ".."));
                     if ddpos != elts.len() {
-                        word(&mut self.s, ",")?;
-                        self.commasep(Inconsistent, &elts[ddpos..], |s, p| s.print_pat(&p))?;
+                        try!(word(&mut self.s, ","));
+                        try!(self.commasep(Inconsistent, &elts[ddpos..], |s, p| s.print_pat(&p)));
                     }
                 } else {
-                    self.commasep(Inconsistent, &elts[..], |s, p| s.print_pat(&p))?;
+                    try!(self.commasep(Inconsistent, &elts[..], |s, p| s.print_pat(&p)));
                     if elts.len() == 1 {
-                        word(&mut self.s, ",")?;
+                        try!(word(&mut self.s, ","));
                     }
                 }
-                self.pclose()?;
+                try!(self.pclose());
             }
             PatKind::Box(ref inner) => {
-                word(&mut self.s, "box ")?;
-                self.print_pat(&inner)?;
+                try!(word(&mut self.s, "box "));
+                try!(self.print_pat(&inner));
             }
             PatKind::Ref(ref inner, mutbl) => {
-                word(&mut self.s, "&")?;
+                try!(word(&mut self.s, "&"));
                 if mutbl == ast::Mutability::Mutable {
-                    word(&mut self.s, "mut ")?;
+                    try!(word(&mut self.s, "mut "));
                 }
-                self.print_pat(&inner)?;
+                try!(self.print_pat(&inner));
             }
-            PatKind::Lit(ref e) => self.print_expr(&**e)?,
+            PatKind::Lit(ref e) => try!(self.print_expr(&**e)),
             PatKind::Range(ref begin, ref end) => {
-                self.print_expr(&begin)?;
-                space(&mut self.s)?;
-                word(&mut self.s, "...")?;
-                self.print_expr(&end)?;
+                try!(self.print_expr(&begin));
+                try!(space(&mut self.s));
+                try!(word(&mut self.s, "..."));
+                try!(self.print_expr(&end));
             }
             PatKind::Vec(ref before, ref slice, ref after) => {
-                word(&mut self.s, "[")?;
-                self.commasep(Inconsistent,
+                try!(word(&mut self.s, "["));
+                try!(self.commasep(Inconsistent,
                                    &before[..],
-                                   |s, p| s.print_pat(&p))?;
+                                   |s, p| s.print_pat(&p)));
                 if let Some(ref p) = *slice {
-                    if !before.is_empty() { self.word_space(",")?; }
+                    if !before.is_empty() { try!(self.word_space(",")); }
                     if p.node != PatKind::Wild {
-                        self.print_pat(&p)?;
+                        try!(self.print_pat(&p));
                     }
-                    word(&mut self.s, "..")?;
-                    if !after.is_empty() { self.word_space(",")?; }
+                    try!(word(&mut self.s, ".."));
+                    if !after.is_empty() { try!(self.word_space(",")); }
                 }
-                self.commasep(Inconsistent,
+                try!(self.commasep(Inconsistent,
                                    &after[..],
-                                   |s, p| s.print_pat(&p))?;
-                word(&mut self.s, "]")?;
+                                   |s, p| s.print_pat(&p)));
+                try!(word(&mut self.s, "]"));
             }
-            PatKind::Mac(ref m) => self.print_mac(m, token::Paren)?,
+            PatKind::Mac(ref m) => try!(self.print_mac(m, token::Paren)),
         }
         self.ann.post(self, NodePat(pat))
     }
@@ -2576,43 +2576,43 @@ impl<'a> State<'a> {
         // I have no idea why this check is necessary, but here it
         // is :(
         if arm.attrs.is_empty() {
-            space(&mut self.s)?;
+            try!(space(&mut self.s));
         }
-        self.cbox(INDENT_UNIT)?;
-        self.ibox(0)?;
-        self.print_outer_attributes(&arm.attrs)?;
+        try!(self.cbox(INDENT_UNIT));
+        try!(self.ibox(0));
+        try!(self.print_outer_attributes(&arm.attrs));
         let mut first = true;
         for p in &arm.pats {
             if first {
                 first = false;
             } else {
-                space(&mut self.s)?;
-                self.word_space("|")?;
+                try!(space(&mut self.s));
+                try!(self.word_space("|"));
             }
-            self.print_pat(&p)?;
+            try!(self.print_pat(&p));
         }
-        space(&mut self.s)?;
+        try!(space(&mut self.s));
         if let Some(ref e) = arm.guard {
-            self.word_space("if")?;
-            self.print_expr(&e)?;
-            space(&mut self.s)?;
+            try!(self.word_space("if"));
+            try!(self.print_expr(&e));
+            try!(space(&mut self.s));
         }
-        self.word_space("=>")?;
+        try!(self.word_space("=>"));
 
         match arm.body.node {
             ast::ExprKind::Block(ref blk) => {
                 // the block will close the pattern's ibox
-                self.print_block_unclosed_indent(&blk, INDENT_UNIT)?;
+                try!(self.print_block_unclosed_indent(&blk, INDENT_UNIT));
 
                 // If it is a user-provided unsafe block, print a comma after it
                 if let BlockCheckMode::Unsafe(ast::UserProvided) = blk.rules {
-                    word(&mut self.s, ",")?;
+                    try!(word(&mut self.s, ","));
                 }
             }
             _ => {
-                self.end()?; // close the ibox for the pattern
-                self.print_expr(&arm.body)?;
-                word(&mut self.s, ",")?;
+                try!(self.end()); // close the ibox for the pattern
+                try!(self.print_expr(&arm.body));
+                try!(word(&mut self.s, ","));
             }
         }
         self.end() // close enclosing cbox
@@ -2621,19 +2621,19 @@ impl<'a> State<'a> {
     fn print_explicit_self(&mut self, explicit_self: &ast::ExplicitSelf) -> io::Result<()> {
         match explicit_self.node {
             SelfKind::Value(m) => {
-                self.print_mutability(m)?;
+                try!(self.print_mutability(m));
                 word(&mut self.s, "self")
             }
             SelfKind::Region(ref lt, m) => {
-                word(&mut self.s, "&")?;
-                self.print_opt_lifetime(lt)?;
-                self.print_mutability(m)?;
+                try!(word(&mut self.s, "&"));
+                try!(self.print_opt_lifetime(lt));
+                try!(self.print_mutability(m));
                 word(&mut self.s, "self")
             }
             SelfKind::Explicit(ref typ, m) => {
-                self.print_mutability(m)?;
-                word(&mut self.s, "self")?;
-                self.word_space(":")?;
+                try!(self.print_mutability(m));
+                try!(word(&mut self.s, "self"));
+                try!(self.word_space(":"));
                 self.print_type(&typ)
             }
         }
@@ -2647,25 +2647,25 @@ impl<'a> State<'a> {
                     name: Option<ast::Ident>,
                     generics: &ast::Generics,
                     vis: &ast::Visibility) -> io::Result<()> {
-        self.print_fn_header_info(unsafety, constness, abi, vis)?;
+        try!(self.print_fn_header_info(unsafety, constness, abi, vis));
 
         if let Some(name) = name {
-            self.nbsp()?;
-            self.print_ident(name)?;
+            try!(self.nbsp());
+            try!(self.print_ident(name));
         }
-        self.print_generics(generics)?;
-        self.print_fn_args_and_ret(decl)?;
+        try!(self.print_generics(generics));
+        try!(self.print_fn_args_and_ret(decl));
         self.print_where_clause(&generics.where_clause)
     }
 
     pub fn print_fn_args_and_ret(&mut self, decl: &ast::FnDecl)
         -> io::Result<()> {
-        self.popen()?;
-        self.commasep(Inconsistent, &decl.inputs, |s, arg| s.print_arg(arg, false))?;
+        try!(self.popen());
+        try!(self.commasep(Inconsistent, &decl.inputs, |s, arg| s.print_arg(arg, false)));
         if decl.variadic {
-            word(&mut self.s, ", ...")?;
+            try!(word(&mut self.s, ", ..."));
         }
-        self.pclose()?;
+        try!(self.pclose());
 
         self.print_fn_output(decl)
     }
@@ -2674,24 +2674,24 @@ impl<'a> State<'a> {
             &mut self,
             decl: &ast::FnDecl)
             -> io::Result<()> {
-        word(&mut self.s, "|")?;
-        self.commasep(Inconsistent, &decl.inputs, |s, arg| s.print_arg(arg, true))?;
-        word(&mut self.s, "|")?;
+        try!(word(&mut self.s, "|"));
+        try!(self.commasep(Inconsistent, &decl.inputs, |s, arg| s.print_arg(arg, true)));
+        try!(word(&mut self.s, "|"));
 
         if let ast::FunctionRetTy::Default(..) = decl.output {
             return Ok(());
         }
 
-        self.space_if_not_bol()?;
-        self.word_space("->")?;
+        try!(self.space_if_not_bol());
+        try!(self.word_space("->"));
         match decl.output {
             ast::FunctionRetTy::Ty(ref ty) => {
-                self.print_type(&ty)?;
+                try!(self.print_type(&ty));
                 self.maybe_print_comment(ty.span.lo)
             }
             ast::FunctionRetTy::Default(..) => unreachable!(),
             ast::FunctionRetTy::None(span) => {
-                self.word_nbsp("!")?;
+                try!(self.word_nbsp("!"));
                 self.maybe_print_comment(span.lo)
             }
         }
@@ -2710,28 +2710,28 @@ impl<'a> State<'a> {
                         bounds: &[ast::TyParamBound])
                         -> io::Result<()> {
         if !bounds.is_empty() {
-            word(&mut self.s, prefix)?;
+            try!(word(&mut self.s, prefix));
             let mut first = true;
             for bound in bounds {
-                self.nbsp()?;
+                try!(self.nbsp());
                 if first {
                     first = false;
                 } else {
-                    self.word_space("+")?;
+                    try!(self.word_space("+"));
                 }
 
-                match *bound {
+                try!(match *bound {
                     TraitTyParamBound(ref tref, TraitBoundModifier::None) => {
                         self.print_poly_trait_ref(tref)
                     }
                     TraitTyParamBound(ref tref, TraitBoundModifier::Maybe) => {
-                        word(&mut self.s, "?")?;
+                        try!(word(&mut self.s, "?"));
                         self.print_poly_trait_ref(tref)
                     }
                     RegionTyParamBound(ref lt) => {
                         self.print_lifetime(lt)
                     }
-                }?
+                })
             }
             Ok(())
         } else {
@@ -2750,11 +2750,11 @@ impl<'a> State<'a> {
                               lifetime: &ast::LifetimeDef)
                               -> io::Result<()>
     {
-        self.print_lifetime(&lifetime.lifetime)?;
+        try!(self.print_lifetime(&lifetime.lifetime));
         let mut sep = ":";
         for v in &lifetime.bounds {
-            word(&mut self.s, sep)?;
-            self.print_lifetime(v)?;
+            try!(word(&mut self.s, sep));
+            try!(self.print_lifetime(v));
             sep = "+";
         }
         Ok(())
@@ -2769,14 +2769,14 @@ impl<'a> State<'a> {
             return Ok(());
         }
 
-        word(&mut self.s, "<")?;
+        try!(word(&mut self.s, "<"));
 
         let mut ints = Vec::new();
         for i in 0..total {
             ints.push(i);
         }
 
-        self.commasep(Inconsistent, &ints[..], |s, &idx| {
+        try!(self.commasep(Inconsistent, &ints[..], |s, &idx| {
             if idx < generics.lifetimes.len() {
                 let lifetime = &generics.lifetimes[idx];
                 s.print_lifetime_def(lifetime)
@@ -2785,19 +2785,19 @@ impl<'a> State<'a> {
                 let param = &generics.ty_params[idx];
                 s.print_ty_param(param)
             }
-        })?;
+        }));
 
-        word(&mut self.s, ">")?;
+        try!(word(&mut self.s, ">"));
         Ok(())
     }
 
     pub fn print_ty_param(&mut self, param: &ast::TyParam) -> io::Result<()> {
-        self.print_ident(param.ident)?;
-        self.print_bounds(":", &param.bounds)?;
+        try!(self.print_ident(param.ident));
+        try!(self.print_bounds(":", &param.bounds));
         match param.default {
             Some(ref default) => {
-                space(&mut self.s)?;
-                self.word_space("=")?;
+                try!(space(&mut self.s));
+                try!(self.word_space("="));
                 self.print_type(&default)
             }
             _ => Ok(())
@@ -2810,12 +2810,12 @@ impl<'a> State<'a> {
             return Ok(())
         }
 
-        space(&mut self.s)?;
-        self.word_space("where")?;
+        try!(space(&mut self.s));
+        try!(self.word_space("where"));
 
         for (i, predicate) in where_clause.predicates.iter().enumerate() {
             if i != 0 {
-                self.word_space(",")?;
+                try!(self.word_space(","));
             }
 
             match *predicate {
@@ -2823,29 +2823,29 @@ impl<'a> State<'a> {
                                                                              ref bounded_ty,
                                                                              ref bounds,
                                                                              ..}) => {
-                    self.print_formal_lifetime_list(bound_lifetimes)?;
-                    self.print_type(&bounded_ty)?;
-                    self.print_bounds(":", bounds)?;
+                    try!(self.print_formal_lifetime_list(bound_lifetimes));
+                    try!(self.print_type(&bounded_ty));
+                    try!(self.print_bounds(":", bounds));
                 }
                 ast::WherePredicate::RegionPredicate(ast::WhereRegionPredicate{ref lifetime,
                                                                                ref bounds,
                                                                                ..}) => {
-                    self.print_lifetime(lifetime)?;
-                    word(&mut self.s, ":")?;
+                    try!(self.print_lifetime(lifetime));
+                    try!(word(&mut self.s, ":"));
 
                     for (i, bound) in bounds.iter().enumerate() {
-                        self.print_lifetime(bound)?;
+                        try!(self.print_lifetime(bound));
 
                         if i != 0 {
-                            word(&mut self.s, ":")?;
+                            try!(word(&mut self.s, ":"));
                         }
                     }
                 }
                 ast::WherePredicate::EqPredicate(ast::WhereEqPredicate{ref path, ref ty, ..}) => {
-                    self.print_path(path, false, 0)?;
-                    space(&mut self.s)?;
-                    self.word_space("=")?;
-                    self.print_type(&ty)?;
+                    try!(self.print_path(path, false, 0));
+                    try!(space(&mut self.s));
+                    try!(self.word_space("="));
+                    try!(self.print_type(&ty));
                 }
             }
         }
@@ -2856,52 +2856,52 @@ impl<'a> State<'a> {
     pub fn print_view_path(&mut self, vp: &ast::ViewPath) -> io::Result<()> {
         match vp.node {
             ast::ViewPathSimple(ident, ref path) => {
-                self.print_path(path, false, 0)?;
+                try!(self.print_path(path, false, 0));
 
                 if path.segments.last().unwrap().identifier.name !=
                         ident.name {
-                    space(&mut self.s)?;
-                    self.word_space("as")?;
-                    self.print_ident(ident)?;
+                    try!(space(&mut self.s));
+                    try!(self.word_space("as"));
+                    try!(self.print_ident(ident));
                 }
 
                 Ok(())
             }
 
             ast::ViewPathGlob(ref path) => {
-                self.print_path(path, false, 0)?;
+                try!(self.print_path(path, false, 0));
                 word(&mut self.s, "::*")
             }
 
             ast::ViewPathList(ref path, ref idents) => {
                 if path.segments.is_empty() {
-                    word(&mut self.s, "{")?;
+                    try!(word(&mut self.s, "{"));
                 } else {
-                    self.print_path(path, false, 0)?;
-                    word(&mut self.s, "::{")?;
+                    try!(self.print_path(path, false, 0));
+                    try!(word(&mut self.s, "::{"));
                 }
-                self.commasep(Inconsistent, &idents[..], |s, w| {
+                try!(self.commasep(Inconsistent, &idents[..], |s, w| {
                     match w.node {
                         ast::PathListItemKind::Ident { name, rename, .. } => {
-                            s.print_ident(name)?;
+                            try!(s.print_ident(name));
                             if let Some(ident) = rename {
-                                space(&mut s.s)?;
-                                s.word_space("as")?;
-                                s.print_ident(ident)?;
+                                try!(space(&mut s.s));
+                                try!(s.word_space("as"));
+                                try!(s.print_ident(ident));
                             }
                             Ok(())
                         },
                         ast::PathListItemKind::Mod { rename, .. } => {
-                            word(&mut s.s, "self")?;
+                            try!(word(&mut s.s, "self"));
                             if let Some(ident) = rename {
-                                space(&mut s.s)?;
-                                s.word_space("as")?;
-                                s.print_ident(ident)?;
+                                try!(space(&mut s.s));
+                                try!(s.word_space("as"));
+                                try!(s.print_ident(ident));
                             }
                             Ok(())
                         }
                     }
-                })?;
+                }));
                 word(&mut self.s, "}")
             }
         }
@@ -2916,17 +2916,17 @@ impl<'a> State<'a> {
     }
 
     pub fn print_mt(&mut self, mt: &ast::MutTy) -> io::Result<()> {
-        self.print_mutability(mt.mutbl)?;
+        try!(self.print_mutability(mt.mutbl));
         self.print_type(&mt.ty)
     }
 
     pub fn print_arg(&mut self, input: &ast::Arg, is_closure: bool) -> io::Result<()> {
-        self.ibox(INDENT_UNIT)?;
+        try!(self.ibox(INDENT_UNIT));
         match input.ty.node {
-            ast::TyKind::Infer if is_closure => self.print_pat(&input.pat)?,
+            ast::TyKind::Infer if is_closure => try!(self.print_pat(&input.pat)),
             _ => {
                 if let Some(eself) = input.to_self() {
-                    self.print_explicit_self(&eself)?;
+                    try!(self.print_explicit_self(&eself));
                 } else {
                     let invalid = if let PatKind::Ident(_, ident, _) = input.pat.node {
                         ident.node.name == keywords::Invalid.name()
@@ -2934,11 +2934,11 @@ impl<'a> State<'a> {
                         false
                     };
                     if !invalid {
-                        self.print_pat(&input.pat)?;
-                        word(&mut self.s, ":")?;
-                        space(&mut self.s)?;
+                        try!(self.print_pat(&input.pat));
+                        try!(word(&mut self.s, ":"));
+                        try!(space(&mut self.s));
                     }
-                    self.print_type(&input.ty)?;
+                    try!(self.print_type(&input.ty));
                 }
             }
         }
@@ -2950,17 +2950,17 @@ impl<'a> State<'a> {
             return Ok(());
         }
 
-        self.space_if_not_bol()?;
-        self.ibox(INDENT_UNIT)?;
-        self.word_space("->")?;
+        try!(self.space_if_not_bol());
+        try!(self.ibox(INDENT_UNIT));
+        try!(self.word_space("->"));
         match decl.output {
             ast::FunctionRetTy::None(_) =>
-                self.word_nbsp("!")?,
+                try!(self.word_nbsp("!")),
             ast::FunctionRetTy::Default(..) => unreachable!(),
             ast::FunctionRetTy::Ty(ref ty) =>
-                self.print_type(&ty)?
+                try!(self.print_type(&ty))
         }
-        self.end()?;
+        try!(self.end());
 
         match decl.output {
             ast::FunctionRetTy::Ty(ref output) => self.maybe_print_comment(output.span.lo),
@@ -2975,10 +2975,10 @@ impl<'a> State<'a> {
                        name: Option<ast::Ident>,
                        generics: &ast::Generics)
                        -> io::Result<()> {
-        self.ibox(INDENT_UNIT)?;
+        try!(self.ibox(INDENT_UNIT));
         if !generics.lifetimes.is_empty() || !generics.ty_params.is_empty() {
-            word(&mut self.s, "for")?;
-            self.print_generics(generics)?;
+            try!(word(&mut self.s, "for"));
+            try!(self.print_generics(generics));
         }
         let generics = ast::Generics {
             lifetimes: Vec::new(),
@@ -2988,13 +2988,13 @@ impl<'a> State<'a> {
                 predicates: Vec::new(),
             },
         };
-        self.print_fn(decl,
+        try!(self.print_fn(decl,
                       unsafety,
                       ast::Constness::NotConst,
                       abi,
                       name,
                       &generics,
-                      &ast::Visibility::Inherited)?;
+                      &ast::Visibility::Inherited));
         self.end()
     }
 
@@ -3026,12 +3026,12 @@ impl<'a> State<'a> {
         // If there aren't any remaining comments, then we need to manually
         // make sure there is a line break at the end.
         if self.next_comment().is_none() {
-            hardbreak(&mut self.s)?;
+            try!(hardbreak(&mut self.s));
         }
         loop {
             match self.next_comment() {
                 Some(ref cmnt) => {
-                    self.print_comment(cmnt)?;
+                    try!(self.print_comment(cmnt));
                     self.cur_cmnt_and_lit.cur_cmnt += 1;
                 }
                 _ => break
@@ -3046,7 +3046,7 @@ impl<'a> State<'a> {
         match opt_abi {
             Some(Abi::Rust) => Ok(()),
             Some(abi) => {
-                self.word_nbsp("extern")?;
+                try!(self.word_nbsp("extern"));
                 self.word_nbsp(&abi.to_string())
             }
             None => Ok(())
@@ -3057,7 +3057,7 @@ impl<'a> State<'a> {
                                 opt_abi: Option<Abi>) -> io::Result<()> {
         match opt_abi {
             Some(abi) => {
-                self.word_nbsp("extern")?;
+                try!(self.word_nbsp("extern"));
                 self.word_nbsp(&abi.to_string())
             }
             None => Ok(())
@@ -3069,18 +3069,18 @@ impl<'a> State<'a> {
                                 constness: ast::Constness,
                                 abi: Abi,
                                 vis: &ast::Visibility) -> io::Result<()> {
-        word(&mut self.s, &visibility_qualified(vis, ""))?;
+        try!(word(&mut self.s, &visibility_qualified(vis, "")));
 
         match constness {
             ast::Constness::NotConst => {}
-            ast::Constness::Const => self.word_nbsp("const")?
+            ast::Constness::Const => try!(self.word_nbsp("const"))
         }
 
-        self.print_unsafety(unsafety)?;
+        try!(self.print_unsafety(unsafety));
 
         if abi != Abi::Rust {
-            self.word_nbsp("extern")?;
-            self.word_nbsp(&abi.to_string())?;
+            try!(self.word_nbsp("extern"));
+            try!(self.word_nbsp(&abi.to_string()));
         }
 
         word(&mut self.s, "fn")