diff --git a/src/cargo/core/features.rs b/src/cargo/core/features.rs
index 524985dcaa3..d944ba833d1 100644
--- a/src/cargo/core/features.rs
+++ b/src/cargo/core/features.rs
@@ -387,7 +387,7 @@ features! {
(unstable, public_dependency, "", "reference/unstable.html#public-dependency"),
// Allow to specify profiles other than 'dev', 'release', 'test', etc.
- (unstable, named_profiles, "", "reference/unstable.html#custom-named-profiles"),
+ (stable, named_profiles, "1.57", "reference/profiles.html#custom-profiles"),
// Opt-in new-resolver behavior.
(stable, resolver, "1.51", "reference/resolver.html#resolver-versions"),
@@ -643,7 +643,6 @@ unstable_cli_options!(
minimal_versions: bool = ("Resolve minimal dependency versions instead of maximum"),
mtime_on_use: bool = ("Configure Cargo to update the mtime of used files"),
multitarget: bool = ("Allow passing multiple `--target` flags to the cargo subcommand selected"),
- named_profiles: bool = ("Allow defining custom profiles"),
namespaced_features: bool = ("Allow features with `dep:` prefix"),
no_index_update: bool = ("Do not update the registry index even if the cache is outdated"),
panic_abort_tests: bool = ("Enable support to run tests with -Cpanic=abort"),
@@ -699,6 +698,10 @@ const STABILIZED_CONFIGURABLE_ENV: &str = "The [env] section is now always enabl
const STABILIZED_PATCH_IN_CONFIG: &str = "The patch-in-config feature is now always enabled.";
+const STABILIZED_NAMED_PROFILES: &str = "The named-profiles feature is now always enabled.\n\
+ See https://doc.rust-lang.org/nightly/cargo/reference/profiles.html#custom-profiles \
+ for more information";
+
fn deserialize_build_std<'de, D>(deserializer: D) -> Result
+
As a special case, specifying the test profile will also enable checking in
+test mode which will enable checking tests and enable the test cfg option.
+See rustc tests for more
+detail.
+
See the the reference for more details on profiles.
@@ -347,24 +347,6 @@ the number of CPUs.
-## PROFILES
-
-Profiles may be used to configure compiler options such as optimization levels
-and debug settings. See [the reference](../reference/profiles.html) for more
-details.
-
-Profile selection depends on the target and crate being built. By default the
-`dev` or `test` profiles are used. If the `--release` flag is given, then the
-`release` or `bench` profiles are used.
-
-Target | Default Profile | `--release` Profile
--------|-----------------|---------------------
-lib, bin, example | `dev` | `release`
-test, bench, or any target in "test" or "bench" mode | `test` | `bench`
-
-Dependencies use the `dev`/`release` profiles.
-
-
## ENVIRONMENT
See [the reference](../reference/environment-variables.html) for
diff --git a/src/doc/src/commands/cargo-clean.md b/src/doc/src/commands/cargo-clean.md
index 33d6dc0e936..ba32e8bfdfa 100644
--- a/src/doc/src/commands/cargo-clean.md
+++ b/src/doc/src/commands/cargo-clean.md
@@ -41,7 +41,11 @@ the target directory.
--release
-
Clean all artifacts that were built with the release or bench profiles.
+
Remove all artifacts in the release directory.
+
+
+
--profilename
+
Remove all artifacts in the directory with the given profile name.
--target-dirdirectory
diff --git a/src/doc/src/commands/cargo-doc.md b/src/doc/src/commands/cargo-doc.md
index 774169816c9..51f37dedd74 100644
--- a/src/doc/src/commands/cargo-doc.md
+++ b/src/doc/src/commands/cargo-doc.md
@@ -165,9 +165,14 @@ target artifacts are placed in a separate directory. See the
--release
-
Document optimized artifacts with the release profile. See the
-PROFILES section for details on how this affects profile
-selection.
+
Document optimized artifacts with the release profile.
+See also the --profile option for choosing a specific profile by name.
+
+
+
+
--profilename
+
Document with the given profile.
+See the the reference for more details on profiles.
@@ -316,24 +321,6 @@ the number of CPUs.
-## PROFILES
-
-Profiles may be used to configure compiler options such as optimization levels
-and debug settings. See [the reference](../reference/profiles.html) for more
-details.
-
-Profile selection depends on the target and crate being built. By default the
-`dev` or `test` profiles are used. If the `--release` flag is given, then the
-`release` or `bench` profiles are used.
-
-Target | Default Profile | `--release` Profile
--------|-----------------|---------------------
-lib, bin, example | `dev` | `release`
-test, bench, or any target in "test" or "bench" mode | `test` | `bench`
-
-Dependencies use the `dev`/`release` profiles.
-
-
## ENVIRONMENT
See [the reference](../reference/environment-variables.html) for
diff --git a/src/doc/src/commands/cargo-fix.md b/src/doc/src/commands/cargo-fix.md
index 534520188d3..100da109e7e 100644
--- a/src/doc/src/commands/cargo-fix.md
+++ b/src/doc/src/commands/cargo-fix.md
@@ -267,18 +267,18 @@ target artifacts are placed in a separate directory. See the
--release
-
Fix optimized artifacts with the release profile. See the
-PROFILES section for details on how this affects profile
-selection.
+
Fix optimized artifacts with the release profile.
+See also the --profile option for choosing a specific profile by name.
--profilename
-
Changes fix behavior. Currently only test is supported,
-which will fix with the #[cfg(test)] attribute enabled.
-This is useful to have it fix unit tests which are usually
-excluded via the cfg attribute. This does not change the actual profile
-used.
+
Fix with the given profile.
+
As a special case, specifying the test profile will also enable checking in
+test mode which will enable checking tests and enable the test cfg option.
+See rustc tests for more
+detail.
@@ -427,24 +427,6 @@ the number of CPUs.
-## PROFILES
-
-Profiles may be used to configure compiler options such as optimization levels
-and debug settings. See [the reference](../reference/profiles.html) for more
-details.
-
-Profile selection depends on the target and crate being built. By default the
-`dev` or `test` profiles are used. If the `--release` flag is given, then the
-`release` or `bench` profiles are used.
-
-Target | Default Profile | `--release` Profile
--------|-----------------|---------------------
-lib, bin, example | `dev` | `release`
-test, bench, or any target in "test" or "bench" mode | `test` | `bench`
-
-Dependencies use the `dev`/`release` profiles.
-
-
## ENVIRONMENT
See [the reference](../reference/environment-variables.html) for
diff --git a/src/doc/src/commands/cargo-install.md b/src/doc/src/commands/cargo-install.md
index 1639b28cb6e..acb98dbb79c 100644
--- a/src/doc/src/commands/cargo-install.md
+++ b/src/doc/src/commands/cargo-install.md
@@ -49,7 +49,7 @@ change, then Cargo will reinstall the package:
- The package version and source.
- The set of binary names installed.
- The chosen features.
-- The release mode (`--debug`).
+- The profile (`--profile`).
- The target (`--target`).
Installing with `--path` will always build and install, unless there are
@@ -226,7 +226,14 @@ is specified.
--debug
-
Build with the dev profile instead the release profile.
+
Build with the dev profile instead the release profile.
+See also the --profile option for choosing a specific profile by name.
+
+
+
--profilename
+
Install with the given profile.
+See the the reference for more details on profiles.
+
diff --git a/src/doc/src/commands/cargo-run.md b/src/doc/src/commands/cargo-run.md
index d7cf9ec5fb9..79c51ab19c2 100644
--- a/src/doc/src/commands/cargo-run.md
+++ b/src/doc/src/commands/cargo-run.md
@@ -100,9 +100,14 @@ target artifacts are placed in a separate directory. See the
--release
-
Run optimized artifacts with the release profile. See the
-PROFILES section for details on how this affects profile
-selection.
+
Run optimized artifacts with the release profile.
+See also the --profile option for choosing a specific profile by name.
+
+
+
+
--profilename
+
Run with the given profile.
+See the the reference for more details on profiles.
@@ -255,24 +260,6 @@ the number of CPUs.
-## PROFILES
-
-Profiles may be used to configure compiler options such as optimization levels
-and debug settings. See [the reference](../reference/profiles.html) for more
-details.
-
-Profile selection depends on the target and crate being built. By default the
-`dev` or `test` profiles are used. If the `--release` flag is given, then the
-`release` or `bench` profiles are used.
-
-Target | Default Profile | `--release` Profile
--------|-----------------|---------------------
-lib, bin, example | `dev` | `release`
-test, bench, or any target in "test" or "bench" mode | `test` | `bench`
-
-Dependencies use the `dev`/`release` profiles.
-
-
## ENVIRONMENT
See [the reference](../reference/environment-variables.html) for
diff --git a/src/doc/src/commands/cargo-rustc.md b/src/doc/src/commands/cargo-rustc.md
index 65dbeee3fff..99b780d14af 100644
--- a/src/doc/src/commands/cargo-rustc.md
+++ b/src/doc/src/commands/cargo-rustc.md
@@ -169,12 +169,27 @@ target artifacts are placed in a separate directory. See the
--release
-
Build optimized artifacts with the release profile. See the
-PROFILES section for details on how this affects profile
-selection.
+
Build optimized artifacts with the release profile.
+See also the --profile option for choosing a specific profile by name.
+
--profilename
+
Build with the given profile.
+
The rustc subcommand will treat the following named profiles with special behaviors:
+
+
check — Builds in the same way as the cargo-check(1) command with
+the dev profile.
+
test — Builds in the same way as the cargo-test(1) command,
+enabling building in test mode which will enable tests and enable the test
+cfg option. See rustc
+tests for more detail.
+
bench — Builds in the same was as the cargo-bench(1) command,
+similar to the test profile.
Build the target even if the selected Rust compiler is older than the
required Rust version as configured in the project's rust-version field.
@@ -324,24 +339,6 @@ the number of CPUs.
-## PROFILES
-
-Profiles may be used to configure compiler options such as optimization levels
-and debug settings. See [the reference](../reference/profiles.html) for more
-details.
-
-Profile selection depends on the target and crate being built. By default the
-`dev` or `test` profiles are used. If the `--release` flag is given, then the
-`release` or `bench` profiles are used.
-
-Target | Default Profile | `--release` Profile
--------|-----------------|---------------------
-lib, bin, example | `dev` | `release`
-test, bench, or any target in "test" or "bench" mode | `test` | `bench`
-
-Dependencies use the `dev`/`release` profiles.
-
-
## ENVIRONMENT
See [the reference](../reference/environment-variables.html) for
diff --git a/src/doc/src/commands/cargo-rustdoc.md b/src/doc/src/commands/cargo-rustdoc.md
index 96de095f821..a7847f1ed7c 100644
--- a/src/doc/src/commands/cargo-rustdoc.md
+++ b/src/doc/src/commands/cargo-rustdoc.md
@@ -184,9 +184,14 @@ target artifacts are placed in a separate directory. See the
--release
-
Document optimized artifacts with the release profile. See the
-PROFILES section for details on how this affects profile
-selection.
+
Document optimized artifacts with the release profile.
+See also the --profile option for choosing a specific profile by name.
+
+
+
+
--profilename
+
Document with the given profile.
+See the the reference for more details on profiles.
@@ -335,24 +340,6 @@ the number of CPUs.
-## PROFILES
-
-Profiles may be used to configure compiler options such as optimization levels
-and debug settings. See [the reference](../reference/profiles.html) for more
-details.
-
-Profile selection depends on the target and crate being built. By default the
-`dev` or `test` profiles are used. If the `--release` flag is given, then the
-`release` or `bench` profiles are used.
-
-Target | Default Profile | `--release` Profile
--------|-----------------|---------------------
-lib, bin, example | `dev` | `release`
-test, bench, or any target in "test" or "bench" mode | `test` | `bench`
-
-Dependencies use the `dev`/`release` profiles.
-
-
## ENVIRONMENT
See [the reference](../reference/environment-variables.html) for
diff --git a/src/doc/src/commands/cargo-test.md b/src/doc/src/commands/cargo-test.md
index e2daf71f681..1eef72fc2d0 100644
--- a/src/doc/src/commands/cargo-test.md
+++ b/src/doc/src/commands/cargo-test.md
@@ -263,9 +263,14 @@ target artifacts are placed in a separate directory. See the
--release
-
Test optimized artifacts with the release profile. See the
-PROFILES section for details on how this affects profile
-selection.
+
Test optimized artifacts with the release profile.
+See also the --profile option for choosing a specific profile by name.
+
+
+
+
--profilename
+
Test with the given profile.
+See the the reference for more details on profiles.
@@ -432,32 +437,6 @@ the number of CPUs.
-## PROFILES
-
-Profiles may be used to configure compiler options such as optimization levels
-and debug settings. See [the reference](../reference/profiles.html) for more
-details.
-
-Profile selection depends on the target and crate being built. By default the
-`dev` or `test` profiles are used. If the `--release` flag is given, then the
-`release` or `bench` profiles are used.
-
-Target | Default Profile | `--release` Profile
--------|-----------------|---------------------
-lib, bin, example | `dev` | `release`
-test, bench, or any target in "test" or "bench" mode | `test` | `bench`
-
-Dependencies use the `dev`/`release` profiles.
-
-
-Unit tests are separate executable artifacts which use the `test`/`bench`
-profiles. Example targets are built the same as with `cargo build` (using the
-`dev`/`release` profiles) unless you are building them with the test harness
-(by setting `test = true` in the manifest or using the `--example` flag) in
-which case they use the `test`/`bench` profiles. Library targets are built
-with the `dev`/`release` profiles when linked to an integration test, binary,
-or doctest.
-
## ENVIRONMENT
See [the reference](../reference/environment-variables.html) for
diff --git a/src/doc/src/guide/build-cache.md b/src/doc/src/guide/build-cache.md
index 18bb2df0b7a..a8453f615fb 100644
--- a/src/doc/src/guide/build-cache.md
+++ b/src/doc/src/guide/build-cache.md
@@ -9,21 +9,27 @@ value, or the `--target-dir` command-line flag.
The directory layout depends on whether or not you are using the `--target`
flag to build for a specific platform. If `--target` is not specified, Cargo
runs in a mode where it builds for the host architecture. The output goes into
-the root of the target directory, separated based on whether or not it is a
-release build:
+the root of the target directory, with each [profile] stored in a separate
+subdirectory:
Directory | Description
----------|------------
-target/debug/ | Contains debug build output.
-target/release/ | Contains release build output (with `--release` flag).
+target/debug/ | Contains output for the `dev` profile.
+target/release/ | Contains output for the `release` profile (with the `--release` option).
+target/foo/ | Contains build output for the `foo` profile (with the `--profile=foo` option).
+
+For historical reasons, the `dev` and `test` profiles are stored in the
+`debug` directory, and the `release` and `bench` profiles are stored in the
+`release` directory. User-defined profiles are stored in a directory with the
+same name as the profile.
When building for another target with `--target`, the output is placed in a
directory with the name of the target:
Directory | Example
----------|--------
-target/<triple>/debug/ | target/thumbv7em-none-eabihf/debug/
-target/<triple>/release/ | target/thumbv7em-none-eabihf/release/
+target/<triple>/debug/ | target/thumbv7em-none-eabihf/debug/
+target/<triple>/release/ | target/thumbv7em-none-eabihf/release/
> **Note**: When not using `--target`, this has a consequence that Cargo will
> share your dependencies with build scripts and proc macros. [`RUSTFLAGS`]
@@ -31,13 +37,13 @@ Directory | Example
> build scripts and proc macros are built separately (for the host
> architecture), and do not share `RUSTFLAGS`.
-Within the profile directory (`debug` or `release`), artifacts are placed into
-the following directories:
+Within the profile directory (such as `debug` or `release`), artifacts are
+placed into the following directories:
Directory | Description
----------|------------
-target/debug/ | Contains the output of the package being built (the `[[bin]]` executables and `[lib]` library targets).
-target/debug/examples/ | Contains examples (`[[example]]` targets).
+target/debug/ | Contains the output of the package being built (the [binary executables] and [library targets]).
+target/debug/examples/ | Contains [example targets].
Some commands place their output in dedicated directories in the top level of
the `target` directory:
@@ -53,9 +59,9 @@ change. Some of these directories are:
Directory | Description
----------|------------
-target/debug/deps/ | Dependencies and other artifacts.
-target/debug/incremental/ | `rustc` [incremental output], a cache used to speed up subsequent builds.
-target/debug/build/ | Output from [build scripts].
+target/debug/deps/ | Dependencies and other artifacts.
+target/debug/incremental/ | `rustc` [incremental output], a cache used to speed up subsequent builds.
+target/debug/build/ | Output from [build scripts].
### Dep-info files
@@ -95,3 +101,7 @@ configuration][config]. Refer to sccache documentation for more details.
[environment variable]: ../reference/environment-variables.md
[incremental output]: ../reference/profiles.md#incremental
[sccache]: https://github.com/mozilla/sccache
+[profile]: ../reference/profiles.md
+[binary executables]: ../reference/cargo-targets.md#binaries
+[library targets]: ../reference/cargo-targets.md#library
+[example targets]: ../reference/cargo-targets.md#examples
diff --git a/src/doc/src/images/profile-selection.svg b/src/doc/src/images/profile-selection.svg
deleted file mode 100644
index 4975383bf76..00000000000
--- a/src/doc/src/images/profile-selection.svg
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
\ No newline at end of file
diff --git a/src/doc/src/reference/environment-variables.md b/src/doc/src/reference/environment-variables.md
index 72f035d68e0..b0a2bb34d63 100644
--- a/src/doc/src/reference/environment-variables.md
+++ b/src/doc/src/reference/environment-variables.md
@@ -333,7 +333,11 @@ let out_dir = env::var("OUT_DIR").unwrap();
compatible [jobserver] for sub-make invocations.
* `OPT_LEVEL`, `DEBUG` — values of the corresponding variables for the
profile currently being built.
-* `PROFILE` — `release` for release builds, `debug` for other builds.
+* `PROFILE` — `release` for release builds, `debug` for other builds. This is
+ determined based on if the [profile] inherits from the [`dev`] or
+ [`release`] profile. Using this environment variable is not recommended.
+ Using other environment variables like `OPT_LEVEL` provide a more correct
+ view of the actual settings being used.
* `DEP__` — For more information about this set of environment
variables, see build script documentation about [`links`][links].
* `RUSTC`, `RUSTDOC` — the compiler and documentation generator that Cargo has
@@ -371,6 +375,9 @@ let out_dir = env::var("OUT_DIR").unwrap();
[cargo-config]: config.md
[Target Triple]: ../appendix/glossary.md#target
[variables set for crates]: #environment-variables-cargo-sets-for-crates
+[profile]: profiles.md
+[`dev`]: profiles.md#dev
+[`release`]: profiles.md#release
### Environment variables Cargo sets for 3rd party subcommands
diff --git a/src/doc/src/reference/profiles.md b/src/doc/src/reference/profiles.md
index 1f4248a1533..1732c491e72 100644
--- a/src/doc/src/reference/profiles.md
+++ b/src/doc/src/reference/profiles.md
@@ -3,10 +3,10 @@
Profiles provide a way to alter the compiler settings, influencing things like
optimizations and debugging symbols.
-Cargo has 4 built-in profiles: `dev`, `release`, `test`, and `bench`. It
-automatically chooses the profile based on which command is being run, the
-package and target that is being built, and command-line flags like
-`--release`. The selection process is [described below](#profile-selection).
+Cargo has 4 built-in profiles: `dev`, `release`, `test`, and `bench`. The
+profile is automatically chosen based on which command is being run if a
+profile is not specified on the command-line. In addition to the built-in
+profiles, custom user-defined profiles can also be specified.
Profile settings can be changed in [`Cargo.toml`](manifest.md) with the
`[profile]` table. Within each named profile, individual settings can be changed
@@ -267,44 +267,14 @@ rpath = false
#### test
The `test` profile is used for building tests, or when benchmarks are built in
-debug mode with `cargo build`.
-
-The default settings for the `test` profile are:
-
-```toml
-[profile.test]
-opt-level = 0
-debug = 2
-split-debuginfo = '...' # Platform-specific.
-debug-assertions = true
-overflow-checks = true
-lto = false
-panic = 'unwind' # This setting is always ignored.
-incremental = true
-codegen-units = 256
-rpath = false
-```
+debug mode with `cargo build`. By default, the `test` profile inherits the
+settings from the [`dev`](#dev) profile.
#### bench
The `bench` profile is used for building benchmarks, or when tests are built
-with the `--release` flag.
-
-The default settings for the `bench` profile are:
-
-```toml
-[profile.bench]
-opt-level = 3
-debug = false
-split-debuginfo = '...' # Platform-specific.
-debug-assertions = false
-overflow-checks = false
-lto = false
-panic = 'unwind' # This setting is always ignored.
-incremental = false
-codegen-units = 16
-rpath = false
-```
+with the `--release` flag. By default, the `bench` profile inherits the
+settings from the [`release`](#release) profile.
#### Build Dependencies
@@ -325,35 +295,50 @@ codegen-units = 256
Build dependencies otherwise inherit settings from the active profile in use, as
described below.
-### Profile selection
+### Custom profiles
+
+In addition to the built-in profiles, additional custom profiles can be
+defined. These may be useful for setting up multiple workflows and build
+modes. When defining a custom profile, you must specify the `inherits` key to
+specify which profile the custom profile inherits settings from when the
+setting is not specified.
+
+For example, let's say you want to compare a normal release build with a
+release build with [LTO](#lto) optimizations, you can specify something like
+the following in `Cargo.toml`:
+
+```toml
+[profile.release-lto]
+inherits = "release"
+lto = true
+```
-The profile used depends on the command, the package, the Cargo target, and
-command-line flags like `--release`.
+The `--profile` flag can then be used to choose this custom profile:
-Build commands like [`cargo build`], [`cargo rustc`], [`cargo check`], and
-[`cargo run`] default to using the `dev` profile. The `--release` flag may be
-used to switch to the `release` profile.
+```console
+cargo build --profile release-lto
+```
-The [`cargo install`] command defaults to the `release` profile, and may use
-the `--debug` flag to switch to the `dev` profile.
+The output for each profile will be placed in a directory of the same name
+as the profile in the [`target` directory]. As in the example above, the
+output would go into the `target/release-lto` directory.
-Test targets are built with the `test` profile by default. The `--release`
-flag switches tests to the `bench` profile.
+[`target` directory]: ../guide/build-cache.md
-Bench targets are built with the `bench` profile by default. The [`cargo
-build`] command can be used to build a bench target with the `test` profile to
-enable debugging.
+### Profile selection
-Note that when using the [`cargo test`] and [`cargo bench`] commands, the
-`test`/`bench` profiles only apply to the final test executable. Dependencies
-will continue to use the `dev`/`release` profiles. Also note that when a
-library is built for unit tests, then the library is built with the `test`
-profile. However, when building an integration test target, the library target
-is built with the `dev` profile and linked into the integration test
-executable.
+The profile used depends on the command, the command-line flags like
+`--release` or `--profile`, and the package (in the case of
+[overrides](#overrides)). The default profile if none is specified is:
-
+* Build commands like [`cargo build`], [`cargo rustc`], [`cargo check`], and
+[`cargo run`]: [`dev` profile](#dev)
+* [`cargo test`]: [`test` profile](#test)
+* [`cargo bench`]: [`bench` profile](#bench)
+* [`cargo install`]: [`release` profile](#release)
+The profile for specific packages can be specified with
+[overrides](#overrides), described below.
[`cargo bench`]: ../commands/cargo-bench.md
[`cargo build`]: ../commands/cargo-build.md
diff --git a/src/doc/src/reference/unstable.md b/src/doc/src/reference/unstable.md
index c27b0085582..ae550d7e5c2 100644
--- a/src/doc/src/reference/unstable.md
+++ b/src/doc/src/reference/unstable.md
@@ -87,7 +87,6 @@ Each new feature described below should explain how to use it.
* [`doctest-in-workspace`](#doctest-in-workspace) — Fixes workspace-relative paths when running doctests.
* [rustdoc-map](#rustdoc-map) — Provides mappings for documentation to link to external sites like [docs.rs](https://docs.rs/).
* `Cargo.toml` extensions
- * [Custom named profiles](#custom-named-profiles) — Adds custom named profiles in addition to the standard names.
* [Profile `strip` option](#profile-strip-option) — Forces the removal of debug information and symbols from executables.
* [per-package-target](#per-package-target) — Sets the `--target` to use for each individual package.
* Information and metadata
@@ -238,49 +237,6 @@ or running tests for both targets:
cargo test --target x86_64-unknown-linux-gnu --target i686-unknown-linux-gnu
```
-### Custom named profiles
-
-* Tracking Issue: [rust-lang/cargo#6988](https://github.com/rust-lang/cargo/issues/6988)
-* RFC: [#2678](https://github.com/rust-lang/rfcs/pull/2678)
-
-With this feature you can define custom profiles having new names. With the
-custom profile enabled, build artifacts can be emitted by default to
-directories other than `release` or `debug`, based on the custom profile's
-name.
-
-For example:
-
-```toml
-cargo-features = ["named-profiles"]
-
-[profile.release-lto]
-inherits = "release"
-lto = true
-````
-
-An `inherits` key is used in order to receive attributes from other profiles,
-so that a new custom profile can be based on the standard `dev` or `release`
-profile presets. Cargo emits errors in case `inherits` loops are detected. When
-considering inheritance hierarchy, all profiles directly or indirectly inherit
-from either from `release` or from `dev`.
-
-Valid profile names are: must not be empty, use only alphanumeric characters or
-`-` or `_`.
-
-Passing `--profile` with the profile's name to various Cargo commands, directs
-operations to use the profile's attributes. Overrides that are specified in the
-profiles from which the custom profile inherits are inherited too.
-
-For example, using `cargo build` with `--profile` and the manifest from above:
-
-```sh
-cargo +nightly build --profile release-lto -Z unstable-options
-```
-
-When a custom profile is used, build artifacts go to a different target by
-default. In the example above, you can expect to see the outputs under
-`target/release-lto`.
-
#### New `dir-name` attribute
@@ -1421,3 +1377,8 @@ information.
The 2021 edition has been stabilized in the 1.56 release.
See the [`edition` field](manifest.md#the-edition-field) for more information on setting the edition.
See [`cargo fix --edition`](../commands/cargo-fix.md) and [The Edition Guide](../../edition-guide/index.html) for more information on migrating existing projects.
+
+### Custom named profiles
+
+Custom named profiles have been stabilized in the 1.57 release. See the
+[profiles chapter](profiles.md#custom-profiles) for more information.
diff --git a/src/etc/man/cargo-bench.1 b/src/etc/man/cargo-bench.1
index a8239d002d9..5d8df036bfb 100644
--- a/src/etc/man/cargo-bench.1
+++ b/src/etc/man/cargo-bench.1
@@ -50,6 +50,12 @@ running benchmarks on the stable channel, such as
.br
.RE
.ll
+.sp
+By default, \fBcargo bench\fR uses the \fI\f(BIbench\fI profile\fR , which enables
+optimizations and disables debugging information. If you need to debug a
+benchmark, you can use the \fB\-\-profile=dev\fR command\-line option to switch to
+the dev profile. You can then run the debug\-enabled benchmark within a
+debugger.
.SH "OPTIONS"
.SS "Benchmark Options"
.sp
@@ -251,6 +257,12 @@ target artifacts are placed in a separate directory. See the
\fIbuild cache\fR documentation for more details.
.RE
.sp
+\fB\-\-profile\fR \fIname\fR
+.RS 4
+Benchmark with the given profile.
+See the \fIthe reference\fR for more details on profiles.
+.RE
+.sp
\fB\-\-ignore\-rust\-version\fR
.RS 4
Benchmark the target even if the selected Rust compiler is older than the
@@ -420,21 +432,6 @@ Number of parallel jobs to run. May also be specified with the
\fBbuild.jobs\fR \fIconfig value\fR \&. Defaults to
the number of CPUs.
.RE
-.SH "PROFILES"
-Profiles may be used to configure compiler options such as optimization levels
-and debug settings. See
-\fIthe reference\fR
-for more details.
-.sp
-Benchmarks are always built with the \fBbench\fR profile. Binary and lib targets
-are built separately as benchmarks with the \fBbench\fR profile. Library targets
-are built with the \fBrelease\fR profiles when linked to binaries and benchmarks.
-Dependencies use the \fBrelease\fR profile.
-.sp
-If you need a debug build of a benchmark, try building it with
-\fBcargo\-build\fR(1) which will use the \fBtest\fR profile which is by default
-unoptimized and includes debug information. You can then run the debug\-enabled
-benchmark manually.
.SH "ENVIRONMENT"
See \fIthe reference\fR for
details on environment variables that Cargo reads.
diff --git a/src/etc/man/cargo-build.1 b/src/etc/man/cargo-build.1
index 4eaea1bc5a7..bdee1436b94 100644
--- a/src/etc/man/cargo-build.1
+++ b/src/etc/man/cargo-build.1
@@ -171,9 +171,14 @@ target artifacts are placed in a separate directory. See the
.sp
\fB\-\-release\fR
.RS 4
-Build optimized artifacts with the \fBrelease\fR profile. See the
-PROFILES section for details on how this affects profile
-selection.
+Build optimized artifacts with the \fBrelease\fR profile.
+See also the \fB\-\-profile\fR option for choosing a specific profile by name.
+.RE
+.sp
+\fB\-\-profile\fR \fIname\fR
+.RS 4
+Build with the given profile.
+See the \fIthe reference\fR for more details on profiles.
.RE
.sp
\fB\-\-ignore\-rust\-version\fR
@@ -354,43 +359,6 @@ Number of parallel jobs to run. May also be specified with the
\fBbuild.jobs\fR \fIconfig value\fR \&. Defaults to
the number of CPUs.
.RE
-.SH "PROFILES"
-Profiles may be used to configure compiler options such as optimization levels
-and debug settings. See \fIthe reference\fR for more
-details.
-.sp
-Profile selection depends on the target and crate being built. By default the
-\fBdev\fR or \fBtest\fR profiles are used. If the \fB\-\-release\fR flag is given, then the
-\fBrelease\fR or \fBbench\fR profiles are used.
-
-.TS
-allbox tab(:);
-lt lt lt.
-T{
-Target
-T}:T{
-Default Profile
-T}:T{
-\fB\-\-release\fR Profile
-T}
-T{
-lib, bin, example
-T}:T{
-\fBdev\fR
-T}:T{
-\fBrelease\fR
-T}
-T{
-test, bench, or any target in "test" or "bench" mode
-T}:T{
-\fBtest\fR
-T}:T{
-\fBbench\fR
-T}
-.TE
-.sp
-.sp
-Dependencies use the \fBdev\fR/\fBrelease\fR profiles.
.SH "ENVIRONMENT"
See \fIthe reference\fR for
details on environment variables that Cargo reads.
diff --git a/src/etc/man/cargo-check.1 b/src/etc/man/cargo-check.1
index 7c6b2ea17d2..a1456e9832e 100644
--- a/src/etc/man/cargo-check.1
+++ b/src/etc/man/cargo-check.1
@@ -176,18 +176,20 @@ target artifacts are placed in a separate directory. See the
.sp
\fB\-\-release\fR
.RS 4
-Check optimized artifacts with the \fBrelease\fR profile. See the
-PROFILES section for details on how this affects profile
-selection.
+Check optimized artifacts with the \fBrelease\fR profile.
+See also the \fB\-\-profile\fR option for choosing a specific profile by name.
.RE
.sp
\fB\-\-profile\fR \fIname\fR
.RS 4
-Changes check behavior. Currently only \fBtest\fR is supported,
-which will check with the \fB#[cfg(test)]\fR attribute enabled.
-This is useful to have it check unit tests which are usually
-excluded via the \fBcfg\fR attribute. This does not change the actual profile
-used.
+Check with the given profile.
+.sp
+As a special case, specifying the \fBtest\fR profile will also enable checking in
+test mode which will enable checking tests and enable the \fBtest\fR cfg option.
+See \fIrustc tests\fR for more
+detail.
+.sp
+See the \fIthe reference\fR for more details on profiles.
.RE
.sp
\fB\-\-ignore\-rust\-version\fR
@@ -347,43 +349,6 @@ Number of parallel jobs to run. May also be specified with the
\fBbuild.jobs\fR \fIconfig value\fR \&. Defaults to
the number of CPUs.
.RE
-.SH "PROFILES"
-Profiles may be used to configure compiler options such as optimization levels
-and debug settings. See \fIthe reference\fR for more
-details.
-.sp
-Profile selection depends on the target and crate being built. By default the
-\fBdev\fR or \fBtest\fR profiles are used. If the \fB\-\-release\fR flag is given, then the
-\fBrelease\fR or \fBbench\fR profiles are used.
-
-.TS
-allbox tab(:);
-lt lt lt.
-T{
-Target
-T}:T{
-Default Profile
-T}:T{
-\fB\-\-release\fR Profile
-T}
-T{
-lib, bin, example
-T}:T{
-\fBdev\fR
-T}:T{
-\fBrelease\fR
-T}
-T{
-test, bench, or any target in "test" or "bench" mode
-T}:T{
-\fBtest\fR
-T}:T{
-\fBbench\fR
-T}
-.TE
-.sp
-.sp
-Dependencies use the \fBdev\fR/\fBrelease\fR profiles.
.SH "ENVIRONMENT"
See \fIthe reference\fR for
details on environment variables that Cargo reads.
diff --git a/src/etc/man/cargo-clean.1 b/src/etc/man/cargo-clean.1
index 0836166e677..01823d991d8 100644
--- a/src/etc/man/cargo-clean.1
+++ b/src/etc/man/cargo-clean.1
@@ -33,7 +33,12 @@ the target directory.
.sp
\fB\-\-release\fR
.RS 4
-Clean all artifacts that were built with the \fBrelease\fR or \fBbench\fR profiles.
+Remove all artifacts in the \fBrelease\fR directory.
+.RE
+.sp
+\fB\-\-profile\fR \fIname\fR
+.RS 4
+Remove all artifacts in the directory with the given profile name.
.RE
.sp
\fB\-\-target\-dir\fR \fIdirectory\fR
diff --git a/src/etc/man/cargo-doc.1 b/src/etc/man/cargo-doc.1
index 045795bb3ac..32ac9feaf11 100644
--- a/src/etc/man/cargo-doc.1
+++ b/src/etc/man/cargo-doc.1
@@ -149,9 +149,14 @@ target artifacts are placed in a separate directory. See the
.sp
\fB\-\-release\fR
.RS 4
-Document optimized artifacts with the \fBrelease\fR profile. See the
-PROFILES section for details on how this affects profile
-selection.
+Document optimized artifacts with the \fBrelease\fR profile.
+See also the \fB\-\-profile\fR option for choosing a specific profile by name.
+.RE
+.sp
+\fB\-\-profile\fR \fIname\fR
+.RS 4
+Document with the given profile.
+See the \fIthe reference\fR for more details on profiles.
.RE
.sp
\fB\-\-ignore\-rust\-version\fR
@@ -311,43 +316,6 @@ Number of parallel jobs to run. May also be specified with the
\fBbuild.jobs\fR \fIconfig value\fR \&. Defaults to
the number of CPUs.
.RE
-.SH "PROFILES"
-Profiles may be used to configure compiler options such as optimization levels
-and debug settings. See \fIthe reference\fR for more
-details.
-.sp
-Profile selection depends on the target and crate being built. By default the
-\fBdev\fR or \fBtest\fR profiles are used. If the \fB\-\-release\fR flag is given, then the
-\fBrelease\fR or \fBbench\fR profiles are used.
-
-.TS
-allbox tab(:);
-lt lt lt.
-T{
-Target
-T}:T{
-Default Profile
-T}:T{
-\fB\-\-release\fR Profile
-T}
-T{
-lib, bin, example
-T}:T{
-\fBdev\fR
-T}:T{
-\fBrelease\fR
-T}
-T{
-test, bench, or any target in "test" or "bench" mode
-T}:T{
-\fBtest\fR
-T}:T{
-\fBbench\fR
-T}
-.TE
-.sp
-.sp
-Dependencies use the \fBdev\fR/\fBrelease\fR profiles.
.SH "ENVIRONMENT"
See \fIthe reference\fR for
details on environment variables that Cargo reads.
diff --git a/src/etc/man/cargo-fix.1 b/src/etc/man/cargo-fix.1
index 57eb1da015f..97c34bb0139 100644
--- a/src/etc/man/cargo-fix.1
+++ b/src/etc/man/cargo-fix.1
@@ -271,18 +271,20 @@ target artifacts are placed in a separate directory. See the
.sp
\fB\-\-release\fR
.RS 4
-Fix optimized artifacts with the \fBrelease\fR profile. See the
-PROFILES section for details on how this affects profile
-selection.
+Fix optimized artifacts with the \fBrelease\fR profile.
+See also the \fB\-\-profile\fR option for choosing a specific profile by name.
.RE
.sp
\fB\-\-profile\fR \fIname\fR
.RS 4
-Changes fix behavior. Currently only \fBtest\fR is supported,
-which will fix with the \fB#[cfg(test)]\fR attribute enabled.
-This is useful to have it fix unit tests which are usually
-excluded via the \fBcfg\fR attribute. This does not change the actual profile
-used.
+Fix with the given profile.
+.sp
+As a special case, specifying the \fBtest\fR profile will also enable checking in
+test mode which will enable checking tests and enable the \fBtest\fR cfg option.
+See \fIrustc tests\fR for more
+detail.
+.sp
+See the \fIthe reference\fR for more details on profiles.
.RE
.sp
\fB\-\-ignore\-rust\-version\fR
@@ -442,43 +444,6 @@ Number of parallel jobs to run. May also be specified with the
\fBbuild.jobs\fR \fIconfig value\fR \&. Defaults to
the number of CPUs.
.RE
-.SH "PROFILES"
-Profiles may be used to configure compiler options such as optimization levels
-and debug settings. See \fIthe reference\fR for more
-details.
-.sp
-Profile selection depends on the target and crate being built. By default the
-\fBdev\fR or \fBtest\fR profiles are used. If the \fB\-\-release\fR flag is given, then the
-\fBrelease\fR or \fBbench\fR profiles are used.
-
-.TS
-allbox tab(:);
-lt lt lt.
-T{
-Target
-T}:T{
-Default Profile
-T}:T{
-\fB\-\-release\fR Profile
-T}
-T{
-lib, bin, example
-T}:T{
-\fBdev\fR
-T}:T{
-\fBrelease\fR
-T}
-T{
-test, bench, or any target in "test" or "bench" mode
-T}:T{
-\fBtest\fR
-T}:T{
-\fBbench\fR
-T}
-.TE
-.sp
-.sp
-Dependencies use the \fBdev\fR/\fBrelease\fR profiles.
.SH "ENVIRONMENT"
See \fIthe reference\fR for
details on environment variables that Cargo reads.
diff --git a/src/etc/man/cargo-install.1 b/src/etc/man/cargo-install.1
index 1840182a258..139140279cb 100644
--- a/src/etc/man/cargo-install.1
+++ b/src/etc/man/cargo-install.1
@@ -71,7 +71,7 @@ change, then Cargo will reinstall the package:
.RE
.sp
.RS 4
-\h'-04'\(bu\h'+02'The release mode (\fB\-\-debug\fR).
+\h'-04'\(bu\h'+02'The profile (\fB\-\-profile\fR).
.RE
.sp
.RS 4
@@ -258,6 +258,13 @@ is specified.
\fB\-\-debug\fR
.RS 4
Build with the \fBdev\fR profile instead the \fBrelease\fR profile.
+See also the \fB\-\-profile\fR option for choosing a specific profile by name.
+.RE
+.sp
+\fB\-\-profile\fR \fIname\fR
+.RS 4
+Install with the given profile.
+See the \fIthe reference\fR for more details on profiles.
.RE
.SS "Manifest Options"
.sp
diff --git a/src/etc/man/cargo-run.1 b/src/etc/man/cargo-run.1
index c4ff6e444bf..c332d94bda4 100644
--- a/src/etc/man/cargo-run.1
+++ b/src/etc/man/cargo-run.1
@@ -82,9 +82,14 @@ target artifacts are placed in a separate directory. See the
.sp
\fB\-\-release\fR
.RS 4
-Run optimized artifacts with the \fBrelease\fR profile. See the
-PROFILES section for details on how this affects profile
-selection.
+Run optimized artifacts with the \fBrelease\fR profile.
+See also the \fB\-\-profile\fR option for choosing a specific profile by name.
+.RE
+.sp
+\fB\-\-profile\fR \fIname\fR
+.RS 4
+Run with the given profile.
+See the \fIthe reference\fR for more details on profiles.
.RE
.sp
\fB\-\-ignore\-rust\-version\fR
@@ -244,43 +249,6 @@ Number of parallel jobs to run. May also be specified with the
\fBbuild.jobs\fR \fIconfig value\fR \&. Defaults to
the number of CPUs.
.RE
-.SH "PROFILES"
-Profiles may be used to configure compiler options such as optimization levels
-and debug settings. See \fIthe reference\fR for more
-details.
-.sp
-Profile selection depends on the target and crate being built. By default the
-\fBdev\fR or \fBtest\fR profiles are used. If the \fB\-\-release\fR flag is given, then the
-\fBrelease\fR or \fBbench\fR profiles are used.
-
-.TS
-allbox tab(:);
-lt lt lt.
-T{
-Target
-T}:T{
-Default Profile
-T}:T{
-\fB\-\-release\fR Profile
-T}
-T{
-lib, bin, example
-T}:T{
-\fBdev\fR
-T}:T{
-\fBrelease\fR
-T}
-T{
-test, bench, or any target in "test" or "bench" mode
-T}:T{
-\fBtest\fR
-T}:T{
-\fBbench\fR
-T}
-.TE
-.sp
-.sp
-Dependencies use the \fBdev\fR/\fBrelease\fR profiles.
.SH "ENVIRONMENT"
See \fIthe reference\fR for
details on environment variables that Cargo reads.
diff --git a/src/etc/man/cargo-rustc.1 b/src/etc/man/cargo-rustc.1
index 5a69821c6e1..6daf5a3f37e 100644
--- a/src/etc/man/cargo-rustc.1
+++ b/src/etc/man/cargo-rustc.1
@@ -157,9 +157,34 @@ target artifacts are placed in a separate directory. See the
.sp
\fB\-\-release\fR
.RS 4
-Build optimized artifacts with the \fBrelease\fR profile. See the
-PROFILES section for details on how this affects profile
-selection.
+Build optimized artifacts with the \fBrelease\fR profile.
+See also the \fB\-\-profile\fR option for choosing a specific profile by name.
+.RE
+.sp
+\fB\-\-profile\fR \fIname\fR
+.RS 4
+Build with the given profile.
+.sp
+The \fBrustc\fR subcommand will treat the following named profiles with special behaviors:
+.sp
+.RS 4
+\h'-04'\(bu\h'+02'\fBcheck\fR \[em] Builds in the same way as the \fBcargo\-check\fR(1) command with
+the \fBdev\fR profile.
+.RE
+.sp
+.RS 4
+\h'-04'\(bu\h'+02'\fBtest\fR \[em] Builds in the same way as the \fBcargo\-test\fR(1) command,
+enabling building in test mode which will enable tests and enable the \fBtest\fR
+cfg option. See \fIrustc
+tests\fR for more detail.
+.RE
+.sp
+.RS 4
+\h'-04'\(bu\h'+02'\fBbench\fR \[em] Builds in the same was as the \fBcargo\-bench\fR(1) command,
+similar to the \fBtest\fR profile.
+.RE
+.sp
+See the \fIthe reference\fR for more details on profiles.
.RE
.sp
\fB\-\-ignore\-rust\-version\fR
@@ -319,43 +344,6 @@ Number of parallel jobs to run. May also be specified with the
\fBbuild.jobs\fR \fIconfig value\fR \&. Defaults to
the number of CPUs.
.RE
-.SH "PROFILES"
-Profiles may be used to configure compiler options such as optimization levels
-and debug settings. See \fIthe reference\fR for more
-details.
-.sp
-Profile selection depends on the target and crate being built. By default the
-\fBdev\fR or \fBtest\fR profiles are used. If the \fB\-\-release\fR flag is given, then the
-\fBrelease\fR or \fBbench\fR profiles are used.
-
-.TS
-allbox tab(:);
-lt lt lt.
-T{
-Target
-T}:T{
-Default Profile
-T}:T{
-\fB\-\-release\fR Profile
-T}
-T{
-lib, bin, example
-T}:T{
-\fBdev\fR
-T}:T{
-\fBrelease\fR
-T}
-T{
-test, bench, or any target in "test" or "bench" mode
-T}:T{
-\fBtest\fR
-T}:T{
-\fBbench\fR
-T}
-.TE
-.sp
-.sp
-Dependencies use the \fBdev\fR/\fBrelease\fR profiles.
.SH "ENVIRONMENT"
See \fIthe reference\fR for
details on environment variables that Cargo reads.
diff --git a/src/etc/man/cargo-rustdoc.1 b/src/etc/man/cargo-rustdoc.1
index 2a9af8cf6b1..ad5cfbb187e 100644
--- a/src/etc/man/cargo-rustdoc.1
+++ b/src/etc/man/cargo-rustdoc.1
@@ -168,9 +168,14 @@ target artifacts are placed in a separate directory. See the
.sp
\fB\-\-release\fR
.RS 4
-Document optimized artifacts with the \fBrelease\fR profile. See the
-PROFILES section for details on how this affects profile
-selection.
+Document optimized artifacts with the \fBrelease\fR profile.
+See also the \fB\-\-profile\fR option for choosing a specific profile by name.
+.RE
+.sp
+\fB\-\-profile\fR \fIname\fR
+.RS 4
+Document with the given profile.
+See the \fIthe reference\fR for more details on profiles.
.RE
.sp
\fB\-\-ignore\-rust\-version\fR
@@ -330,43 +335,6 @@ Number of parallel jobs to run. May also be specified with the
\fBbuild.jobs\fR \fIconfig value\fR \&. Defaults to
the number of CPUs.
.RE
-.SH "PROFILES"
-Profiles may be used to configure compiler options such as optimization levels
-and debug settings. See \fIthe reference\fR for more
-details.
-.sp
-Profile selection depends on the target and crate being built. By default the
-\fBdev\fR or \fBtest\fR profiles are used. If the \fB\-\-release\fR flag is given, then the
-\fBrelease\fR or \fBbench\fR profiles are used.
-
-.TS
-allbox tab(:);
-lt lt lt.
-T{
-Target
-T}:T{
-Default Profile
-T}:T{
-\fB\-\-release\fR Profile
-T}
-T{
-lib, bin, example
-T}:T{
-\fBdev\fR
-T}:T{
-\fBrelease\fR
-T}
-T{
-test, bench, or any target in "test" or "bench" mode
-T}:T{
-\fBtest\fR
-T}:T{
-\fBbench\fR
-T}
-.TE
-.sp
-.sp
-Dependencies use the \fBdev\fR/\fBrelease\fR profiles.
.SH "ENVIRONMENT"
See \fIthe reference\fR for
details on environment variables that Cargo reads.
diff --git a/src/etc/man/cargo-test.1 b/src/etc/man/cargo-test.1
index bafeb08662e..ee0d3cf3929 100644
--- a/src/etc/man/cargo-test.1
+++ b/src/etc/man/cargo-test.1
@@ -268,9 +268,14 @@ target artifacts are placed in a separate directory. See the
.sp
\fB\-\-release\fR
.RS 4
-Test optimized artifacts with the \fBrelease\fR profile. See the
-PROFILES section for details on how this affects profile
-selection.
+Test optimized artifacts with the \fBrelease\fR profile.
+See also the \fB\-\-profile\fR option for choosing a specific profile by name.
+.RE
+.sp
+\fB\-\-profile\fR \fIname\fR
+.RS 4
+Test with the given profile.
+See the \fIthe reference\fR for more details on profiles.
.RE
.sp
\fB\-\-ignore\-rust\-version\fR
@@ -448,51 +453,6 @@ Number of parallel jobs to run. May also be specified with the
\fBbuild.jobs\fR \fIconfig value\fR \&. Defaults to
the number of CPUs.
.RE
-.SH "PROFILES"
-Profiles may be used to configure compiler options such as optimization levels
-and debug settings. See \fIthe reference\fR for more
-details.
-.sp
-Profile selection depends on the target and crate being built. By default the
-\fBdev\fR or \fBtest\fR profiles are used. If the \fB\-\-release\fR flag is given, then the
-\fBrelease\fR or \fBbench\fR profiles are used.
-
-.TS
-allbox tab(:);
-lt lt lt.
-T{
-Target
-T}:T{
-Default Profile
-T}:T{
-\fB\-\-release\fR Profile
-T}
-T{
-lib, bin, example
-T}:T{
-\fBdev\fR
-T}:T{
-\fBrelease\fR
-T}
-T{
-test, bench, or any target in "test" or "bench" mode
-T}:T{
-\fBtest\fR
-T}:T{
-\fBbench\fR
-T}
-.TE
-.sp
-.sp
-Dependencies use the \fBdev\fR/\fBrelease\fR profiles.
-.sp
-Unit tests are separate executable artifacts which use the \fBtest\fR/\fBbench\fR
-profiles. Example targets are built the same as with \fBcargo build\fR (using the
-\fBdev\fR/\fBrelease\fR profiles) unless you are building them with the test harness
-(by setting \fBtest = true\fR in the manifest or using the \fB\-\-example\fR flag) in
-which case they use the \fBtest\fR/\fBbench\fR profiles. Library targets are built
-with the \fBdev\fR/\fBrelease\fR profiles when linked to an integration test, binary,
-or doctest.
.SH "ENVIRONMENT"
See \fIthe reference\fR for
details on environment variables that Cargo reads.
diff --git a/tests/testsuite/lto.rs b/tests/testsuite/lto.rs
index 5b431fdb298..a7d92934d04 100644
--- a/tests/testsuite/lto.rs
+++ b/tests/testsuite/lto.rs
@@ -351,6 +351,15 @@ fn test_all_and_bench() {
.run();
}
+/// Basic setup:
+///
+/// foo v0.0.0
+/// ├── bar v0.0.0
+/// │ ├── registry v0.0.1
+/// │ └── registry-shared v0.0.1
+/// └── registry-shared v0.0.1
+///
+/// Where `bar` will have the given crate types.
fn project_with_dep(crate_types: &str) -> Project {
Package::new("registry", "0.0.1")
.file("src/lib.rs", r#"pub fn foo() { println!("registry"); }"#)
@@ -419,6 +428,10 @@ fn project_with_dep(crate_types: &str) -> Project {
.build()
}
+/// Helper for checking which LTO behavior is used for a specific crate.
+///
+/// `krate_info` is extra compiler flags used to distinguish this if the same
+/// crate name is being built multiple times.
fn verify_lto(output: &Output, krate: &str, krate_info: &str, expected_lto: Lto) {
let stderr = std::str::from_utf8(&output.stderr).unwrap();
let mut matches = stderr.lines().filter(|line| {
@@ -467,18 +480,22 @@ fn verify_lto(output: &Output, krate: &str, krate_info: &str, expected_lto: Lto)
fn cdylib_and_rlib() {
let p = project_with_dep("'cdylib', 'rlib'");
let output = p.cargo("build --release -v").exec_with_output().unwrap();
+ // `registry` is ObjectAndBitcode because because it needs Object for the
+ // rlib, and Bitcode for the cdylib (which doesn't support LTO).
verify_lto(
&output,
"registry",
"--crate-type lib",
Lto::ObjectAndBitcode,
);
+ // Same as `registry`
verify_lto(
&output,
"registry_shared",
"--crate-type lib",
Lto::ObjectAndBitcode,
);
+ // Same as `registry`
verify_lto(
&output,
"bar",
@@ -493,8 +510,8 @@ fn cdylib_and_rlib() {
[FRESH] registry-shared v0.0.1
[FRESH] bar v0.0.0 [..]
[COMPILING] foo [..]
-[RUNNING] `rustc --crate-name foo [..]-C embed-bitcode=no [..]--test[..]
-[RUNNING] `rustc --crate-name a [..]-C embed-bitcode=no [..]--test[..]
+[RUNNING] `rustc --crate-name foo [..]-C lto [..]--test[..]
+[RUNNING] `rustc --crate-name a [..]-C lto [..]--test[..]
[FINISHED] [..]
[RUNNING] [..]
[RUNNING] [..]
@@ -514,19 +531,16 @@ fn cdylib_and_rlib() {
p.cargo("test --release -v --manifest-path bar/Cargo.toml")
.with_stderr_unordered(
"\
-[COMPILING] registry v0.0.1
-[COMPILING] registry-shared v0.0.1
-[RUNNING] `rustc --crate-name registry [..]-C embed-bitcode=no[..]
-[RUNNING] `rustc --crate-name registry_shared [..]-C embed-bitcode=no[..]
+[FRESH] registry-shared v0.0.1
+[FRESH] registry v0.0.1
[COMPILING] bar [..]
-[RUNNING] `rustc --crate-name bar [..]--crate-type cdylib --crate-type rlib [..]-C embed-bitcode=no[..]
-[RUNNING] `rustc --crate-name bar [..]-C embed-bitcode=no [..]--test[..]
-[RUNNING] `rustc --crate-name b [..]-C embed-bitcode=no [..]--test[..]
+[RUNNING] `rustc --crate-name bar [..]-C lto[..]--test[..]
+[RUNNING] `rustc --crate-name b [..]-C lto[..]--test[..]
[FINISHED] [..]
[RUNNING] [..]target/release/deps/bar-[..]
[RUNNING] [..]target/release/deps/b-[..]
[DOCTEST] bar
-[RUNNING] `rustdoc --crate-type cdylib --crate-type rlib --crate-name bar --test [..]-C embed-bitcode=no[..]
+[RUNNING] `rustdoc --crate-type cdylib --crate-type rlib --crate-name bar --test [..]-C lto[..]
",
)
.run();
@@ -536,15 +550,23 @@ fn cdylib_and_rlib() {
fn dylib() {
let p = project_with_dep("'dylib'");
let output = p.cargo("build --release -v").exec_with_output().unwrap();
+ // `registry` is OnlyObject because rustc doesn't support LTO with dylibs.
verify_lto(&output, "registry", "--crate-type lib", Lto::OnlyObject);
+ // `registry_shared` is both because it is needed by both bar (Object) and
+ // foo (Bitcode for LTO).
verify_lto(
&output,
"registry_shared",
"--crate-type lib",
Lto::ObjectAndBitcode,
);
+ // `bar` is OnlyObject because rustc doesn't support LTO with dylibs.
verify_lto(&output, "bar", "--crate-type dylib", Lto::OnlyObject);
+ // `foo` is LTO because it is a binary, and the profile specifies `lto=true`.
verify_lto(&output, "foo", "--crate-type bin", Lto::Run(None));
+ // `cargo test` should not rebuild dependencies. It builds the test
+ // executables with `lto=true` because the tests are built with the
+ // `--release` flag.
p.cargo("test --release -v")
.with_stderr_unordered(
"\
@@ -552,14 +574,19 @@ fn dylib() {
[FRESH] registry-shared v0.0.1
[FRESH] bar v0.0.0 [..]
[COMPILING] foo [..]
-[RUNNING] `rustc --crate-name foo [..]-C embed-bitcode=no [..]--test[..]
-[RUNNING] `rustc --crate-name a [..]-C embed-bitcode=no [..]--test[..]
+[RUNNING] `rustc --crate-name foo [..]-C lto [..]--test[..]
+[RUNNING] `rustc --crate-name a [..]-C lto [..]--test[..]
[FINISHED] [..]
[RUNNING] [..]
[RUNNING] [..]
",
)
.run();
+ // Building just `bar` causes `registry-shared` to get rebuilt because it
+ // switches to OnlyObject because it is now only being used with a dylib
+ // which does not support LTO.
+ //
+ // `bar` gets rebuilt because `registry_shared` got rebuilt.
p.cargo("build --release -v --manifest-path bar/Cargo.toml")
.with_stderr_unordered(
"\
@@ -572,14 +599,21 @@ fn dylib() {
",
)
.run();
+ // Testing just `bar` causes `registry` to get rebuilt because it switches
+ // to needing both Object (for the `bar` dylib) and Bitcode (for the test
+ // built with LTO).
+ //
+ // `bar` the dylib gets rebuilt because `registry` got rebuilt.
p.cargo("test --release -v --manifest-path bar/Cargo.toml")
.with_stderr_unordered(
"\
[FRESH] registry-shared v0.0.1
-[FRESH] registry v0.0.1
+[COMPILING] registry v0.0.1
+[RUNNING] `rustc --crate-name registry [..]
[COMPILING] bar [..]
-[RUNNING] `rustc --crate-name bar [..]-C embed-bitcode=no [..]--test[..]
-[RUNNING] `rustc --crate-name b [..]-C embed-bitcode=no [..]--test[..]
+[RUNNING] `rustc --crate-name bar [..]--crate-type dylib [..]-C embed-bitcode=no[..]
+[RUNNING] `rustc --crate-name bar [..]-C lto [..]--test[..]
+[RUNNING] `rustc --crate-name b [..]-C lto [..]--test[..]
[FINISHED] [..]
[RUNNING] [..]
[RUNNING] [..]
@@ -640,59 +674,6 @@ fn test_profile() {
.run();
}
-#[cargo_test]
-fn dev_profile() {
- // Mixing dev=LTO with test=not-LTO
- Package::new("bar", "0.0.1")
- .file("src/lib.rs", "pub fn foo() -> i32 { 123 } ")
- .publish();
-
- let p = project()
- .file(
- "Cargo.toml",
- r#"
- [package]
- name = "foo"
- version = "0.1.0"
- edition = "2018"
-
- [profile.dev]
- lto = 'thin'
-
- [dependencies]
- bar = "*"
- "#,
- )
- .file(
- "src/lib.rs",
- r#"
- #[test]
- fn t1() {
- assert_eq!(123, bar::foo());
- }
- "#,
- )
- .build();
-
- p.cargo("test -v")
- // unordered because the two `foo` builds start in parallel
- .with_stderr_unordered("\
-[UPDATING] [..]
-[DOWNLOADING] [..]
-[DOWNLOADED] [..]
-[COMPILING] bar v0.0.1
-[RUNNING] `rustc --crate-name bar [..]crate-type lib[..]
-[COMPILING] foo [..]
-[RUNNING] `rustc --crate-name foo [..]--crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no [..]
-[RUNNING] `rustc --crate-name foo [..]--emit=dep-info,link -C embed-bitcode=no [..]--test[..]
-[FINISHED] [..]
-[RUNNING] [..]
-[DOCTEST] foo
-[RUNNING] `rustdoc [..]
-")
- .run();
-}
-
#[cargo_test]
fn doctest() {
let p = project()
@@ -732,18 +713,24 @@ fn doctest() {
.build();
p.cargo("test --doc --release -v")
- .with_stderr_contains("[..]`rustc --crate-name bar[..]-C embed-bitcode=no[..]")
- .with_stderr_contains("[..]`rustc --crate-name foo[..]-C embed-bitcode=no[..]")
+ .with_stderr_contains("[..]`rustc --crate-name bar[..]-C linker-plugin-lto[..]")
+ .with_stderr_contains("[..]`rustc --crate-name foo[..]-C linker-plugin-lto[..]")
// embed-bitcode should be harmless here
- .with_stderr_contains("[..]`rustdoc [..]-C embed-bitcode=no[..]")
+ .with_stderr_contains("[..]`rustdoc [..]-C lto[..]")
.run();
// Try with bench profile.
p.cargo("test --doc --release -v")
.env("CARGO_PROFILE_BENCH_LTO", "true")
- .with_stderr_contains("[..]`rustc --crate-name bar[..]-C linker-plugin-lto[..]")
- .with_stderr_contains("[..]`rustc --crate-name foo[..]-C linker-plugin-lto[..]")
- .with_stderr_contains("[..]`rustdoc [..]-C lto[..]")
+ .with_stderr_unordered(
+ "\
+[FRESH] bar v0.1.0 [..]
+[FRESH] foo v0.1.0 [..]
+[FINISHED] release [..]
+[DOCTEST] foo
+[RUNNING] `rustdoc [..]-C lto[..]
+",
+ )
.run();
}
@@ -821,15 +808,13 @@ fn fresh_swapping_commands() {
p.cargo("test --release -v")
.with_stderr_unordered(
"\
-[COMPILING] bar v1.0.0
-[RUNNING] `rustc --crate-name bar [..]-C embed-bitcode=no[..]
+[FRESH] bar v1.0.0
[COMPILING] foo v0.1.0 [..]
-[RUNNING] `rustc --crate-name foo src/lib.rs [..]--crate-type lib[..]-C embed-bitcode=no[..]
-[RUNNING] `rustc --crate-name foo src/lib.rs [..]-C embed-bitcode=no[..]--test[..]
+[RUNNING] `rustc --crate-name foo src/lib.rs [..]-C lto[..]--test[..]
[FINISHED] [..]
[RUNNING] `[..]/foo[..]`
[DOCTEST] foo
-[RUNNING] `rustdoc [..]-C embed-bitcode=no[..]
+[RUNNING] `rustdoc [..]-C lto[..]
",
)
.run();
diff --git a/tests/testsuite/profile_config.rs b/tests/testsuite/profile_config.rs
index f7e98add1f7..1678a57917a 100644
--- a/tests/testsuite/profile_config.rs
+++ b/tests/testsuite/profile_config.rs
@@ -4,41 +4,6 @@ use cargo_test_support::paths::CargoPathExt;
use cargo_test_support::registry::Package;
use cargo_test_support::{basic_lib_manifest, paths, project};
-#[cargo_test]
-fn named_profile_gated() {
- // Named profile in config requires enabling in Cargo.toml.
- let p = project()
- .file("src/lib.rs", "")
- .file(
- ".cargo/config",
- r#"
- [profile.foo]
- inherits = 'dev'
- opt-level = 1
- "#,
- )
- .build();
- p.cargo("build --profile foo -Zunstable-options")
- .masquerade_as_nightly_cargo()
- .with_stderr(
- "\
-[ERROR] config profile `foo` is not valid (defined in `[..]/foo/.cargo/config`)
-
-Caused by:
- feature `named-profiles` is required
-
- The package requires the Cargo feature called `named-profiles`, \
- but that feature is not stabilized in this version of Cargo (1.[..]).
- Consider adding `cargo-features = [\"named-profiles\"]` to the top of Cargo.toml \
- (above the [package] table) to tell Cargo you are opting in to use this unstable feature.
- See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#custom-named-profiles \
- for more information about the status of this feature.
-",
- )
- .with_status(101)
- .run();
-}
-
#[cargo_test]
fn profile_config_validate_warnings() {
let p = project()
@@ -378,8 +343,6 @@ fn named_config_profile() {
fs::write(
paths::root().join("Cargo.toml"),
r#"
- cargo-features = ['named-profiles']
-
[workspace]
[profile.middle]
@@ -397,7 +360,7 @@ fn named_config_profile() {
"#,
)
.unwrap();
- let config = ConfigBuilder::new().nightly_features_allowed(true).build();
+ let config = ConfigBuilder::new().build();
let profile_name = InternedString::new("foo");
let ws = Workspace::new(&paths::root().join("Cargo.toml"), &config).unwrap();
let profiles = Profiles::new(&ws, profile_name).unwrap();
@@ -443,7 +406,6 @@ fn named_env_profile() {
.file(
"Cargo.toml",
r#"
- cargo-features = ["named-profiles"]
[package]
name = "foo"
version = "0.1.0"
@@ -452,8 +414,7 @@ fn named_env_profile() {
.file("src/lib.rs", "")
.build();
- p.cargo("build -v -Zunstable-options --profile=other")
- .masquerade_as_nightly_cargo()
+ p.cargo("build -v --profile=other")
.env("CARGO_PROFILE_OTHER_CODEGEN_UNITS", "1")
.env("CARGO_PROFILE_OTHER_INHERITS", "dev")
.with_stderr_contains("[..]-C codegen-units=1 [..]")
@@ -462,7 +423,8 @@ fn named_env_profile() {
#[cargo_test]
fn test_with_dev_profile() {
- // `cargo test` uses "dev" profile for dependencies.
+ // The `test` profile inherits from `dev` for both local crates and
+ // dependencies.
Package::new("somedep", "1.0.0").publish();
let p = project()
.file(
@@ -488,7 +450,7 @@ fn test_with_dev_profile() {
[COMPILING] somedep v1.0.0
[RUNNING] `rustc --crate-name somedep [..]-C debuginfo=0[..]
[COMPILING] foo v0.1.0 [..]
-[RUNNING] `rustc --crate-name foo [..]-C debuginfo=2[..]
+[RUNNING] `rustc --crate-name foo [..]-C debuginfo=0[..]
[FINISHED] [..]
",
)
diff --git a/tests/testsuite/profile_custom.rs b/tests/testsuite/profile_custom.rs
index 1307b4e071b..889665baf87 100644
--- a/tests/testsuite/profile_custom.rs
+++ b/tests/testsuite/profile_custom.rs
@@ -3,31 +3,12 @@
use cargo_test_support::paths::CargoPathExt;
use cargo_test_support::{basic_lib_manifest, project};
-#[cargo_test]
-fn gated() {
- let p = project().file("src/lib.rs", "").build();
- // `rustc`, `fix`, and `check` have had `--profile` before custom named profiles.
- // Without unstable, these shouldn't be allowed to access non-legacy names.
- for command in [
- "rustc", "fix", "check", "bench", "clean", "install", "test", "build", "doc", "run",
- "rustdoc",
- ] {
- p.cargo(command)
- .arg("--profile=release")
- .with_status(101)
- .with_stderr("error: usage of `--profile` requires `-Z unstable-options`")
- .run();
- }
-}
-
#[cargo_test]
fn inherits_on_release() {
let p = project()
.file(
"Cargo.toml",
r#"
- cargo-features = ["named-profiles"]
-
[package]
name = "foo"
version = "0.0.1"
@@ -41,7 +22,6 @@ fn inherits_on_release() {
.build();
p.cargo("build")
- .masquerade_as_nightly_cargo()
.with_status(101)
.with_stderr(
"\
@@ -57,8 +37,6 @@ fn missing_inherits() {
.file(
"Cargo.toml",
r#"
- cargo-features = ["named-profiles"]
-
[package]
name = "foo"
version = "0.0.1"
@@ -72,7 +50,6 @@ fn missing_inherits() {
.build();
p.cargo("build")
- .masquerade_as_nightly_cargo()
.with_status(101)
.with_stderr(
"\
@@ -89,8 +66,6 @@ fn invalid_profile_name() {
.file(
"Cargo.toml",
r#"
- cargo-features = ["named-profiles"]
-
[package]
name = "foo"
version = "0.0.1"
@@ -105,7 +80,6 @@ fn invalid_profile_name() {
.build();
p.cargo("build")
- .masquerade_as_nightly_cargo()
.with_status(101)
.with_stderr(
"\
@@ -126,8 +100,6 @@ fn invalid_dir_name() {
.file(
"Cargo.toml",
r#"
- cargo-features = ["named-profiles"]
-
[package]
name = "foo"
version = "0.0.1"
@@ -143,7 +115,6 @@ fn invalid_dir_name() {
.build();
p.cargo("build")
- .masquerade_as_nightly_cargo()
.with_status(101)
.with_stderr(
"\
@@ -161,8 +132,6 @@ fn dir_name_disabled() {
.file(
"Cargo.toml",
r#"
- cargo-features = ["named-profiles"]
-
[package]
name = "foo"
version = "0.1.0"
@@ -177,7 +146,6 @@ fn dir_name_disabled() {
.build();
p.cargo("build")
- .masquerade_as_nightly_cargo()
.with_status(101)
.with_stderr(
"\
@@ -197,8 +165,6 @@ fn invalid_inherits() {
.file(
"Cargo.toml",
r#"
- cargo-features = ["named-profiles"]
-
[package]
name = "foo"
version = "0.0.1"
@@ -213,7 +179,6 @@ fn invalid_inherits() {
.build();
p.cargo("build")
- .masquerade_as_nightly_cargo()
.with_status(101)
.with_stderr(
"error: profile `release-lto` inherits from `.release`, \
@@ -228,8 +193,6 @@ fn non_existent_inherits() {
.file(
"Cargo.toml",
r#"
- cargo-features = ["named-profiles"]
-
[package]
name = "foo"
version = "0.0.1"
@@ -244,7 +207,6 @@ fn non_existent_inherits() {
.build();
p.cargo("build")
- .masquerade_as_nightly_cargo()
.with_status(101)
.with_stderr(
"\
@@ -260,8 +222,6 @@ fn self_inherits() {
.file(
"Cargo.toml",
r#"
- cargo-features = ["named-profiles"]
-
[package]
name = "foo"
version = "0.0.1"
@@ -276,7 +236,6 @@ fn self_inherits() {
.build();
p.cargo("build")
- .masquerade_as_nightly_cargo()
.with_status(101)
.with_stderr(
"\
@@ -292,8 +251,6 @@ fn inherits_loop() {
.file(
"Cargo.toml",
r#"
- cargo-features = ["named-profiles"]
-
[package]
name = "foo"
version = "0.0.1"
@@ -312,7 +269,6 @@ fn inherits_loop() {
.build();
p.cargo("build")
- .masquerade_as_nightly_cargo()
.with_status(101)
.with_stderr(
"\
@@ -328,8 +284,6 @@ fn overrides_with_custom() {
.file(
"Cargo.toml",
r#"
- cargo-features = ["named-profiles"]
-
[package]
name = "foo"
version = "0.0.1"
@@ -365,7 +319,6 @@ fn overrides_with_custom() {
// profile overrides are inherited between profiles using inherits and have a
// higher priority than profile options provided by custom profiles
p.cargo("build -v")
- .masquerade_as_nightly_cargo()
.with_stderr_unordered(
"\
[COMPILING] xxx [..]
@@ -380,8 +333,7 @@ fn overrides_with_custom() {
.run();
// This also verifies that the custom profile names appears in the finished line.
- p.cargo("build --profile=other -Z unstable-options -v")
- .masquerade_as_nightly_cargo()
+ p.cargo("build --profile=other -v")
.with_stderr_unordered(
"\
[COMPILING] xxx [..]
@@ -408,11 +360,44 @@ fn conflicting_usage() {
authors = []
"#,
)
- .file("src/lib.rs", "")
+ .file("src/main.rs", "fn main() {}")
.build();
- p.cargo("build -Z unstable-options --profile=dev --release")
- .masquerade_as_nightly_cargo()
+ p.cargo("build --profile=dev --release")
+ .with_status(101)
+ .with_stderr(
+ "\
+error: conflicting usage of --profile=dev and --release
+The `--release` flag is the same as `--profile=release`.
+Remove one flag or the other to continue.
+",
+ )
+ .run();
+
+ p.cargo("install --profile=release --debug")
+ .with_status(101)
+ .with_stderr(
+ "\
+error: conflicting usage of --profile=release and --debug
+The `--debug` flag is the same as `--profile=dev`.
+Remove one flag or the other to continue.
+",
+ )
+ .run();
+
+ p.cargo("rustc --profile=dev --release")
+ .with_stderr(
+ "\
+warning: the `--release` flag should not be specified with the `--profile` flag
+The `--release` flag will be ignored.
+This was historically accepted, but will become an error in a future release.
+[COMPILING] foo [..]
+[FINISHED] dev [..]
+",
+ )
+ .run();
+
+ p.cargo("check --profile=dev --release")
.with_status(101)
.with_stderr(
"\
@@ -423,8 +408,49 @@ Remove one flag or the other to continue.
)
.run();
- p.cargo("install -Z unstable-options --profile=release --debug")
- .masquerade_as_nightly_cargo()
+ p.cargo("check --profile=test --release")
+ .with_stderr(
+ "\
+warning: the `--release` flag should not be specified with the `--profile` flag
+The `--release` flag will be ignored.
+This was historically accepted, but will become an error in a future release.
+[CHECKING] foo [..]
+[FINISHED] test [..]
+",
+ )
+ .run();
+
+ // This is OK since the two are the same.
+ p.cargo("rustc --profile=release --release")
+ .with_stderr(
+ "\
+[COMPILING] foo [..]
+[FINISHED] release [..]
+",
+ )
+ .run();
+
+ p.cargo("build --profile=release --release")
+ .with_stderr(
+ "\
+[FINISHED] release [..]
+",
+ )
+ .run();
+
+ p.cargo("install --path . --profile=dev --debug")
+ .with_stderr(
+ "\
+[INSTALLING] foo [..]
+[FINISHED] dev [..]
+[INSTALLING] [..]
+[INSTALLED] [..]
+[WARNING] be sure to add [..]
+",
+ )
+ .run();
+
+ p.cargo("install --path . --profile=release --debug")
.with_status(101)
.with_stderr(
"\
@@ -442,8 +468,6 @@ fn clean_custom_dirname() {
.file(
"Cargo.toml",
r#"
- cargo-features = ["named-profiles"]
-
[package]
name = "foo"
version = "0.0.1"
@@ -457,7 +481,6 @@ fn clean_custom_dirname() {
.build();
p.cargo("build --release")
- .masquerade_as_nightly_cargo()
.with_stdout("")
.with_stderr(
"\
@@ -470,7 +493,6 @@ fn clean_custom_dirname() {
p.cargo("clean -p foo").masquerade_as_nightly_cargo().run();
p.cargo("build --release")
- .masquerade_as_nightly_cargo()
.with_stdout("")
.with_stderr(
"\
@@ -479,12 +501,9 @@ fn clean_custom_dirname() {
)
.run();
- p.cargo("clean -p foo --release")
- .masquerade_as_nightly_cargo()
- .run();
+ p.cargo("clean -p foo --release").run();
p.cargo("build --release")
- .masquerade_as_nightly_cargo()
.with_stderr(
"\
[COMPILING] foo v0.0.1 ([..])
@@ -494,7 +513,6 @@ fn clean_custom_dirname() {
.run();
p.cargo("build")
- .masquerade_as_nightly_cargo()
.with_stdout("")
.with_stderr(
"\
@@ -504,8 +522,7 @@ fn clean_custom_dirname() {
)
.run();
- p.cargo("build -Z unstable-options --profile=other")
- .masquerade_as_nightly_cargo()
+ p.cargo("build --profile=other")
.with_stderr(
"\
[COMPILING] foo v0.0.1 ([..])
@@ -514,10 +531,7 @@ fn clean_custom_dirname() {
)
.run();
- p.cargo("clean")
- .arg("--release")
- .masquerade_as_nightly_cargo()
- .run();
+ p.cargo("clean").arg("--release").run();
// Make sure that 'other' was not cleaned
assert!(p.build_dir().is_dir());
@@ -526,10 +540,7 @@ fn clean_custom_dirname() {
assert!(!p.build_dir().join("release").is_dir());
// This should clean 'other'
- p.cargo("clean -Z unstable-options --profile=other")
- .masquerade_as_nightly_cargo()
- .with_stderr("")
- .run();
+ p.cargo("clean --profile=other").with_stderr("").run();
assert!(p.build_dir().join("debug").is_dir());
assert!(!p.build_dir().join("other").is_dir());
}
@@ -540,8 +551,6 @@ fn unknown_profile() {
.file(
"Cargo.toml",
r#"
- cargo-features = ["named-profiles"]
-
[package]
name = "foo"
version = "0.0.1"
@@ -550,14 +559,12 @@ fn unknown_profile() {
.file("src/lib.rs", "")
.build();
- p.cargo("build --profile alpha -Zunstable-options")
- .masquerade_as_nightly_cargo()
+ p.cargo("build --profile alpha")
.with_stderr("[ERROR] profile `alpha` is not defined")
.with_status(101)
.run();
// Clean has a separate code path, need to check it too.
- p.cargo("clean --profile alpha -Zunstable-options")
- .masquerade_as_nightly_cargo()
+ p.cargo("clean --profile alpha")
.with_stderr("[ERROR] profile `alpha` is not defined")
.with_status(101)
.run();
@@ -580,15 +587,13 @@ fn reserved_profile_names() {
.file("src/lib.rs", "")
.build();
- p.cargo("build --profile=doc -Zunstable-options")
- .masquerade_as_nightly_cargo()
+ p.cargo("build --profile=doc")
.with_status(101)
.with_stderr("error: profile `doc` is reserved and not allowed to be explicitly specified")
.run();
// Not an exhaustive list, just a sample.
for name in ["build", "cargo", "check", "rustc", "CaRgO_startswith"] {
- p.cargo(&format!("build --profile={} -Zunstable-options", name))
- .masquerade_as_nightly_cargo()
+ p.cargo(&format!("build --profile={}", name))
.with_status(101)
.with_stderr(&format!(
"\
@@ -605,8 +610,6 @@ See https://doc.rust-lang.org/cargo/reference/profiles.html for more on configur
"Cargo.toml",
&format!(
r#"
- cargo-features = ["named-profiles"]
-
[package]
name = "foo"
version = "0.1.0"
@@ -619,7 +622,6 @@ See https://doc.rust-lang.org/cargo/reference/profiles.html for more on configur
);
p.cargo("build")
- .masquerade_as_nightly_cargo()
.with_status(101)
.with_stderr(&format!(
"\
@@ -638,8 +640,6 @@ Caused by:
p.change_file(
"Cargo.toml",
r#"
- cargo-features = ["named-profiles"]
-
[package]
name = "foo"
version = "0.1.0"
@@ -652,7 +652,6 @@ Caused by:
);
p.cargo("build")
- .masquerade_as_nightly_cargo()
.with_status(101)
.with_stderr(
"\
@@ -674,8 +673,6 @@ fn legacy_commands_support_custom() {
.file(
"Cargo.toml",
r#"
- cargo-features = ["named-profiles"]
-
[package]
name = "foo"
version = "0.1.0"
@@ -694,9 +691,7 @@ fn legacy_commands_support_custom() {
pb.arg("--allow-no-vcs");
}
pb.arg("--profile=super-dev")
- .arg("-Zunstable-options")
.arg("-v")
- .masquerade_as_nightly_cargo()
.with_stderr_contains("[RUNNING] [..]codegen-units=3[..]")
.run();
p.build_dir().rm_rf();
diff --git a/tests/testsuite/profile_targets.rs b/tests/testsuite/profile_targets.rs
index 045f2a3e065..74d54385ff1 100644
--- a/tests/testsuite/profile_targets.rs
+++ b/tests/testsuite/profile_targets.rs
@@ -2,7 +2,7 @@
//! example, the `test` profile applying to test targets, but not other
//! targets, etc.
-use cargo_test_support::{basic_manifest, is_nightly, project, Project};
+use cargo_test_support::{basic_manifest, project, Project};
fn all_target_project() -> Project {
// This abuses the `codegen-units` setting so that we can verify exactly
@@ -10,41 +10,32 @@ fn all_target_project() -> Project {
project()
.file(
"Cargo.toml",
- &format!(
- r#"
- cargo-features = [{named_profiles}]
-
- [package]
- name = "foo"
- version = "0.0.1"
+ r#"
+ [package]
+ name = "foo"
+ version = "0.0.1"
- [dependencies]
- bar = {{ path = "bar" }}
+ [dependencies]
+ bar = { path = "bar" }
- [build-dependencies]
- bdep = {{ path = "bdep" }}
+ [build-dependencies]
+ bdep = { path = "bdep" }
- [profile.dev]
- codegen-units = 1
- panic = "abort"
- [profile.release]
- codegen-units = 2
- panic = "abort"
- [profile.test]
- codegen-units = 3
- [profile.bench]
- codegen-units = 4
- [profile.dev.build-override]
- codegen-units = 5
- [profile.release.build-override]
- codegen-units = 6
- "#,
- named_profiles = if is_nightly() {
- "\"named-profiles\", "
- } else {
- ""
- }
- ),
+ [profile.dev]
+ codegen-units = 1
+ panic = "abort"
+ [profile.release]
+ codegen-units = 2
+ panic = "abort"
+ [profile.test]
+ codegen-units = 3
+ [profile.bench]
+ codegen-units = 4
+ [profile.dev.build-override]
+ codegen-units = 5
+ [profile.release.build-override]
+ codegen-units = 6
+ "#,
)
.file("src/lib.rs", "extern crate bar;")
.file("src/main.rs", "extern crate foo; fn main() {}")
@@ -91,7 +82,7 @@ fn profile_selection_build() {
// NOTES:
// - bdep `panic` is not set because it thinks `build.rs` is a plugin.
// - build_script_build is built without panic because it thinks `build.rs` is a plugin.
- p.cargo("build -vv").masquerade_as_nightly_cargo().with_stderr_unordered("\
+ p.cargo("build -vv").with_stderr_unordered("\
[COMPILING] bar [..]
[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C panic=abort[..]-C codegen-units=1 -C debuginfo=2 [..]
[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=5 -C debuginfo=2 [..]
@@ -106,7 +97,6 @@ fn profile_selection_build() {
[FINISHED] dev [unoptimized + debuginfo] [..]
").run();
p.cargo("build -vv")
- .masquerade_as_nightly_cargo()
.with_stderr_unordered(
"\
[FRESH] bar [..]
@@ -123,7 +113,7 @@ fn profile_selection_build_release() {
let p = all_target_project();
// `build --release`
- p.cargo("build --release -vv").masquerade_as_nightly_cargo().with_stderr_unordered("\
+ p.cargo("build --release -vv").with_stderr_unordered("\
[COMPILING] bar [..]
[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3 -C panic=abort[..]-C codegen-units=2 [..]
[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=6 [..]
@@ -138,7 +128,6 @@ fn profile_selection_build_release() {
[FINISHED] release [optimized] [..]
").run();
p.cargo("build --release -vv")
- .masquerade_as_nightly_cargo()
.with_stderr_unordered(
"\
[FRESH] bar [..]
@@ -153,7 +142,6 @@ fn profile_selection_build_release() {
#[cargo_test]
fn profile_selection_build_all_targets() {
let p = all_target_project();
- let affected = if is_nightly() { 1 } else { 3 };
// `build`
// NOTES:
// - bdep `panic` is not set because it thinks `build.rs` is a plugin.
@@ -181,7 +169,7 @@ fn profile_selection_build_all_targets() {
// bin dev dev
// bin dev build
// example dev build
- p.cargo("build --all-targets -vv").masquerade_as_nightly_cargo().with_stderr_unordered(format!("\
+ p.cargo("build --all-targets -vv").with_stderr_unordered("\
[COMPILING] bar [..]
[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=1 -C debuginfo=2 [..]
[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C panic=abort[..]-C codegen-units=1 -C debuginfo=2 [..]
@@ -193,17 +181,16 @@ fn profile_selection_build_all_targets() {
[RUNNING] `[..]/target/debug/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=[..]link -C panic=abort[..]-C codegen-units=1 -C debuginfo=2 [..]`
-[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--emit=[..]link[..]-C codegen-units={affected} -C debuginfo=2 --test [..]`
+[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--emit=[..]link[..]-C codegen-units=1 -C debuginfo=2 --test [..]`
[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=1 -C debuginfo=2 [..]`
-[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--emit=[..]link[..]-C codegen-units={affected} -C debuginfo=2 --test [..]`
-[RUNNING] `[..] rustc --crate-name test1 tests/test1.rs [..]--emit=[..]link[..]-C codegen-units={affected} -C debuginfo=2 --test [..]`
-[RUNNING] `[..] rustc --crate-name bench1 benches/bench1.rs [..]--emit=[..]link[..]-C codegen-units={affected} -C debuginfo=2 --test [..]`
+[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--emit=[..]link[..]-C codegen-units=1 -C debuginfo=2 --test [..]`
+[RUNNING] `[..] rustc --crate-name test1 tests/test1.rs [..]--emit=[..]link[..]-C codegen-units=1 -C debuginfo=2 --test [..]`
+[RUNNING] `[..] rustc --crate-name bench1 benches/bench1.rs [..]--emit=[..]link[..]-C codegen-units=1 -C debuginfo=2 --test [..]`
[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--crate-type bin --emit=[..]link -C panic=abort[..]-C codegen-units=1 -C debuginfo=2 [..]`
[RUNNING] `[..] rustc --crate-name ex1 examples/ex1.rs [..]--crate-type bin --emit=[..]link -C panic=abort[..]-C codegen-units=1 -C debuginfo=2 [..]`
[FINISHED] dev [unoptimized + debuginfo] [..]
-", affected=affected)).run();
+").run();
p.cargo("build -vv")
- .masquerade_as_nightly_cargo()
.with_stderr_unordered(
"\
[FRESH] bar [..]
@@ -218,7 +205,6 @@ fn profile_selection_build_all_targets() {
#[cargo_test]
fn profile_selection_build_all_targets_release() {
let p = all_target_project();
- let affected = if is_nightly() { 2 } else { 4 };
// `build --all-targets --release`
// NOTES:
// - bdep `panic` is not set because it thinks `build.rs` is a plugin.
@@ -249,7 +235,7 @@ fn profile_selection_build_all_targets_release() {
// bin release test (bench/test de-duped)
// bin release build
// example release build
- p.cargo("build --all-targets --release -vv").masquerade_as_nightly_cargo().with_stderr_unordered(format!("\
+ p.cargo("build --all-targets --release -vv").with_stderr_unordered("\
[COMPILING] bar [..]
[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3[..]-C codegen-units=2 [..]
[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3 -C panic=abort[..]-C codegen-units=2 [..]
@@ -261,17 +247,16 @@ fn profile_selection_build_all_targets_release() {
[RUNNING] `[..]/target/release/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=[..]link -C opt-level=3 -C panic=abort[..]-C codegen-units=2 [..]`
-[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--emit=[..]link -C opt-level=3[..]-C codegen-units={affected} --test [..]`
+[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--emit=[..]link -C opt-level=3[..]-C codegen-units=2 --test [..]`
[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3[..]-C codegen-units=2 [..]`
-[RUNNING] `[..] rustc --crate-name test1 tests/test1.rs [..]--emit=[..]link -C opt-level=3[..]-C codegen-units={affected} --test [..]`
-[RUNNING] `[..] rustc --crate-name bench1 benches/bench1.rs [..]--emit=[..]link -C opt-level=3[..]-C codegen-units={affected} --test [..]`
-[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--emit=[..]link -C opt-level=3[..]-C codegen-units={affected} --test [..]`
+[RUNNING] `[..] rustc --crate-name test1 tests/test1.rs [..]--emit=[..]link -C opt-level=3[..]-C codegen-units=2 --test [..]`
+[RUNNING] `[..] rustc --crate-name bench1 benches/bench1.rs [..]--emit=[..]link -C opt-level=3[..]-C codegen-units=2 --test [..]`
+[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--emit=[..]link -C opt-level=3[..]-C codegen-units=2 --test [..]`
[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--crate-type bin --emit=[..]link -C opt-level=3 -C panic=abort[..]-C codegen-units=2 [..]`
[RUNNING] `[..] rustc --crate-name ex1 examples/ex1.rs [..]--crate-type bin --emit=[..]link -C opt-level=3 -C panic=abort[..]-C codegen-units=2 [..]`
[FINISHED] release [optimized] [..]
-", affected=affected)).run();
+").run();
p.cargo("build --all-targets --release -vv")
- .masquerade_as_nightly_cargo()
.with_stderr_unordered(
"\
[FRESH] bar [..]
@@ -286,7 +271,6 @@ fn profile_selection_build_all_targets_release() {
#[cargo_test]
fn profile_selection_test() {
let p = all_target_project();
- let affected = if is_nightly() { 3 } else { 1 };
// `test`
// NOTES:
// - Dependency profiles:
@@ -308,33 +292,32 @@ fn profile_selection_test() {
// bin test test
// bin test build
//
- p.cargo("test -vv").masquerade_as_nightly_cargo().with_stderr_unordered(format!("\
+ p.cargo("test -vv").with_stderr_unordered("\
[COMPILING] bar [..]
-[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units={affected} -C debuginfo=2 [..]
+[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=3 -C debuginfo=2 [..]
[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=5 -C debuginfo=2 [..]
-[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C panic=abort[..]-C codegen-units={affected} -C debuginfo=2 [..]
+[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C panic=abort[..]-C codegen-units=3 -C debuginfo=2 [..]
[COMPILING] bdep [..]
[RUNNING] `[..] rustc --crate-name bdep bdep/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=5 -C debuginfo=2 [..]
[COMPILING] foo [..]
[RUNNING] `[..] rustc --crate-name build_script_build build.rs [..]--crate-type bin --emit=[..]link[..]-C codegen-units=5 -C debuginfo=2 [..]
[RUNNING] `[..]/target/debug/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=[..]link -C panic=abort[..]-C codegen-units={affected} -C debuginfo=2 [..]
-[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units={affected} -C debuginfo=2 [..]
+[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=[..]link -C panic=abort[..]-C codegen-units=3 -C debuginfo=2 [..]
+[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=3 -C debuginfo=2 [..]
[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--emit=[..]link[..]-C codegen-units=3 -C debuginfo=2 --test [..]
[RUNNING] `[..] rustc --crate-name test1 tests/test1.rs [..]--emit=[..]link[..]-C codegen-units=3 -C debuginfo=2 --test [..]
-[RUNNING] `[..] rustc --crate-name ex1 examples/ex1.rs [..]--crate-type bin --emit=[..]link[..]-C codegen-units={affected} -C debuginfo=2 [..]
+[RUNNING] `[..] rustc --crate-name ex1 examples/ex1.rs [..]--crate-type bin --emit=[..]link[..]-C codegen-units=3 -C debuginfo=2 [..]
[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--emit=[..]link[..]-C codegen-units=3 -C debuginfo=2 --test [..]
-[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--crate-type bin --emit=[..]link -C panic=abort[..]-C codegen-units={affected} -C debuginfo=2 [..]
+[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--crate-type bin --emit=[..]link -C panic=abort[..]-C codegen-units=3 -C debuginfo=2 [..]
[FINISHED] test [unoptimized + debuginfo] [..]
[RUNNING] `[..]/deps/foo-[..]`
[RUNNING] `[..]/deps/foo-[..]`
[RUNNING] `[..]/deps/test1-[..]`
[DOCTEST] foo
[RUNNING] `rustdoc [..]--test [..]
-", affected=affected)).run();
+").run();
p.cargo("test -vv")
- .masquerade_as_nightly_cargo()
.with_stderr_unordered(
"\
[FRESH] bar [..]
@@ -354,7 +337,6 @@ fn profile_selection_test() {
#[cargo_test]
fn profile_selection_test_release() {
let p = all_target_project();
- let affected = if is_nightly() { 2 } else { 4 };
// `test --release`
// NOTES:
@@ -377,7 +359,7 @@ fn profile_selection_test_release() {
// bin release test
// bin release build
//
- p.cargo("test --release -vv").masquerade_as_nightly_cargo().with_stderr_unordered(format!("\
+ p.cargo("test --release -vv").with_stderr_unordered("\
[COMPILING] bar [..]
[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=6 [..]
[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3 -C panic=abort[..]-C codegen-units=2 [..]
@@ -390,9 +372,9 @@ fn profile_selection_test_release() {
[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=[..]link -C opt-level=3 -C panic=abort[..]-C codegen-units=2 [..]
[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3[..]-C codegen-units=2 [..]
-[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--emit=[..]link -C opt-level=3[..]-C codegen-units={affected} --test [..]
-[RUNNING] `[..] rustc --crate-name test1 tests/test1.rs [..]--emit=[..]link -C opt-level=3[..]-C codegen-units={affected} --test [..]
-[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--emit=[..]link -C opt-level=3[..]-C codegen-units={affected} --test [..]
+[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--emit=[..]link -C opt-level=3[..]-C codegen-units=2 --test [..]
+[RUNNING] `[..] rustc --crate-name test1 tests/test1.rs [..]--emit=[..]link -C opt-level=3[..]-C codegen-units=2 --test [..]
+[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--emit=[..]link -C opt-level=3[..]-C codegen-units=2 --test [..]
[RUNNING] `[..] rustc --crate-name ex1 examples/ex1.rs [..]--crate-type bin --emit=[..]link -C opt-level=3[..]-C codegen-units=2 [..]
[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--crate-type bin --emit=[..]link -C opt-level=3 -C panic=abort[..]-C codegen-units=2 [..]
[FINISHED] release [optimized] [..]
@@ -401,9 +383,8 @@ fn profile_selection_test_release() {
[RUNNING] `[..]/deps/test1-[..]`
[DOCTEST] foo
[RUNNING] `rustdoc [..]--test [..]`
-", affected=affected)).run();
+").run();
p.cargo("test --release -vv")
- .masquerade_as_nightly_cargo()
.with_stderr_unordered(
"\
[FRESH] bar [..]
@@ -423,7 +404,6 @@ fn profile_selection_test_release() {
#[cargo_test]
fn profile_selection_bench() {
let p = all_target_project();
- let affected = if is_nightly() { 4 } else { 2 };
// `bench`
// NOTES:
@@ -445,10 +425,10 @@ fn profile_selection_bench() {
// bin bench test(bench)
// bin bench build
//
- p.cargo("bench -vv").masquerade_as_nightly_cargo().with_stderr_unordered(format!("\
+ p.cargo("bench -vv").with_stderr_unordered("\
[COMPILING] bar [..]
-[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3[..]-C codegen-units={affected} [..]
-[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3 -C panic=abort[..]-C codegen-units={affected} [..]
+[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3[..]-C codegen-units=4 [..]
+[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3 -C panic=abort[..]-C codegen-units=4 [..]
[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=6 [..]
[COMPILING] bdep [..]
[RUNNING] `[..] rustc --crate-name bdep bdep/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=6 [..]
@@ -456,19 +436,18 @@ fn profile_selection_bench() {
[RUNNING] `[..] rustc --crate-name build_script_build build.rs [..]--crate-type bin --emit=[..]link[..]-C codegen-units=6 [..]
[RUNNING] `[..]target/release/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=[..]link -C opt-level=3 -C panic=abort[..]-C codegen-units={affected} [..]
-[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3[..]-C codegen-units={affected} [..]
+[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3 -C panic=abort[..]-C codegen-units=4 [..]
+[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=[..]link -C opt-level=3[..]-C codegen-units=4 [..]
[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--emit=[..]link -C opt-level=3[..]-C codegen-units=4 --test [..]
[RUNNING] `[..] rustc --crate-name bench1 benches/bench1.rs [..]--emit=[..]link -C opt-level=3[..]-C codegen-units=4 --test [..]
[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--emit=[..]link -C opt-level=3[..]-C codegen-units=4 --test [..]
-[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--crate-type bin --emit=[..]link -C opt-level=3 -C panic=abort[..]-C codegen-units={affected} [..]
+[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--crate-type bin --emit=[..]link -C opt-level=3 -C panic=abort[..]-C codegen-units=4 [..]
[FINISHED] bench [optimized] [..]
[RUNNING] `[..]/deps/foo-[..] --bench`
[RUNNING] `[..]/deps/foo-[..] --bench`
[RUNNING] `[..]/deps/bench1-[..] --bench`
-", affected=affected)).run();
+").run();
p.cargo("bench -vv")
- .masquerade_as_nightly_cargo()
.with_stderr_unordered(
"\
[FRESH] bar [..]
@@ -511,7 +490,7 @@ fn profile_selection_check_all_targets() {
// bin dev check
// bin dev-panic check-test (checking bin as a unittest)
//
- p.cargo("check --all-targets -vv").masquerade_as_nightly_cargo().with_stderr_unordered("\
+ p.cargo("check --all-targets -vv").with_stderr_unordered("\
[COMPILING] bar [..]
[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=5 -C debuginfo=2 [..]
[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]metadata[..]-C codegen-units=1 -C debuginfo=2 [..]
@@ -537,7 +516,6 @@ fn profile_selection_check_all_targets() {
// rechecked.
// See PR rust-lang/rust#49289 and issue rust-lang/cargo#3624.
p.cargo("check --all-targets -vv")
- .masquerade_as_nightly_cargo()
.with_stderr_unordered(
"\
[FRESH] bar [..]
@@ -557,7 +535,7 @@ fn profile_selection_check_all_targets_release() {
// This is a pretty straightforward variant of
// `profile_selection_check_all_targets` that uses `release` instead of
// `dev` for all targets.
- p.cargo("check --all-targets --release -vv").masquerade_as_nightly_cargo().with_stderr_unordered("\
+ p.cargo("check --all-targets --release -vv").with_stderr_unordered("\
[COMPILING] bar [..]
[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=6 [..]
[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]metadata -C opt-level=3[..]-C codegen-units=2 [..]
@@ -580,7 +558,6 @@ fn profile_selection_check_all_targets_release() {
").run();
p.cargo("check --all-targets --release -vv")
- .masquerade_as_nightly_cargo()
.with_stderr_unordered(
"\
[FRESH] bar [..]
@@ -595,7 +572,6 @@ fn profile_selection_check_all_targets_release() {
#[cargo_test]
fn profile_selection_check_all_targets_test() {
let p = all_target_project();
- let affected = if is_nightly() { 3 } else { 1 };
// `check --profile=test`
// - Dependency profiles:
@@ -618,27 +594,26 @@ fn profile_selection_check_all_targets_test() {
// bench test-panic check-test
// bin test-panic check-test
//
- p.cargo("check --all-targets --profile=test -vv").masquerade_as_nightly_cargo().with_stderr_unordered(format!("\
+ p.cargo("check --all-targets --profile=test -vv").with_stderr_unordered("\
[COMPILING] bar [..]
[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=5 -C debuginfo=2 [..]
-[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]metadata[..]-C codegen-units={affected} -C debuginfo=2 [..]
+[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]metadata[..]-C codegen-units=3 -C debuginfo=2 [..]
[COMPILING] bdep[..]
[RUNNING] `[..] rustc --crate-name bdep bdep/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=5 -C debuginfo=2 [..]
[COMPILING] foo [..]
[RUNNING] `[..] rustc --crate-name build_script_build build.rs [..]--crate-type bin --emit=[..]link[..]-C codegen-units=5 -C debuginfo=2 [..]
[RUNNING] `[..]target/debug/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=[..]metadata[..]-C codegen-units={affected} -C debuginfo=2 [..]
-[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--emit=[..]metadata[..]-C codegen-units={affected} -C debuginfo=2 --test [..]
-[RUNNING] `[..] rustc --crate-name test1 tests/test1.rs [..]--emit=[..]metadata[..]-C codegen-units={affected} -C debuginfo=2 --test [..]
-[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--emit=[..]metadata[..]-C codegen-units={affected} -C debuginfo=2 --test [..]
-[RUNNING] `[..] rustc --crate-name bench1 benches/bench1.rs [..]--emit=[..]metadata[..]-C codegen-units={affected} -C debuginfo=2 --test [..]
-[RUNNING] `[..] rustc --crate-name ex1 examples/ex1.rs [..]--emit=[..]metadata[..]-C codegen-units={affected} -C debuginfo=2 --test [..]
+[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--crate-type lib --emit=[..]metadata[..]-C codegen-units=3 -C debuginfo=2 [..]
+[RUNNING] `[..] rustc --crate-name foo src/lib.rs [..]--emit=[..]metadata[..]-C codegen-units=3 -C debuginfo=2 --test [..]
+[RUNNING] `[..] rustc --crate-name test1 tests/test1.rs [..]--emit=[..]metadata[..]-C codegen-units=3 -C debuginfo=2 --test [..]
+[RUNNING] `[..] rustc --crate-name foo src/main.rs [..]--emit=[..]metadata[..]-C codegen-units=3 -C debuginfo=2 --test [..]
+[RUNNING] `[..] rustc --crate-name bench1 benches/bench1.rs [..]--emit=[..]metadata[..]-C codegen-units=3 -C debuginfo=2 --test [..]
+[RUNNING] `[..] rustc --crate-name ex1 examples/ex1.rs [..]--emit=[..]metadata[..]-C codegen-units=3 -C debuginfo=2 --test [..]
[FINISHED] test [unoptimized + debuginfo] [..]
-", affected=affected)).run();
+").run();
p.cargo("check --all-targets --profile=test -vv")
- .masquerade_as_nightly_cargo()
.with_stderr_unordered(
"\
[FRESH] bar [..]
@@ -664,7 +639,7 @@ fn profile_selection_doc() {
// foo custom dev* link For build.rs
//
// `*` = wants panic, but it is cleared when args are built.
- p.cargo("doc -vv").masquerade_as_nightly_cargo().with_stderr_unordered("\
+ p.cargo("doc -vv").with_stderr_unordered("\
[COMPILING] bar [..]
[DOCUMENTING] bar [..]
[RUNNING] `[..] rustc --crate-name bar bar/src/lib.rs [..]--crate-type lib --emit=[..]link[..]-C codegen-units=5 -C debuginfo=2 [..]