about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-09-13 22:41:34 -0700
committerGitHub <noreply@github.com>2016-09-13 22:41:34 -0700
commit739d57180fa207410b8858f8cede7b8a9ea6f01e (patch)
tree48bd42052665b2f0b5c7b82ffadd10d0e1844a53
parentb1363a73ede57ae595f3a1be2bb75d308ba4f7f6 (diff)
parent694d601dbc2df575c32a490a529656a864dc0a2e (diff)
downloadrust-739d57180fa207410b8858f8cede7b8a9ea6f01e.tar.gz
rust-739d57180fa207410b8858f8cede7b8a9ea6f01e.zip
Auto merge of #36041 - ahmedcharles:try, r=nrc
Replace try! with ?.
-rw-r--r--src/bootstrap/lib.rs2
-rw-r--r--src/libcore/num/bignum.rs4
-rw-r--r--src/librustc/hir/print.rs4
-rw-r--r--src/librustc/infer/higher_ranked/mod.rs2
-rw-r--r--src/librustc/util/fs.rs2
-rw-r--r--src/librustc_back/target/aarch64_apple_ios.rs2
-rw-r--r--src/librustc_back/target/apple_ios_base.rs4
-rw-r--r--src/librustc_back/target/armv7_apple_ios.rs2
-rw-r--r--src/librustc_back/target/armv7s_apple_ios.rs2
-rw-r--r--src/librustc_back/target/i386_apple_ios.rs2
-rw-r--r--src/librustc_back/target/i586_pc_windows_msvc.rs2
-rw-r--r--src/librustc_back/target/i586_unknown_linux_gnu.rs2
-rw-r--r--src/librustc_back/target/mod.rs16
-rw-r--r--src/librustc_back/target/x86_64_apple_ios.rs2
-rw-r--r--src/librustc_const_eval/eval.rs41
-rw-r--r--src/librustc_errors/emitter.rs34
-rw-r--r--src/librustc_incremental/persist/hash.rs4
-rw-r--r--src/librustc_incremental/persist/load.rs8
-rw-r--r--src/librustc_incremental/persist/save.rs10
-rw-r--r--src/librustc_metadata/loader.rs4
-rw-r--r--src/librustc_mir/pretty.rs12
-rw-r--r--src/libserialize/json.rs11
-rw-r--r--src/libserialize/serialize.rs8
-rw-r--r--src/libstd/sync/mpsc/oneshot.rs2
-rw-r--r--src/libstd/sync/mpsc/stream.rs3
-rw-r--r--src/libstd/sys/common/backtrace.rs4
-rw-r--r--src/tools/compiletest/src/runtest.rs16
-rw-r--r--src/tools/linkchecker/main.rs9
28 files changed, 105 insertions, 109 deletions
diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
index 4beba5c8852..ebca0c8ecea 100644
--- a/src/bootstrap/lib.rs
+++ b/src/bootstrap/lib.rs
@@ -45,7 +45,7 @@ use util::{exe, mtime, libdir, add_lib_path};
 /// * The error itself
 ///
 /// This is currently used judiciously throughout the build system rather than
-/// using a `Result` with `try!`, but this may change on day...
+/// using a `Result` with `try!`, but this may change one day...
 macro_rules! t {
     ($e:expr) => (match $e {
         Ok(e) => e,
diff --git a/src/libcore/num/bignum.rs b/src/libcore/num/bignum.rs
index bc503ba3e46..1ca550c6746 100644
--- a/src/libcore/num/bignum.rs
+++ b/src/libcore/num/bignum.rs
@@ -474,9 +474,9 @@ macro_rules! define_bignum {
                 let sz = if self.size < 1 {1} else {self.size};
                 let digitlen = mem::size_of::<$ty>() * 2;
 
-                try!(write!(f, "{:#x}", self.base[sz-1]));
+                write!(f, "{:#x}", self.base[sz-1])?;
                 for &v in self.base[..sz-1].iter().rev() {
-                    try!(write!(f, "_{:01$x}", v, digitlen));
+                    write!(f, "_{:01$x}", v, digitlen)?;
                 }
                 ::result::Result::Ok(())
             }
diff --git a/src/librustc/hir/print.rs b/src/librustc/hir/print.rs
index f236bd4884d..eebc8fa9e5d 100644
--- a/src/librustc/hir/print.rs
+++ b/src/librustc/hir/print.rs
@@ -1756,9 +1756,9 @@ impl<'a> State<'a> {
                         self.commasep(Inconsistent, &elts[ddpos..], |s, p| s.print_pat(&p))?;
                     }
                 } else {
-                    try!(self.commasep(Inconsistent, &elts[..], |s, p| s.print_pat(&p)));
+                    self.commasep(Inconsistent, &elts[..], |s, p| s.print_pat(&p))?;
                 }
-                try!(self.pclose());
+                self.pclose()?;
             }
             PatKind::Path(None, ref path) => {
                 self.print_path(path, true, 0)?;
diff --git a/src/librustc/infer/higher_ranked/mod.rs b/src/librustc/infer/higher_ranked/mod.rs
index 322752ccea3..7c02de05d26 100644
--- a/src/librustc/infer/higher_ranked/mod.rs
+++ b/src/librustc/infer/higher_ranked/mod.rs
@@ -130,7 +130,7 @@ impl<'a, 'gcx, 'tcx> CombineFields<'a, 'gcx, 'tcx> {
             debug!("higher_ranked_match: skol_map={:?}", skol_map);
 
             // Equate types now that bound regions have been replaced.
-            try!(self.equate(a_is_expected).relate(&a_match, &b_match));
+            self.equate(a_is_expected).relate(&a_match, &b_match)?;
 
             // Map each skolemized region to a vector of other regions that it
             // must be equated with. (Note that this vector may include other
diff --git a/src/librustc/util/fs.rs b/src/librustc/util/fs.rs
index d7800ccaa5d..c290d8f893e 100644
--- a/src/librustc/util/fs.rs
+++ b/src/librustc/util/fs.rs
@@ -68,7 +68,7 @@ pub fn link_or_copy<P: AsRef<Path>, Q: AsRef<Path>>(p: P, q: Q) -> io::Result<Li
     let p = p.as_ref();
     let q = q.as_ref();
     if q.exists() {
-        try!(fs::remove_file(&q));
+        fs::remove_file(&q)?;
     }
 
     match fs::hard_link(p, q) {
diff --git a/src/librustc_back/target/aarch64_apple_ios.rs b/src/librustc_back/target/aarch64_apple_ios.rs
index 6530ccb0630..660ed0ac7b8 100644
--- a/src/librustc_back/target/aarch64_apple_ios.rs
+++ b/src/librustc_back/target/aarch64_apple_ios.rs
@@ -12,7 +12,7 @@ use target::{Target, TargetOptions, TargetResult};
 use super::apple_ios_base::{opts, Arch};
 
 pub fn target() -> TargetResult {
-    let base = try!(opts(Arch::Arm64));
+    let base = opts(Arch::Arm64)?;
     Ok(Target {
         llvm_target: "arm64-apple-ios".to_string(),
         target_endian: "little".to_string(),
diff --git a/src/librustc_back/target/apple_ios_base.rs b/src/librustc_back/target/apple_ios_base.rs
index 8bd9feabdbe..17492b8bdcb 100644
--- a/src/librustc_back/target/apple_ios_base.rs
+++ b/src/librustc_back/target/apple_ios_base.rs
@@ -68,7 +68,7 @@ fn build_pre_link_args(arch: Arch) -> Result<Vec<String>, String> {
 
     let arch_name = arch.to_string();
 
-    let sdk_root = try!(get_sdk_root(sdk_name));
+    let sdk_root = get_sdk_root(sdk_name)?;
 
     Ok(vec!["-arch".to_string(), arch_name.to_string(),
          "-Wl,-syslibroot".to_string(), sdk_root])
@@ -85,7 +85,7 @@ fn target_cpu(arch: Arch) -> String {
 }
 
 pub fn opts(arch: Arch) -> Result<TargetOptions, String> {
-    let pre_link_args = try!(build_pre_link_args(arch));
+    let pre_link_args = build_pre_link_args(arch)?;
     Ok(TargetOptions {
         cpu: target_cpu(arch),
         dynamic_linking: false,
diff --git a/src/librustc_back/target/armv7_apple_ios.rs b/src/librustc_back/target/armv7_apple_ios.rs
index a806204d0a6..71533a09b16 100644
--- a/src/librustc_back/target/armv7_apple_ios.rs
+++ b/src/librustc_back/target/armv7_apple_ios.rs
@@ -12,7 +12,7 @@ use target::{Target, TargetOptions, TargetResult};
 use super::apple_ios_base::{opts, Arch};
 
 pub fn target() -> TargetResult {
-    let base = try!(opts(Arch::Armv7));
+    let base = opts(Arch::Armv7)?;
     Ok(Target {
         llvm_target: "armv7-apple-ios".to_string(),
         target_endian: "little".to_string(),
diff --git a/src/librustc_back/target/armv7s_apple_ios.rs b/src/librustc_back/target/armv7s_apple_ios.rs
index aaa3570fa62..f24b9969910 100644
--- a/src/librustc_back/target/armv7s_apple_ios.rs
+++ b/src/librustc_back/target/armv7s_apple_ios.rs
@@ -12,7 +12,7 @@ use target::{Target, TargetOptions, TargetResult};
 use super::apple_ios_base::{opts, Arch};
 
 pub fn target() -> TargetResult {
-    let base = try!(opts(Arch::Armv7s));
+    let base = opts(Arch::Armv7s)?;
     Ok(Target {
         llvm_target: "armv7s-apple-ios".to_string(),
         target_endian: "little".to_string(),
diff --git a/src/librustc_back/target/i386_apple_ios.rs b/src/librustc_back/target/i386_apple_ios.rs
index f391d4118ea..94146fe9d98 100644
--- a/src/librustc_back/target/i386_apple_ios.rs
+++ b/src/librustc_back/target/i386_apple_ios.rs
@@ -12,7 +12,7 @@ use target::{Target, TargetOptions, TargetResult};
 use super::apple_ios_base::{opts, Arch};
 
 pub fn target() -> TargetResult {
-    let base = try!(opts(Arch::I386));
+    let base = opts(Arch::I386)?;
     Ok(Target {
         llvm_target: "i386-apple-ios".to_string(),
         target_endian: "little".to_string(),
diff --git a/src/librustc_back/target/i586_pc_windows_msvc.rs b/src/librustc_back/target/i586_pc_windows_msvc.rs
index 445ee6c4122..9b88cde5989 100644
--- a/src/librustc_back/target/i586_pc_windows_msvc.rs
+++ b/src/librustc_back/target/i586_pc_windows_msvc.rs
@@ -11,7 +11,7 @@
 use target::TargetResult;
 
 pub fn target() -> TargetResult {
-    let mut base = try!(super::i686_pc_windows_msvc::target());
+    let mut base = super::i686_pc_windows_msvc::target()?;
     base.options.cpu = "pentium".to_string();
     base.llvm_target = "i586-pc-windows-msvc".to_string();
     Ok(base)
diff --git a/src/librustc_back/target/i586_unknown_linux_gnu.rs b/src/librustc_back/target/i586_unknown_linux_gnu.rs
index 1ca8606149b..40fb4a67acd 100644
--- a/src/librustc_back/target/i586_unknown_linux_gnu.rs
+++ b/src/librustc_back/target/i586_unknown_linux_gnu.rs
@@ -11,7 +11,7 @@
 use target::TargetResult;
 
 pub fn target() -> TargetResult {
-    let mut base = try!(super::i686_unknown_linux_gnu::target());
+    let mut base = super::i686_unknown_linux_gnu::target()?;
     base.options.cpu = "pentium".to_string();
     base.llvm_target = "i586-unknown-linux-gnu".to_string();
     Ok(base)
diff --git a/src/librustc_back/target/mod.rs b/src/librustc_back/target/mod.rs
index 1a26ffaf1e1..756586602b4 100644
--- a/src/librustc_back/target/mod.rs
+++ b/src/librustc_back/target/mod.rs
@@ -77,12 +77,12 @@ macro_rules! supported_targets {
             match target {
                 $(
                     $triple => {
-                        let mut t = try!($module::target());
+                        let mut t = $module::target()?;
                         t.options.is_builtin = true;
 
                         // round-trip through the JSON parser to ensure at
                         // run-time that the parser works correctly
-                        t = try!(Target::from_json(t.to_json()));
+                        t = Target::from_json(t.to_json())?;
                         debug!("Got builtin target: {:?}", t);
                         Ok(t)
                     },
@@ -438,12 +438,12 @@ impl Target {
         };
 
         let mut base = Target {
-            llvm_target: try!(get_req_field("llvm-target")),
-            target_endian: try!(get_req_field("target-endian")),
-            target_pointer_width: try!(get_req_field("target-pointer-width")),
-            data_layout: try!(get_req_field("data-layout")),
-            arch: try!(get_req_field("arch")),
-            target_os: try!(get_req_field("os")),
+            llvm_target: get_req_field("llvm-target")?,
+            target_endian: get_req_field("target-endian")?,
+            target_pointer_width: get_req_field("target-pointer-width")?,
+            data_layout: get_req_field("data-layout")?,
+            arch: get_req_field("arch")?,
+            target_os: get_req_field("os")?,
             target_env: get_opt_field("env", ""),
             target_vendor: get_opt_field("vendor", "unknown"),
             options: Default::default(),
diff --git a/src/librustc_back/target/x86_64_apple_ios.rs b/src/librustc_back/target/x86_64_apple_ios.rs
index 4afc9bcb946..3b8b636b6dc 100644
--- a/src/librustc_back/target/x86_64_apple_ios.rs
+++ b/src/librustc_back/target/x86_64_apple_ios.rs
@@ -12,7 +12,7 @@ use target::{Target, TargetOptions, TargetResult};
 use super::apple_ios_base::{opts, Arch};
 
 pub fn target() -> TargetResult {
-    let base = try!(opts(Arch::X86_64));
+    let base = opts(Arch::X86_64)?;
     Ok(Target {
         llvm_target: "x86_64-apple-ios".to_string(),
         target_endian: "little".to_string(),
diff --git a/src/librustc_const_eval/eval.rs b/src/librustc_const_eval/eval.rs
index 4f4c16d3f6a..4ced9d87f0a 100644
--- a/src/librustc_const_eval/eval.rs
+++ b/src/librustc_const_eval/eval.rs
@@ -278,9 +278,9 @@ pub fn const_expr_to_pat<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
     }
     let pat = match expr.node {
         hir::ExprTup(ref exprs) =>
-            PatKind::Tuple(try!(exprs.iter()
-                                     .map(|expr| const_expr_to_pat(tcx, &expr, pat_id, span))
-                                     .collect()), None),
+            PatKind::Tuple(exprs.iter()
+                                .map(|expr| const_expr_to_pat(tcx, &expr, pat_id, span))
+                                .collect::<Result<_, _>>()?, None),
 
         hir::ExprCall(ref callee, ref args) => {
             let def = tcx.expect_def(callee.id);
@@ -297,34 +297,31 @@ pub fn const_expr_to_pat<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                 })),
                 _ => bug!()
             };
-            let pats = try!(args.iter()
-                                .map(|expr| const_expr_to_pat(tcx, &**expr,
-                                                              pat_id, span))
-                                .collect());
+            let pats = args.iter()
+                           .map(|expr| const_expr_to_pat(tcx, &**expr, pat_id, span))
+                           .collect::<Result<_, _>>()?;
             PatKind::TupleStruct(path, pats, None)
         }
 
         hir::ExprStruct(ref path, ref fields, None) => {
             let field_pats =
-                try!(fields.iter()
-                           .map(|field| Ok(codemap::Spanned {
-                               span: syntax_pos::DUMMY_SP,
-                               node: hir::FieldPat {
-                                   name: field.name.node,
-                                   pat: try!(const_expr_to_pat(tcx, &field.expr,
-                                                               pat_id, span)),
-                                   is_shorthand: false,
-                               },
-                           }))
-                           .collect());
+                fields.iter()
+                      .map(|field| Ok(codemap::Spanned {
+                          span: syntax_pos::DUMMY_SP,
+                          node: hir::FieldPat {
+                              name: field.name.node,
+                              pat: const_expr_to_pat(tcx, &field.expr, pat_id, span)?,
+                              is_shorthand: false,
+                          },
+                      }))
+                      .collect::<Result<_, _>>()?;
             PatKind::Struct(path.clone(), field_pats, false)
         }
 
         hir::ExprVec(ref exprs) => {
-            let pats = try!(exprs.iter()
-                                 .map(|expr| const_expr_to_pat(tcx, &expr,
-                                                               pat_id, span))
-                                 .collect());
+            let pats = exprs.iter()
+                            .map(|expr| const_expr_to_pat(tcx, &expr, pat_id, span))
+                            .collect::<Result<_, _>>()?;
             PatKind::Vec(pats, None, hir::HirVec::new())
         }
 
diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs
index dcdbe2a8525..1bdc9ef3088 100644
--- a/src/librustc_errors/emitter.rs
+++ b/src/librustc_errors/emitter.rs
@@ -882,45 +882,45 @@ impl Destination {
         match style {
             Style::FileNameStyle | Style::LineAndColumn => {}
             Style::LineNumber => {
-                try!(self.start_attr(term::Attr::Bold));
+                self.start_attr(term::Attr::Bold)?;
                 if cfg!(windows) {
-                    try!(self.start_attr(term::Attr::ForegroundColor(term::color::BRIGHT_CYAN)));
+                    self.start_attr(term::Attr::ForegroundColor(term::color::BRIGHT_CYAN))?;
                 } else {
-                    try!(self.start_attr(term::Attr::ForegroundColor(term::color::BRIGHT_BLUE)));
+                    self.start_attr(term::Attr::ForegroundColor(term::color::BRIGHT_BLUE))?;
                 }
             }
             Style::ErrorCode => {
-                try!(self.start_attr(term::Attr::Bold));
-                try!(self.start_attr(term::Attr::ForegroundColor(term::color::BRIGHT_MAGENTA)));
+                self.start_attr(term::Attr::Bold)?;
+                self.start_attr(term::Attr::ForegroundColor(term::color::BRIGHT_MAGENTA))?;
             }
             Style::Quotation => {}
             Style::OldSchoolNote => {
-                try!(self.start_attr(term::Attr::Bold));
-                try!(self.start_attr(term::Attr::ForegroundColor(term::color::BRIGHT_GREEN)));
+                self.start_attr(term::Attr::Bold)?;
+                self.start_attr(term::Attr::ForegroundColor(term::color::BRIGHT_GREEN))?;
             }
             Style::OldSchoolNoteText | Style::HeaderMsg => {
-                try!(self.start_attr(term::Attr::Bold));
+                self.start_attr(term::Attr::Bold)?;
                 if cfg!(windows) {
-                    try!(self.start_attr(term::Attr::ForegroundColor(term::color::BRIGHT_WHITE)));
+                    self.start_attr(term::Attr::ForegroundColor(term::color::BRIGHT_WHITE))?;
                 }
             }
             Style::UnderlinePrimary | Style::LabelPrimary => {
-                try!(self.start_attr(term::Attr::Bold));
-                try!(self.start_attr(term::Attr::ForegroundColor(lvl.color())));
+                self.start_attr(term::Attr::Bold)?;
+                self.start_attr(term::Attr::ForegroundColor(lvl.color()))?;
             }
             Style::UnderlineSecondary |
             Style::LabelSecondary => {
-                try!(self.start_attr(term::Attr::Bold));
+                self.start_attr(term::Attr::Bold)?;
                 if cfg!(windows) {
-                    try!(self.start_attr(term::Attr::ForegroundColor(term::color::BRIGHT_CYAN)));
+                    self.start_attr(term::Attr::ForegroundColor(term::color::BRIGHT_CYAN))?;
                 } else {
-                    try!(self.start_attr(term::Attr::ForegroundColor(term::color::BRIGHT_BLUE)));
+                    self.start_attr(term::Attr::ForegroundColor(term::color::BRIGHT_BLUE))?;
                 }
             }
             Style::NoStyle => {}
             Style::Level(l) => {
-                try!(self.start_attr(term::Attr::Bold));
-                try!(self.start_attr(term::Attr::ForegroundColor(l.color())));
+                self.start_attr(term::Attr::Bold)?;
+                self.start_attr(term::Attr::ForegroundColor(l.color()))?;
             }
         }
         Ok(())
@@ -960,4 +960,4 @@ impl Write for Destination {
             Raw(ref mut w) => w.flush(),
         }
     }
-}
\ No newline at end of file
+}
diff --git a/src/librustc_incremental/persist/hash.rs b/src/librustc_incremental/persist/hash.rs
index 95bee669d32..bafaafd4afa 100644
--- a/src/librustc_incremental/persist/hash.rs
+++ b/src/librustc_incremental/persist/hash.rs
@@ -194,7 +194,7 @@ impl<'a, 'tcx> HashContext<'a, 'tcx> {
 
         // Load up the hashes for the def-ids from this crate.
         let mut decoder = Decoder::new(data, 0);
-        let svh_in_hashes_file = try!(Svh::decode(&mut decoder));
+        let svh_in_hashes_file = Svh::decode(&mut decoder)?;
 
         if svh_in_hashes_file != expected_svh {
             // We should not be able to get here. If we do, then
@@ -202,7 +202,7 @@ impl<'a, 'tcx> HashContext<'a, 'tcx> {
             bug!("mismatch between SVH in crate and SVH in incr. comp. hashes")
         }
 
-        let serialized_hashes = try!(SerializedMetadataHashes::decode(&mut decoder));
+        let serialized_hashes = SerializedMetadataHashes::decode(&mut decoder)?;
         for serialized_hash in serialized_hashes.hashes {
             // the hashes are stored with just a def-index, which is
             // always relative to the old crate; convert that to use
diff --git a/src/librustc_incremental/persist/load.rs b/src/librustc_incremental/persist/load.rs
index 48f95430f26..6e6464e4968 100644
--- a/src/librustc_incremental/persist/load.rs
+++ b/src/librustc_incremental/persist/load.rs
@@ -125,11 +125,11 @@ pub fn decode_dep_graph<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
 {
     // Decode the list of work_products
     let mut work_product_decoder = Decoder::new(work_products_data, 0);
-    let work_products = try!(<Vec<SerializedWorkProduct>>::decode(&mut work_product_decoder));
+    let work_products = <Vec<SerializedWorkProduct>>::decode(&mut work_product_decoder)?;
 
     // Deserialize the directory and dep-graph.
     let mut dep_graph_decoder = Decoder::new(dep_graph_data, 0);
-    let prev_commandline_args_hash = try!(u64::decode(&mut dep_graph_decoder));
+    let prev_commandline_args_hash = u64::decode(&mut dep_graph_decoder)?;
 
     if prev_commandline_args_hash != tcx.sess.opts.dep_tracking_hash() {
         // We can't reuse the cache, purge it.
@@ -142,8 +142,8 @@ pub fn decode_dep_graph<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
         return Ok(());
     }
 
-    let directory = try!(DefIdDirectory::decode(&mut dep_graph_decoder));
-    let serialized_dep_graph = try!(SerializedDepGraph::decode(&mut dep_graph_decoder));
+    let directory = DefIdDirectory::decode(&mut dep_graph_decoder)?;
+    let serialized_dep_graph = SerializedDepGraph::decode(&mut dep_graph_decoder)?;
 
     // Retrace the paths in the directory to find their current location (if any).
     let retraced = directory.retrace(tcx);
diff --git a/src/librustc_incremental/persist/save.rs b/src/librustc_incremental/persist/save.rs
index d31252be5e8..41212d8e138 100644
--- a/src/librustc_incremental/persist/save.rs
+++ b/src/librustc_incremental/persist/save.rs
@@ -110,7 +110,7 @@ pub fn encode_dep_graph(preds: &Predecessors,
                         -> io::Result<()> {
     // First encode the commandline arguments hash
     let tcx = builder.tcx();
-    try!(tcx.sess.opts.dep_tracking_hash().encode(encoder));
+    tcx.sess.opts.dep_tracking_hash().encode(encoder)?;
 
     // Create a flat list of (Input, WorkProduct) edges for
     // serialization.
@@ -149,8 +149,8 @@ pub fn encode_dep_graph(preds: &Predecessors,
     debug!("graph = {:#?}", graph);
 
     // Encode the directory and then the graph data.
-    try!(builder.directory().encode(encoder));
-    try!(graph.encode(encoder));
+    builder.directory().encode(encoder)?;
+    graph.encode(encoder)?;
 
     Ok(())
 }
@@ -222,8 +222,8 @@ pub fn encode_metadata_hashes(tcx: TyCtxt,
     }
 
     // Encode everything.
-    try!(svh.encode(encoder));
-    try!(serialized_hashes.encode(encoder));
+    svh.encode(encoder)?;
+    serialized_hashes.encode(encoder)?;
 
     Ok(())
 }
diff --git a/src/librustc_metadata/loader.rs b/src/librustc_metadata/loader.rs
index 44d7861066d..a4f8ee47799 100644
--- a/src/librustc_metadata/loader.rs
+++ b/src/librustc_metadata/loader.rs
@@ -809,7 +809,7 @@ fn get_metadata_section_imp(target: &Target, flavor: CrateFlavor, filename: &Pat
             None => Err(format!("failed to read rlib metadata: '{}'",
                                 filename.display())),
             Some(blob) => {
-                try!(verify_decompressed_encoding_version(&blob, filename));
+                verify_decompressed_encoding_version(&blob, filename)?;
                 Ok(blob)
             }
         };
@@ -858,7 +858,7 @@ fn get_metadata_section_imp(target: &Target, flavor: CrateFlavor, filename: &Pat
                 match flate::inflate_bytes(bytes) {
                     Ok(inflated) => {
                         let blob = MetadataVec(inflated);
-                        try!(verify_decompressed_encoding_version(&blob, filename));
+                        verify_decompressed_encoding_version(&blob, filename)?;
                         return Ok(blob);
                     }
                     Err(_) => {}
diff --git a/src/librustc_mir/pretty.rs b/src/librustc_mir/pretty.rs
index d46a7b2bb95..01e2c6308ba 100644
--- a/src/librustc_mir/pretty.rs
+++ b/src/librustc_mir/pretty.rs
@@ -77,12 +77,12 @@ pub fn dump_mir<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                             node_id, promotion_id, pass_name, disambiguator);
     file_path.push(&file_name);
     let _ = fs::File::create(&file_path).and_then(|mut file| {
-        try!(writeln!(file, "// MIR for `{}`", node_path));
-        try!(writeln!(file, "// node_id = {}", node_id));
-        try!(writeln!(file, "// pass_name = {}", pass_name));
-        try!(writeln!(file, "// disambiguator = {}", disambiguator));
-        try!(writeln!(file, ""));
-        try!(write_mir_fn(tcx, src, mir, &mut file, auxiliary));
+        writeln!(file, "// MIR for `{}`", node_path)?;
+        writeln!(file, "// node_id = {}", node_id)?;
+        writeln!(file, "// pass_name = {}", pass_name)?;
+        writeln!(file, "// disambiguator = {}", disambiguator)?;
+        writeln!(file, "")?;
+        write_mir_fn(tcx, src, mir, &mut file, auxiliary)?;
         Ok(())
     });
 }
diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs
index 0782601e179..6ccc0be41bc 100644
--- a/src/libserialize/json.rs
+++ b/src/libserialize/json.rs
@@ -475,15 +475,14 @@ impl<'a> Encoder<'a> {
 }
 
 macro_rules! emit_enquoted_if_mapkey {
-    ($enc:ident,$e:expr) => {
+    ($enc:ident,$e:expr) => ({
         if $enc.is_emitting_map_key {
-            try!(write!($enc.writer, "\"{}\"", $e));
-            Ok(())
+            write!($enc.writer, "\"{}\"", $e)?;
         } else {
-            try!(write!($enc.writer, "{}", $e));
-            Ok(())
+            write!($enc.writer, "{}", $e)?;
         }
-    }
+        Ok(())
+    })
 }
 
 impl<'a> ::Encoder for Encoder<'a> {
diff --git a/src/libserialize/serialize.rs b/src/libserialize/serialize.rs
index b75ec5dad8d..8e271597dfc 100644
--- a/src/libserialize/serialize.rs
+++ b/src/libserialize/serialize.rs
@@ -511,10 +511,10 @@ macro_rules! tuple {
                 let len: usize = count_idents!($($name,)*);
                 d.read_tuple(len, |d| {
                     let mut i = 0;
-                    let ret = ($(try!(d.read_tuple_arg({ i+=1; i-1 },
-                                                       |d| -> Result<$name,D::Error> {
+                    let ret = ($(d.read_tuple_arg({ i+=1; i-1 },
+                                                  |d| -> Result<$name,D::Error> {
                         Decodable::decode(d)
-                    })),)*);
+                    })?,)*);
                     Ok(ret)
                 })
             }
@@ -527,7 +527,7 @@ macro_rules! tuple {
                 $(let $name = $name; n += 1;)*
                 s.emit_tuple(n, |s| {
                     let mut i = 0;
-                    $(try!(s.emit_tuple_arg({ i+=1; i-1 }, |s| $name.encode(s)));)*
+                    $(s.emit_tuple_arg({ i+=1; i-1 }, |s| $name.encode(s))?;)*
                     Ok(())
                 })
             }
diff --git a/src/libstd/sync/mpsc/oneshot.rs b/src/libstd/sync/mpsc/oneshot.rs
index 7a35ea6bbaa..7389280b853 100644
--- a/src/libstd/sync/mpsc/oneshot.rs
+++ b/src/libstd/sync/mpsc/oneshot.rs
@@ -150,7 +150,7 @@ impl<T> Packet<T> {
                     let timed_out = !wait_token.wait_max_until(deadline);
                     // Try to reset the state
                     if timed_out {
-                        try!(self.abort_selection().map_err(Upgraded));
+                        self.abort_selection().map_err(Upgraded)?;
                     }
                 } else {
                     wait_token.wait();
diff --git a/src/libstd/sync/mpsc/stream.rs b/src/libstd/sync/mpsc/stream.rs
index aa1254c8641..61c8316467d 100644
--- a/src/libstd/sync/mpsc/stream.rs
+++ b/src/libstd/sync/mpsc/stream.rs
@@ -187,8 +187,7 @@ impl<T> Packet<T> {
             if let Some(deadline) = deadline {
                 let timed_out = !wait_token.wait_max_until(deadline);
                 if timed_out {
-                    try!(self.abort_selection(/* was_upgrade = */ false)
-                             .map_err(Upgraded));
+                    self.abort_selection(/* was_upgrade = */ false).map_err(Upgraded)?;
                 }
             } else {
                 wait_token.wait();
diff --git a/src/libstd/sys/common/backtrace.rs b/src/libstd/sys/common/backtrace.rs
index a509b80eaca..a8540fed928 100644
--- a/src/libstd/sys/common/backtrace.rs
+++ b/src/libstd/sys/common/backtrace.rs
@@ -153,11 +153,11 @@ pub fn demangle(writer: &mut Write, s: &str) -> io::Result<()> {
                     macro_rules! demangle {
                         ($($pat:expr => $demangled:expr),*) => ({
                             $(if rest.starts_with($pat) {
-                                try!(writer.write_all($demangled));
+                                writer.write_all($demangled)?;
                                 rest = &rest[$pat.len()..];
                               } else)*
                             {
-                                try!(writer.write_all(rest.as_bytes()));
+                                writer.write_all(rest.as_bytes())?;
                                 break;
                             }
 
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 228d6ada01d..bfb85dd479d 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -2113,23 +2113,23 @@ actual:\n\
     }
 
     fn aggressive_rm_rf(&self, path: &Path) -> io::Result<()> {
-        for e in try!(path.read_dir()) {
-            let entry = try!(e);
+        for e in path.read_dir()? {
+            let entry = e?;
             let path = entry.path();
-            if try!(entry.file_type()).is_dir() {
-                try!(self.aggressive_rm_rf(&path));
+            if entry.file_type()?.is_dir() {
+                self.aggressive_rm_rf(&path)?;
             } else {
                 // Remove readonly files as well on windows (by default we can't)
-                try!(fs::remove_file(&path).or_else(|e| {
+                fs::remove_file(&path).or_else(|e| {
                     if cfg!(windows) && e.kind() == io::ErrorKind::PermissionDenied {
-                        let mut meta = try!(entry.metadata()).permissions();
+                        let mut meta = entry.metadata()?.permissions();
                         meta.set_readonly(false);
-                        try!(fs::set_permissions(&path, meta));
+                        fs::set_permissions(&path, meta)?;
                         fs::remove_file(&path)
                     } else {
                         Err(e)
                     }
-                }))
+                })?;
             }
         }
         fs::remove_dir(path)
diff --git a/src/tools/linkchecker/main.rs b/src/tools/linkchecker/main.rs
index 27adabbc72e..3e2bc9032a1 100644
--- a/src/tools/linkchecker/main.rs
+++ b/src/tools/linkchecker/main.rs
@@ -24,6 +24,8 @@
 //! A few whitelisted exceptions are allowed as there's known bugs in rustdoc,
 //! but this should catch the majority of "broken link" cases.
 
+#![feature(question_mark)]
+
 extern crate url;
 
 use std::env;
@@ -243,15 +245,14 @@ fn load_file(cache: &mut Cache,
             None
         }
         Entry::Vacant(entry) => {
-            let mut fp = try!(File::open(file.clone()).map_err(|err| {
+            let mut fp = File::open(file.clone()).map_err(|err| {
                 if let FromRedirect(true) = redirect {
                     LoadError::BrokenRedirect(file.clone(), err)
                 } else {
                     LoadError::IOError(err)
                 }
-            }));
-            try!(fp.read_to_string(&mut contents)
-                   .map_err(|err| LoadError::IOError(err)));
+            })?;
+            fp.read_to_string(&mut contents).map_err(|err| LoadError::IOError(err))?;
 
             let maybe = maybe_redirect(&contents);
             if maybe.is_some() {