pub fn translate_dep_info(
    rustc_dep_info: &Path,
    cargo_dep_info: &Path,
    pkg_root: &Path,
    rustc_cwd: &Path,
) -> CargoResult<()> {
    let target = parse_rustc_dep_info(rustc_dep_info)?;
    let deps = &target
        .get(0)
        .ok_or_else(|| internal("malformed dep-info format, no targets".to_string()))?
        .1;

    let mut new_contents = Vec::new();
    for file in deps {
        let absolute = rustc_cwd.join(file);
        let path = absolute.strip_prefix(pkg_root).unwrap_or(&absolute);
        new_contents.extend(util::path2bytes(path)?);
        new_contents.push(0);
    }
    paths::write(cargo_dep_info, &new_contents)?;
    Ok(())
}
/// Parses the dep-info file coming out of rustc into a Cargo-specific format.
///
/// This function will parse `rustc_dep_info` as a makefile-style dep info to
/// learn about the all files which a crate depends on. This is then
/// re-serialized into the `cargo_dep_info` path in a Cargo-specific format.
///
/// The `pkg_root` argument here is the absolute path to the directory
/// containing `Cargo.toml` for this crate that was compiled. The paths listed
/// in the rustc dep-info file may or may not be absolute but we'll want to
/// consider all of them relative to the `root` specified.
///
/// The `rustc_cwd` argument is the absolute path to the cwd of the compiler
/// when it was invoked.
///
/// The serialized Cargo format will contain a list of files, all of which are
/// relative if they're under `root`. or absolute if they're elsewhere.
Parses the dep-info file coming out of rustc into a Cargo-specific format.
This function will parse `rustc_dep_info` as a makefile-style dep info to
learn about the all files which a crate depends on. This is then
re-serialized into the `cargo_dep_info` path in a Cargo-specific format.

The `pkg_root` argument here is the absolute path to the directory
containing `Cargo.toml` for this crate that was compiled. The paths listed
in the rustc dep-info file may or may not be absolute but we'll want to
consider all of them relative to the `root` specified.

The `rustc_cwd` argument is the absolute path to the cwd of the compiler
when it was invoked.

The serialized Cargo format will contain a list of files, all of which are
relative if they're under `root`. or absolute if they're elsewhere.
Parses the dep - info file coming out of rustc into a Cargo - specific format . This function will parse ` rustc_dep_info ` as a makefile - style dep info to learn about the all files which a crate depends on . This is then re - serialized into the ` cargo_dep_info ` path in a Cargo - specific format . The ` pkg_root ` argument here is the absolute path to the directory containing ` Cargo . toml ` for this crate that was compiled . The paths listed in the rustc dep - info file may or may not be absolute but we ' ll want to consider all of them relative to the ` root ` specified . The ` rustc_cwd ` argument is the absolute path to the cwd of the compiler when it was invoked . The serialized Cargo format will contain a list of files all of which are relative if they ' re under ` root ` . or absolute if they ' re elsewhere .
pub fn translate_dep_info(
    rustc_dep_info: &Path,
    cargo_dep_info: &Path,
    pkg_root: &Path,
    rustc_cwd: &Path,
) -> CargoResult<()> {
    let target = parse_rustc_dep_info(rustc_dep_info)?;
    let deps = &target
        .get(0)
        .ok_or_else(|| internal("malformed dep-info format, no targets".to_string()))?
        .1;
    let mut new_contents = Vec::new();
    for file in deps {
        let absolute = rustc_cwd.join(file);
        let path = absolute.strip_prefix(pkg_root).unwrap_or(&absolute);
        new_contents.extend(util::path2bytes(path)?);
        new_contents.push(0);
    }
    paths::write(cargo_dep_info, &new_contents)?;
    Ok(())
}
pub fn translate_dep_info ( rustc_dep_info : & Path , cargo_dep_info : & Path , pkg_root : & Path , rustc_cwd : & Path , ) -> CargoResult < ( ) > { let target = parse_rustc_dep_info ( rustc_dep_info ) ? ; let deps = & target . get ( 0 ) . ok_or_else ( | | internal ( " " . to_string ( ) ) ) ? . 1 ; let mut new_contents = Vec :: new ( ) ; for file in deps { let absolute = rustc_cwd . join ( file ) ; let path = absolute . strip_prefix ( pkg_root ) . unwrap_or ( & absolute ) ; new_contents . extend ( util :: path2bytes ( path ) ? ) ; new_contents . push ( 0 ) ; } paths :: write ( cargo_dep_info , & new_contents ) ? ; Ok ( ( ) ) }
Parses the dep-info file coming out of rustc into a Cargo-specific format.
Parses the dep - info file coming out of rustc into a Cargo - specific format .
rustc_dep_info
&Path
cargo_dep_info
&Path
pkg_root
&Path
rustc_cwd
&Path
rustc_dep_info
&Path
cargo_dep_info
&Path
pkg_root
&Path
rustc_cwd
&Path