pub fn generate_std_roots<'a>(
    bcx: &BuildContext<'a, '_>,
    crates: &[String],
    std_resolve: &'a Resolve,
    std_features: &ResolvedFeatures,
    kind: CompileKind,
) -> CargoResult<Vec<Unit<'a>>> {
    // Generate the root Units for the standard library.
    let std_ids = crates
        .iter()
        .map(|crate_name| std_resolve.query(crate_name))
        .collect::<CargoResult<Vec<PackageId>>>()?;
    // Convert PackageId to Package.
    let std_pkgs = bcx.packages.get_many(std_ids)?;
    // Generate a list of Units.
    std_pkgs
        .into_iter()
        .map(|pkg| {
            let lib = pkg
                .targets()
                .iter()
                .find(|t| t.is_lib())
                .expect("std has a lib");
            let unit_for = UnitFor::new_normal();
            // I don't think we need to bother with Check here, the difference
            // in time is minimal, and the difference in caching is
            // significant.
            let mode = CompileMode::Build;
            let profile = bcx.profiles.get_profile(
                pkg.package_id(),
                /*is_member*/ false,
                unit_for,
                mode,
            );
            let features =
                std_features.activated_features(pkg.package_id(), FeaturesFor::NormalOrDev);
            Ok(bcx.units.intern(
                pkg, lib, profile, kind, mode, features, /*is_std*/ true,
            ))
        })
        .collect::<CargoResult<Vec<_>>>()
}
/// Generate a list of root `Unit`s for the standard library.
///
/// The given slice of crate names is the root set.
Generate a list of root `Unit`s for the standard library.
The given slice of crate names is the root set.
Generate a list of root ` Unit ` s for the standard library . The given slice of crate names is the root set .
pub fn generate_std_roots<'a>(
    bcx: &BuildContext<'a, '_>,
    crates: &[String],
    std_resolve: &'a Resolve,
    std_features: &ResolvedFeatures,
    kind: CompileKind,
) -> CargoResult<Vec<Unit<'a>>> {
    // Generate the root Units for the standard library.
    let std_ids = crates
        .iter()
        .map(|crate_name| std_resolve.query(crate_name))
        .collect::<CargoResult<Vec<PackageId>>>()?;
    // Convert PackageId to Package.
    let std_pkgs = bcx.packages.get_many(std_ids)?;
    // Generate a list of Units.
    std_pkgs
        .into_iter()
        .map(|pkg| {
            let lib = pkg
                .targets()
                .iter()
                .find(|t| t.is_lib())
                .expect("std has a lib");
            let unit_for = UnitFor::new_normal();
            // I don't think we need to bother with Check here, the difference
            // in time is minimal, and the difference in caching is
            // significant.
            let mode = CompileMode::Build;
            let profile = bcx.profiles.get_profile(
                pkg.package_id(),
                /*is_member*/ false,
                unit_for,
                mode,
            );
            let features =
                std_features.activated_features(pkg.package_id(), FeaturesFor::NormalOrDev);
            Ok(bcx.units.intern(
                pkg, lib, profile, kind, mode, features, /*is_std*/ true,
            ))
        })
        .collect::<CargoResult<Vec<_>>>()
}
pub fn generate_std_roots < ' a > ( bcx : & BuildContext < ' a , ' _ > , crates : & [ String ] , std_resolve : & ' a Resolve , std_features : & ResolvedFeatures , kind : CompileKind , ) -> CargoResult < Vec < Unit < ' a > > > { // Generate the root Units for the standard library. let std_ids = crates . iter ( ) . map ( | crate_name | std_resolve . query ( crate_name ) ) . collect :: < CargoResult < Vec < PackageId > > > ( ) ? ; // Convert PackageId to Package. let std_pkgs = bcx . packages . get_many ( std_ids ) ? ; // Generate a list of Units. std_pkgs . into_iter ( ) . map ( | pkg | { let lib = pkg . targets ( ) . iter ( ) . find ( | t | t . is_lib ( ) ) . expect ( " " ) ; let unit_for = UnitFor :: new_normal ( ) ; // I don't think we need to bother with Check here, the difference // in time is minimal, and the difference in caching is // significant. let mode = CompileMode :: Build ; let profile = bcx . profiles . get_profile ( pkg . package_id ( ) , /*is_member*/ false , unit_for , mode , ) ; let features = std_features . activated_features ( pkg . package_id ( ) , FeaturesFor :: NormalOrDev ) ; Ok ( bcx . units . intern ( pkg , lib , profile , kind , mode , features , /*is_std*/ true , ) ) } ) . collect :: < CargoResult < Vec < _ > > > ( ) }
Generate a list of root `Unit`s for the standard library.
Generate a list of root ` Unit ` s for the standard library .
bcx
&BuildContext<'a, '_>
crates
&[String]
std_resolve
&'a Resolve
std_features
&ResolvedFeatures
kind
CompileKind
bcx
&BuildContext<'a, '_>
crates
&[String]
std_resolve
&'a Resolve
std_features
&ResolvedFeatures
kind
CompileKind