Skip to content

Commit

Permalink
Add error context for reading vendor dir.
Browse files Browse the repository at this point in the history
  • Loading branch information
ehuss committed Nov 12, 2020
1 parent eadb4fc commit 85b5b18
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/cargo/core/compiler/standard_lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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| {
Expand All @@ -74,7 +75,8 @@ pub fn resolve_std<'cfg>(
let dep = Dependency::parse_no_deprecated(&name, None, source_path)?;
Ok(dep)
})
.collect::<CargoResult<Vec<_>>>()?;
.collect::<CargoResult<Vec<_>>>()
.chain_err(|| "failed to generate vendor patches")?;

let crates_io_url = crate::sources::CRATES_IO_INDEX.parse().unwrap();
let mut patch = HashMap::new();
Expand Down

0 comments on commit 85b5b18

Please sign in to comment.