From 85b5b180f49d0892d79fbd21c4cd37b634eee4ff Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Wed, 11 Nov 2020 19:35:20 -0800 Subject: [PATCH] Add error context for reading vendor dir. --- src/cargo/core/compiler/standard_lib.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/cargo/core/compiler/standard_lib.rs b/src/cargo/core/compiler/standard_lib.rs index 68b752d79aa..e04627f43d7 100644 --- a/src/cargo/core/compiler/standard_lib.rs +++ b/src/cargo/core/compiler/standard_lib.rs @@ -7,7 +7,7 @@ use crate::core::resolver::features::{FeaturesFor, ResolvedFeatures}; use crate::core::resolver::{HasDevUnits, ResolveOpts}; use crate::core::{Dependency, PackageId, PackageSet, Resolve, SourceId, Workspace}; use crate::ops::{self, Packages}; -use crate::util::errors::CargoResult; +use crate::util::errors::{CargoResult, CargoResultExt}; use std::collections::{HashMap, HashSet}; use std::env; use std::fs; @@ -52,7 +52,8 @@ pub fn resolve_std<'cfg>( // If rust-src contains a "vendor" directory, then patch in all the crates it contains. let vendor_path = src_path.join("vendor"); - let vendor_dir = fs::read_dir(vendor_path)?; + let vendor_dir = fs::read_dir(&vendor_path) + .chain_err(|| format!("could not read vendor path {}", vendor_path.display()))?; let patches = vendor_dir .into_iter() .map(|entry| { @@ -74,7 +75,8 @@ pub fn resolve_std<'cfg>( let dep = Dependency::parse_no_deprecated(&name, None, source_path)?; Ok(dep) }) - .collect::>>()?; + .collect::>>() + .chain_err(|| "failed to generate vendor patches")?; let crates_io_url = crate::sources::CRATES_IO_INDEX.parse().unwrap(); let mut patch = HashMap::new();