diff --git a/Cargo.toml b/Cargo.toml index 8238380861d..0166d0cbc96 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,6 +46,7 @@ log = "0.4.6" libgit2-sys = "0.7.9" num_cpus = "1.0" opener = "0.3.0" +pathdiff = "0.1" rustfix = "0.4.4" same-file = "1" semver = { version = "0.9.0", features = ["serde"] } diff --git a/src/cargo/core/compiler/build_context/target_info.rs b/src/cargo/core/compiler/build_context/target_info.rs index 0aef86742f3..720a14831b4 100644 --- a/src/cargo/core/compiler/build_context/target_info.rs +++ b/src/cargo/core/compiler/build_context/target_info.rs @@ -27,15 +27,22 @@ pub enum FileFlavor { DebugInfo, } +/// A description about the type of file generated by a Unit. pub struct FileType { + /// The type of the file. pub flavor: FileFlavor, + /// The suffix of the filename, such as ".dll", ".rlib", ".exe", etc. + /// This is an empty string for executables on Unix-like platforms. suffix: String, + /// The prefix of the filename, such as "lib". + /// This is an empty string for things like executables. prefix: String, - // wasm bin target will generate two files in deps such as - // "web-stuff.js" and "web_stuff.wasm". Note the different usages of - // "-" and "_". should_replace_hyphens is a flag to indicate that - // we need to convert the stem "web-stuff" to "web_stuff", so we - // won't miss "web_stuff.wasm". + /// Flag to convert hyphen to underscore. + /// + /// wasm bin targets will generate two files in deps such as + /// "web-stuff.js" and "web_stuff.wasm". Note the different usages of "-" + /// and "_". This flag indicates that the stem "web-stuff" should be + /// converted to "web_stuff". should_replace_hyphens: bool, } diff --git a/src/cargo/core/compiler/compilation.rs b/src/cargo/core/compiler/compilation.rs index 0751b5735b8..164d686e839 100644 --- a/src/cargo/core/compiler/compilation.rs +++ b/src/cargo/core/compiler/compilation.rs @@ -22,6 +22,7 @@ pub struct Doctest { /// A structure returning the result of a compilation. pub struct Compilation<'cfg> { /// An array of all tests created during this compilation. + /// (package, target_kind, test_name, path_to_test_exe) pub tests: Vec<(Package, TargetKind, String, PathBuf)>, /// An array of all binaries created. diff --git a/src/cargo/core/compiler/context/compilation_files.rs b/src/cargo/core/compiler/context/compilation_files.rs index 206d0d4f17d..9351e773019 100644 --- a/src/cargo/core/compiler/context/compilation_files.rs +++ b/src/cargo/core/compiler/context/compilation_files.rs @@ -9,7 +9,7 @@ use lazycell::LazyCell; use log::info; use super::{BuildContext, Context, FileFlavor, Kind, Layout, Unit}; -use crate::core::{TargetKind, Workspace}; +use crate::core::{compiler::CompileMode, TargetKind, Workspace}; use crate::util::{self, CargoResult}; /// The `Metadata` is a hash used to make unique file names for each unit in a build. @@ -144,11 +144,13 @@ impl<'a, 'cfg: 'a> CompilationFiles<'a, 'cfg> { /// target. pub fn out_dir(&self, unit: &Unit<'a>) -> PathBuf { if unit.mode.is_doc() { - self.layout(unit.kind).root().parent().unwrap().join("doc") + self.layout(unit.kind).doc().to_path_buf() } else if unit.target.is_custom_build() { self.build_script_dir(unit) } else if unit.target.is_example() { self.layout(unit.kind).examples().to_path_buf() + } else if unit.mode == CompileMode::Test || unit.mode == CompileMode::Bench { + self.layout(unit.kind).legacy_deps().to_path_buf() } else { self.deps_dir(unit).to_path_buf() } @@ -168,7 +170,7 @@ impl<'a, 'cfg: 'a> CompilationFiles<'a, 'cfg> { /// Return the root of the build output tree pub fn target_root(&self) -> &Path { - self.host.dest() + self.host.root() } pub fn host_deps(&self) -> &Path { @@ -239,8 +241,8 @@ impl<'a, 'cfg: 'a> CompilationFiles<'a, 'cfg> { /// (eg a dependent lib) fn link_stem(&self, unit: &Unit<'a>) -> Option<(PathBuf, String)> { let out_dir = self.out_dir(unit); - let bin_stem = self.bin_stem(unit); - let file_stem = self.file_stem(unit); + let bin_stem = self.bin_stem(unit); // Stem without metadata. + let file_stem = self.file_stem(unit); // Stem with metadata. // We currently only lift files up from the `deps` directory. If // it was compiled into something like `example/` or `doc/` then @@ -249,7 +251,7 @@ impl<'a, 'cfg: 'a> CompilationFiles<'a, 'cfg> { // Don't lift up library dependencies if unit.target.is_bin() || self.roots.contains(unit) { Some(( - out_dir.parent().unwrap().to_owned(), + self.layout(unit.kind).dest().to_path_buf(), if unit.mode.is_any_test() { file_stem } else { @@ -284,85 +286,78 @@ impl<'a, 'cfg: 'a> CompilationFiles<'a, 'cfg> { let mut ret = Vec::new(); let mut unsupported = Vec::new(); - { - if unit.mode.is_check() { - // This may be confusing. rustc outputs a file named `lib*.rmeta` - // for both libraries and binaries. - let path = out_dir.join(format!("lib{}.rmeta", file_stem)); - ret.push(OutputFile { - path, - hardlink: None, - export_path: None, - flavor: FileFlavor::Linkable, - }); - } else { - let mut add = |crate_type: &str, flavor: FileFlavor| -> CargoResult<()> { - let crate_type = if crate_type == "lib" { - "rlib" - } else { - crate_type - }; - let file_types = info.file_types( - crate_type, - flavor, - unit.target.kind(), - bcx.target_triple(), - )?; - - match file_types { - Some(types) => { - for file_type in types { - let path = out_dir.join(file_type.filename(&file_stem)); - let hardlink = link_stem - .as_ref() - .map(|&(ref ld, ref ls)| ld.join(file_type.filename(ls))); - let export_path = if unit.target.is_custom_build() { - None - } else { - self.export_dir.as_ref().and_then(|export_dir| { - hardlink.as_ref().and_then(|hardlink| { - Some(export_dir.join(hardlink.file_name().unwrap())) - }) + if unit.mode.is_check() { + // This may be confusing. rustc outputs a file named `lib*.rmeta` + // for both libraries and binaries. + let path = out_dir.join(format!("lib{}.rmeta", file_stem)); + ret.push(OutputFile { + path, + hardlink: None, + export_path: None, + flavor: FileFlavor::Linkable, + }); + } else { + let mut add = |crate_type: &str, flavor: FileFlavor| -> CargoResult<()> { + let crate_type = if crate_type == "lib" { + "rlib" + } else { + crate_type + }; + let file_types = + info.file_types(crate_type, flavor, unit.target.kind(), bcx.target_triple())?; + + match file_types { + Some(types) => { + for file_type in types { + let path = out_dir.join(file_type.filename(&file_stem)); + let hardlink = link_stem + .as_ref() + .map(|&(ref ld, ref ls)| ld.join(file_type.filename(ls))); + let export_path = if unit.target.is_custom_build() { + None + } else { + self.export_dir.as_ref().and_then(|export_dir| { + hardlink.as_ref().and_then(|hardlink| { + Some(export_dir.join(hardlink.file_name().unwrap())) }) - }; - ret.push(OutputFile { - path, - hardlink, - export_path, - flavor: file_type.flavor, - }); - } - } - // not supported, don't worry about it - None => { - unsupported.push(crate_type.to_string()); + }) + }; + ret.push(OutputFile { + path, + hardlink, + export_path, + flavor: file_type.flavor, + }); } } - Ok(()) - }; - //info!("{:?}", unit); - match *unit.target.kind() { - TargetKind::Bin - | TargetKind::CustomBuild - | TargetKind::ExampleBin - | TargetKind::Bench - | TargetKind::Test => { - add("bin", FileFlavor::Normal)?; - } - TargetKind::Lib(..) | TargetKind::ExampleLib(..) if unit.mode.is_any_test() => { - add("bin", FileFlavor::Normal)?; + // not supported, don't worry about it + None => { + unsupported.push(crate_type.to_string()); } - TargetKind::ExampleLib(ref kinds) | TargetKind::Lib(ref kinds) => { - for kind in kinds { - add( - kind.crate_type(), - if kind.linkable() { - FileFlavor::Linkable - } else { - FileFlavor::Normal - }, - )?; - } + } + Ok(()) + }; + match *unit.target.kind() { + TargetKind::Bin + | TargetKind::CustomBuild + | TargetKind::ExampleBin + | TargetKind::Bench + | TargetKind::Test => { + add("bin", FileFlavor::Normal)?; + } + TargetKind::Lib(..) | TargetKind::ExampleLib(..) if unit.mode.is_any_test() => { + add("bin", FileFlavor::Normal)?; + } + TargetKind::ExampleLib(ref kinds) | TargetKind::Lib(ref kinds) => { + for kind in kinds { + add( + kind.crate_type(), + if kind.linkable() { + FileFlavor::Linkable + } else { + FileFlavor::Normal + }, + )?; } } } diff --git a/src/cargo/core/compiler/context/mod.rs b/src/cargo/core/compiler/context/mod.rs index 6285fa19673..e47669dd4bf 100644 --- a/src/cargo/core/compiler/context/mod.rs +++ b/src/cargo/core/compiler/context/mod.rs @@ -343,7 +343,7 @@ impl<'a, 'cfg> Context<'a, 'cfg> { let files = self.files.as_ref().unwrap(); let layout = files.target.as_ref().unwrap_or(&files.host); - self.compilation.root_output = layout.dest().to_path_buf(); + self.compilation.root_output = layout.root().to_path_buf(); self.compilation.deps_output = layout.deps().to_path_buf(); Ok(()) } diff --git a/src/cargo/core/compiler/layout.rs b/src/cargo/core/compiler/layout.rs index 7606fefa2b1..dd84d47d0dc 100644 --- a/src/cargo/core/compiler/layout.rs +++ b/src/cargo/core/compiler/layout.rs @@ -8,37 +8,60 @@ //! # places all of its output here. //! target/ //! -//! # This is the root directory for all output of *dependencies* +//! # File used to lock the directory to prevent multiple cargo processes +//! # from using it at the same time. +//! .cargo-lock +//! +//! # Cache of `rustc -Vv` output for performance. +//! .rustc-info.json +//! +//! # This is the root directory for all rustc artifacts except build +//! # scripts, examples, and test and bench executables. Almost every +//! # artifact should have a metadata hash added to its filename to +//! # prevent collisions. One notable exception is dynamic libraries. //! deps/ //! -//! # Root directory for all compiled examples -//! examples/ +//! # All final artifacts are linked into this directory from `deps`. +//! debug/ # or release/ +//! +//! # Root directory for all compiled examples. +//! examples/ +//! +//! # Legacy deps directory, where tests and benchmarks are stored. +//! # This is how older Cargo worked, and some tests use `current_exe` +//! # to find binaries. +//! deps/ //! //! # This is the location at which the output of all custom build -//! # commands are rooted +//! # commands are rooted. //! build/ //! //! # Each package gets its own directory where its build script and //! # script output are placed -//! $pkg1/ -//! $pkg2/ -//! $pkg3/ +//! $pkgname-$META/ # For the build script itself. +//! # The build script executable (name may be changed by user). +//! build-script-build-$META +//! # Hard link to build-script-build-$META. +//! build-script-build +//! # Dependency information generated by rustc. +//! build-script-build-$META.d +//! # Debug information, depending on platform and profile +//! # settings. +//! //! -//! # Each directory package has a `out` directory where output -//! # is placed. +//! # The package shows up twice with two different metadata hashes. +//! $pkgname-$META/ # For the output of the build script. +//! # Timestamp when the build script was last executed. +//! invoked.timestamp +//! # Directory where script can output files ($OUT_DIR). //! out/ -//! -//! # This is the location at which the output of all old custom build -//! # commands are rooted -//! native/ -//! -//! # Each package gets its own directory for where its output is -//! # placed. We can't track exactly what's getting put in here, so -//! # we just assume that all relevant output is in these -//! # directories. -//! $pkg1/ -//! $pkg2/ -//! $pkg3/ +//! # Output from the build script. +//! output +//! # Path to `out`, used to help when the target directory is +//! # moved. +//! root-output +//! # Stderr output from the build script. +//! stderr //! //! # Directory used to store incremental data for the compiler (when //! # incremental is enabled. @@ -47,32 +70,71 @@ //! # Hidden directory that holds all of the fingerprint files for all //! # packages //! .fingerprint/ +//! # Each package is in a separate directory. +//! $pkgname-$META/ +//! # Set of source filenames for this package. +//! dep-lib-$pkgname-$META +//! # Timestamp when this package was last built. +//! invoked.timestamp +//! # The fingerprint hash. +//! lib-$pkgname-$META +//! # Detailed information used for logging the reason why +//! # something is being recompiled. +//! lib-$pkgname-$META.json +//! +//! # Output from rustdoc +//! doc/ +//! +//! # Used by `cargo package` and `cargo publish` to build a `.crate` file. +//! package/ +//! +//! # Experimental feature for generated build scripts. +//! .metabuild/ //! ``` +//! +//! When cross-compiling, the layout is the same, except it appears in +//! `target/$TRIPLE`. use std::fs; use std::io; use std::path::{Path, PathBuf}; use crate::core::Workspace; -use crate::util::{CargoResult, Config, FileLock, Filesystem}; +use crate::util::{CargoResult, FileLock}; /// Contains the paths of all target output locations. /// /// See module docs for more information. pub struct Layout { + /// The root directory: `/path/to/target`. + /// If cross compiling: `/path/to/target/$TRIPLE`. root: PathBuf, + /// The final artifact destination: `$root/debug` (or `release`). + dest: PathBuf, + /// The directory with rustc artifacts: `$root/deps` deps: PathBuf, - native: PathBuf, + /// The "legacy" deps directory: `$root/{debug,release}/deps` + /// Cargo previously stored all artifacts here. Now, it only holds tests + /// and benchmarks for backwards compatibility (because some of them use + /// `current_exe` to discover binary executables). + legacy_deps: PathBuf, + /// The directory for build scripts: `$root/build` build: PathBuf, + /// The directory for incremental files: `$root/incremental` incremental: PathBuf, + /// The directory for fingerprints: `$root/.fingerprint` fingerprint: PathBuf, + /// The directory for examples: `$root/debug/examples` (or `release`). examples: PathBuf, - /// The lockfile for a build, will be unlocked when this struct is `drop`ped. + /// The directory for rustdoc output: `$root/doc` + doc: PathBuf, + /// The lockfile for a build (`.cargo-lock`). Will be unlocked when this + /// struct is `drop`ped. _lock: FileLock, } pub fn is_bad_artifact_name(name: &str) -> bool { - ["deps", "examples", "build", "native", "incremental"] + ["deps", "examples"] .iter() .any(|&reserved| reserved == name) } @@ -82,46 +144,42 @@ impl Layout { /// /// This function will block if the directory is already locked. /// - /// Differs from `at` in that this calculates the root path from the workspace target directory, - /// adding the target triple and the profile (debug, release, ...). + /// `dest` should be the final artifact directory name. Currently either + /// "debug" or "release". pub fn new(ws: &Workspace<'_>, triple: Option<&str>, dest: &str) -> CargoResult { - let mut path = ws.target_dir(); + let mut root = ws.target_dir(); // Flexible target specifications often point at json files, so interpret // the target triple as a Path and then just use the file stem as the // component for the directory name in that case. if let Some(triple) = triple { let triple = Path::new(triple); if triple.extension().and_then(|s| s.to_str()) == Some("json") { - path.push( + root.push( triple .file_stem() .ok_or_else(|| failure::format_err!("invalid target"))?, ); } else { - path.push(triple); + root.push(triple); } } - path.push(dest); - Layout::at(ws.config(), path) - } - /// Calculate the paths for build output, lock the build directory, and return as a Layout. - /// - /// This function will block if the directory is already locked. - pub fn at(config: &Config, root: Filesystem) -> CargoResult { // For now we don't do any more finer-grained locking on the artifact // directory, so just lock the entire thing for the duration of this // compile. - let lock = root.open_rw(".cargo-lock", config, "build directory")?; + let lock = root.open_rw(".cargo-lock", ws.config(), "build directory")?; let root = root.into_path_unlocked(); + let root_dest = root.join(dest); Ok(Layout { deps: root.join("deps"), - native: root.join("native"), + legacy_deps: root_dest.join("deps"), build: root.join("build"), incremental: root.join("incremental"), fingerprint: root.join(".fingerprint"), - examples: root.join("examples"), + examples: root_dest.join("examples"), + doc: root.join("doc"), + dest: root_dest, root, _lock: lock, }) @@ -164,8 +222,9 @@ impl Layout { self.exclude_from_backups(&self.root); + mkdir(&self.dest)?; mkdir(&self.deps)?; - mkdir(&self.native)?; + mkdir(&self.legacy_deps)?; mkdir(&self.incremental)?; mkdir(&self.fingerprint)?; mkdir(&self.examples)?; @@ -181,18 +240,26 @@ impl Layout { } } - /// Fetch the root path. + /// Fetch the destination path for final artifacts. pub fn dest(&self) -> &Path { - &self.root + &self.dest } /// Fetch the deps path. pub fn deps(&self) -> &Path { &self.deps } + /// Fetch the legacy deps path. + pub fn legacy_deps(&self) -> &Path { + &self.legacy_deps + } /// Fetch the examples path. pub fn examples(&self) -> &Path { &self.examples } + /// Fetch the doc path. + pub fn doc(&self) -> &Path { + &self.doc + } /// Fetch the root path. pub fn root(&self) -> &Path { &self.root diff --git a/src/cargo/core/compiler/mod.rs b/src/cargo/core/compiler/mod.rs index a3bf609ad2a..cd3a6629bf7 100644 --- a/src/cargo/core/compiler/mod.rs +++ b/src/cargo/core/compiler/mod.rs @@ -419,6 +419,7 @@ fn link_targets<'a, 'cfg>( let path = unit.pkg.manifest().metabuild_path(cx.bcx.ws.target_dir()); target.set_src_path(TargetSourcePath::Path(path)); } + let workspace_root = bcx.ws.root().to_path_buf(); Ok(Work::new(move |_| { // If we're a "root crate", e.g. the target of this compilation, then we @@ -441,14 +442,14 @@ fn link_targets<'a, 'cfg>( } }; destinations.push(dst.clone()); - hardlink_or_copy(src, dst)?; + hardlink_or_copy(src, dst, &workspace_root)?; if let Some(ref path) = output.export_path { let export_dir = export_dir.as_ref().unwrap(); if !export_dir.exists() { fs::create_dir_all(export_dir)?; } - hardlink_or_copy(src, path)?; + hardlink_or_copy(src, path, &workspace_root)?; } } @@ -475,12 +476,15 @@ fn link_targets<'a, 'cfg>( })) } -fn hardlink_or_copy(src: &Path, dst: &Path) -> CargoResult<()> { +/// Hardlink (file) or symlink (dir) src to dst if possible, otherwise copy it. +/// `root` is the workspace root. +fn hardlink_or_copy(src: &Path, dst: &Path, root: &Path) -> CargoResult<()> { debug!("linking {} to {}", src.display(), dst.display()); if is_same_file(src, dst).unwrap_or(false) { return Ok(()); } - if dst.exists() { + // Check if file exists. Don't follow symlinks. + if dst.symlink_metadata().is_ok() { paths::remove_file(&dst)?; } @@ -492,9 +496,11 @@ fn hardlink_or_copy(src: &Path, dst: &Path) -> CargoResult<()> { #[cfg(windows)] use std::os::windows::fs::symlink_dir as symlink; - let dst_dir = dst.parent().unwrap(); - let src = if src.starts_with(dst_dir) { - src.strip_prefix(dst_dir).unwrap() + let src = src.to_path_buf(); + let src = if src.starts_with(root) && dst.starts_with(root) { + // Keep paths within the workspace relative. + let dst_dir = dst.parent().unwrap(); + pathdiff::diff_paths(&src, dst_dir).unwrap_or(src) } else { src }; diff --git a/tests/testsuite/build.rs b/tests/testsuite/build.rs index 892b7c9e277..20145611b03 100644 --- a/tests/testsuite/build.rs +++ b/tests/testsuite/build.rs @@ -47,16 +47,12 @@ fn cargo_compile_incremental() { p.cargo("build -v") .env("CARGO_INCREMENTAL", "1") - .with_stderr_contains( - "[RUNNING] `rustc [..] -C incremental=[..]/target/debug/incremental[..]`\n", - ) + .with_stderr_contains("[RUNNING] `rustc [..] -C incremental=[..]/target/incremental[..]`\n") .run(); p.cargo("test -v") .env("CARGO_INCREMENTAL", "1") - .with_stderr_contains( - "[RUNNING] `rustc [..] -C incremental=[..]/target/debug/incremental[..]`\n", - ) + .with_stderr_contains("[RUNNING] `rustc [..] -C incremental=[..]/target/incremental[..]`\n") .run(); } @@ -347,7 +343,7 @@ fn cargo_compile_with_forbidden_bin_target_name() { version = "0.0.0" [[bin]] - name = "build" + name = "examples" "#, ) .build(); @@ -359,7 +355,7 @@ fn cargo_compile_with_forbidden_bin_target_name() { [ERROR] failed to parse manifest at `[..]` Caused by: - the binary target name `build` is forbidden + the binary target name `examples` is forbidden ", ) .run(); @@ -1391,15 +1387,15 @@ fn cargo_default_env_metadata_env_var() { -C prefer-dynamic -C debuginfo=2 \ -C metadata=[..] \ --out-dir [..] \ - -L dependency=[CWD]/target/debug/deps` + -L dependency=[CWD]/target/deps` [COMPILING] foo v0.0.1 ([CWD]) [RUNNING] `rustc --crate-name foo src/lib.rs --color never --crate-type lib \ --emit=dep-info,link -C debuginfo=2 \ -C metadata=[..] \ -C extra-filename=[..] \ --out-dir [..] \ - -L dependency=[CWD]/target/debug/deps \ - --extern bar=[CWD]/target/debug/deps/{prefix}bar{suffix}` + -L dependency=[CWD]/target/deps \ + --extern bar=[CWD]/target/deps/{prefix}bar{suffix}` [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]", prefix = env::consts::DLL_PREFIX, suffix = env::consts::DLL_SUFFIX, @@ -1419,15 +1415,15 @@ fn cargo_default_env_metadata_env_var() { -C prefer-dynamic -C debuginfo=2 \ -C metadata=[..] \ --out-dir [..] \ - -L dependency=[CWD]/target/debug/deps` + -L dependency=[CWD]/target/deps` [COMPILING] foo v0.0.1 ([CWD]) [RUNNING] `rustc --crate-name foo src/lib.rs --color never --crate-type lib \ --emit=dep-info,link -C debuginfo=2 \ -C metadata=[..] \ -C extra-filename=[..] \ --out-dir [..] \ - -L dependency=[CWD]/target/debug/deps \ - --extern bar=[CWD]/target/debug/deps/{prefix}bar-[..]{suffix}` + -L dependency=[CWD]/target/deps \ + --extern bar=[CWD]/target/deps/{prefix}bar-[..]{suffix}` [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] ", prefix = env::consts::DLL_PREFIX, @@ -1800,8 +1796,8 @@ fn lto_build() { -C opt-level=3 \ -C lto \ -C metadata=[..] \ - --out-dir [CWD]/target/release/deps \ - -L dependency=[CWD]/target/release/deps` + --out-dir [CWD]/target/deps \ + -L dependency=[CWD]/target/deps` [FINISHED] release [optimized] target(s) in [..] ", ) @@ -1819,7 +1815,7 @@ fn verbose_build() { --emit=dep-info,link -C debuginfo=2 \ -C metadata=[..] \ --out-dir [..] \ - -L dependency=[CWD]/target/debug/deps` + -L dependency=[CWD]/target/deps` [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] ", ) @@ -1838,7 +1834,7 @@ fn verbose_release_build() { -C opt-level=3 \ -C metadata=[..] \ --out-dir [..] \ - -L dependency=[CWD]/target/release/deps` + -L dependency=[CWD]/target/deps` [FINISHED] release [optimized] target(s) in [..] ", ) @@ -1889,16 +1885,16 @@ fn verbose_release_build_deps() { -C opt-level=3 \ -C metadata=[..] \ --out-dir [..] \ - -L dependency=[CWD]/target/release/deps` + -L dependency=[CWD]/target/deps` [COMPILING] test v0.0.0 ([CWD]) [RUNNING] `rustc --crate-name test src/lib.rs --color never --crate-type lib \ --emit=dep-info,link \ -C opt-level=3 \ -C metadata=[..] \ --out-dir [..] \ - -L dependency=[CWD]/target/release/deps \ - --extern foo=[CWD]/target/release/deps/{prefix}foo{suffix} \ - --extern foo=[CWD]/target/release/deps/libfoo.rlib` + -L dependency=[CWD]/target/deps \ + --extern foo=[CWD]/target/deps/{prefix}foo{suffix} \ + --extern foo=[CWD]/target/deps/libfoo.rlib` [FINISHED] release [optimized] target(s) in [..] ", prefix = env::consts::DLL_PREFIX, @@ -4001,7 +3997,7 @@ fn cdylib_not_lifted() { for file in files { println!("checking: {}", file); - assert!(p.root().join("target/debug/deps").join(&file).is_file()); + assert!(p.root().join("target/deps").join(&file).is_file()); } } diff --git a/tests/testsuite/build_lib.rs b/tests/testsuite/build_lib.rs index 00c256b610f..58e6212ae3f 100644 --- a/tests/testsuite/build_lib.rs +++ b/tests/testsuite/build_lib.rs @@ -15,7 +15,7 @@ fn build_lib_only() { --emit=dep-info,link -C debuginfo=2 \ -C metadata=[..] \ --out-dir [..] \ - -L dependency=[CWD]/target/debug/deps` + -L dependency=[CWD]/target/deps` [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]", ) .run(); diff --git a/tests/testsuite/build_plan.rs b/tests/testsuite/build_plan.rs index 4fa915a8491..7584e74ccc4 100644 --- a/tests/testsuite/build_plan.rs +++ b/tests/testsuite/build_plan.rs @@ -85,7 +85,7 @@ fn cargo_build_plan_single_dep() { "kind": "Host", "links": "{...}", "outputs": [ - "[..]/foo/target/debug/deps/libbar-[..].rlib" + "[..]/foo/target/deps/libbar-[..].rlib" ], "package_name": "bar", "package_version": "0.0.1", @@ -101,7 +101,7 @@ fn cargo_build_plan_single_dep() { "kind": "Host", "links": "{...}", "outputs": [ - "[..]/foo/target/debug/deps/libfoo-[..].rlib" + "[..]/foo/target/deps/libfoo-[..].rlib" ], "package_name": "foo", "package_version": "0.5.0", @@ -151,7 +151,7 @@ fn cargo_build_plan_build_script() { "kind": "Host", "links": "{...}", "outputs": [ - "[..]/foo/target/debug/build/[..]/build_script_build-[..]" + "[..]/foo/target/build/[..]/build_script_build-[..]" ], "package_name": "foo", "package_version": "0.5.0", diff --git a/tests/testsuite/build_script.rs b/tests/testsuite/build_script.rs index 9c4dd7031f1..63579c06458 100644 --- a/tests/testsuite/build_script.rs +++ b/tests/testsuite/build_script.rs @@ -116,11 +116,7 @@ fn custom_build_env_vars() { assert!(env::var("RUSTC_LINKER").is_err()); }} "#, - p.root() - .join("target") - .join("debug") - .join("build") - .display() + p.root().join("target").join("build").display() ); let p = p.file("bar/build.rs", &file_content).build(); @@ -1017,20 +1013,20 @@ fn build_cmd_with_a_build_cmd() { [RUNNING] `rustc --crate-name a [..]lib.rs --color never --crate-type lib \ --emit=dep-info,link -C debuginfo=2 \ -C metadata=[..] \ - --out-dir [..]target/debug/deps \ - -L [..]target/debug/deps` + --out-dir [..]target/deps \ + -L [..]target/deps` [COMPILING] foo v0.5.0 ([CWD]) [RUNNING] `rustc --crate-name build_script_build build.rs --color never --crate-type bin \ --emit=dep-info,link \ -C debuginfo=2 -C metadata=[..] --out-dir [..] \ - -L [..]target/debug/deps \ + -L [..]target/deps \ --extern a=[..]liba[..].rlib` [RUNNING] `[..]/foo-[..]/build-script-build` [RUNNING] `rustc --crate-name foo [..]lib.rs --color never --crate-type lib \ --emit=dep-info,link -C debuginfo=2 \ -C metadata=[..] \ --out-dir [..] \ - -L [..]target/debug/deps` + -L [..]target/deps` [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] ", ) @@ -3525,10 +3521,9 @@ fn _rename_with_link_search_path(cross: bool) { p.root() .join("target") .join(cross_compile::alternate()) - .join("debug") .join("deps") } else { - p.root().join("target").join("debug").join("deps") + p.root().join("target").join("deps") }; let file = format!("{}foo{}", env::consts::DLL_PREFIX, env::consts::DLL_SUFFIX); let src = root.join(&file); diff --git a/tests/testsuite/check.rs b/tests/testsuite/check.rs index 390293d0f8e..910fc0b3000 100644 --- a/tests/testsuite/check.rs +++ b/tests/testsuite/check.rs @@ -622,21 +622,21 @@ fn check_artifacts() { assert!(!p.root().join("target/debug/libfoo.rmeta").is_file()); assert!(!p.root().join("target/debug/libfoo.rlib").is_file()); assert!(!p.root().join("target/debug").join(exe("foo")).is_file()); - assert_glob("target/debug/deps/libfoo-*.rmeta", 2); + assert_glob("target/deps/libfoo-*.rmeta", 2); p.root().join("target").rm_rf(); p.cargo("check --lib").run(); assert!(!p.root().join("target/debug/libfoo.rmeta").is_file()); assert!(!p.root().join("target/debug/libfoo.rlib").is_file()); assert!(!p.root().join("target/debug").join(exe("foo")).is_file()); - assert_glob("target/debug/deps/libfoo-*.rmeta", 1); + assert_glob("target/deps/libfoo-*.rmeta", 1); p.root().join("target").rm_rf(); p.cargo("check --bin foo").run(); assert!(!p.root().join("target/debug/libfoo.rmeta").is_file()); assert!(!p.root().join("target/debug/libfoo.rlib").is_file()); assert!(!p.root().join("target/debug").join(exe("foo")).is_file()); - assert_glob("target/debug/deps/libfoo-*.rmeta", 2); + assert_glob("target/deps/libfoo-*.rmeta", 2); p.root().join("target").rm_rf(); p.cargo("check --test t1").run(); @@ -644,8 +644,8 @@ fn check_artifacts() { assert!(!p.root().join("target/debug/libfoo.rlib").is_file()); assert!(!p.root().join("target/debug").join(exe("foo")).is_file()); assert_glob("target/debug/t1-*", 0); - assert_glob("target/debug/deps/libfoo-*.rmeta", 1); - assert_glob("target/debug/deps/libt1-*.rmeta", 1); + assert_glob("target/deps/libfoo-*.rmeta", 1); + assert_glob("target/deps/libt1-*.rmeta", 1); p.root().join("target").rm_rf(); p.cargo("check --example ex1").run(); @@ -656,7 +656,7 @@ fn check_artifacts() { .join("target/debug/examples") .join(exe("ex1")) .is_file()); - assert_glob("target/debug/deps/libfoo-*.rmeta", 1); + assert_glob("target/deps/libfoo-*.rmeta", 1); assert_glob("target/debug/examples/libex1-*.rmeta", 1); p.root().join("target").rm_rf(); @@ -665,8 +665,8 @@ fn check_artifacts() { assert!(!p.root().join("target/debug/libfoo.rlib").is_file()); assert!(!p.root().join("target/debug").join(exe("foo")).is_file()); assert_glob("target/debug/b1-*", 0); - assert_glob("target/debug/deps/libfoo-*.rmeta", 1); - assert_glob("target/debug/deps/libb1-*.rmeta", 1); + assert_glob("target/deps/libfoo-*.rmeta", 1); + assert_glob("target/deps/libb1-*.rmeta", 1); } #[test] diff --git a/tests/testsuite/collisions.rs b/tests/testsuite/collisions.rs index e3f744e8551..fa6f272ab3d 100644 --- a/tests/testsuite/collisions.rs +++ b/tests/testsuite/collisions.rs @@ -45,7 +45,7 @@ fn collision_dylib() { .with_stderr_contains(&format!("\ [WARNING] output filename collision. The lib target `a` in package `b v1.0.0 ([..]/foo/b)` has the same output filename as the lib target `a` in package `a v1.0.0 ([..]/foo/a)`. -Colliding filename is: [..]/foo/target/debug/deps/{}a{} +Colliding filename is: [..]/foo/target/deps/{}a{} The targets should have unique names. Consider changing their names to be unique or compiling them separately. This may become a hard error in the future, see https://github.com/rust-lang/cargo/issues/6313 diff --git a/tests/testsuite/concurrent.rs b/tests/testsuite/concurrent.rs index d30c5786fb3..3918289614c 100644 --- a/tests/testsuite/concurrent.rs +++ b/tests/testsuite/concurrent.rs @@ -442,6 +442,7 @@ fn debug_release_ok() { p.cargo("build").run(); fs::remove_dir_all(p.root().join("target")).unwrap(); + // One of these should block the other, depending on who starts first. let mut a = p.cargo("build").build_command(); let mut b = p.cargo("build --release").build_command(); a.stdout(Stdio::piped()).stderr(Stdio::piped()); @@ -453,7 +454,7 @@ fn debug_release_ok() { let a = a.join().unwrap(); execs() - .with_stderr( + .with_stderr_contains( "\ [COMPILING] foo v0.0.1 [..] [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] @@ -461,7 +462,7 @@ fn debug_release_ok() { ) .run_output(&a); execs() - .with_stderr( + .with_stderr_contains( "\ [COMPILING] foo v0.0.1 [..] [FINISHED] release [optimized] target(s) in [..] diff --git a/tests/testsuite/cross_compile.rs b/tests/testsuite/cross_compile.rs index 686b284146e..7d7ed6cf8da 100644 --- a/tests/testsuite/cross_compile.rs +++ b/tests/testsuite/cross_compile.rs @@ -379,11 +379,11 @@ fn linker_and_ar() { [RUNNING] `rustc --crate-name foo src/foo.rs --color never --crate-type bin \ --emit=dep-info,link -C debuginfo=2 \ -C metadata=[..] \ - --out-dir [CWD]/target/{target}/debug/deps \ + --out-dir [CWD]/target/{target}/deps \ --target {target} \ -C ar=my-ar-tool -C linker=my-linker-tool \ - -L dependency=[CWD]/target/{target}/debug/deps \ - -L dependency=[CWD]/target/debug/deps` + -L dependency=[CWD]/target/{target}/deps \ + -L dependency=[CWD]/target/deps` ", target = target, )) @@ -659,8 +659,6 @@ fn cross_with_a_build_script() { path.pop(); assert_eq!(path.file_name().unwrap().to_str().unwrap(), "build"); path.pop(); - assert_eq!(path.file_name().unwrap().to_str().unwrap(), "debug"); - path.pop(); assert_eq!(path.file_name().unwrap().to_str().unwrap(), "{0}"); path.pop(); assert_eq!(path.file_name().unwrap().to_str().unwrap(), "target"); @@ -677,8 +675,8 @@ fn cross_with_a_build_script() { .with_stderr(&format!( "\ [COMPILING] foo v0.0.0 ([CWD]) -[RUNNING] `rustc [..] build.rs [..] --out-dir [CWD]/target/debug/build/foo-[..]` -[RUNNING] `[CWD]/target/debug/build/foo-[..]/build-script-build` +[RUNNING] `rustc [..] build.rs [..] --out-dir [CWD]/target/build/foo-[..]` +[RUNNING] `[CWD]/target/build/foo-[..]/build-script-build` [RUNNING] `rustc [..] src/main.rs [..] --target {target} [..]` [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] ", @@ -774,9 +772,9 @@ fn build_script_needed_for_host_and_target() { .arg(&target) .with_stderr_contains(&"[COMPILING] d1 v0.0.0 ([CWD]/d1)") .with_stderr_contains( - "[RUNNING] `rustc [..] d1/build.rs [..] --out-dir [CWD]/target/debug/build/d1-[..]`", + "[RUNNING] `rustc [..] d1/build.rs [..] --out-dir [CWD]/target/build/d1-[..]`", ) - .with_stderr_contains("[RUNNING] `[CWD]/target/debug/build/d1-[..]/build-script-build`") + .with_stderr_contains("[RUNNING] `[CWD]/target/build/d1-[..]/build-script-build`") .with_stderr_contains("[RUNNING] `rustc [..] d1/src/lib.rs [..]`") .with_stderr_contains("[COMPILING] d2 v0.0.0 ([CWD]/d2)") .with_stderr_contains(&format!( @@ -785,7 +783,7 @@ fn build_script_needed_for_host_and_target() { )) .with_stderr_contains("[COMPILING] foo v0.0.0 ([CWD])") .with_stderr_contains(&format!( - "[RUNNING] `rustc [..] build.rs [..] --out-dir [CWD]/target/debug/build/foo-[..] \ + "[RUNNING] `rustc [..] build.rs [..] --out-dir [CWD]/target/build/foo-[..] \ -L /path/to/{host}`", host = host )) @@ -881,7 +879,7 @@ fn build_script_only_host() { fn main() { assert!(env::var("OUT_DIR").unwrap().replace("\\", "/") - .contains("target/debug/build/d1-"), + .contains("target/build/d1-"), "bad: {:?}", env::var("OUT_DIR")); } "#, @@ -994,7 +992,7 @@ fn build_script_with_platform_specific_dependencies() { [RUNNING] `rustc [..] d1/src/lib.rs [..]` [COMPILING] foo v0.0.1 ([..]) [RUNNING] `rustc [..] build.rs [..]` -[RUNNING] `[CWD]/target/debug/build/foo-[..]/build-script-build` +[RUNNING] `[CWD]/target/build/foo-[..]/build-script-build` [RUNNING] `rustc [..] src/lib.rs [..] --target {target} [..]` [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] ", diff --git a/tests/testsuite/doc.rs b/tests/testsuite/doc.rs index 5b0aef63a45..09d669df278 100644 --- a/tests/testsuite/doc.rs +++ b/tests/testsuite/doc.rs @@ -114,7 +114,7 @@ fn doc_deps() { // Verify that it only emits rmeta for the dependency. assert_eq!( - glob(&p.root().join("target/debug/**/*.rlib").to_str().unwrap()) + glob(&p.root().join("target/**/*.rlib").to_str().unwrap()) .unwrap() .count(), 0 @@ -122,7 +122,7 @@ fn doc_deps() { assert_eq!( glob( &p.root() - .join("target/debug/deps/libbar-*.rmeta") + .join("target/deps/libbar-*.rmeta") .to_str() .unwrap() ) diff --git a/tests/testsuite/freshness.rs b/tests/testsuite/freshness.rs index 9d14ca533c2..3fa3e430d1e 100644 --- a/tests/testsuite/freshness.rs +++ b/tests/testsuite/freshness.rs @@ -230,7 +230,7 @@ fn changing_profiles_caches_targets() { "\ [..]Compiling foo v0.0.1 ([..]) [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] -[RUNNING] target[..]debug[..]deps[..]foo-[..][EXE] +[RUNNING] target/debug/deps/foo-[..][EXE] [DOCTEST] foo ", ) @@ -246,7 +246,7 @@ fn changing_profiles_caches_targets() { .with_stderr( "\ [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] -[RUNNING] target[..]debug[..]deps[..]foo-[..][EXE] +[RUNNING] target/debug/deps/foo-[..][EXE] [DOCTEST] foo ", ) @@ -1237,7 +1237,7 @@ fn simple_deps_cleaner_does_not_rebuild() { .env("RUSTFLAGS", "-C target-cpu=native") .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]") .run(); - simple_deps_cleaner(p.target_debug_dir(), timestamp); + simple_deps_cleaner(p.build_dir(), timestamp); // This should not recompile! p.cargo("build -Z mtime-on-use") .masquerade_as_nightly_cargo() @@ -1332,7 +1332,7 @@ fn fingerprint_cleaner_does_not_rebuild() { .env("RUSTFLAGS", "-C target-cpu=native") .with_stderr("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]") .run(); - fingerprint_cleaner(p.target_debug_dir(), timestamp); + fingerprint_cleaner(p.build_dir(), timestamp); // This should not recompile! p.cargo("build -Z mtime-on-use") .masquerade_as_nightly_cargo() diff --git a/tests/testsuite/metabuild.rs b/tests/testsuite/metabuild.rs index c159ba47d7c..0b059fa81da 100644 --- a/tests/testsuite/metabuild.rs +++ b/tests/testsuite/metabuild.rs @@ -463,7 +463,7 @@ fn metabuild_build_plan() { "compile_mode": "build", "kind": "Host", "deps": [], - "outputs": ["[..]/target/debug/deps/libmb-[..].rlib"], + "outputs": ["[..]/target/deps/libmb-[..].rlib"], "links": {}, "program": "rustc", "args": "{...}", @@ -477,7 +477,7 @@ fn metabuild_build_plan() { "compile_mode": "build", "kind": "Host", "deps": [], - "outputs": ["[..]/target/debug/deps/libmb_other-[..].rlib"], + "outputs": ["[..]/target/deps/libmb_other-[..].rlib"], "links": {}, "program": "rustc", "args": "{...}", @@ -491,7 +491,7 @@ fn metabuild_build_plan() { "compile_mode": "build", "kind": "Host", "deps": [0, 1], - "outputs": ["[..]/target/debug/build/foo-[..]/metabuild_foo-[..][EXE]"], + "outputs": ["[..]/target/build/foo-[..]/metabuild_foo-[..][EXE]"], "links": "{...}", "program": "rustc", "args": "{...}", @@ -507,7 +507,7 @@ fn metabuild_build_plan() { "deps": [2], "outputs": [], "links": {}, - "program": "[..]/foo/target/debug/build/foo-[..]/metabuild-foo", + "program": "[..]/foo/target/build/foo-[..]/metabuild-foo", "args": [], "env": "{...}", "cwd": "[..]" @@ -519,7 +519,7 @@ fn metabuild_build_plan() { "compile_mode": "build", "kind": "Host", "deps": [3], - "outputs": ["[..]/foo/target/debug/deps/libfoo-[..].rlib"], + "outputs": ["[..]/foo/target/deps/libfoo-[..].rlib"], "links": "{...}", "program": "rustc", "args": "{...}", @@ -705,7 +705,7 @@ fn metabuild_json_artifact() { "executable": null, "features": [], "filenames": [ - "[..]/foo/target/debug/build/foo-[..]/metabuild-foo[EXE]" + "[..]/foo/target/build/foo-[..]/metabuild-foo[EXE]" ], "fresh": false, "package_id": "foo [..]", diff --git a/tests/testsuite/new.rs b/tests/testsuite/new.rs index 8c60fb26a7c..a2064aebf5e 100644 --- a/tests/testsuite/new.rs +++ b/tests/testsuite/new.rs @@ -146,11 +146,11 @@ fn reserved_name() { #[test] fn reserved_binary_name() { - cargo_process("new --bin incremental") + cargo_process("new --bin examples") .with_status(101) .with_stderr( "\ - [ERROR] The name `incremental` cannot be used as a crate name\n\ + [ERROR] The name `examples` cannot be used as a crate name\n\ use --name to override crate name", ) .run(); diff --git a/tests/testsuite/profile_targets.rs b/tests/testsuite/profile_targets.rs index 8994e7e8f94..66e17247426 100644 --- a/tests/testsuite/profile_targets.rs +++ b/tests/testsuite/profile_targets.rs @@ -86,7 +86,7 @@ fn profile_selection_build() { [RUNNING] `[..] rustc --crate-name bdep bdep/src/lib.rs [..]--crate-type lib --emit=dep-info,link -C codegen-units=1 -C debuginfo=2 [..] [COMPILING] foo [..] [RUNNING] `[..] rustc --crate-name build_script_build build.rs [..]--crate-type bin --emit=dep-info,link -C codegen-units=1 -C debuginfo=2 [..] -[RUNNING] `[..]/target/debug/build/foo-[..]/build-script-build` +[RUNNING] `[..]/target/build/foo-[..]/build-script-build` [foo 0.0.1] foo custom build PROFILE=debug DEBUG=true OPT_LEVEL=0 [RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=dep-info,link -C panic=abort -C codegen-units=1 -C debuginfo=2 [..] [RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--crate-type bin --emit=dep-info,link -C panic=abort -C codegen-units=1 -C debuginfo=2 [..] @@ -117,7 +117,7 @@ fn profile_selection_build_release() { [RUNNING] `[..] rustc --crate-name bdep bdep/src/lib.rs [..]--crate-type lib --emit=dep-info,link -C opt-level=3 -C codegen-units=2 [..] [COMPILING] foo [..] [RUNNING] `[..] rustc --crate-name build_script_build build.rs [..]--crate-type bin --emit=dep-info,link -C opt-level=3 -C codegen-units=2 [..] -[RUNNING] `[..]/target/release/build/foo-[..]/build-script-build` +[RUNNING] `[..]/target/build/foo-[..]/build-script-build` [foo 0.0.1] foo custom build PROFILE=release DEBUG=false OPT_LEVEL=3 [RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=dep-info,link -C opt-level=3 -C panic=abort -C codegen-units=2 [..] [RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--crate-type bin --emit=dep-info,link -C opt-level=3 -C panic=abort -C codegen-units=2 [..] @@ -173,7 +173,7 @@ fn profile_selection_build_all_targets() { [RUNNING] `[..] rustc --crate-name bdep bdep/src/lib.rs [..]--crate-type lib --emit=dep-info,link -C codegen-units=1 -C debuginfo=2 [..] [COMPILING] foo [..] [RUNNING] `[..] rustc --crate-name build_script_build build.rs [..]--crate-type bin --emit=dep-info,link -C codegen-units=1 -C debuginfo=2 [..] -[RUNNING] `[..]/target/debug/build/foo-[..]/build-script-build` +[RUNNING] `[..]/target/build/foo-[..]/build-script-build` [foo 0.0.1] foo custom build PROFILE=debug DEBUG=true OPT_LEVEL=0 [RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=dep-info,link -C panic=abort -C codegen-units=1 -C debuginfo=2 [..]` [RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--emit=dep-info,link -C codegen-units=3 -C debuginfo=2 --test [..]` @@ -238,7 +238,7 @@ fn profile_selection_build_all_targets_release() { [RUNNING] `[..] rustc --crate-name bdep bdep/src/lib.rs [..]--crate-type lib --emit=dep-info,link -C opt-level=3 -C codegen-units=2 [..] [COMPILING] foo [..] [RUNNING] `[..] rustc --crate-name build_script_build build.rs [..]--crate-type bin --emit=dep-info,link -C opt-level=3 -C codegen-units=2 [..] -[RUNNING] `[..]/target/release/build/foo-[..]/build-script-build` +[RUNNING] `[..]/target/build/foo-[..]/build-script-build` [foo 0.0.1] foo custom build PROFILE=release DEBUG=false OPT_LEVEL=3 [RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=dep-info,link -C opt-level=3 -C panic=abort -C codegen-units=2 [..]` [RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--emit=dep-info,link -C opt-level=3 -C codegen-units=4 --test [..]` @@ -294,7 +294,7 @@ fn profile_selection_test() { [RUNNING] `[..] rustc --crate-name bdep bdep/src/lib.rs [..]--crate-type lib --emit=dep-info,link -C codegen-units=1 -C debuginfo=2 [..] [COMPILING] foo [..] [RUNNING] `[..] rustc --crate-name build_script_build build.rs [..]--crate-type bin --emit=dep-info,link -C codegen-units=1 -C debuginfo=2 [..] -[RUNNING] `[..]/target/debug/build/foo-[..]/build-script-build` +[RUNNING] `[..]/target/build/foo-[..]/build-script-build` [foo 0.0.1] foo custom build PROFILE=debug DEBUG=true OPT_LEVEL=0 [RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=dep-info,link -C panic=abort -C codegen-units=1 -C debuginfo=2 [..] [RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=dep-info,link -C codegen-units=1 -C debuginfo=2 [..] @@ -359,7 +359,7 @@ fn profile_selection_test_release() { [RUNNING] `[..] rustc --crate-name bdep bdep/src/lib.rs [..]--crate-type lib --emit=dep-info,link -C opt-level=3 -C codegen-units=2 [..] [COMPILING] foo [..] [RUNNING] `[..] rustc --crate-name build_script_build build.rs [..]--crate-type bin --emit=dep-info,link -C opt-level=3 -C codegen-units=2 [..] -[RUNNING] `[..]/target/release/build/foo-[..]/build-script-build` +[RUNNING] `[..]/target/build/foo-[..]/build-script-build` [foo 0.0.1] foo custom build PROFILE=release DEBUG=false OPT_LEVEL=3 [RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=dep-info,link -C opt-level=3 -C panic=abort -C codegen-units=2 [..] [RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=dep-info,link -C opt-level=3 -C codegen-units=2 [..] @@ -424,7 +424,7 @@ fn profile_selection_bench() { [RUNNING] `[..] rustc --crate-name bdep bdep/src/lib.rs [..]--crate-type lib --emit=dep-info,link -C opt-level=3 -C codegen-units=2 [..] [COMPILING] foo [..] [RUNNING] `[..] rustc --crate-name build_script_build build.rs [..]--crate-type bin --emit=dep-info,link -C opt-level=3 -C codegen-units=2 [..] -[RUNNING] `[..]target/release/build/foo-[..]/build-script-build` +[RUNNING] `[..]target/build/foo-[..]/build-script-build` [foo 0.0.1] foo custom build PROFILE=release DEBUG=false OPT_LEVEL=3 [RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=dep-info,link -C opt-level=3 -C panic=abort -C codegen-units=2 [..] [RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=dep-info,link -C opt-level=3 -C codegen-units=2 [..] @@ -494,7 +494,7 @@ fn profile_selection_check_all_targets() { [RUNNING] `[..] rustc --crate-name bdep bdep/src/lib.rs [..]--crate-type lib --emit=dep-info,link -C codegen-units=1 -C debuginfo=2 [..] [COMPILING] foo [..] [RUNNING] `[..] rustc --crate-name build_script_build build.rs [..]--crate-type bin --emit=dep-info,link -C codegen-units=1 -C debuginfo=2 [..] -[RUNNING] `[..]target/debug/build/foo-[..]/build-script-build` +[RUNNING] `[..]target/build/foo-[..]/build-script-build` [foo 0.0.1] foo custom build PROFILE=debug DEBUG=true OPT_LEVEL=0 [RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=dep-info,metadata -C panic=abort -C codegen-units=1 -C debuginfo=2 [..] [RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=dep-info,metadata -C codegen-units=1 -C debuginfo=2 [..] @@ -545,7 +545,7 @@ fn profile_selection_check_all_targets_release() { [RUNNING] `[..] rustc --crate-name bdep bdep/src/lib.rs [..]--crate-type lib --emit=dep-info,link -C opt-level=3 -C codegen-units=2 [..] [COMPILING] foo [..] [RUNNING] `[..] rustc --crate-name build_script_build build.rs [..]--crate-type bin --emit=dep-info,link -C opt-level=3 -C codegen-units=2 [..] -[RUNNING] `[..]target/release/build/foo-[..]/build-script-build` +[RUNNING] `[..]target/build/foo-[..]/build-script-build` [foo 0.0.1] foo custom build PROFILE=release DEBUG=false OPT_LEVEL=3 [RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=dep-info,metadata -C opt-level=3 -C panic=abort -C codegen-units=2 [..] [RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=dep-info,metadata -C opt-level=3 -C codegen-units=2 [..] @@ -610,7 +610,7 @@ fn profile_selection_check_all_targets_test() { [RUNNING] `[..] rustc --crate-name bdep bdep/src/lib.rs [..]--crate-type lib --emit=dep-info,link -C codegen-units=1 -C debuginfo=2 [..] [COMPILING] foo [..] [RUNNING] `[..] rustc --crate-name build_script_build build.rs [..]--crate-type bin --emit=dep-info,link -C codegen-units=1 -C debuginfo=2 [..] -[RUNNING] `[..]target/debug/build/foo-[..]/build-script-build` +[RUNNING] `[..]target/build/foo-[..]/build-script-build` [foo 0.0.1] foo custom build PROFILE=debug DEBUG=true OPT_LEVEL=0 [RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=dep-info,metadata -C codegen-units=1 -C debuginfo=2 [..] [RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--emit=dep-info,metadata -C codegen-units=1 -C debuginfo=2 --test [..] @@ -657,7 +657,7 @@ fn profile_selection_doc() { [RUNNING] `[..] rustc --crate-name bdep bdep/src/lib.rs [..]--crate-type lib --emit=dep-info,link -C codegen-units=1 -C debuginfo=2 [..] [COMPILING] foo [..] [RUNNING] `[..] rustc --crate-name build_script_build build.rs [..]--crate-type bin --emit=dep-info,link -C codegen-units=1 -C debuginfo=2 [..] -[RUNNING] `[..]target/debug/build/foo-[..]/build-script-build` +[RUNNING] `[..]target/build/foo-[..]/build-script-build` [foo 0.0.1] foo custom build PROFILE=debug DEBUG=true OPT_LEVEL=0 [DOCUMENTING] foo [..] [RUNNING] `rustdoc --crate-name foo src/lib.rs [..] diff --git a/tests/testsuite/profiles.rs b/tests/testsuite/profiles.rs index a06a4975fe4..e20565bc094 100644 --- a/tests/testsuite/profiles.rs +++ b/tests/testsuite/profiles.rs @@ -34,7 +34,7 @@ fn profile_overrides() { -C metadata=[..] \ -C rpath \ --out-dir [..] \ - -L dependency=[CWD]/target/debug/deps` + -L dependency=[CWD]/target/deps` [FINISHED] dev [optimized] target(s) in [..] ", ) @@ -68,7 +68,7 @@ fn opt_level_override_0() { -C debuginfo=2 \ -C metadata=[..] \ --out-dir [..] \ - -L dependency=[CWD]/target/debug/deps` + -L dependency=[CWD]/target/deps` [FINISHED] [..] target(s) in [..] ", ) @@ -101,7 +101,7 @@ fn debug_override_1() { -C debuginfo=1 \ -C metadata=[..] \ --out-dir [..] \ - -L dependency=[CWD]/target/debug/deps` + -L dependency=[CWD]/target/deps` [FINISHED] [..] target(s) in [..] ", ) @@ -139,7 +139,7 @@ fn check_opt_level_override(profile_level: &str, rustc_level: &str) { -C debug-assertions=on \ -C metadata=[..] \ --out-dir [..] \ - -L dependency=[CWD]/target/debug/deps` + -L dependency=[CWD]/target/deps` [FINISHED] [..] target(s) in [..] ", level = rustc_level @@ -216,8 +216,8 @@ fn top_level_overrides_deps() { -C opt-level=1 \ -C debuginfo=2 \ -C metadata=[..] \ - --out-dir [CWD]/target/release/deps \ - -L dependency=[CWD]/target/release/deps` + --out-dir [CWD]/target/deps \ + -L dependency=[CWD]/target/deps` [COMPILING] test v0.0.0 ([CWD]) [RUNNING] `rustc --crate-name test src/lib.rs --color never --crate-type lib \ --emit=dep-info,link \ @@ -225,10 +225,9 @@ fn top_level_overrides_deps() { -C debuginfo=2 \ -C metadata=[..] \ --out-dir [..] \ - -L dependency=[CWD]/target/release/deps \ - --extern foo=[CWD]/target/release/deps/\ - {prefix}foo[..]{suffix} \ - --extern foo=[CWD]/target/release/deps/libfoo.rlib` + -L dependency=[CWD]/target/deps \ + --extern foo=[CWD]/target/deps/{prefix}foo[..]{suffix} \ + --extern foo=[CWD]/target/deps/libfoo.rlib` [FINISHED] release [optimized + debuginfo] target(s) in [..] ", prefix = env::consts::DLL_PREFIX, diff --git a/tests/testsuite/rename_deps.rs b/tests/testsuite/rename_deps.rs index 970c2c8a456..868e6d39d77 100644 --- a/tests/testsuite/rename_deps.rs +++ b/tests/testsuite/rename_deps.rs @@ -266,8 +266,8 @@ fn can_run_doc_tests() { [DOCTEST] foo [RUNNING] `rustdoc --test [CWD]/src/lib.rs \ [..] \ - --extern bar=[CWD]/target/debug/deps/libbar-[..].rlib \ - --extern baz=[CWD]/target/debug/deps/libbar-[..].rlib \ + --extern bar=[CWD]/target/deps/libbar-[..].rlib \ + --extern baz=[CWD]/target/deps/libbar-[..].rlib \ [..]` ", ) diff --git a/tests/testsuite/run.rs b/tests/testsuite/run.rs index 8a8e3388c0e..87882979616 100644 --- a/tests/testsuite/run.rs +++ b/tests/testsuite/run.rs @@ -691,16 +691,16 @@ fn example_with_release_flag() { --emit=dep-info,link \ -C opt-level=3 \ -C metadata=[..] \ - --out-dir [CWD]/target/release/deps \ - -L dependency=[CWD]/target/release/deps` + --out-dir [CWD]/target/deps \ + -L dependency=[CWD]/target/deps` [COMPILING] foo v0.0.1 ([CWD]) [RUNNING] `rustc --crate-name a examples/a.rs --color never --crate-type bin \ --emit=dep-info,link \ -C opt-level=3 \ -C metadata=[..] \ --out-dir [CWD]/target/release/examples \ - -L dependency=[CWD]/target/release/deps \ - --extern bar=[CWD]/target/release/deps/libbar-[..].rlib` + -L dependency=[CWD]/target/deps \ + --extern bar=[CWD]/target/deps/libbar-[..].rlib` [FINISHED] release [optimized] target(s) in [..] [RUNNING] `target/release/examples/a[EXE]` ", @@ -720,16 +720,16 @@ fast2", --emit=dep-info,link \ -C debuginfo=2 \ -C metadata=[..] \ - --out-dir [CWD]/target/debug/deps \ - -L dependency=[CWD]/target/debug/deps` + --out-dir [CWD]/target/deps \ + -L dependency=[CWD]/target/deps` [COMPILING] foo v0.0.1 ([CWD]) [RUNNING] `rustc --crate-name a examples/a.rs --color never --crate-type bin \ --emit=dep-info,link \ -C debuginfo=2 \ -C metadata=[..] \ --out-dir [CWD]/target/debug/examples \ - -L dependency=[CWD]/target/debug/deps \ - --extern bar=[CWD]/target/debug/deps/libbar-[..].rlib` + -L dependency=[CWD]/target/deps \ + --extern bar=[CWD]/target/deps/libbar-[..].rlib` [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] [RUNNING] `target/debug/examples/a[EXE]` ", diff --git a/tests/testsuite/rustc.rs b/tests/testsuite/rustc.rs index 5df915e5e2c..c1532b0ff4d 100644 --- a/tests/testsuite/rustc.rs +++ b/tests/testsuite/rustc.rs @@ -19,7 +19,7 @@ fn build_lib_for_foo() { --emit=dep-info,link -C debuginfo=2 \ -C metadata=[..] \ --out-dir [..] \ - -L dependency=[CWD]/target/debug/deps` + -L dependency=[CWD]/target/deps` [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] ", ) @@ -42,7 +42,7 @@ fn lib() { -C debug-assertions=off \ -C metadata=[..] \ --out-dir [..] \ - -L dependency=[CWD]/target/debug/deps` + -L dependency=[CWD]/target/deps` [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] ", ) @@ -64,14 +64,14 @@ fn build_main_and_allow_unstable_options() { --emit=dep-info,link -C debuginfo=2 \ -C metadata=[..] \ --out-dir [..] \ - -L dependency=[CWD]/target/debug/deps` + -L dependency=[CWD]/target/deps` [RUNNING] `rustc --crate-name {name} src/main.rs --color never --crate-type bin \ --emit=dep-info,link -C debuginfo=2 \ -C debug-assertions \ -C metadata=[..] \ --out-dir [..] \ - -L dependency=[CWD]/target/debug/deps \ - --extern {name}=[CWD]/target/debug/deps/lib{name}-[..].rlib` + -L dependency=[CWD]/target/deps \ + --extern {name}=[CWD]/target/deps/lib{name}-[..].rlib` [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] ", name = "foo", diff --git a/tests/testsuite/rustdoc.rs b/tests/testsuite/rustdoc.rs index 405ba6526c9..dca248bed91 100644 --- a/tests/testsuite/rustdoc.rs +++ b/tests/testsuite/rustdoc.rs @@ -10,7 +10,7 @@ fn rustdoc_simple() { [DOCUMENTING] foo v0.0.1 ([CWD]) [RUNNING] `rustdoc --crate-name foo src/lib.rs [..]\ -o [CWD]/target/doc \ - -L dependency=[CWD]/target/debug/deps` + -L dependency=[CWD]/target/deps` [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] ", ) @@ -28,7 +28,7 @@ fn rustdoc_args() { [RUNNING] `rustdoc --crate-name foo src/lib.rs [..]\ -o [CWD]/target/doc \ --cfg=foo \ - -L dependency=[CWD]/target/debug/deps` + -L dependency=[CWD]/target/deps` [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] ", ) @@ -67,7 +67,7 @@ fn rustdoc_foo_with_bar_dependency() { [RUNNING] `rustdoc --crate-name foo src/lib.rs [..]\ -o [CWD]/target/doc \ --cfg=foo \ - -L dependency=[CWD]/target/debug/deps \ + -L dependency=[CWD]/target/deps \ --extern [..]` [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] ", @@ -105,7 +105,7 @@ fn rustdoc_only_bar_dependency() { [RUNNING] `rustdoc --crate-name bar [..]bar/src/lib.rs [..]\ -o [CWD]/target/doc \ --cfg=foo \ - -L dependency=[CWD]/target/debug/deps` + -L dependency=[CWD]/target/deps` [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] ", ) @@ -126,7 +126,7 @@ fn rustdoc_same_name_documents_lib() { [RUNNING] `rustdoc --crate-name foo src/lib.rs [..]\ -o [CWD]/target/doc \ --cfg=foo \ - -L dependency=[CWD]/target/debug/deps` + -L dependency=[CWD]/target/deps` [FINISHED] dev [unoptimized + debuginfo] target(s) in [..] ", ) @@ -168,8 +168,8 @@ fn rustdoc_target() { [RUNNING] `rustdoc --crate-name foo src/lib.rs [..]\ --target x86_64-unknown-linux-gnu \ -o [CWD]/target/x86_64-unknown-linux-gnu/doc \ - -L dependency=[CWD]/target/x86_64-unknown-linux-gnu/debug/deps \ - -L dependency=[CWD]/target/debug/deps` + -L dependency=[CWD]/target/x86_64-unknown-linux-gnu/deps \ + -L dependency=[CWD]/target/deps` [FINISHED] dev [unoptimized + debuginfo] target(s) in [..]", ) .run();