commit
739d57180f
28 changed files with 105 additions and 109 deletions
|
@ -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,
|
||||
|
|
|
@ -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(())
|
||||
}
|
||||
|
|
|
@ -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)?;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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(),
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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(),
|
||||
|
|
|
@ -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(),
|
||||
|
|
|
@ -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(),
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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(),
|
||||
|
|
|
@ -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(),
|
||||
|
|
|
@ -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())
|
||||
}
|
||||
|
||||
|
|
|
@ -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(),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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(())
|
||||
}
|
||||
|
|
|
@ -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(_) => {}
|
||||
|
|
|
@ -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(())
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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> {
|
||||
|
|
|
@ -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(())
|
||||
})
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Add table
Reference in a new issue