Merge branch 'master' into yerke/negative_jobs

This commit is contained in:
Yerkebulan Tulibergenov 2022-07-31 18:21:33 -07:00
commit 767368fd02
242 changed files with 1570 additions and 1008 deletions

View File

@ -806,9 +806,14 @@ impl Execs {
p.build_command()
}
pub fn masquerade_as_nightly_cargo(&mut self) -> &mut Self {
/// Enables nightly features for testing
///
/// The list of reasons should be why nightly cargo is needed. If it is
/// becuase of an unstable feature put the name of the feature as the reason,
/// e.g. `&["print-im-a-teapot"]`
pub fn masquerade_as_nightly_cargo(&mut self, reasons: &[&str]) -> &mut Self {
if let Some(ref mut p) = self.process_builder {
p.masquerade_as_nightly_cargo();
p.masquerade_as_nightly_cargo(reasons);
}
self
}
@ -1139,17 +1144,20 @@ fn _process(t: &OsStr) -> ProcessBuilder {
/// Enable nightly features for testing
pub trait ChannelChanger {
fn masquerade_as_nightly_cargo(self) -> Self;
/// The list of reasons should be why nightly cargo is needed. If it is
/// becuase of an unstable feature put the name of the feature as the reason,
/// e.g. `&["print-im-a-teapot"]`.
fn masquerade_as_nightly_cargo(self, _reasons: &[&str]) -> Self;
}
impl ChannelChanger for &mut ProcessBuilder {
fn masquerade_as_nightly_cargo(self) -> Self {
fn masquerade_as_nightly_cargo(self, _reasons: &[&str]) -> Self {
self.env("__CARGO_TEST_CHANNEL_OVERRIDE_DO_NOT_USE_THIS", "nightly")
}
}
impl ChannelChanger for snapbox::cmd::Command {
fn masquerade_as_nightly_cargo(self) -> Self {
fn masquerade_as_nightly_cargo(self, _reasons: &[&str]) -> Self {
self.env("__CARGO_TEST_CHANNEL_OVERRIDE_DO_NOT_USE_THIS", "nightly")
}
}

View File

@ -12,7 +12,7 @@ use std::time::Instant;
use cargo::core::dependency::DepKind;
use cargo::core::resolver::{self, ResolveOpts, VersionPreferences};
use cargo::core::source::{GitReference, SourceId};
use cargo::core::source::{GitReference, QueryKind, SourceId};
use cargo::core::Resolve;
use cargo::core::{Dependency, PackageId, Registry, Summary};
use cargo::util::{CargoResult, Config, Graph, IntoUrl};
@ -128,11 +128,15 @@ pub fn resolve_with_config_raw(
fn query(
&mut self,
dep: &Dependency,
kind: QueryKind,
f: &mut dyn FnMut(Summary),
fuzzy: bool,
) -> Poll<CargoResult<()>> {
for summary in self.list.iter() {
if fuzzy || dep.matches(summary) {
let matched = match kind {
QueryKind::Exact => dep.matches(summary),
QueryKind::Fuzzy => true,
};
if matched {
self.used.insert(summary.package_id());
f(summary.clone());
}

View File

@ -7,6 +7,7 @@ use cargo::ops::cargo_add::add;
use cargo::ops::cargo_add::AddOptions;
use cargo::ops::cargo_add::DepOp;
use cargo::ops::cargo_add::DepTable;
use cargo::ops::resolve_ws;
use cargo::util::command_prelude::*;
use cargo::util::interning::InternedString;
use cargo::CargoResult;
@ -193,6 +194,12 @@ pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
};
add(&ws, &options)?;
if !dry_run {
// Reload the workspace since we've changed dependencies
let ws = args.workspace(config)?;
resolve_ws(&ws)?;
}
Ok(())
}

View File

@ -55,7 +55,10 @@ pub fn cli() -> App {
.arg(flag("no-track", "Do not save tracking information"))
.arg_features()
.arg_profile("Install artifacts with the specified profile")
.arg(flag("debug", "Build in debug mode instead of release mode"))
.arg(flag(
"debug",
"Build in debug mode (with the 'dev' profile) instead of release mode",
))
.arg_targets_bins_examples(
"Install only the specified binary",
"Install all binaries",

View File

@ -39,7 +39,7 @@ pub fn cli() -> App {
.arg(multi_opt(
CRATE_TYPE_ARG_NAME,
"CRATE-TYPE",
"Comma separated list of types of crates for the compiler to emit (unstable)",
"Comma separated list of types of crates for the compiler to emit",
))
.arg_target_dir()
.arg_manifest_path()
@ -88,9 +88,6 @@ pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
compile_opts.target_rustc_crate_types = if crate_types.is_empty() {
None
} else {
config
.cli_unstable()
.fail_if_stable_opt(CRATE_TYPE_ARG_NAME, 10083)?;
Some(crate_types)
};
ops::compile(&ws, &compile_opts)?;

View File

@ -2,7 +2,7 @@ use crate::core::Target;
use crate::util::errors::CargoResult;
use crate::util::interning::InternedString;
use crate::util::{Config, StableHasher};
use anyhow::{bail, Context as _};
use anyhow::Context as _;
use serde::Serialize;
use std::collections::BTreeSet;
use std::fs;
@ -65,9 +65,6 @@ impl CompileKind {
};
if !targets.is_empty() {
if targets.len() > 1 && !config.cli_unstable().multitarget {
bail!("specifying multiple `--target` flags requires `-Zmultitarget`")
}
return dedup(targets);
}

View File

@ -1,7 +1,7 @@
//! Support for future-incompatible warning reporting.
use crate::core::compiler::BuildContext;
use crate::core::{Dependency, PackageId, Workspace};
use crate::core::{Dependency, PackageId, QueryKind, Workspace};
use crate::sources::SourceConfigMap;
use crate::util::{iter_join, CargoResult, Config};
use anyhow::{bail, format_err, Context};
@ -293,7 +293,7 @@ fn get_updates(ws: &Workspace<'_>, package_ids: &BTreeSet<PackageId>) -> Option<
Ok(dep) => dep,
Err(_) => return false,
};
match source.query_vec(&dep) {
match source.query_vec(&dep, QueryKind::Exact) {
Poll::Ready(Ok(sum)) => {
summaries.push((pkg_id, sum));
false

View File

@ -86,7 +86,9 @@
//! `CliUnstable. Remove the `(unstable)` note in the clap help text if
//! necessary.
//! 2. Remove `masquerade_as_nightly_cargo` from any tests, and remove
//! `cargo-features` from `Cargo.toml` test files if any.
//! `cargo-features` from `Cargo.toml` test files if any. You can
//! quickly find what needs to be removed by searching for the name
//! of the feature, e.g. `print_im_a_teapot`
//! 3. Update the docs in unstable.md to move the section to the bottom
//! and summarize it similar to the other entries. Update the rest of the
//! documentation to add the new feature.
@ -414,7 +416,7 @@ features! {
(unstable, profile_rustflags, "", "reference/unstable.html#profile-rustflags-option"),
// Allow specifying rustflags directly in a profile
(unstable, workspace_inheritance, "", "reference/unstable.html#workspace-inheritance"),
(stable, workspace_inheritance, "1.64", "reference/unstable.html#workspace-inheritance"),
}
pub struct Feature {
@ -720,6 +722,8 @@ const STABILISED_NAMESPACED_FEATURES: &str = "Namespaced features are now always
const STABILIZED_TIMINGS: &str = "The -Ztimings option has been stabilized as --timings.";
const STABILISED_MULTITARGET: &str = "Multiple `--target` options are now always available.";
fn deserialize_build_std<'de, D>(deserializer: D) -> Result<Option<Vec<String>>, D::Error>
where
D: serde::Deserializer<'de>,
@ -920,7 +924,7 @@ impl CliUnstable {
self.features = Some(feats);
}
"separate-nightlies" => self.separate_nightlies = parse_empty(k, v)?,
"multitarget" => self.multitarget = parse_empty(k, v)?,
"multitarget" => stabilized_warn(k, "1.64", STABILISED_MULTITARGET),
"rustdoc-map" => self.rustdoc_map = parse_empty(k, v)?,
"terminal-width" => self.terminal_width = Some(parse_usize_opt(v)?),
"sparse-registry" => self.sparse_registry = parse_empty(k, v)?,

View File

@ -8,7 +8,7 @@ pub use self::package_id_spec::PackageIdSpec;
pub use self::registry::Registry;
pub use self::resolver::{Resolve, ResolveVersion};
pub use self::shell::{Shell, Verbosity};
pub use self::source::{GitReference, Source, SourceId, SourceMap};
pub use self::source::{GitReference, QueryKind, Source, SourceId, SourceMap};
pub use self::summary::{FeatureMap, FeatureValue, Summary};
pub use self::workspace::{
find_workspace_root, resolve_relative_path, MaybePackage, Workspace, WorkspaceConfig,

View File

@ -2,7 +2,7 @@ use std::collections::{HashMap, HashSet};
use std::task::Poll;
use crate::core::PackageSet;
use crate::core::{Dependency, PackageId, Source, SourceId, SourceMap, Summary};
use crate::core::{Dependency, PackageId, QueryKind, Source, SourceId, SourceMap, Summary};
use crate::sources::config::SourceConfigMap;
use crate::util::errors::CargoResult;
use crate::util::interning::InternedString;
@ -19,14 +19,13 @@ pub trait Registry {
fn query(
&mut self,
dep: &Dependency,
kind: QueryKind,
f: &mut dyn FnMut(Summary),
fuzzy: bool,
) -> Poll<CargoResult<()>>;
fn query_vec(&mut self, dep: &Dependency, fuzzy: bool) -> Poll<CargoResult<Vec<Summary>>> {
fn query_vec(&mut self, dep: &Dependency, kind: QueryKind) -> Poll<CargoResult<Vec<Summary>>> {
let mut ret = Vec::new();
self.query(dep, &mut |s| ret.push(s), fuzzy)
.map_ok(|()| ret)
self.query(dep, kind, &mut |s| ret.push(s)).map_ok(|()| ret)
}
fn describe_source(&self, source: SourceId) -> String;
@ -327,7 +326,7 @@ impl<'cfg> PackageRegistry<'cfg> {
.get_mut(dep.source_id())
.expect("loaded source not present");
let summaries = match source.query_vec(dep)? {
let summaries = match source.query_vec(dep, QueryKind::Exact)? {
Poll::Ready(deps) => deps,
Poll::Pending => {
deps_pending.push(dep_remaining);
@ -483,7 +482,7 @@ impl<'cfg> PackageRegistry<'cfg> {
for &s in self.overrides.iter() {
let src = self.sources.get_mut(s).unwrap();
let dep = Dependency::new_override(dep.package_name(), s);
let mut results = match src.query_vec(&dep) {
let mut results = match src.query_vec(&dep, QueryKind::Exact) {
Poll::Ready(results) => results?,
Poll::Pending => return Poll::Pending,
};
@ -575,8 +574,8 @@ impl<'cfg> Registry for PackageRegistry<'cfg> {
fn query(
&mut self,
dep: &Dependency,
kind: QueryKind,
f: &mut dyn FnMut(Summary),
fuzzy: bool,
) -> Poll<CargoResult<()>> {
assert!(self.patches_locked);
let (override_summary, n, to_warn) = {
@ -671,11 +670,7 @@ impl<'cfg> Registry for PackageRegistry<'cfg> {
}
f(lock(locked, all_patches, summary))
};
return if fuzzy {
source.fuzzy_query(dep, callback)
} else {
source.query(dep, callback)
};
return source.query(dep, kind, callback);
}
// If we have an override summary then we query the source
@ -694,11 +689,7 @@ impl<'cfg> Registry for PackageRegistry<'cfg> {
n += 1;
to_warn = Some(summary);
};
let pend = if fuzzy {
source.fuzzy_query(dep, callback)?
} else {
source.query(dep, callback)?
};
let pend = source.query(dep, kind, callback);
if pend.is_pending() {
return Poll::Pending;
}
@ -889,7 +880,7 @@ fn summary_for_patch(
// No summaries found, try to help the user figure out what is wrong.
if let Some(locked) = locked {
// Since the locked patch did not match anything, try the unlocked one.
let orig_matches = match source.query_vec(orig_patch) {
let orig_matches = match source.query_vec(orig_patch, QueryKind::Exact) {
Poll::Pending => return Poll::Pending,
Poll::Ready(deps) => deps,
}
@ -914,7 +905,7 @@ fn summary_for_patch(
// Try checking if there are *any* packages that match this by name.
let name_only_dep = Dependency::new_override(orig_patch.package_name(), orig_patch.source_id());
let name_summaries = match source.query_vec(&name_only_dep) {
let name_summaries = match source.query_vec(&name_only_dep, QueryKind::Exact) {
Poll::Pending => return Poll::Pending,
Poll::Ready(deps) => deps,
}

View File

@ -16,7 +16,9 @@ use crate::core::resolver::{
ActivateError, ActivateResult, CliFeatures, RequestedFeatures, ResolveOpts, VersionOrdering,
VersionPreferences,
};
use crate::core::{Dependency, FeatureValue, PackageId, PackageIdSpec, Registry, Summary};
use crate::core::{
Dependency, FeatureValue, PackageId, PackageIdSpec, QueryKind, Registry, Summary,
};
use crate::util::errors::CargoResult;
use crate::util::interning::InternedString;
@ -100,13 +102,9 @@ impl<'a> RegistryQueryer<'a> {
}
let mut ret = Vec::new();
let ready = self.registry.query(
dep,
&mut |s| {
ret.push(s);
},
false,
)?;
let ready = self.registry.query(dep, QueryKind::Exact, &mut |s| {
ret.push(s);
})?;
if ready.is_pending() {
self.registry_cache.insert(dep.clone(), Poll::Pending);
return Poll::Pending;
@ -127,7 +125,7 @@ impl<'a> RegistryQueryer<'a> {
dep.version_req()
);
let mut summaries = match self.registry.query_vec(dep, false)? {
let mut summaries = match self.registry.query_vec(dep, QueryKind::Exact)? {
Poll::Ready(s) => s.into_iter(),
Poll::Pending => {
self.registry_cache.insert(dep.clone(), Poll::Pending);

View File

@ -1,7 +1,7 @@
use std::fmt;
use std::task::Poll;
use crate::core::{Dependency, PackageId, Registry, Summary};
use crate::core::{Dependency, PackageId, QueryKind, Registry, Summary};
use crate::util::lev_distance::lev_distance;
use crate::util::{Config, VersionExt};
use anyhow::Error;
@ -228,7 +228,7 @@ pub(super) fn activation_error(
new_dep.set_version_req(all_req);
let mut candidates = loop {
match registry.query_vec(&new_dep, false) {
match registry.query_vec(&new_dep, QueryKind::Exact) {
Poll::Ready(Ok(candidates)) => break candidates,
Poll::Ready(Err(e)) => return to_resolve_err(e),
Poll::Pending => match registry.block_until_ready() {
@ -294,7 +294,7 @@ pub(super) fn activation_error(
// Maybe the user mistyped the name? Like `dep-thing` when `Dep_Thing`
// was meant. So we try asking the registry for a `fuzzy` search for suggestions.
let mut candidates = loop {
match registry.query_vec(&new_dep, true) {
match registry.query_vec(&new_dep, QueryKind::Fuzzy) {
Poll::Ready(Ok(candidates)) => break candidates,
Poll::Ready(Err(e)) => return to_resolve_err(e),
Poll::Pending => match registry.block_until_ready() {

View File

@ -119,11 +119,12 @@ impl ResolveBehavior {
}
}
pub fn to_manifest(&self) -> Option<String> {
pub fn to_manifest(&self) -> String {
match self {
ResolveBehavior::V1 => None,
ResolveBehavior::V2 => Some("2".to_string()),
ResolveBehavior::V1 => "1",
ResolveBehavior::V2 => "2",
}
.to_owned()
}
}

View File

@ -29,21 +29,16 @@ pub trait Source {
fn requires_precise(&self) -> bool;
/// Attempts to find the packages that match a dependency request.
fn query(&mut self, dep: &Dependency, f: &mut dyn FnMut(Summary)) -> Poll<CargoResult<()>>;
/// Attempts to find the packages that are close to a dependency request.
/// Each source gets to define what `close` means for it.
/// Path/Git sources may return all dependencies that are at that URI,
/// whereas an `Index` source may return dependencies that have the same canonicalization.
fn fuzzy_query(
fn query(
&mut self,
dep: &Dependency,
kind: QueryKind,
f: &mut dyn FnMut(Summary),
) -> Poll<CargoResult<()>>;
fn query_vec(&mut self, dep: &Dependency) -> Poll<CargoResult<Vec<Summary>>> {
fn query_vec(&mut self, dep: &Dependency, kind: QueryKind) -> Poll<CargoResult<Vec<Summary>>> {
let mut ret = Vec::new();
self.query(dep, &mut |s| ret.push(s)).map_ok(|_| ret)
self.query(dep, kind, &mut |s| ret.push(s)).map_ok(|_| ret)
}
/// Ensure that the source is fully up-to-date for the current session on the next query.
@ -115,6 +110,15 @@ pub trait Source {
fn block_until_ready(&mut self) -> CargoResult<()>;
}
#[derive(Copy, Clone, PartialEq, Eq)]
pub enum QueryKind {
Exact,
/// Each source gets to define what `close` means for it.
/// Path/Git sources may return all dependencies that are at that URI,
/// whereas an `Index` source may return dependencies that have the same canonicalization.
Fuzzy,
}
pub enum MaybePackage {
Ready(Package),
Download { url: String, descriptor: String },
@ -142,17 +146,13 @@ impl<'a, T: Source + ?Sized + 'a> Source for Box<T> {
}
/// Forwards to `Source::query`.
fn query(&mut self, dep: &Dependency, f: &mut dyn FnMut(Summary)) -> Poll<CargoResult<()>> {
(**self).query(dep, f)
}
/// Forwards to `Source::query`.
fn fuzzy_query(
fn query(
&mut self,
dep: &Dependency,
kind: QueryKind,
f: &mut dyn FnMut(Summary),
) -> Poll<CargoResult<()>> {
(**self).fuzzy_query(dep, f)
(**self).query(dep, kind, f)
}
fn invalidate_cache(&mut self) {
@ -216,16 +216,13 @@ impl<'a, T: Source + ?Sized + 'a> Source for &'a mut T {
(**self).requires_precise()
}
fn query(&mut self, dep: &Dependency, f: &mut dyn FnMut(Summary)) -> Poll<CargoResult<()>> {
(**self).query(dep, f)
}
fn fuzzy_query(
fn query(
&mut self,
dep: &Dependency,
kind: QueryKind,
f: &mut dyn FnMut(Summary),
) -> Poll<CargoResult<()>> {
(**self).fuzzy_query(dep, f)
(**self).query(dep, kind, f)
}
fn invalidate_cache(&mut self) {

View File

@ -686,6 +686,8 @@ impl<'cfg> Workspace<'cfg> {
})?;
}
self.find_path_deps(&root_manifest_path, &root_manifest_path, false)?;
if let Some(default) = default_members_paths {
for path in default {
let normalized_path = paths::normalize_path(&path);
@ -716,7 +718,7 @@ impl<'cfg> Workspace<'cfg> {
self.default_members.push(self.current_manifest.clone())
}
self.find_path_deps(&root_manifest_path, &root_manifest_path, false)
Ok(())
}
fn find_path_deps(
@ -1702,10 +1704,17 @@ fn find_workspace_root_with_loader(
mut loader: impl FnMut(&Path) -> CargoResult<Option<PathBuf>>,
) -> CargoResult<Option<PathBuf>> {
// Check if there are any workspace roots that have already been found that would work
for (ws_root, ws_root_config) in config.ws_roots.borrow().iter() {
if manifest_path.starts_with(ws_root) && !ws_root_config.is_excluded(manifest_path) {
// Add `Cargo.toml` since ws_root is the root and not the file
return Ok(Some(ws_root.join("Cargo.toml").clone()));
{
let roots = config.ws_roots.borrow();
// Iterate through the manifests parent directories until we find a workspace
// root. Note we skip the first item since that is just the path itself
for current in manifest_path.ancestors().skip(1) {
if let Some(ws_config) = roots.get(current) {
if !ws_config.is_excluded(manifest_path) {
// Add `Cargo.toml` since ws_root is the root and not the file
return Ok(Some(current.join("Cargo.toml")));
}
}
}
}

View File

@ -238,8 +238,7 @@ impl str::FromStr for Manifest {
impl std::fmt::Display for Manifest {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let s = self.data.to_string();
s.fmt(f)
self.data.fmt(f)
}
}
@ -433,6 +432,12 @@ impl LocalManifest {
}
}
impl std::fmt::Display for LocalManifest {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
self.manifest.fmt(f)
}
}
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
enum DependencyStatus {
None,

View File

@ -19,6 +19,7 @@ use toml_edit::Item as TomlItem;
use crate::core::dependency::DepKind;
use crate::core::registry::PackageRegistry;
use crate::core::Package;
use crate::core::QueryKind;
use crate::core::Registry;
use crate::core::Shell;
use crate::core::Workspace;
@ -61,6 +62,7 @@ pub fn add(workspace: &Workspace<'_>, options: &AddOptions<'_>) -> CargoResult<(
let manifest_path = options.spec.manifest_path().to_path_buf();
let mut manifest = LocalManifest::try_new(&manifest_path)?;
let original_raw_manifest = manifest.to_string();
let legacy = manifest.get_legacy_sections();
if !legacy.is_empty() {
anyhow::bail!(
@ -141,6 +143,16 @@ pub fn add(workspace: &Workspace<'_>, options: &AddOptions<'_>) -> CargoResult<(
}
}
if options.config.locked() {
let new_raw_manifest = manifest.to_string();
if original_raw_manifest != new_raw_manifest {
anyhow::bail!(
"the manifest file {} needs to be updated but --locked was passed to prevent this",
manifest.path.display()
);
}
}
if options.dry_run {
options.config.shell().warn("aborting add due to dry run")?;
} else {
@ -443,8 +455,7 @@ fn get_latest_dependency(
}
MaybeWorkspace::Other(query) => {
let possibilities = loop {
let fuzzy = true;
match registry.query_vec(&query, fuzzy) {
match registry.query_vec(&query, QueryKind::Fuzzy) {
std::task::Poll::Ready(res) => {
break res?;
}
@ -485,8 +496,8 @@ fn select_package(
}
MaybeWorkspace::Other(query) => {
let possibilities = loop {
let fuzzy = false; // Returns all for path/git
match registry.query_vec(&query, fuzzy) {
// Exact to avoid returning all for path/git
match registry.query_vec(&query, QueryKind::Exact) {
std::task::Poll::Ready(res) => {
break res?;
}
@ -600,7 +611,7 @@ fn populate_available_features(
MaybeWorkspace::Other(query) => query,
};
let possibilities = loop {
match registry.query_vec(&query, true) {
match registry.query_vec(&query, QueryKind::Fuzzy) {
std::task::Poll::Ready(res) => {
break res?;
}

View File

@ -11,7 +11,7 @@ use serde::{Deserialize, Serialize};
use toml_edit::easy as toml;
use crate::core::compiler::Freshness;
use crate::core::{Dependency, FeatureValue, Package, PackageId, Source, SourceId};
use crate::core::{Dependency, FeatureValue, Package, PackageId, QueryKind, Source, SourceId};
use crate::ops::{self, CompileFilter, CompileOptions};
use crate::sources::PathSource;
use crate::util::errors::CargoResult;
@ -540,7 +540,7 @@ where
}
let deps = loop {
match source.query_vec(&dep)? {
match source.query_vec(&dep, QueryKind::Exact)? {
Poll::Ready(deps) => break deps,
Poll::Pending => source.block_until_ready()?,
}

View File

@ -209,7 +209,7 @@ fn resolve_with_registry<'cfg>(
Ok(resolve)
}
/// Resolves all dependencies for a package using an optional previous instance.
/// Resolves all dependencies for a package using an optional previous instance
/// of resolve to guide the resolution process.
///
/// This also takes an optional hash set, `to_avoid`, which is a list of package

View File

@ -60,7 +60,7 @@ struct VendorConfig {
#[serde(rename_all = "lowercase", untagged)]
enum VendorSource {
Directory {
directory: PathBuf,
directory: String,
},
Registry {
registry: Option<String>,
@ -298,7 +298,10 @@ fn sync(
config.insert(
merged_source_name.to_string(),
VendorSource::Directory {
directory: opts.destination.to_path_buf(),
// Windows-flavour paths are valid here on Windows but Unix.
// This backslash normalization is for making output paths more
// cross-platform compatible.
directory: opts.destination.to_string_lossy().replace("\\", "/"),
},
);
} else if !dest_dir_already_exists {

View File

@ -4,7 +4,7 @@ use std::path::{Path, PathBuf};
use std::task::Poll;
use crate::core::source::MaybePackage;
use crate::core::{Dependency, Package, PackageId, Source, SourceId, Summary};
use crate::core::{Dependency, Package, PackageId, QueryKind, Source, SourceId, Summary};
use crate::sources::PathSource;
use crate::util::errors::CargoResult;
use crate::util::Config;
@ -46,28 +46,21 @@ impl<'cfg> Debug for DirectorySource<'cfg> {
}
impl<'cfg> Source for DirectorySource<'cfg> {
fn query(&mut self, dep: &Dependency, f: &mut dyn FnMut(Summary)) -> Poll<CargoResult<()>> {
if !self.updated {
return Poll::Pending;
}
let packages = self.packages.values().map(|p| &p.0);
let matches = packages.filter(|pkg| dep.matches(pkg.summary()));
for summary in matches.map(|pkg| pkg.summary().clone()) {
f(summary);
}
Poll::Ready(Ok(()))
}
fn fuzzy_query(
fn query(
&mut self,
_dep: &Dependency,
dep: &Dependency,
kind: QueryKind,
f: &mut dyn FnMut(Summary),
) -> Poll<CargoResult<()>> {
if !self.updated {
return Poll::Pending;
}
let packages = self.packages.values().map(|p| &p.0);
for summary in packages.map(|pkg| pkg.summary().clone()) {
let matches = packages.filter(|pkg| match kind {
QueryKind::Exact => dep.matches(pkg.summary()),
QueryKind::Fuzzy => true,
});
for summary in matches.map(|pkg| pkg.summary().clone()) {
f(summary);
}
Poll::Ready(Ok(()))

View File

@ -1,4 +1,4 @@
use crate::core::source::{MaybePackage, Source, SourceId};
use crate::core::source::{MaybePackage, QueryKind, Source, SourceId};
use crate::core::GitReference;
use crate::core::{Dependency, Package, PackageId, Summary};
use crate::sources::git::utils::GitRemote;
@ -86,21 +86,14 @@ impl<'cfg> Debug for GitSource<'cfg> {
}
impl<'cfg> Source for GitSource<'cfg> {
fn query(&mut self, dep: &Dependency, f: &mut dyn FnMut(Summary)) -> Poll<CargoResult<()>> {
if let Some(src) = self.path_source.as_mut() {
src.query(dep, f)
} else {
Poll::Pending
}
}
fn fuzzy_query(
fn query(
&mut self,
dep: &Dependency,
kind: QueryKind,
f: &mut dyn FnMut(Summary),
) -> Poll<CargoResult<()>> {
if let Some(src) = self.path_source.as_mut() {
src.fuzzy_query(dep, f)
src.query(dep, kind, f)
} else {
Poll::Pending
}

View File

@ -4,7 +4,7 @@ use std::path::{Path, PathBuf};
use std::task::Poll;
use crate::core::source::MaybePackage;
use crate::core::{Dependency, Package, PackageId, Source, SourceId, Summary};
use crate::core::{Dependency, Package, PackageId, QueryKind, Source, SourceId, Summary};
use crate::ops;
use crate::util::{internal, CargoResult, Config};
use anyhow::Context as _;
@ -497,24 +497,21 @@ impl<'cfg> Debug for PathSource<'cfg> {
}
impl<'cfg> Source for PathSource<'cfg> {
fn query(&mut self, dep: &Dependency, f: &mut dyn FnMut(Summary)) -> Poll<CargoResult<()>> {
self.update()?;
for s in self.packages.iter().map(|p| p.summary()) {
if dep.matches(s) {
f(s.clone())
}
}
Poll::Ready(Ok(()))
}
fn fuzzy_query(
fn query(
&mut self,
_dep: &Dependency,
dep: &Dependency,
kind: QueryKind,
f: &mut dyn FnMut(Summary),
) -> Poll<CargoResult<()>> {
self.update()?;
for s in self.packages.iter().map(|p| p.summary()) {
f(s.clone())
let matched = match kind {
QueryKind::Exact => dep.matches(s),
QueryKind::Fuzzy => true,
};
if matched {
f(s.clone())
}
}
Poll::Ready(Ok(()))
}

View File

@ -176,7 +176,7 @@ use tar::Archive;
use crate::core::dependency::{DepKind, Dependency};
use crate::core::source::MaybePackage;
use crate::core::{Package, PackageId, Source, SourceId, Summary};
use crate::core::{Package, PackageId, QueryKind, Source, SourceId, Summary};
use crate::sources::PathSource;
use crate::util::hex;
use crate::util::interning::InternedString;
@ -701,12 +701,18 @@ impl<'cfg> RegistrySource<'cfg> {
}
impl<'cfg> Source for RegistrySource<'cfg> {
fn query(&mut self, dep: &Dependency, f: &mut dyn FnMut(Summary)) -> Poll<CargoResult<()>> {
fn query(
&mut self,
dep: &Dependency,
kind: QueryKind,
f: &mut dyn FnMut(Summary),
) -> Poll<CargoResult<()>> {
// If this is a precise dependency, then it came from a lock file and in
// theory the registry is known to contain this version. If, however, we
// come back with no summaries, then our registry may need to be
// updated, so we fall back to performing a lazy update.
if dep.source_id().precise().is_some() && !self.ops.is_updated() {
if kind == QueryKind::Exact && dep.source_id().precise().is_some() && !self.ops.is_updated()
{
debug!("attempting query without update");
let mut called = false;
let pend =
@ -731,21 +737,16 @@ impl<'cfg> Source for RegistrySource<'cfg> {
self.index
.query_inner(dep, &mut *self.ops, &self.yanked_whitelist, &mut |s| {
if dep.matches(&s) {
let matched = match kind {
QueryKind::Exact => dep.matches(&s),
QueryKind::Fuzzy => true,
};
if matched {
f(s);
}
})
}
fn fuzzy_query(
&mut self,
dep: &Dependency,
f: &mut dyn FnMut(Summary),
) -> Poll<CargoResult<()>> {
self.index
.query_inner(dep, &mut *self.ops, &self.yanked_whitelist, f)
}
fn supports_checksums(&self) -> bool {
true
}

View File

@ -1,5 +1,5 @@
use crate::core::source::MaybePackage;
use crate::core::{Dependency, Package, PackageId, Source, SourceId, Summary};
use crate::core::{Dependency, Package, PackageId, QueryKind, Source, SourceId, Summary};
use crate::util::errors::CargoResult;
use std::task::Poll;
@ -42,32 +42,17 @@ impl<'cfg> Source for ReplacedSource<'cfg> {
self.inner.requires_precise()
}
fn query(&mut self, dep: &Dependency, f: &mut dyn FnMut(Summary)) -> Poll<CargoResult<()>> {
let (replace_with, to_replace) = (self.replace_with, self.to_replace);
let dep = dep.clone().map_source(to_replace, replace_with);
self.inner
.query(&dep, &mut |summary| {
f(summary.map_source(replace_with, to_replace))
})
.map_err(|e| {
e.context(format!(
"failed to query replaced source {}",
self.to_replace
))
})
}
fn fuzzy_query(
fn query(
&mut self,
dep: &Dependency,
kind: QueryKind,
f: &mut dyn FnMut(Summary),
) -> Poll<CargoResult<()>> {
let (replace_with, to_replace) = (self.replace_with, self.to_replace);
let dep = dep.clone().map_source(to_replace, replace_with);
self.inner
.fuzzy_query(&dep, &mut |summary| {
.query(&dep, kind, &mut |summary| {
f(summary.map_source(replace_with, to_replace))
})
.map_err(|e| {

View File

@ -2248,13 +2248,7 @@ impl BuildTargetConfig {
};
let values = match &self.inner.val {
BuildTargetConfigInner::One(s) => vec![map(s)],
BuildTargetConfigInner::Many(v) => {
if !config.cli_unstable().multitarget {
bail!("specifying an array in `build.target` config value requires `-Zmultitarget`")
} else {
v.iter().map(map).collect()
}
}
BuildTargetConfigInner::Many(v) => v.iter().map(map).collect(),
};
Ok(values)
}

View File

@ -1017,19 +1017,16 @@ pub enum MaybeWorkspace<T> {
impl<T> MaybeWorkspace<T> {
fn resolve<'a>(
self,
cargo_features: &Features,
label: &str,
get_ws_field: impl FnOnce() -> CargoResult<T>,
) -> CargoResult<T> {
match self {
MaybeWorkspace::Defined(value) => Ok(value),
MaybeWorkspace::Workspace(TomlWorkspaceField { workspace: true }) => {
cargo_features.require(Feature::workspace_inheritance())?;
get_ws_field().context(format!(
MaybeWorkspace::Workspace(TomlWorkspaceField { workspace: true }) => get_ws_field()
.context(format!(
"error inheriting `{}` from workspace root manifest's `workspace.package.{}`",
label, label
))
}
)),
MaybeWorkspace::Workspace(TomlWorkspaceField { workspace: false }) => Err(anyhow!(
"`workspace=false` is unsupported for `package.{}`",
label,
@ -1345,7 +1342,7 @@ impl TomlManifest {
.unwrap()
.clone();
package.workspace = None;
package.resolver = ws.resolve_behavior().to_manifest();
package.resolver = Some(ws.resolve_behavior().to_manifest());
if let Some(license_file) = &package.license_file {
let license_file = license_file
.as_defined()
@ -1592,7 +1589,7 @@ impl TomlManifest {
let version = project
.version
.clone()
.resolve(&features, "version", || inherit()?.version())?;
.resolve("version", || inherit()?.version())?;
project.version = MaybeWorkspace::Defined(version.clone());
@ -1600,7 +1597,7 @@ impl TomlManifest {
let edition = if let Some(edition) = project.edition.clone() {
let edition: Edition = edition
.resolve(&features, "edition", || inherit()?.edition())?
.resolve("edition", || inherit()?.edition())?
.parse()
.with_context(|| "failed to parse the `edition` key")?;
project.edition = Some(MaybeWorkspace::Defined(edition.to_string()));
@ -1625,7 +1622,7 @@ impl TomlManifest {
let rust_version = if let Some(rust_version) = &project.rust_version {
let rust_version = rust_version
.clone()
.resolve(&features, "rust_version", || inherit()?.rust_version())?;
.resolve("rust_version", || inherit()?.rust_version())?;
let req = match semver::VersionReq::parse(&rust_version) {
// Exclude semver operators like `^` and pre-release identifiers
Ok(req) if rust_version.chars().all(|c| c.is_ascii_digit() || c == '.') => req,
@ -1716,7 +1713,6 @@ impl TomlManifest {
};
fn process_dependencies(
features: &Features,
cx: &mut Context<'_, '_>,
new_deps: Option<&BTreeMap<String, TomlDependency>>,
kind: Option<DepKind>,
@ -1736,7 +1732,7 @@ impl TomlManifest {
let mut deps: BTreeMap<String, TomlDependency> = BTreeMap::new();
for (n, v) in dependencies.iter() {
let resolved = v.clone().resolve(features, n, cx, || inherit())?;
let resolved = v.clone().resolve(n, cx, || inherit())?;
let dep = resolved.to_dependency(n, cx, kind)?;
validate_package_name(dep.name_in_toml().as_str(), "dependency name", "")?;
cx.deps.push(dep);
@ -1747,7 +1743,6 @@ impl TomlManifest {
// Collect the dependencies.
let dependencies = process_dependencies(
&features,
&mut cx,
me.dependencies.as_ref(),
None,
@ -1762,7 +1757,6 @@ impl TomlManifest {
.as_ref()
.or_else(|| me.dev_dependencies2.as_ref());
let dev_deps = process_dependencies(
&features,
&mut cx,
dev_deps,
Some(DepKind::Development),
@ -1777,7 +1771,6 @@ impl TomlManifest {
.as_ref()
.or_else(|| me.build_dependencies2.as_ref());
let build_deps = process_dependencies(
&features,
&mut cx,
build_deps,
Some(DepKind::Build),
@ -1793,7 +1786,6 @@ impl TomlManifest {
Some(platform)
};
let deps = process_dependencies(
&features,
&mut cx,
platform.dependencies.as_ref(),
None,
@ -1809,7 +1801,6 @@ impl TomlManifest {
.as_ref()
.or_else(|| platform.build_dependencies2.as_ref());
let build_deps = process_dependencies(
&features,
&mut cx,
build_deps,
Some(DepKind::Build),
@ -1825,7 +1816,6 @@ impl TomlManifest {
.as_ref()
.or_else(|| platform.dev_dependencies2.as_ref());
let dev_deps = process_dependencies(
&features,
&mut cx,
dev_deps,
Some(DepKind::Development),
@ -1872,13 +1862,13 @@ impl TomlManifest {
let exclude = project
.exclude
.clone()
.map(|mw| mw.resolve(&features, "exclude", || inherit()?.exclude()))
.map(|mw| mw.resolve("exclude", || inherit()?.exclude()))
.transpose()?
.unwrap_or_default();
let include = project
.include
.clone()
.map(|mw| mw.resolve(&features, "include", || inherit()?.include()))
.map(|mw| mw.resolve("include", || inherit()?.include()))
.transpose()?
.unwrap_or_default();
let empty_features = BTreeMap::new();
@ -1895,67 +1885,63 @@ impl TomlManifest {
description: project
.description
.clone()
.map(|mw| mw.resolve(&features, "description", || inherit()?.description()))
.map(|mw| mw.resolve("description", || inherit()?.description()))
.transpose()?,
homepage: project
.homepage
.clone()
.map(|mw| mw.resolve(&features, "homepage", || inherit()?.homepage()))
.map(|mw| mw.resolve("homepage", || inherit()?.homepage()))
.transpose()?,
documentation: project
.documentation
.clone()
.map(|mw| mw.resolve(&features, "documentation", || inherit()?.documentation()))
.map(|mw| mw.resolve("documentation", || inherit()?.documentation()))
.transpose()?,
readme: readme_for_project(
package_root,
project
.readme
.clone()
.map(|mw| mw.resolve(&features, "readme", || inherit()?.readme(package_root)))
.map(|mw| mw.resolve("readme", || inherit()?.readme(package_root)))
.transpose()?,
),
authors: project
.authors
.clone()
.map(|mw| mw.resolve(&features, "authors", || inherit()?.authors()))
.map(|mw| mw.resolve("authors", || inherit()?.authors()))
.transpose()?
.unwrap_or_default(),
license: project
.license
.clone()
.map(|mw| mw.resolve(&features, "license", || inherit()?.license()))
.map(|mw| mw.resolve("license", || inherit()?.license()))
.transpose()?,
license_file: project
.license_file
.clone()
.map(|mw| {
mw.resolve(&features, "license", || {
inherit()?.license_file(package_root)
})
})
.map(|mw| mw.resolve("license", || inherit()?.license_file(package_root)))
.transpose()?,
repository: project
.repository
.clone()
.map(|mw| mw.resolve(&features, "repository", || inherit()?.repository()))
.map(|mw| mw.resolve("repository", || inherit()?.repository()))
.transpose()?,
keywords: project
.keywords
.clone()
.map(|mw| mw.resolve(&features, "keywords", || inherit()?.keywords()))
.map(|mw| mw.resolve("keywords", || inherit()?.keywords()))
.transpose()?
.unwrap_or_default(),
categories: project
.categories
.clone()
.map(|mw| mw.resolve(&features, "categories", || inherit()?.categories()))
.map(|mw| mw.resolve("categories", || inherit()?.categories()))
.transpose()?
.unwrap_or_default(),
badges: me
.badges
.clone()
.map(|mw| mw.resolve(&features, "badges", || inherit()?.badges()))
.map(|mw| mw.resolve("badges", || inherit()?.badges()))
.transpose()?
.unwrap_or_default(),
links: project.links.clone(),
@ -2015,11 +2001,10 @@ impl TomlManifest {
profiles.validate(&features, &mut warnings)?;
}
let publish = project.publish.clone().map(|publish| {
publish
.resolve(&features, "publish", || inherit()?.publish())
.unwrap()
});
let publish = project
.publish
.clone()
.map(|publish| publish.resolve("publish", || inherit()?.publish()).unwrap());
project.publish = publish.clone().map(|p| MaybeWorkspace::Defined(p));
@ -2479,7 +2464,6 @@ impl<P: ResolveToPath + Clone> TomlDependency<P> {
impl TomlDependency {
fn resolve<'a>(
self,
cargo_features: &Features,
label: &str,
cx: &mut Context<'_, '_>,
get_inheritable: impl FnOnce() -> CargoResult<&'a InheritableFields>,
@ -2492,7 +2476,6 @@ impl TomlDependency {
features,
optional,
}) => {
cargo_features.require(Feature::workspace_inheritance())?;
let inheritable = get_inheritable()?;
inheritable.get_dependency(label).context(format!(
"error reading `dependencies.{}` from workspace root manifest's `workspace.dependencies.{}`",

View File

@ -17,4 +17,5 @@
- [Running Tests](./tests/running.md)
- [Writing Tests](./tests/writing.md)
- [Benchmarking and Profiling](./tests/profiling.md)
- [Crater](./tests/crater.md)
- [Design Principles](./design.md)

View File

@ -28,6 +28,46 @@ and stable releases.
[`dist` bootstrap module]: https://github.com/rust-lang/rust/blob/master/src/bootstrap/dist.rs
## Submodule updates
Cargo is tracked in the [rust-lang/rust] repository using a [git submodule].
It is updated manually about once a week by a Cargo team member.
However, anyone is welcome to update it as needed.
[@ehuss] has a tool called [subup](https://github.com/ehuss/subup) to automate the process of updating the submodule, updating the lockfile, running tests, and creating a PR.
Running the tests ahead-of-time helps avoid long cycle times waiting for bors if there are any errors.
Subup will also provide a message to include in the PR with a list of all PRs it covers.
Posting this in the PR message also helps create reference links on each Cargo PR to the submodule update PR to help track when it gets merged.
The following is an example of the command to run in a local clone of rust-lang/rust to run a certain set of tests of things that are likely to get broken by a Cargo update:
```bash
subup --up-branch update-cargo \
--commit-message "Update cargo" \
--test="src/tools/linkchecker tidy \
src/tools/cargo \
src/tools/rustfmt \
src/tools/rls" \
src/tools/cargo
```
If doing a [beta backport](#beta-backports), the command is similar, but needs to point to the correct branches:
```bash
subup --up-branch update-beta-cargo \
--rust-branch beta \
--set-config rust.channel=beta \
--commit-message "[beta] Update cargo" \
--test="src/tools/linkchecker tidy \
src/tools/cargo \
src/tools/rustfmt \
src/tools/rls" \
rust-1.63.0:src/tools/cargo
```
[@ehuss]: https://github.com/ehuss/
[git submodule]: https://git-scm.com/book/en/v2/Git-Tools-Submodules
## Version updates
Shortly after each major release, a Cargo team member will post a PR to update
@ -53,6 +93,23 @@ release**. It is rare that these get updated. Bumping these as-needed helps
avoid churning incompatible version numbers. This process should be improved
in the future!
[@ehuss] has a tool called [cargo-new-release] to automate the process of doing a version bump.
It runs through several steps:
1. Creates a branch
2. Updates the version numbers
3. Creates a changelog for anything on the master branch that is not part of beta
4. Creates a changelog for anything on the beta branch
It opens a browser tab for every PR in order to review each change.
It places each PR in the changelog with its title, but usually every PR should be rewritten to explain the change from the user's perspective.
Each PR should also be categorized as an Addition, Change, Fix, or Nightly-only change.
Most PRs are deleted, since they are not relevant to users of Cargo.
For example, remove all PRs related to Cargo internals, infrastructure, documentation, error changes, refactorings, etc.
Usually about half of the PRs get removed.
This process usually takes @ehuss about an hour to finish.
[@ehuss]: https://github.com/ehuss/
[cargo-new-release]: https://github.com/ehuss/cargo-new-release
[`crates/` directory]: https://github.com/rust-lang/cargo/tree/master/crates
## Docs publishing

View File

@ -0,0 +1,122 @@
# Crater
[Crater](https://github.com/rust-lang/crater) is a tool for compiling and running tests for _every_ crate on [crates.io](https://crates.io) (and a few on GitHub).
It is mainly used for checking the extent of breakage when implementing potentially breaking changes and ensuring lack of breakage by running beta vs stable compiler versions.
Essentially it runs some `cargo` command on every crate twice; once against the "start" toolchain and again against the "end" toolchain.
For example, "start" could be the stable release, and "end" could be beta.
If it passes in "start" but fails with "end", then that is reported as a regression.
There is a bot called [craterbot] which is used to run crater on hardware managed by the rust-lang organization.
Crater is run by the release team during the beta cycle.
If there are any regressions that look like they are caused by Cargo, they should contact the Cargo team to decide how to handle it.
## Running crater
If you have a change that you want to test before the beta release, or you want to test behavior that is not normally exercised by crater, you can do a manual run of crater.
Roughly the steps are:
1. Create a branch with your changes.
In your clone of cargo, make the changes to incorporate whatever new thing you want to test and push it to a branch on your fork on GitHub.
2. Get a clone of <https://github.com/rust-lang/rust>
3. Create a branch in your rust-lang/rust clone to add your changes.
4. Change the `src/tools/cargo` submodule to point to your new branch.
Modify `.gitmodules` to point to your clone and branch of cargo with the changes you want to test.
For example:
```bash
git submodule set-url src/tools/cargo https://github.com/ehuss/cargo.git
git submodule set-branch --branch my-awesome-feature src/tools/cargo
git submodule update --remote src/tools/cargo
git add .gitmodules src/tools/cargo
git commit
```
5. Create an PR on rust-lang/rust.
Push your submodule changes to GitHub and make a PR.
Start the PR title with `[EXPERIMENT]` to make it clear what the PR is for and assign yourself or @ghost.
6. Make a "try" build.
A "try" build creates a full release of x86_64-unknown-linux-gnu and stores it on rust-lang servers.
This can be done with a comment `@bors try` on the PR (all Cargo team members should have permission to do this).
7. Run crater.
Look at the [craterbot] docs to determine the command that you want to run.
There are different modes like `check-only`, `build-and-test`, `rustdoc`, etc.
You can also choose how many crates to run against.
If you are uncertain if your cargo changes will work correctly, it might be a good idea to run against `top-100` first to check its behavior.
This will run much faster.
You can do a full run afterwards.
After the try build finishes (which should take a couple hours), ask someone to make a crater run.
The Cargo team does not have that permission, so just ask someone on Zulip.
They will need to write a comment to `@craterbot` with the command that you have specified.
8. Wait.
Crater can take anywhere from a few hours to a few weeks to run depending on how long the [craterbot queue](https://crater.rust-lang.org/) is and which mode you picked and the priority of your job.
When the crater run finishes, craterbot will post a comment to the PR with a link to a report of the results.
9. Investigate the report.
Look through the report which contains links to build logs for any regressions or errors.
10. Close the PR.
Whenever you are done doing crater runs, close your PR.
[craterbot]: https://github.com/rust-lang/crater/blob/master/docs/bot-usage.md
## Advanced crater modes
Crater only has a few built-in modes, such as running `cargo check` or `cargo test`.
You can pass extra flags with `+cargoflags`.
More complex tests can be accomplished by customizing Cargo to perform whatever actions you want.
Since crater essentially runs `cargo check`, you can modify the `check` command to perform whichever actions you want.
For example, to test `cargo fix --edition`, [this commit](https://github.com/ehuss/cargo/commit/6901690a6f8d519efb4fabf48c1c2b94af0c3bd8) intercepted `cargo check` and modified it to instead:
1. Only run on crates with the 2018 edition.
2. Run `cargo fix --edition`.
3. Modify the manifest to switch to the 2021 edition.
4. Run `cargo check` to verify.
If you need to compare the before and after of a command that is not part of crater's built-in modes, that can be more difficult.
Two possible options:
* Work with the infra team to add a new mode.
* Build two custom try builds.
Each one should modify the `cargo check` command as described above.
The "start" build should perform whichever action you want with an otherwise unmodified cargo.
The "end" build should perform whichever action you want with your modified cargo.
Then, in the `@craterbot` command, specify the start and end hashes of the two try builds.
## Limitations
There are some limitations of crater to consider when running Cargo:
* A crater run without regressions is not a green light to move forward.
* A large portion of Rust code is not tested, such as closed-source projects or things otherwise not collected by crater.
* Many crates can't build in crater's environment or are otherwise broken.
* Some crates have flaky tests.
* Crater runs in an isolated environment.
* It only runs on Linux x86-64.
* It does not have network access.
* The crate source is in a read-only mount.
* Crater does several steps before running the test (using its own copy of the stable toolchain):
* It generates a lockfile using `generate-lockfile` and includes `-Zno-index-update` to prevent index updates (which makes it run much faster).
* All dependencies are downloaded ahead-of-time with `cargo fetch`.
* The built-in modes pass several flags to cargo such as `--frozen` or `--message-format=json`.
It will sometimes use `--all-targets` and sometimes not.
Check the [crater source](https://github.com/rust-lang/crater/blob/master/src/runner/test.rs) for more details on how it works.

View File

@ -71,11 +71,11 @@ fn <description>() {
#### Testing Nightly Features
If you are testing a Cargo feature that only works on "nightly" Cargo, then
you need to call `masquerade_as_nightly_cargo` on the process builder like
this:
you need to call `masquerade_as_nightly_cargo` on the process builder and pass
the name of the feature as the reason, like this:
```rust,ignore
p.cargo("build").masquerade_as_nightly_cargo()
p.cargo("build").masquerade_as_nightly_cargo(&["print-im-a-teapot"])
```
If you are testing a feature that only works on *nightly rustc* (such as
@ -192,12 +192,12 @@ Be sure to check the snapshots to make sure they make sense.
#### Testing Nightly Features
If you are testing a Cargo feature that only works on "nightly" Cargo, then
you need to call `masquerade_as_nightly_cargo` on the process builder like
this:
you need to call `masquerade_as_nightly_cargo` on the process builder and pass
the name of the feature as the reason, like this:
```rust,ignore
snapbox::cmd::Command::cargo()
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["print-im-a-teapot"])
```
If you are testing a feature that only works on *nightly rustc* (such as

View File

@ -1,6 +1,7 @@
# cargo-bench(1)
{{*set actionverb="Benchmark"}}
{{*set nouns="benchmarks"}}
{{*set multitarget=true}}
## NAME

View File

@ -1,5 +1,6 @@
# cargo-build(1)
{{*set actionverb="Build"}}
{{*set multitarget=true}}
## NAME

View File

@ -1,5 +1,6 @@
# cargo-check(1)
{{*set actionverb="Check"}}
{{*set multitarget=true}}
## NAME

View File

@ -1,5 +1,6 @@
# cargo-clean(1)
{{*set actionverb="Clean"}}
{{*set multitarget=true}}
## NAME

View File

@ -1,5 +1,6 @@
# cargo-doc(1)
{{*set actionverb="Document"}}
{{*set multitarget=true}}
## NAME

View File

@ -1,6 +1,7 @@
# cargo-fetch(1)
{{*set actionverb="Fetch"}}
{{*set target-default-to-all-arch=true}}
{{*set multitarget=true}}
## NAME

View File

@ -1,5 +1,6 @@
# cargo-fix(1)
{{*set actionverb="Fix"}}
{{*set multitarget=true}}
## NAME

View File

@ -1,6 +1,7 @@
# cargo-package(1)
{{*set actionverb="Package"}}
{{*set noall=true}}
{{*set multitarget=true}}
## NAME

View File

@ -1,5 +1,6 @@
# cargo-publish(1)
{{*set actionverb="Publish"}}
{{*set multitarget=true}}
## NAME

View File

@ -1,5 +1,6 @@
# cargo-rustc(1)
{{*set actionverb="Build"}}
{{*set multitarget=true}}
## NAME
@ -70,6 +71,19 @@ See the [the reference](../reference/profiles.html) for more details on profiles
{{> options-timings }}
{{#option "`--crate-type` _crate-type_"}}
Build for the given crate type. This flag accepts a comma-separated list of
1 or more crate types, of which the allowed values are the same as `crate-type`
field in the manifest for configurating a Cargo target. See
[`crate-type` field](../reference/cargo-targets.html#the-crate-type-field)
for possible values.
If the manifest contains a list, and `--crate-type` is provided,
the command-line argument value will override what is in the manifest.
This flag only works when building a `lib` or `example` library target.
{{/option}}
{{/options}}
### Output Options
@ -123,5 +137,9 @@ See the [the reference](../reference/profiles.html) for more details on profiles
cargo rustc --lib -- -Z print-type-sizes
3. Override `crate-type` field in Cargo.toml with command-line option:
cargo rustc --lib --crate-type lib,cdylib
## SEE ALSO
{{man "cargo" 1}}, {{man "cargo-build" 1}}, {{man "rustc" 1}}

View File

@ -1,5 +1,6 @@
# cargo-rustdoc(1)
{{*set actionverb="Document"}}
{{*set multitarget=true}}
## NAME

View File

@ -1,6 +1,7 @@
# cargo-test(1)
{{*set actionverb="Test"}}
{{*set nouns="tests"}}
{{*set multitarget=true}}
## NAME

View File

@ -208,7 +208,8 @@ OPTIONS
Benchmark for the given architecture. The default is the host
architecture. The general format of the triple is
<arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
a list of supported targets.
a list of supported targets. This flag may be specified multiple
times.
This may also be specified with the build.target config value
<https://doc.rust-lang.org/cargo/reference/config.html>.

View File

@ -140,7 +140,8 @@ OPTIONS
Build for the given architecture. The default is the host
architecture. The general format of the triple is
<arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
a list of supported targets.
a list of supported targets. This flag may be specified multiple
times.
This may also be specified with the build.target config value
<https://doc.rust-lang.org/cargo/reference/config.html>.

View File

@ -137,7 +137,8 @@ OPTIONS
Check for the given architecture. The default is the host
architecture. The general format of the triple is
<arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
a list of supported targets.
a list of supported targets. This flag may be specified multiple
times.
This may also be specified with the build.target config value
<https://doc.rust-lang.org/cargo/reference/config.html>.

View File

@ -43,7 +43,8 @@ OPTIONS
Clean for the given architecture. The default is the host
architecture. The general format of the triple is
<arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
a list of supported targets.
a list of supported targets. This flag may be specified multiple
times.
This may also be specified with the build.target config value
<https://doc.rust-lang.org/cargo/reference/config.html>.

View File

@ -115,7 +115,8 @@ OPTIONS
Document for the given architecture. The default is the host
architecture. The general format of the triple is
<arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
a list of supported targets.
a list of supported targets. This flag may be specified multiple
times.
This may also be specified with the build.target config value
<https://doc.rust-lang.org/cargo/reference/config.html>.

View File

@ -28,7 +28,8 @@ OPTIONS
Fetch for the given architecture. The default is all architectures.
The general format of the triple is
<arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
a list of supported targets.
a list of supported targets. This flag may be specified multiple
times.
This may also be specified with the build.target config value
<https://doc.rust-lang.org/cargo/reference/config.html>.

View File

@ -210,7 +210,8 @@ OPTIONS
Fix for the given architecture. The default is the host
architecture. The general format of the triple is
<arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
a list of supported targets.
a list of supported targets. This flag may be specified multiple
times.
This may also be specified with the build.target config value
<https://doc.rust-lang.org/cargo/reference/config.html>.

View File

@ -112,7 +112,8 @@ OPTIONS
Package for the given architecture. The default is the host
architecture. The general format of the triple is
<arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
a list of supported targets.
a list of supported targets. This flag may be specified multiple
times.
This may also be specified with the build.target config value
<https://doc.rust-lang.org/cargo/reference/config.html>.

View File

@ -79,7 +79,8 @@ OPTIONS
Publish for the given architecture. The default is the host
architecture. The general format of the triple is
<arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
a list of supported targets.
a list of supported targets. This flag may be specified multiple
times.
This may also be specified with the build.target config value
<https://doc.rust-lang.org/cargo/reference/config.html>.

View File

@ -131,7 +131,8 @@ OPTIONS
Build for the given architecture. The default is the host
architecture. The general format of the triple is
<arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
a list of supported targets.
a list of supported targets. This flag may be specified multiple
times.
This may also be specified with the build.target config value
<https://doc.rust-lang.org/cargo/reference/config.html>.
@ -191,6 +192,19 @@ OPTIONS
o json (unstable, requires -Zunstable-options): Emit
machine-readable JSON information about timing information.
--crate-type crate-type
Build for the given crate type. This flag accepts a comma-separated
list of 1 or more crate types, of which the allowed values are the
same as crate-type field in the manifest for configurating a Cargo
target. See crate-type field
<https://doc.rust-lang.org/cargo/reference/cargo-targets.html#the-crate-type-field>
for possible values.
If the manifest contains a list, and --crate-type is provided, the
command-line argument value will override what is in the manifest.
This flag only works when building a lib or example library target.
Output Options
--target-dir directory
Directory for all generated artifacts and intermediate files. May
@ -341,6 +355,10 @@ EXAMPLES
cargo rustc --lib -- -Z print-type-sizes
3. Override crate-type field in Cargo.toml with command-line option:
cargo rustc --lib --crate-type lib,cdylib
SEE ALSO
cargo(1), cargo-build(1), rustc(1)

View File

@ -131,7 +131,8 @@ OPTIONS
Document for the given architecture. The default is the host
architecture. The general format of the triple is
<arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
a list of supported targets.
a list of supported targets. This flag may be specified multiple
times.
This may also be specified with the build.target config value
<https://doc.rust-lang.org/cargo/reference/config.html>.

View File

@ -222,7 +222,8 @@ OPTIONS
Test for the given architecture. The default is the host
architecture. The general format of the triple is
<arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
a list of supported targets.
a list of supported targets. This flag may be specified multiple
times.
This may also be specified with the build.target config value
<https://doc.rust-lang.org/cargo/reference/config.html>.

View File

@ -5,6 +5,7 @@
{{~/if}} The general format of the triple is
`<arch><sub>-<vendor>-<sys>-<abi>`. Run `rustc --print target-list` for a
list of supported targets.
{{~#if multitarget }} This flag may be specified multiple times. {{~/if}}
This may also be specified with the `build.target`
[config value](../reference/config.html).

View File

@ -2,6 +2,7 @@
## NAME
cargo-bench - Execute benchmarks of a package
@ -255,7 +256,7 @@ be specified multiple times, which enables all specified features.</dd>
<dt class="option-term" id="option-cargo-bench---target"><a class="option-anchor" href="#option-cargo-bench---target"></a><code>--target</code> <em>triple</em></dt>
<dd class="option-desc">Benchmark for the given architecture. The default is the host architecture. The general format of the triple is
<code>&lt;arch&gt;&lt;sub&gt;-&lt;vendor&gt;-&lt;sys&gt;-&lt;abi&gt;</code>. Run <code>rustc --print target-list</code> for a
list of supported targets.</p>
list of supported targets. This flag may be specified multiple times.</p>
<p>This may also be specified with the <code>build.target</code>
<a href="../reference/config.html">config value</a>.</p>
<p>Note that specifying this flag makes Cargo run in a different mode where the

View File

@ -1,6 +1,7 @@
# cargo-build(1)
## NAME
cargo-build - Compile the current package
@ -182,7 +183,7 @@ be specified multiple times, which enables all specified features.</dd>
<dt class="option-term" id="option-cargo-build---target"><a class="option-anchor" href="#option-cargo-build---target"></a><code>--target</code> <em>triple</em></dt>
<dd class="option-desc">Build for the given architecture. The default is the host architecture. The general format of the triple is
<code>&lt;arch&gt;&lt;sub&gt;-&lt;vendor&gt;-&lt;sys&gt;-&lt;abi&gt;</code>. Run <code>rustc --print target-list</code> for a
list of supported targets.</p>
list of supported targets. This flag may be specified multiple times.</p>
<p>This may also be specified with the <code>build.target</code>
<a href="../reference/config.html">config value</a>.</p>
<p>Note that specifying this flag makes Cargo run in a different mode where the

View File

@ -1,6 +1,7 @@
# cargo-check(1)
## NAME
cargo-check - Check the current package
@ -177,7 +178,7 @@ be specified multiple times, which enables all specified features.</dd>
<dt class="option-term" id="option-cargo-check---target"><a class="option-anchor" href="#option-cargo-check---target"></a><code>--target</code> <em>triple</em></dt>
<dd class="option-desc">Check for the given architecture. The default is the host architecture. The general format of the triple is
<code>&lt;arch&gt;&lt;sub&gt;-&lt;vendor&gt;-&lt;sys&gt;-&lt;abi&gt;</code>. Run <code>rustc --print target-list</code> for a
list of supported targets.</p>
list of supported targets. This flag may be specified multiple times.</p>
<p>This may also be specified with the <code>build.target</code>
<a href="../reference/config.html">config value</a>.</p>
<p>Note that specifying this flag makes Cargo run in a different mode where the

View File

@ -1,6 +1,7 @@
# cargo-clean(1)
## NAME
cargo-clean - Remove generated artifacts
@ -59,7 +60,7 @@ Defaults to <code>target</code> in the root of the workspace.</dd>
<dt class="option-term" id="option-cargo-clean---target"><a class="option-anchor" href="#option-cargo-clean---target"></a><code>--target</code> <em>triple</em></dt>
<dd class="option-desc">Clean for the given architecture. The default is the host architecture. The general format of the triple is
<code>&lt;arch&gt;&lt;sub&gt;-&lt;vendor&gt;-&lt;sys&gt;-&lt;abi&gt;</code>. Run <code>rustc --print target-list</code> for a
list of supported targets.</p>
list of supported targets. This flag may be specified multiple times.</p>
<p>This may also be specified with the <code>build.target</code>
<a href="../reference/config.html">config value</a>.</p>
<p>Note that specifying this flag makes Cargo run in a different mode where the

View File

@ -1,6 +1,7 @@
# cargo-doc(1)
## NAME
cargo-doc - Build a package's documentation
@ -155,7 +156,7 @@ be specified multiple times, which enables all specified features.</dd>
<dt class="option-term" id="option-cargo-doc---target"><a class="option-anchor" href="#option-cargo-doc---target"></a><code>--target</code> <em>triple</em></dt>
<dd class="option-desc">Document for the given architecture. The default is the host architecture. The general format of the triple is
<code>&lt;arch&gt;&lt;sub&gt;-&lt;vendor&gt;-&lt;sys&gt;-&lt;abi&gt;</code>. Run <code>rustc --print target-list</code> for a
list of supported targets.</p>
list of supported targets. This flag may be specified multiple times.</p>
<p>This may also be specified with the <code>build.target</code>
<a href="../reference/config.html">config value</a>.</p>
<p>Note that specifying this flag makes Cargo run in a different mode where the

View File

@ -2,6 +2,7 @@
## NAME
cargo-fetch - Fetch dependencies of a package from the network
@ -34,7 +35,7 @@ you plan to use Cargo without a network with the `--offline` flag.
<dt class="option-term" id="option-cargo-fetch---target"><a class="option-anchor" href="#option-cargo-fetch---target"></a><code>--target</code> <em>triple</em></dt>
<dd class="option-desc">Fetch for the given architecture. The default is all architectures. The general format of the triple is
<code>&lt;arch&gt;&lt;sub&gt;-&lt;vendor&gt;-&lt;sys&gt;-&lt;abi&gt;</code>. Run <code>rustc --print target-list</code> for a
list of supported targets.</p>
list of supported targets. This flag may be specified multiple times.</p>
<p>This may also be specified with the <code>build.target</code>
<a href="../reference/config.html">config value</a>.</p>
<p>Note that specifying this flag makes Cargo run in a different mode where the

View File

@ -1,6 +1,7 @@
# cargo-fix(1)
## NAME
cargo-fix - Automatically fix lint warnings reported by rustc
@ -257,7 +258,7 @@ be specified multiple times, which enables all specified features.</dd>
<dt class="option-term" id="option-cargo-fix---target"><a class="option-anchor" href="#option-cargo-fix---target"></a><code>--target</code> <em>triple</em></dt>
<dd class="option-desc">Fix for the given architecture. The default is the host architecture. The general format of the triple is
<code>&lt;arch&gt;&lt;sub&gt;-&lt;vendor&gt;-&lt;sys&gt;-&lt;abi&gt;</code>. Run <code>rustc --print target-list</code> for a
list of supported targets.</p>
list of supported targets. This flag may be specified multiple times.</p>
<p>This may also be specified with the <code>build.target</code>
<a href="../reference/config.html">config value</a>.</p>
<p>Note that specifying this flag makes Cargo run in a different mode where the

View File

@ -2,6 +2,7 @@
## NAME
cargo-package - Assemble the local package into a distributable tarball
@ -133,7 +134,7 @@ single quotes or double quotes around each pattern.</dd>
<dt class="option-term" id="option-cargo-package---target"><a class="option-anchor" href="#option-cargo-package---target"></a><code>--target</code> <em>triple</em></dt>
<dd class="option-desc">Package for the given architecture. The default is the host architecture. The general format of the triple is
<code>&lt;arch&gt;&lt;sub&gt;-&lt;vendor&gt;-&lt;sys&gt;-&lt;abi&gt;</code>. Run <code>rustc --print target-list</code> for a
list of supported targets.</p>
list of supported targets. This flag may be specified multiple times.</p>
<p>This may also be specified with the <code>build.target</code>
<a href="../reference/config.html">config value</a>.</p>
<p>Note that specifying this flag makes Cargo run in a different mode where the

View File

@ -1,6 +1,7 @@
# cargo-publish(1)
## NAME
cargo-publish - Upload a package to the registry
@ -99,7 +100,7 @@ format.</dd>
<dt class="option-term" id="option-cargo-publish---target"><a class="option-anchor" href="#option-cargo-publish---target"></a><code>--target</code> <em>triple</em></dt>
<dd class="option-desc">Publish for the given architecture. The default is the host architecture. The general format of the triple is
<code>&lt;arch&gt;&lt;sub&gt;-&lt;vendor&gt;-&lt;sys&gt;-&lt;abi&gt;</code>. Run <code>rustc --print target-list</code> for a
list of supported targets.</p>
list of supported targets. This flag may be specified multiple times.</p>
<p>This may also be specified with the <code>build.target</code>
<a href="../reference/config.html">config value</a>.</p>
<p>Note that specifying this flag makes Cargo run in a different mode where the

View File

@ -1,6 +1,7 @@
# cargo-rustc(1)
## NAME
cargo-rustc - Compile the current package, and pass extra options to the compiler
@ -169,7 +170,7 @@ be specified multiple times, which enables all specified features.</dd>
<dt class="option-term" id="option-cargo-rustc---target"><a class="option-anchor" href="#option-cargo-rustc---target"></a><code>--target</code> <em>triple</em></dt>
<dd class="option-desc">Build for the given architecture. The default is the host architecture. The general format of the triple is
<code>&lt;arch&gt;&lt;sub&gt;-&lt;vendor&gt;-&lt;sys&gt;-&lt;abi&gt;</code>. Run <code>rustc --print target-list</code> for a
list of supported targets.</p>
list of supported targets. This flag may be specified multiple times.</p>
<p>This may also be specified with the <code>build.target</code>
<a href="../reference/config.html">config value</a>.</p>
<p>Note that specifying this flag makes Cargo run in a different mode where the
@ -226,6 +227,17 @@ information about timing information.</li>
<dt class="option-term" id="option-cargo-rustc---crate-type"><a class="option-anchor" href="#option-cargo-rustc---crate-type"></a><code>--crate-type</code> <em>crate-type</em></dt>
<dd class="option-desc">Build for the given crate type. This flag accepts a comma-separated list of
1 or more crate types, of which the allowed values are the same as <code>crate-type</code>
field in the manifest for configurating a Cargo target. See
<a href="../reference/cargo-targets.html#the-crate-type-field"><code>crate-type</code> field</a>
for possible values.</p>
<p>If the manifest contains a list, and <code>--crate-type</code> is provided,
the command-line argument value will override what is in the manifest.</p>
<p>This flag only works when building a <code>lib</code> or <code>example</code> library target.</dd>
</dl>
### Output Options
@ -412,5 +424,9 @@ details on environment variables that Cargo reads.
cargo rustc --lib -- -Z print-type-sizes
3. Override `crate-type` field in Cargo.toml with command-line option:
cargo rustc --lib --crate-type lib,cdylib
## SEE ALSO
[cargo(1)](cargo.html), [cargo-build(1)](cargo-build.html), [rustc(1)](https://doc.rust-lang.org/rustc/index.html)

View File

@ -1,6 +1,7 @@
# cargo-rustdoc(1)
## NAME
cargo-rustdoc - Build a package's documentation, using specified custom flags
@ -174,7 +175,7 @@ be specified multiple times, which enables all specified features.</dd>
<dt class="option-term" id="option-cargo-rustdoc---target"><a class="option-anchor" href="#option-cargo-rustdoc---target"></a><code>--target</code> <em>triple</em></dt>
<dd class="option-desc">Document for the given architecture. The default is the host architecture. The general format of the triple is
<code>&lt;arch&gt;&lt;sub&gt;-&lt;vendor&gt;-&lt;sys&gt;-&lt;abi&gt;</code>. Run <code>rustc --print target-list</code> for a
list of supported targets.</p>
list of supported targets. This flag may be specified multiple times.</p>
<p>This may also be specified with the <code>build.target</code>
<a href="../reference/config.html">config value</a>.</p>
<p>Note that specifying this flag makes Cargo run in a different mode where the

View File

@ -2,6 +2,7 @@
## NAME
cargo-test - Execute unit and integration tests of a package
@ -269,7 +270,7 @@ be specified multiple times, which enables all specified features.</dd>
<dt class="option-term" id="option-cargo-test---target"><a class="option-anchor" href="#option-cargo-test---target"></a><code>--target</code> <em>triple</em></dt>
<dd class="option-desc">Test for the given architecture. The default is the host architecture. The general format of the triple is
<code>&lt;arch&gt;&lt;sub&gt;-&lt;vendor&gt;-&lt;sys&gt;-&lt;abi&gt;</code>. Run <code>rustc --print target-list</code> for a
list of supported targets.</p>
list of supported targets. This flag may be specified multiple times.</p>
<p>This may also be specified with the <code>build.target</code>
<a href="../reference/config.html">config value</a>.</p>
<p>Note that specifying this flag makes Cargo run in a different mode where the

View File

@ -363,7 +363,8 @@ Sets the executable to use for `rustc`.
* Environment: `CARGO_BUILD_RUSTC_WRAPPER` or `RUSTC_WRAPPER`
Sets a wrapper to execute instead of `rustc`. The first argument passed to the
wrapper is the path to the actual `rustc`.
wrapper is the path to the actual executable to use
(i.e., `build.rustc`, if that is set, or `"rustc"` otherwise).
##### `build.rustc-workspace-wrapper`
* Type: string (program path)
@ -371,7 +372,8 @@ wrapper is the path to the actual `rustc`.
* Environment: `CARGO_BUILD_RUSTC_WORKSPACE_WRAPPER` or `RUSTC_WORKSPACE_WRAPPER`
Sets a wrapper to execute instead of `rustc`, for workspace members only.
The first argument passed to the wrapper is the path to the actual `rustc`.
The first argument passed to the wrapper is the path to the actual
executable to use (i.e., `build.rustc`, if that is set, or `"rustc"` otherwise).
It affects the filename hash so that artifacts produced by the wrapper are cached separately.
##### `build.rustdoc`
@ -382,16 +384,25 @@ It affects the filename hash so that artifacts produced by the wrapper are cache
Sets the executable to use for `rustdoc`.
##### `build.target`
* Type: string
* Type: string or array of strings
* Default: host platform
* Environment: `CARGO_BUILD_TARGET`
The default target platform triple to compile to.
The default target platform triples to compile to.
This may also be a relative path to a `.json` target spec file.
This allows passing either a string or an array of strings. Each string value
is a target platform triple. The selected build targets will be built for each
of the selected architectures.
The string value may also be a relative path to a `.json` target spec file.
Can be overridden with the `--target` CLI option.
```toml
[build]
target = ["x86_64-unknown-linux-gnu", "i686-unknown-linux-gnu"]
```
##### `build.target-dir`
* Type: string (path)
* Default: "target"

View File

@ -21,15 +21,18 @@ system:
* `RUSTC` — Instead of running `rustc`, Cargo will execute this specified
compiler instead. See [`build.rustc`] to set via config.
* `RUSTC_WRAPPER` — Instead of simply running `rustc`, Cargo will execute this
specified wrapper instead, passing as its command-line arguments the rustc
invocation, with the first argument being `rustc`. Useful to set up a build
cache tool such as `sccache`. See [`build.rustc-wrapper`] to set via config.
* `RUSTC_WORKSPACE_WRAPPER` — Instead of simply running `rustc`, Cargo will
execute this specified wrapper instead for workspace members only, passing
specified wrapper, passing as its command-line arguments the rustc
invocation, with the first argument being the path to the actual rustc.
Useful to set up a build cache tool such as `sccache`. See
[`build.rustc-wrapper`] to set via config. Setting this to the empty string
overwrites the config and resets cargo to not use a wrapper.
* `RUSTC_WORKSPACE_WRAPPER` — Instead of simply running `rustc`, for workspace
members Cargo will execute this specified wrapper, passing
as its command-line arguments the rustc invocation, with the first argument
being `rustc`. It affects the filename hash so that artifacts produced by
the wrapper are cached separately. See [`build.rustc-workspace-wrapper`]
to set via config.
being the path to the actual rustc. It affects the filename hash
so that artifacts produced by the wrapper are cached separately.
See [`build.rustc-workspace-wrapper`] to set via config. Setting this to the empty string
overwrites the config and resets cargo to not use a wrapper for workspace members.
* `RUSTDOC` — Instead of running `rustdoc`, Cargo will execute this specified
`rustdoc` instance instead. See [`build.rustdoc`] to set via config.
* `RUSTDOCFLAGS` — A space-separated list of custom flags to pass to all `rustdoc`

View File

@ -1,24 +1,37 @@
### Future incompat report
Cargo checks for future-incompatible warnings in all dependencies. These are warnings for
Cargo checks for future-incompatible warnings in all dependencies. These are warnings for
changes that may become hard errors in the future, causing the dependency to
stop building in a future version of rustc. If any warnings are found, a small
notice is displayed indicating that the warnings were found, and provides
instructions on how to display a full report.
For example, you may see something like this at the end of a build:
```text
warning: the following packages contain code that will be rejected by a future
version of Rust: rental v0.5.5
note: to see what the problems were, use the option `--future-incompat-report`,
or run `cargo report future-incompatibilities --id 1`
```
A full report can be displayed with the `cargo report future-incompatibilities
--id ID` command, or by running the build again with
the `--future-incompat-report` flag. The developer should then update their
dependencies to a version where the issue is fixed, or work with the
developers of the dependencies to help resolve the issue.
This feature can be configured through a `[future-incompat-report]`
section in `.cargo/config`. Currently, the supported options are:
## Configuration
```
This feature can be configured through a [`[future-incompat-report]`][config]
section in `.cargo/config.toml`. Currently, the supported options are:
```toml
[future-incompat-report]
frequency = FREQUENCY
frequency = "always"
```
The supported values for `FREQUENCY` are `always` and `never`, which control
The supported values for the frequency are `"always"` and `"never"`, which control
whether or not a message is printed out at the end of `cargo build` / `cargo check`.
[config]: config.md#future-incompat-report

View File

@ -246,7 +246,7 @@ whether or not [`rpath`] is enabled.
#### dev
The `dev` profile is used for normal development and debugging. It is the
default for build commands like [`cargo build`].
default for build commands like [`cargo build`], and is used for `cargo install --debug`.
The default settings for the `dev` profile are:

View File

@ -320,9 +320,10 @@ visit the registry's website to obtain a token, and Cargo can store the token
using the [`cargo login`] command, or by passing the token on the
command-line.
Responses use a 200 response code for both success and errors. Cargo looks at
the JSON response to determine if there was success or failure. Failure
responses have a JSON object with the following structure:
Responses use the 200 response code for success.
Errors should use an appropriate response code, such as 404.
Failure
responses should have a JSON object with the following structure:
```javascript
{
@ -336,10 +337,10 @@ responses have a JSON object with the following structure:
}
```
Servers may also respond with a 404 response code to indicate the requested
resource is not found (for example, an unknown crate name). However, using a
200 response with an `errors` object allows a registry to provide a more
detailed error message if desired.
If the response has this structure Cargo will display the detailed message to the user, even if the response code is 200.
If the response code indicates an error and the content does not have this structure, Cargo will display to the user a
message intended to help debugging the server error. A server returning an `errors` object allows a registry to provide a more
detailed or user-centric error message.
For backwards compatibility, servers should ignore any unexpected query
parameters or JSON fields. If a JSON field is missing, it should be assumed to

View File

@ -454,8 +454,44 @@ following to the above manifest:
log-debug = ['bar/log-debug'] # using 'foo/log-debug' would be an error!
```
### Inheriting a dependency from a workspace
Dependencies can be inherited from a workspace by specifying the
dependency in the workspace's [`[workspace.dependencies]`][workspace.dependencies] table.
After that add it to the `[dependencies]` table with `workspace = true`.
Along with the `workspace` key, dependencies can also include these keys:
- [`optional`][optional]: Note that the`[workspace.dependencies]` table is not allowed to specify `optional`.
- [`features`][features]: These are additive with the features declared in the `[workspace.dependencies]`
Other than `optional` and `features`, inherited dependencies cannot use any other
dependency key (such as `version` or `default-features`).
Dependencies in the `[dependencies]`, `[dev-dependencies]`, `[build-dependencies]`, and
`[target."...".dependencies]` sections support the ability to reference the
`[workspace.dependencies]` definition of dependencies.
```toml
[project]
name = "bar"
version = "0.2.0"
[dependencies]
regex = { workspace = true, features = ["unicode"] }
[build-dependencies]
cc.workspace = true
[dev-dependencies]
rand = { workspace = true, optional = true }
```
[crates.io]: https://crates.io/
[dev-dependencies]: #development-dependencies
[workspace.dependencies]: workspaces.md#the-workspacedependencies-table
[optional]: features.md#optional-dependencies
[features]: features.md
<script>
(function() {

View File

@ -6,7 +6,7 @@ takes, and tracks concurrency information over time.
cargo build --timings
```
This writes an HTML report in `target/cargo-timings/cargo-timings.html`. This
This writes an HTML report in `target/cargo-timings/cargo-timing.html`. This
also writes a copy of the report to the same directory with a timestamp in the
filename, if you want to look at older runs.

View File

@ -48,7 +48,7 @@ how the feature works:
```toml
[unstable]
mtime-on-use = true
multitarget = true
build-std = ["core", "alloc"]
```
Each new feature described below should explain how to use it.
@ -68,7 +68,6 @@ Each new feature described below should explain how to use it.
* [avoid-dev-deps](#avoid-dev-deps) — Prevents the resolver from including dev-dependencies during resolution.
* [minimal-versions](#minimal-versions) — Forces the resolver to use the lowest compatible version instead of the highest.
* [public-dependency](#public-dependency) — Allows dependencies to be classified as either public or private.
* [workspace-inheritance](#workspace-inheritance) - Allow workspace members to share fields and dependencies
* Output behavior
* [out-dir](#out-dir) — Adds a directory where artifacts are copied to.
* [terminal-width](#terminal-width) — Tells rustc the width of the terminal so that long diagnostic messages can be truncated to be more readable.
@ -76,7 +75,6 @@ Each new feature described below should explain how to use it.
* Compile behavior
* [mtime-on-use](#mtime-on-use) — Updates the last-modified timestamp on every dependency every time it is used, to provide a mechanism to delete unused artifacts.
* [doctest-xcompile](#doctest-xcompile) — Supports running doctests with the `--target` flag.
* [multitarget](#multitarget) — Supports building for multiple targets at the same time.
* [build-std](#build-std) — Builds the standard library instead of using pre-built binaries.
* [build-std-features](#build-std-features) — Sets features to use with the standard library.
* [binary-dep-depinfo](#binary-dep-depinfo) — Causes the dep-info file to track binary dependencies.
@ -87,7 +85,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
* [Profile `strip` option](#profile-strip-option) — Forces the removal of debug information and symbols from executables.
* [Profile `rustflags` option](#profile-rustflags-option) — Passed directly to rustc.
* [per-package-target](#per-package-target) — Sets the `--target` to use for each individual package.
* [artifact dependencies](#artifact-dependencies) - Allow build artifacts to be included into other build artifacts and build them for different targets.
@ -218,32 +215,6 @@ information from `.cargo/config.toml`. See the rustc issue for more information.
cargo test --target foo -Zdoctest-xcompile
```
### multitarget
* Tracking Issue: [#8176](https://github.com/rust-lang/cargo/issues/8176)
This flag allows passing multiple `--target` flags to the `cargo` subcommand
selected. When multiple `--target` flags are passed the selected build targets
will be built for each of the selected architectures.
For example to compile a library for both 32 and 64-bit:
```
cargo build --target x86_64-unknown-linux-gnu --target i686-unknown-linux-gnu
```
or running tests for both targets:
```
cargo test --target x86_64-unknown-linux-gnu --target i686-unknown-linux-gnu
```
This can also be specified in `.cargo/config.toml` files.
```toml
[build]
target = ["x86_64-unknown-linux-gnu", "i686-unknown-linux-gnu"]
```
#### New `dir-name` attribute
Some of the paths generated under `target/` have resulted in a de-facto "build
@ -437,25 +408,8 @@ like to stabilize it somehow!
[rust-lang/rust#64158]: https://github.com/rust-lang/rust/pull/64158
### crate-type
* Tracking Issue: [#10083](https://github.com/rust-lang/cargo/issues/10083)
* RFC: [#3180](https://github.com/rust-lang/rfcs/pull/3180)
* Original Pull Request: [#10093](https://github.com/rust-lang/cargo/pull/10093)
`cargo rustc --crate-type=lib,cdylib` forwards the `--crate-type` flag to `rustc`.
This runs `rustc` with the corresponding
[`--crate-type`](https://doc.rust-lang.org/rustc/command-line-arguments.html#--crate-type-a-list-of-types-of-crates-for-the-compiler-to-emit)
flag, and compiling.
When using it, it requires the `-Z unstable-options`
command-line option:
```console
cargo rustc --crate-type lib,cdylib -Z unstable-options
```
### keep-going
* Tracking Issue: [#0](https://github.com/rust-lang/cargo/issues/10496)
* Tracking Issue: [#10496](https://github.com/rust-lang/cargo/issues/10496)
`cargo build --keep-going` (and similarly for `check`, `test` etc) will build as
many crates in the dependency graph as possible, rather than aborting the build
@ -1275,7 +1229,7 @@ documentation = "https://example.github.io/example"
```
```toml
# [PROGJCT_DIR]/bar/Cargo.toml
# [PROJECT_DIR]/bar/Cargo.toml
cargo-features = ["workspace-inheritance"]
[package]
@ -1569,3 +1523,24 @@ unstable and require `-Zunstable-options`.)
The `--config` CLI option has been stabilized in the 1.63 release. See
the [config documentation](config.html#command-line-overrides) for more
information.
### multitarget
The `-Z multitarget` option has been stabilized in the 1.64 release.
See [`build.target`](config.md#buildtarget) for more information about
setting the default target platform triples.
### crate-type
The `--crate-type` flag for `cargo rustc` has been stabilized in the 1.64
release. See the [`cargo rustc` documentation](../commands/cargo-rustc.md)
for more information.
### Workspace Inheritance
Workspace Inheritance has been stabilized in the 1.64 release.
See [workspace.package](workspaces.md#the-workspacepackage-table),
[workspace.dependencies](workspaces.md#the-workspacedependencies-table),
and [inheriting-a-dependency-from-a-workspace](specifying-dependencies.md#inheriting-a-dependency-from-a-workspace)
for more information.

View File

@ -112,6 +112,90 @@ external tools may wish to use them in a consistent fashion, such as referring
to the data in `workspace.metadata` if data is missing from `package.metadata`,
if that makes sense for the tool in question.
### The `workspace.package` table
The `workspace.package` table is where you define keys that can be
inherited by members of a workspace. These keys can be inherited by
defining them in the member package with `{key}.workspace = true`.
Keys that are supported:
| | |
|----------------|-----------------|
| `authors` | `categories` |
| `description` | `documentation` |
| `edition` | `exclude` |
| `homepage` | `include` |
| `keywords` | `license` |
| `license-file` | `publish` |
| `readme` | `repository` |
| `rust-version` | `version` |
- `license-file` and `readme` are relative to the workspace root
- `include` and `exclude` are relative to your package root
Example:
```toml
# [PROJECT_DIR]/Cargo.toml
[workspace]
members = ["bar"]
[workspace.package]
version = "1.2.3"
authors = ["Nice Folks"]
description = "A short description of my package"
documentation = "https://example.com/bar"
```
```toml
# [PROJECT_DIR]/bar/Cargo.toml
[package]
name = "bar"
version.workspace = true
authors.workspace = true
description.workspace = true
documentation.workspace = true
```
### The `workspace.dependencies` table
The `workspace.dependencies` table is where you define dependencies to be
inherited by members of a workspace.
Specifying a workspace dependency is similar to [package dependencies][specifying-dependencies] except:
- Dependencies from this table cannot be declared as `optional`
- [`features`][features] declared in this table are additive with the `features` from `[dependencies]`
You can then [inherit the workspace dependency as a package dependency][inheriting-a-dependency-from-a-workspace]
Example:
```toml
# [PROJECT_DIR]/Cargo.toml
[workspace]
members = ["bar"]
[workspace.dependencies]
cc = "1.0.73"
rand = "0.8.5"
regex = { version = "1.6.0", default-features = false, features = ["std"] }
```
```toml
# [PROJECT_DIR]/bar/Cargo.toml
[project]
name = "bar"
version = "0.2.0"
[dependencies]
regex = { workspace = true, features = ["unicode"] }
[build-dependencies]
cc.workspace = true
[dev-dependencies]
rand.workspace = true
```
[package]: manifest.md#the-package-section
[package-metadata]: manifest.md#the-metadata-table
[output directory]: ../guide/build-cache.md
@ -122,3 +206,6 @@ if that makes sense for the tool in question.
[`package.workspace`]: manifest.md#the-workspace-field
[globs]: https://docs.rs/glob/0.3.0/glob/struct.Pattern.html
[`cargo build`]: ../commands/cargo-build.md
[specifying-dependencies]: specifying-dependencies.md
[features]: features.md
[inheriting-a-dependency-from-a-workspace]: specifying-dependencies.md#inheriting-a-dependency-from-a-workspace

View File

@ -168,7 +168,7 @@ _cargo() {
'(-f --force)'{-f,--force}'[force overwriting of existing crates or binaries]' \
'--bin=[only install the specified binary]:binary' \
'--branch=[branch to use when installing from git]:branch' \
'--debug[build in debug mode instead of release mode]' \
'--debug[Build in debug mode (with the "dev" profile) instead of release mode]' \
'--example=[install the specified example instead of binaries]:example:_cargo_example_names' \
'--git=[specify URL from which to install the crate]:url:_urls' \
'--path=[local filesystem path to crate to install]: :_directories' \

View File

@ -257,7 +257,7 @@ Do not activate the \fBdefault\fR feature of the selected packages.
.RS 4
Benchmark for the given architecture. The default is the host architecture. The general format of the triple is
\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fR\&. Run \fBrustc \-\-print target\-list\fR for a
list of supported targets.
list of supported targets. This flag may be specified multiple times.
.sp
This may also be specified with the \fBbuild.target\fR
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.

View File

@ -168,7 +168,7 @@ Do not activate the \fBdefault\fR feature of the selected packages.
.RS 4
Build for the given architecture. The default is the host architecture. The general format of the triple is
\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fR\&. Run \fBrustc \-\-print target\-list\fR for a
list of supported targets.
list of supported targets. This flag may be specified multiple times.
.sp
This may also be specified with the \fBbuild.target\fR
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.

View File

@ -164,7 +164,7 @@ Do not activate the \fBdefault\fR feature of the selected packages.
.RS 4
Check for the given architecture. The default is the host architecture. The general format of the triple is
\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fR\&. Run \fBrustc \-\-print target\-list\fR for a
list of supported targets.
list of supported targets. This flag may be specified multiple times.
.sp
This may also be specified with the \fBbuild.target\fR
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.

View File

@ -53,7 +53,7 @@ Defaults to \fBtarget\fR in the root of the workspace.
.RS 4
Clean for the given architecture. The default is the host architecture. The general format of the triple is
\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fR\&. Run \fBrustc \-\-print target\-list\fR for a
list of supported targets.
list of supported targets. This flag may be specified multiple times.
.sp
This may also be specified with the \fBbuild.target\fR
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.

View File

@ -137,7 +137,7 @@ Do not activate the \fBdefault\fR feature of the selected packages.
.RS 4
Document for the given architecture. The default is the host architecture. The general format of the triple is
\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fR\&. Run \fBrustc \-\-print target\-list\fR for a
list of supported targets.
list of supported targets. This flag may be specified multiple times.
.sp
This may also be specified with the \fBbuild.target\fR
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.

View File

@ -27,7 +27,7 @@ you plan to use Cargo without a network with the \fB\-\-offline\fR flag.
.RS 4
Fetch for the given architecture. The default is all architectures. The general format of the triple is
\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fR\&. Run \fBrustc \-\-print target\-list\fR for a
list of supported targets.
list of supported targets. This flag may be specified multiple times.
.sp
This may also be specified with the \fBbuild.target\fR
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.

View File

@ -259,7 +259,7 @@ Do not activate the \fBdefault\fR feature of the selected packages.
.RS 4
Fix for the given architecture. The default is the host architecture. The general format of the triple is
\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fR\&. Run \fBrustc \-\-print target\-list\fR for a
list of supported targets.
list of supported targets. This flag may be specified multiple times.
.sp
This may also be specified with the \fBbuild.target\fR
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.

View File

@ -148,7 +148,7 @@ single quotes or double quotes around each pattern.
.RS 4
Package for the given architecture. The default is the host architecture. The general format of the triple is
\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fR\&. Run \fBrustc \-\-print target\-list\fR for a
list of supported targets.
list of supported targets. This flag may be specified multiple times.
.sp
This may also be specified with the \fBbuild.target\fR
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.

View File

@ -98,7 +98,7 @@ format.
.RS 4
Publish for the given architecture. The default is the host architecture. The general format of the triple is
\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fR\&. Run \fBrustc \-\-print target\-list\fR for a
list of supported targets.
list of supported targets. This flag may be specified multiple times.
.sp
This may also be specified with the \fBbuild.target\fR
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.

View File

@ -154,7 +154,7 @@ Do not activate the \fBdefault\fR feature of the selected packages.
.RS 4
Build for the given architecture. The default is the host architecture. The general format of the triple is
\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fR\&. Run \fBrustc \-\-print target\-list\fR for a
list of supported targets.
list of supported targets. This flag may be specified multiple times.
.sp
This may also be specified with the \fBbuild.target\fR
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
@ -224,6 +224,20 @@ and does not provide machine\-readable timing data.
information about timing information.
.RE
.RE
.sp
\fB\-\-crate\-type\fR \fIcrate\-type\fR
.RS 4
Build for the given crate type. This flag accepts a comma\-separated list of
1 or more crate types, of which the allowed values are the same as \fBcrate\-type\fR
field in the manifest for configurating a Cargo target. See
\fI\f(BIcrate\-type\fI field\fR <https://doc.rust\-lang.org/cargo/reference/cargo\-targets.html#the\-crate\-type\-field>
for possible values.
.sp
If the manifest contains a list, and \fB\-\-crate\-type\fR is provided,
the command\-line argument value will override what is in the manifest.
.sp
This flag only works when building a \fBlib\fR or \fBexample\fR library target.
.RE
.SS "Output Options"
.sp
\fB\-\-target\-dir\fR \fIdirectory\fR
@ -434,5 +448,15 @@ cargo rustc \-\-lib \-\- \-Z print\-type\-sizes
.fi
.RE
.RE
.sp
.RS 4
\h'-04' 3.\h'+01'Override \fBcrate\-type\fR field in Cargo.toml with command\-line option:
.sp
.RS 4
.nf
cargo rustc \-\-lib \-\-crate\-type lib,cdylib
.fi
.RE
.RE
.SH "SEE ALSO"
\fBcargo\fR(1), \fBcargo\-build\fR(1), \fBrustc\fR(1)

View File

@ -156,7 +156,7 @@ Do not activate the \fBdefault\fR feature of the selected packages.
.RS 4
Document for the given architecture. The default is the host architecture. The general format of the triple is
\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fR\&. Run \fBrustc \-\-print target\-list\fR for a
list of supported targets.
list of supported targets. This flag may be specified multiple times.
.sp
This may also be specified with the \fBbuild.target\fR
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.

View File

@ -269,7 +269,7 @@ Do not activate the \fBdefault\fR feature of the selected packages.
.RS 4
Test for the given architecture. The default is the host architecture. The general format of the triple is
\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fR\&. Run \fBrustc \-\-print target\-list\fR for a
list of supported targets.
list of supported targets. This flag may be specified multiple times.
.sp
This may also be specified with the \fBbuild.target\fR
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.

View File

@ -32,7 +32,7 @@ fn enable_build_std(e: &mut Execs, arg: Option<&str>) {
None => "-Zbuild-std".to_string(),
};
e.arg(arg);
e.masquerade_as_nightly_cargo();
e.masquerade_as_nightly_cargo(&["build-std"]);
}
// Helper methods used in the tests below

View File

@ -31,7 +31,7 @@ fn source_config_env() {
let path = paths::root().join("registry");
p.cargo("check -Zadvanced-env")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["advanced-env"])
.env("CARGO_SOURCE_crates-io_REPLACE_WITH", "my-local-source")
.env("CARGO_SOURCE_my-local-source_LOCAL_REGISTRY", path)
.run();

View File

@ -30,7 +30,7 @@ fn check_with_invalid_artifact_dependency() {
.file("bar/src/lib.rs", "")
.build();
p.cargo("check -Z bindeps")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["bindeps"])
.with_stderr(
"\
[ERROR] failed to parse manifest at `[..]/Cargo.toml`
@ -49,7 +49,7 @@ Caused by:
) {
assert(
p.cargo(&format!("{} -Z bindeps", cmd))
.masquerade_as_nightly_cargo(),
.masquerade_as_nightly_cargo(&["bindeps"]),
);
assert(&mut p.cargo(cmd));
}
@ -141,7 +141,7 @@ fn check_with_invalid_target_triple() {
.file("bar/src/main.rs", "fn main() {}")
.build();
p.cargo("check -Z bindeps")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["bindeps"])
.with_stderr_contains(
r#"[..]Could not find specification for target "unknown-target-triple"[..]"#,
)
@ -204,7 +204,7 @@ fn disallow_artifact_and_no_artifact_dep_to_same_package_within_the_same_dep_cat
.file("bar/src/main.rs", "fn main() {}")
.build();
p.cargo("check -Z bindeps")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["bindeps"])
.with_status(101)
.with_stderr("\
[WARNING] foo v0.0.0 ([CWD]) ignoring invalid dependency `bar_stable` which is missing a lib target
@ -310,7 +310,7 @@ fn features_are_unified_among_lib_and_bin_dep_of_same_target() {
.build();
p.cargo("build -Z bindeps")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["bindeps"])
.with_stderr(
"\
[COMPILING] d2 v0.0.1 ([CWD]/d2)
@ -417,7 +417,7 @@ fn features_are_not_unified_among_lib_and_bin_dep_of_different_target() {
.build();
p.cargo("build -Z bindeps")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["bindeps"])
.with_status(101)
.with_stderr_contains(
"error[E0425]: cannot find function `f2` in crate `d2`\n --> d1/src/main.rs:6:17",
@ -499,7 +499,7 @@ fn feature_resolution_works_for_cfg_target_specification() {
.build();
p.cargo("test -Z bindeps")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["bindeps"])
.run();
}
@ -565,7 +565,7 @@ fn build_script_with_bin_artifacts() {
.file("bar/src/lib.rs", "")
.build();
p.cargo("build -Z bindeps")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["bindeps"])
.with_stderr_contains("[COMPILING] foo [..]")
.with_stderr_contains("[COMPILING] bar v0.5.0 ([CWD]/bar)")
.with_stderr_contains("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]")
@ -648,7 +648,7 @@ fn build_script_with_bin_artifact_and_lib_false() {
)
.build();
p.cargo("build -Z bindeps")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["bindeps"])
.with_status(101)
.with_stderr_does_not_contain("[..]sentinel[..]")
.run();
@ -689,7 +689,7 @@ fn lib_with_bin_artifact_and_lib_false() {
)
.build();
p.cargo("build -Z bindeps")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["bindeps"])
.with_status(101)
.with_stderr_does_not_contain("[..]sentinel[..]")
.run();
@ -747,7 +747,7 @@ fn build_script_with_selected_dashed_bin_artifact_and_lib_true() {
"#)
.build();
p.cargo("build -Z bindeps")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["bindeps"])
.with_stderr(
"\
[COMPILING] bar-baz v0.5.0 ([CWD]/bar)
@ -844,7 +844,7 @@ fn lib_with_selected_dashed_bin_artifact_and_lib_true() {
.file("bar/src/lib.rs", "pub fn exists() {}")
.build();
p.cargo("build -Z bindeps")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["bindeps"])
.with_stderr(
"\
[COMPILING] bar-baz v0.5.0 ([CWD]/bar)
@ -893,7 +893,7 @@ fn allow_artifact_and_no_artifact_dep_to_same_package_within_different_dep_categ
.file("bar/src/lib.rs", "")
.build();
p.cargo("test -Z bindeps")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["bindeps"])
.with_stderr_contains("[COMPILING] bar v0.5.0 ([CWD]/bar)")
.with_stderr_contains("[FINISHED] test [unoptimized + debuginfo] target(s) in [..]")
.run();
@ -932,7 +932,7 @@ fn normal_build_deps_are_picked_up_in_presence_of_an_artifact_build_dep_to_the_s
.file("bar/src/lib.rs", "pub fn f() {}")
.build();
p.cargo("check -Z bindeps")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["bindeps"])
.run();
}
@ -958,7 +958,7 @@ fn disallow_using_example_binaries_as_artifacts() {
.file("bar/examples/one-example.rs", "fn main() {}")
.build();
p.cargo("build -Z bindeps")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["bindeps"])
.with_status(101)
.with_stderr(r#"[ERROR] dependency `bar` in package `foo` requires a `bin:one-example` artifact to be present."#)
.run();
@ -1007,7 +1007,7 @@ fn allow_artifact_and_non_artifact_dependency_to_same_crate() {
.build();
p.cargo("check -Z bindeps")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["bindeps"])
.with_stderr_contains("[COMPILING] bar [..]")
.with_stderr_contains("[COMPILING] foo [..]")
.run();
@ -1051,7 +1051,7 @@ fn build_script_deps_adopt_specified_target_unconditionally() {
.build();
p.cargo("check -v -Z bindeps")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["bindeps"])
.with_stderr_does_not_contain(format!(
"[RUNNING] `rustc --crate-name build_script_build build.rs [..]--target {} [..]",
target
@ -1122,7 +1122,7 @@ fn build_script_deps_adopt_do_not_allow_multiple_targets_under_different_name_an
.build();
p.cargo("check -v -Z bindeps")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["bindeps"])
.with_status(101)
.with_stderr(format!(
"error: the crate `foo v0.0.0 ([CWD])` depends on crate `bar v0.5.0 ([CWD]/bar)` multiple times with different names",
@ -1166,7 +1166,7 @@ fn non_build_script_deps_adopt_specified_target_unconditionally() {
.build();
p.cargo("check -v -Z bindeps")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["bindeps"])
.with_stderr_contains(format!(
"[RUNNING] `rustc --crate-name bar bar/src/lib.rs [..]--target {} [..]",
target
@ -1224,7 +1224,7 @@ fn no_cross_doctests_works_with_artifacts() {
let target = rustc_host();
p.cargo("test -Z bindeps --target")
.arg(&target)
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["bindeps"])
.with_stderr(&format!(
"\
[COMPILING] bar v0.5.0 ([CWD]/bar)
@ -1244,7 +1244,7 @@ fn no_cross_doctests_works_with_artifacts() {
// This should probably be a warning or error.
p.cargo("test -Z bindeps -v --doc --target")
.arg(&target)
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["bindeps"])
.with_stderr_contains(format!(
"[COMPILING] bar v0.5.0 ([CWD]/bar)
[RUNNING] `rustc --crate-name bar bar/src/lib.rs [..]--target {triple} [..]
@ -1263,7 +1263,7 @@ fn no_cross_doctests_works_with_artifacts() {
// This tests the library, but does not run the doc tests.
p.cargo("test -Z bindeps -v --target")
.arg(&target)
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["bindeps"])
.with_stderr_contains(&format!(
"[FRESH] bar v0.5.0 ([CWD]/bar)
[COMPILING] foo v0.0.1 ([CWD])
@ -1309,7 +1309,7 @@ fn build_script_deps_adopts_target_platform_if_target_equals_target() {
let alternate_target = cross_compile::alternate();
p.cargo("check -v -Z bindeps --target")
.arg(alternate_target)
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["bindeps"])
.with_stderr_does_not_contain(format!(
"[RUNNING] `rustc --crate-name build_script_build build.rs [..]--target {} [..]",
alternate_target
@ -1363,7 +1363,7 @@ fn profile_override_basic() {
.build();
p.cargo("build -v -Z bindeps")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["bindeps"])
.with_stderr_contains(
"[RUNNING] `rustc --crate-name build_script_build [..] -C opt-level=1 [..]`",
)
@ -1428,12 +1428,12 @@ fn dependencies_of_dependencies_work_in_artifacts() {
.file("bar/src/main.rs", r#"fn main() {bar::bar()}"#)
.build();
p.cargo("build -Z bindeps")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["bindeps"])
.run();
// cargo tree sees artifacts as the dependency kind they are in and doesn't do anything special with it.
p.cargo("tree -Z bindeps")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["bindeps"])
.with_stdout(
"\
foo v0.0.0 ([CWD])
@ -1490,7 +1490,7 @@ fn targets_are_picked_up_from_non_workspace_artifact_deps() {
.build();
p.cargo("build -Z bindeps")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["bindeps"])
.run();
}
@ -1529,7 +1529,7 @@ fn allow_dep_renames_with_multiple_versions() {
.file("bar/src/main.rs", r#"fn main() {println!("0.5.0")}"#)
.build();
p.cargo("check -Z bindeps")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["bindeps"])
.with_stderr_contains("[COMPILING] bar [..]")
.with_stderr_contains("[COMPILING] foo [..]")
.run();
@ -1580,7 +1580,7 @@ fn allow_artifact_and_non_artifact_dependency_to_same_crate_if_these_are_not_the
.file("bar/src/main.rs", "fn main() {}")
.build();
p.cargo("build -Z bindeps")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["bindeps"])
.with_stderr(
"\
[COMPILING] bar [..]
@ -1615,7 +1615,7 @@ fn prevent_no_lib_warning_with_artifact_dependencies() {
.file("bar/src/main.rs", "fn main() {}")
.build();
p.cargo("check -Z bindeps")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["bindeps"])
.with_stderr(
"\
[COMPILING] bar v0.5.0 ([CWD]/bar)\n\
@ -1650,7 +1650,7 @@ fn show_no_lib_warning_with_artifact_dependencies_that_have_no_lib_but_lib_true(
.file("bar/src/main.rs", "fn main() {}")
.build();
p.cargo("check -Z bindeps")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["bindeps"])
.with_stderr_contains("[WARNING] foo v0.0.0 ([CWD]) ignoring invalid dependency `bar` which is missing a lib target")
.with_stderr_contains("[COMPILING] bar v0.5.0 ([CWD]/bar)")
.with_stderr_contains("[CHECKING] foo [..]")
@ -1684,7 +1684,7 @@ fn resolver_2_build_dep_without_lib() {
.file("bar/src/main.rs", "fn main() {}")
.build();
p.cargo("check -Z bindeps")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["bindeps"])
.run();
}
@ -1712,7 +1712,7 @@ fn check_missing_crate_type_in_package_fails() {
.file("bar/src/lib.rs", "")
.build();
p.cargo("check -Z bindeps")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["bindeps"])
.with_status(101)
.with_stderr(
"[ERROR] dependency `bar` in package `foo` requires a `[..]` artifact to be present.",
@ -1742,7 +1742,7 @@ fn check_target_equals_target_in_non_build_dependency_errors() {
.file("bar/src/main.rs", "fn main() {}")
.build();
p.cargo("check -Z bindeps")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["bindeps"])
.with_status(101)
.with_stderr_contains(
" `target = \"target\"` in normal- or dev-dependencies has no effect (bar)",
@ -1855,7 +1855,7 @@ fn env_vars_and_build_products_for_various_build_targets() {
.file("bar/src/main.rs", "fn main() {}")
.build();
p.cargo("test -Z bindeps")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["bindeps"])
.with_stderr(
"\
[COMPILING] bar [..]
@ -1901,7 +1901,7 @@ fn publish_artifact_dep() {
.build();
p.cargo("publish -Z bindeps --no-verify --token sekrit")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["bindeps"])
.with_stderr(
"\
[UPDATING] [..]
@ -2014,7 +2014,7 @@ fn doc_lib_true() {
.build();
p.cargo("doc -Z bindeps")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["bindeps"])
.with_stderr(
"\
[COMPILING] bar v0.0.1 ([CWD]/bar)
@ -2034,7 +2034,7 @@ fn doc_lib_true() {
assert_eq!(p.glob("target/debug/deps/libbar-*.rmeta").count(), 2);
p.cargo("doc -Z bindeps")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["bindeps"])
.env("CARGO_LOG", "cargo::ops::cargo_rustc::fingerprint")
.with_stdout("")
.run();
@ -2090,7 +2090,7 @@ fn rustdoc_works_on_libs_with_artifacts_and_lib_false() {
.build();
p.cargo("doc -Z bindeps")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["bindeps"])
.with_stderr(
"\
[COMPILING] bar v0.5.0 ([CWD]/bar)
@ -2260,6 +2260,6 @@ fn build_script_features_for_shared_dependency() {
.build();
p.cargo("build -Z bindeps -v")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["bindeps"])
.run();
}

View File

@ -24,7 +24,7 @@ fn gated() {
// Run cargo build.
p.cargo("build")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["different-binary-name"])
.with_status(101)
.with_stderr_contains("[..]feature `different-binary-name` is required")
.run();
@ -58,7 +58,9 @@ fn binary_name1() {
.build();
// Run cargo build.
p.cargo("build").masquerade_as_nightly_cargo().run();
p.cargo("build")
.masquerade_as_nightly_cargo(&["different-binary-name"])
.run();
// Check the name of the binary that cargo has generated.
// A binary with the name of the crate should NOT be created.
@ -90,7 +92,7 @@ fn binary_name1() {
// Run cargo second time, to verify fingerprint.
p.cargo("build -p foo -v")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["different-binary-name"])
.with_stderr(
"\
[FRESH] foo [..]
@ -100,7 +102,9 @@ fn binary_name1() {
.run();
// Run cargo clean.
p.cargo("clean -p foo").masquerade_as_nightly_cargo().run();
p.cargo("clean -p foo")
.masquerade_as_nightly_cargo(&["different-binary-name"])
.run();
// Check if the appropriate file was removed.
assert!(
@ -156,7 +160,9 @@ fn binary_name2() {
.build();
// Run cargo build.
p.cargo("build").masquerade_as_nightly_cargo().run();
p.cargo("build")
.masquerade_as_nightly_cargo(&["different-binary-name"])
.run();
// Check the name of the binary that cargo has generated.
// A binary with the name of the crate should NOT be created.
@ -168,7 +174,7 @@ fn binary_name2() {
// Check if `cargo test` works
p.cargo("test")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["different-binary-name"])
.with_stderr(
"\
[COMPILING] foo v0.0.1 ([CWD])
@ -180,17 +186,19 @@ fn binary_name2() {
// Check if `cargo run` is able to execute the binary
p.cargo("run")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["different-binary-name"])
.with_stdout("Hello, crabs!")
.run();
p.cargo("install").masquerade_as_nightly_cargo().run();
p.cargo("install")
.masquerade_as_nightly_cargo(&["different-binary-name"])
.run();
assert_has_installed_exe(cargo_home(), "007bar");
p.cargo("uninstall")
.with_stderr("[REMOVING] [ROOT]/home/.cargo/bin/007bar[EXE]")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["different-binary-name"])
.run();
assert_has_not_installed_exe(cargo_home(), "007bar");
@ -234,13 +242,15 @@ fn check_env_vars() {
.build();
// Run cargo build.
p.cargo("build").masquerade_as_nightly_cargo().run();
p.cargo("build")
.masquerade_as_nightly_cargo(&["different-binary-name"])
.run();
p.cargo("run")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["different-binary-name"])
.with_stdout("007bar")
.run();
p.cargo("test")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["different-binary-name"])
.with_status(0)
.run();
}
@ -285,7 +295,7 @@ fn check_msg_format_json() {
// Run cargo build.
p.cargo("build --message-format=json")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["different-binary-name"])
.with_json(output)
.run();
}

View File

@ -5382,7 +5382,7 @@ required by package `bar v0.1.0 ([..]/foo)`
)
.run();
p.cargo("build -Zavoid-dev-deps")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["avoid-dev-deps"])
.run();
}
@ -6132,7 +6132,7 @@ fn simple_terminal_width() {
.build();
p.cargo("build -Zterminal-width=20")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["terminal-width"])
.with_status(101)
.with_stderr_contains("3 | ..._: () = 42;")
.run();

View File

@ -11,7 +11,7 @@ fn cargo_build_plan_simple() {
.build();
p.cargo("build --build-plan -Zunstable-options")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["build-plan"])
.with_json(
r#"
{
@ -70,7 +70,7 @@ fn cargo_build_plan_single_dep() {
.file("bar/src/lib.rs", "pub fn bar() {}")
.build();
p.cargo("build --build-plan -Zunstable-options")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["build-plan"])
.with_json(
r#"
{
@ -139,7 +139,7 @@ fn cargo_build_plan_build_script() {
.build();
p.cargo("build --build-plan -Zunstable-options")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["build-plan"])
.with_json(
r#"
{
@ -217,6 +217,6 @@ fn build_plan_with_dev_dep() {
.build();
p.cargo("build --build-plan -Zunstable-options")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["build-plan"])
.run();
}

View File

@ -404,7 +404,7 @@ fn custom_build_env_var_rustc_linker_host_target() {
// only if build.rs succeeds, despite linker binary not existing.
p.cargo("build -Z target-applies-to-host --target")
.arg(&target)
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["target-applies-to-host"])
.run();
}
@ -440,7 +440,7 @@ fn custom_build_env_var_rustc_linker_host_target_env() {
p.cargo("build -Z target-applies-to-host --target")
.env("CARGO_TARGET_APPLIES_TO_HOST", "false")
.arg(&target)
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["target-applies-to-host"])
.run();
}
@ -465,7 +465,7 @@ fn custom_build_invalid_host_config_feature_flag() {
// build.rs should fail due to -Zhost-config being set without -Ztarget-applies-to-host
p.cargo("build -Z host-config --target")
.arg(&target)
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["host-config"])
.with_status(101)
.with_stderr_contains(
"\
@ -498,7 +498,7 @@ fn custom_build_linker_host_target_with_bad_host_config() {
// build.rs should fail due to bad host linker being set
p.cargo("build -Z target-applies-to-host -Z host-config --verbose --target")
.arg(&target)
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["target-applies-to-host", "host-config"])
.with_status(101)
.with_stderr_contains(
"\
@ -533,7 +533,7 @@ fn custom_build_linker_bad_host() {
// build.rs should fail due to bad host linker being set
p.cargo("build -Z target-applies-to-host -Z host-config --verbose --target")
.arg(&target)
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["target-applies-to-host", "host-config"])
.with_status(101)
.with_stderr_contains(
"\
@ -570,7 +570,7 @@ fn custom_build_linker_bad_host_with_arch() {
// build.rs should fail due to bad host linker being set
p.cargo("build -Z target-applies-to-host -Z host-config --verbose --target")
.arg(&target)
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["target-applies-to-host", "host-config"])
.with_status(101)
.with_stderr_contains(
"\
@ -616,7 +616,7 @@ fn custom_build_env_var_rustc_linker_cross_arch_host() {
// assertion should succeed since it's still passed the target linker
p.cargo("build -Z target-applies-to-host -Z host-config --verbose --target")
.arg(&target)
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["target-applies-to-host", "host-config"])
.run();
}
@ -646,7 +646,7 @@ fn custom_build_linker_bad_cross_arch_host() {
// build.rs should fail due to bad host linker being set
p.cargo("build -Z target-applies-to-host -Z host-config --verbose --target")
.arg(&target)
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["target-applies-to-host", "host-config"])
.with_status(101)
.with_stderr_contains(
"\
@ -4870,7 +4870,7 @@ fn duplicate_script_with_extra_env() {
if cargo_test_support::is_nightly() {
p.cargo("test --workspace -Z doctest-xcompile --doc --target")
.arg(&target)
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["doctest-xcompile"])
.with_stdout_contains("test src/lib.rs - (line 2) ... ok")
.run();
}

View File

@ -130,7 +130,7 @@ fn rustc_bootstrap() {
.run();
// nightly should warn whether or not RUSTC_BOOTSTRAP is set
p.cargo("build")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["RUSTC_BOOTSTRAP"])
// NOTE: uses RUSTC_BOOTSTRAP so it will be propagated to rustc
// (this matters when tests are being run with a beta or stable cargo)
.env("RUSTC_BOOTSTRAP", "1")
@ -159,7 +159,7 @@ fn rustc_bootstrap() {
.build();
// nightly should warn when there's no library whether or not RUSTC_BOOTSTRAP is set
p.cargo("build")
.masquerade_as_nightly_cargo()
.masquerade_as_nightly_cargo(&["RUSTC_BOOTSTRAP"])
// NOTE: uses RUSTC_BOOTSTRAP so it will be propagated to rustc
// (this matters when tests are being run with a beta or stable cargo)
.env("RUSTC_BOOTSTRAP", "1")

View File

@ -23,7 +23,6 @@ fn build_script_extra_link_arg_bin() {
.build();
p.cargo("build -v")
.masquerade_as_nightly_cargo()
.without_status()
.with_stderr_contains(
"[RUNNING] `rustc --crate-name foo [..]-C link-arg=--this-is-a-bogus-flag[..]",
@ -63,7 +62,6 @@ fn build_script_extra_link_arg_bin_single() {
.build();
p.cargo("build -v")
.masquerade_as_nightly_cargo()
.without_status()
.with_stderr_contains(
"[RUNNING] `rustc --crate-name foo [..]-C link-arg=--bogus-flag-all -C link-arg=--bogus-flag-foo[..]",
@ -90,7 +88,6 @@ fn build_script_extra_link_arg() {
.build();
p.cargo("build -v")
.masquerade_as_nightly_cargo()
.without_status()
.with_stderr_contains(
"[RUNNING] `rustc --crate-name foo [..]-C link-arg=--this-is-a-bogus-flag[..]",
@ -126,7 +123,6 @@ fn link_arg_missing_target() {
);
p.cargo("check")
.masquerade_as_nightly_cargo()
.with_status(101)
.with_stderr("\
[COMPILING] foo [..]
@ -141,7 +137,6 @@ The package foo v0.0.1 ([ROOT]/foo) does not have a bin target.
);
p.cargo("check")
.masquerade_as_nightly_cargo()
.with_status(101)
.with_stderr(
"\
@ -158,7 +153,6 @@ The package foo v0.0.1 ([ROOT]/foo) does not have a bin target with the name `ab
);
p.cargo("check")
.masquerade_as_nightly_cargo()
.with_status(101)
.with_stderr(
"\
@ -261,7 +255,6 @@ fn link_arg_transitive_not_allowed() {
.build();
p.cargo("build -v")
.masquerade_as_nightly_cargo()
.with_stderr(
"\
[UPDATING] [..]
@ -303,7 +296,6 @@ fn link_arg_with_doctest() {
.build();
p.cargo("test --doc -v")
.masquerade_as_nightly_cargo()
.without_status()
.with_stderr_contains(
"[RUNNING] `rustdoc [..]--crate-name foo [..]-C link-arg=--this-is-a-bogus-flag[..]",

View File

@ -3,3 +3,7 @@
[package]
name = "cargo-list-test-fixture-dependency"
version = "0.0.0"
[features]
one = []
two = []

Some files were not shown because too many files have changed in this diff Show More