mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
Merge branch 'master' into yerke/negative_jobs
This commit is contained in:
commit
767368fd02
@ -806,9 +806,14 @@ impl Execs {
|
|||||||
p.build_command()
|
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 {
|
if let Some(ref mut p) = self.process_builder {
|
||||||
p.masquerade_as_nightly_cargo();
|
p.masquerade_as_nightly_cargo(reasons);
|
||||||
}
|
}
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
@ -1139,17 +1144,20 @@ fn _process(t: &OsStr) -> ProcessBuilder {
|
|||||||
|
|
||||||
/// Enable nightly features for testing
|
/// Enable nightly features for testing
|
||||||
pub trait ChannelChanger {
|
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 {
|
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")
|
self.env("__CARGO_TEST_CHANNEL_OVERRIDE_DO_NOT_USE_THIS", "nightly")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ChannelChanger for snapbox::cmd::Command {
|
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")
|
self.env("__CARGO_TEST_CHANNEL_OVERRIDE_DO_NOT_USE_THIS", "nightly")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ use std::time::Instant;
|
|||||||
|
|
||||||
use cargo::core::dependency::DepKind;
|
use cargo::core::dependency::DepKind;
|
||||||
use cargo::core::resolver::{self, ResolveOpts, VersionPreferences};
|
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::Resolve;
|
||||||
use cargo::core::{Dependency, PackageId, Registry, Summary};
|
use cargo::core::{Dependency, PackageId, Registry, Summary};
|
||||||
use cargo::util::{CargoResult, Config, Graph, IntoUrl};
|
use cargo::util::{CargoResult, Config, Graph, IntoUrl};
|
||||||
@ -128,11 +128,15 @@ pub fn resolve_with_config_raw(
|
|||||||
fn query(
|
fn query(
|
||||||
&mut self,
|
&mut self,
|
||||||
dep: &Dependency,
|
dep: &Dependency,
|
||||||
|
kind: QueryKind,
|
||||||
f: &mut dyn FnMut(Summary),
|
f: &mut dyn FnMut(Summary),
|
||||||
fuzzy: bool,
|
|
||||||
) -> Poll<CargoResult<()>> {
|
) -> Poll<CargoResult<()>> {
|
||||||
for summary in self.list.iter() {
|
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());
|
self.used.insert(summary.package_id());
|
||||||
f(summary.clone());
|
f(summary.clone());
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ use cargo::ops::cargo_add::add;
|
|||||||
use cargo::ops::cargo_add::AddOptions;
|
use cargo::ops::cargo_add::AddOptions;
|
||||||
use cargo::ops::cargo_add::DepOp;
|
use cargo::ops::cargo_add::DepOp;
|
||||||
use cargo::ops::cargo_add::DepTable;
|
use cargo::ops::cargo_add::DepTable;
|
||||||
|
use cargo::ops::resolve_ws;
|
||||||
use cargo::util::command_prelude::*;
|
use cargo::util::command_prelude::*;
|
||||||
use cargo::util::interning::InternedString;
|
use cargo::util::interning::InternedString;
|
||||||
use cargo::CargoResult;
|
use cargo::CargoResult;
|
||||||
@ -193,6 +194,12 @@ pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
|
|||||||
};
|
};
|
||||||
add(&ws, &options)?;
|
add(&ws, &options)?;
|
||||||
|
|
||||||
|
if !dry_run {
|
||||||
|
// Reload the workspace since we've changed dependencies
|
||||||
|
let ws = args.workspace(config)?;
|
||||||
|
resolve_ws(&ws)?;
|
||||||
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,10 @@ pub fn cli() -> App {
|
|||||||
.arg(flag("no-track", "Do not save tracking information"))
|
.arg(flag("no-track", "Do not save tracking information"))
|
||||||
.arg_features()
|
.arg_features()
|
||||||
.arg_profile("Install artifacts with the specified profile")
|
.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(
|
.arg_targets_bins_examples(
|
||||||
"Install only the specified binary",
|
"Install only the specified binary",
|
||||||
"Install all binaries",
|
"Install all binaries",
|
||||||
|
@ -39,7 +39,7 @@ pub fn cli() -> App {
|
|||||||
.arg(multi_opt(
|
.arg(multi_opt(
|
||||||
CRATE_TYPE_ARG_NAME,
|
CRATE_TYPE_ARG_NAME,
|
||||||
"CRATE-TYPE",
|
"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_target_dir()
|
||||||
.arg_manifest_path()
|
.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() {
|
compile_opts.target_rustc_crate_types = if crate_types.is_empty() {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
config
|
|
||||||
.cli_unstable()
|
|
||||||
.fail_if_stable_opt(CRATE_TYPE_ARG_NAME, 10083)?;
|
|
||||||
Some(crate_types)
|
Some(crate_types)
|
||||||
};
|
};
|
||||||
ops::compile(&ws, &compile_opts)?;
|
ops::compile(&ws, &compile_opts)?;
|
||||||
|
@ -2,7 +2,7 @@ use crate::core::Target;
|
|||||||
use crate::util::errors::CargoResult;
|
use crate::util::errors::CargoResult;
|
||||||
use crate::util::interning::InternedString;
|
use crate::util::interning::InternedString;
|
||||||
use crate::util::{Config, StableHasher};
|
use crate::util::{Config, StableHasher};
|
||||||
use anyhow::{bail, Context as _};
|
use anyhow::Context as _;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use std::collections::BTreeSet;
|
use std::collections::BTreeSet;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
@ -65,9 +65,6 @@ impl CompileKind {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if !targets.is_empty() {
|
if !targets.is_empty() {
|
||||||
if targets.len() > 1 && !config.cli_unstable().multitarget {
|
|
||||||
bail!("specifying multiple `--target` flags requires `-Zmultitarget`")
|
|
||||||
}
|
|
||||||
return dedup(targets);
|
return dedup(targets);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
//! Support for future-incompatible warning reporting.
|
//! Support for future-incompatible warning reporting.
|
||||||
|
|
||||||
use crate::core::compiler::BuildContext;
|
use crate::core::compiler::BuildContext;
|
||||||
use crate::core::{Dependency, PackageId, Workspace};
|
use crate::core::{Dependency, PackageId, QueryKind, Workspace};
|
||||||
use crate::sources::SourceConfigMap;
|
use crate::sources::SourceConfigMap;
|
||||||
use crate::util::{iter_join, CargoResult, Config};
|
use crate::util::{iter_join, CargoResult, Config};
|
||||||
use anyhow::{bail, format_err, Context};
|
use anyhow::{bail, format_err, Context};
|
||||||
@ -293,7 +293,7 @@ fn get_updates(ws: &Workspace<'_>, package_ids: &BTreeSet<PackageId>) -> Option<
|
|||||||
Ok(dep) => dep,
|
Ok(dep) => dep,
|
||||||
Err(_) => return false,
|
Err(_) => return false,
|
||||||
};
|
};
|
||||||
match source.query_vec(&dep) {
|
match source.query_vec(&dep, QueryKind::Exact) {
|
||||||
Poll::Ready(Ok(sum)) => {
|
Poll::Ready(Ok(sum)) => {
|
||||||
summaries.push((pkg_id, sum));
|
summaries.push((pkg_id, sum));
|
||||||
false
|
false
|
||||||
|
@ -86,7 +86,9 @@
|
|||||||
//! `CliUnstable. Remove the `(unstable)` note in the clap help text if
|
//! `CliUnstable. Remove the `(unstable)` note in the clap help text if
|
||||||
//! necessary.
|
//! necessary.
|
||||||
//! 2. Remove `masquerade_as_nightly_cargo` from any tests, and remove
|
//! 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
|
//! 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
|
//! and summarize it similar to the other entries. Update the rest of the
|
||||||
//! documentation to add the new feature.
|
//! documentation to add the new feature.
|
||||||
@ -414,7 +416,7 @@ features! {
|
|||||||
(unstable, profile_rustflags, "", "reference/unstable.html#profile-rustflags-option"),
|
(unstable, profile_rustflags, "", "reference/unstable.html#profile-rustflags-option"),
|
||||||
|
|
||||||
// Allow specifying rustflags directly in a profile
|
// 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 {
|
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 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>
|
fn deserialize_build_std<'de, D>(deserializer: D) -> Result<Option<Vec<String>>, D::Error>
|
||||||
where
|
where
|
||||||
D: serde::Deserializer<'de>,
|
D: serde::Deserializer<'de>,
|
||||||
@ -920,7 +924,7 @@ impl CliUnstable {
|
|||||||
self.features = Some(feats);
|
self.features = Some(feats);
|
||||||
}
|
}
|
||||||
"separate-nightlies" => self.separate_nightlies = parse_empty(k, v)?,
|
"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)?,
|
"rustdoc-map" => self.rustdoc_map = parse_empty(k, v)?,
|
||||||
"terminal-width" => self.terminal_width = Some(parse_usize_opt(v)?),
|
"terminal-width" => self.terminal_width = Some(parse_usize_opt(v)?),
|
||||||
"sparse-registry" => self.sparse_registry = parse_empty(k, v)?,
|
"sparse-registry" => self.sparse_registry = parse_empty(k, v)?,
|
||||||
|
@ -8,7 +8,7 @@ pub use self::package_id_spec::PackageIdSpec;
|
|||||||
pub use self::registry::Registry;
|
pub use self::registry::Registry;
|
||||||
pub use self::resolver::{Resolve, ResolveVersion};
|
pub use self::resolver::{Resolve, ResolveVersion};
|
||||||
pub use self::shell::{Shell, Verbosity};
|
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::summary::{FeatureMap, FeatureValue, Summary};
|
||||||
pub use self::workspace::{
|
pub use self::workspace::{
|
||||||
find_workspace_root, resolve_relative_path, MaybePackage, Workspace, WorkspaceConfig,
|
find_workspace_root, resolve_relative_path, MaybePackage, Workspace, WorkspaceConfig,
|
||||||
|
@ -2,7 +2,7 @@ use std::collections::{HashMap, HashSet};
|
|||||||
use std::task::Poll;
|
use std::task::Poll;
|
||||||
|
|
||||||
use crate::core::PackageSet;
|
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::sources::config::SourceConfigMap;
|
||||||
use crate::util::errors::CargoResult;
|
use crate::util::errors::CargoResult;
|
||||||
use crate::util::interning::InternedString;
|
use crate::util::interning::InternedString;
|
||||||
@ -19,14 +19,13 @@ pub trait Registry {
|
|||||||
fn query(
|
fn query(
|
||||||
&mut self,
|
&mut self,
|
||||||
dep: &Dependency,
|
dep: &Dependency,
|
||||||
|
kind: QueryKind,
|
||||||
f: &mut dyn FnMut(Summary),
|
f: &mut dyn FnMut(Summary),
|
||||||
fuzzy: bool,
|
|
||||||
) -> Poll<CargoResult<()>>;
|
) -> 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();
|
let mut ret = Vec::new();
|
||||||
self.query(dep, &mut |s| ret.push(s), fuzzy)
|
self.query(dep, kind, &mut |s| ret.push(s)).map_ok(|()| ret)
|
||||||
.map_ok(|()| ret)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn describe_source(&self, source: SourceId) -> String;
|
fn describe_source(&self, source: SourceId) -> String;
|
||||||
@ -327,7 +326,7 @@ impl<'cfg> PackageRegistry<'cfg> {
|
|||||||
.get_mut(dep.source_id())
|
.get_mut(dep.source_id())
|
||||||
.expect("loaded source not present");
|
.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::Ready(deps) => deps,
|
||||||
Poll::Pending => {
|
Poll::Pending => {
|
||||||
deps_pending.push(dep_remaining);
|
deps_pending.push(dep_remaining);
|
||||||
@ -483,7 +482,7 @@ impl<'cfg> PackageRegistry<'cfg> {
|
|||||||
for &s in self.overrides.iter() {
|
for &s in self.overrides.iter() {
|
||||||
let src = self.sources.get_mut(s).unwrap();
|
let src = self.sources.get_mut(s).unwrap();
|
||||||
let dep = Dependency::new_override(dep.package_name(), s);
|
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::Ready(results) => results?,
|
||||||
Poll::Pending => return Poll::Pending,
|
Poll::Pending => return Poll::Pending,
|
||||||
};
|
};
|
||||||
@ -575,8 +574,8 @@ impl<'cfg> Registry for PackageRegistry<'cfg> {
|
|||||||
fn query(
|
fn query(
|
||||||
&mut self,
|
&mut self,
|
||||||
dep: &Dependency,
|
dep: &Dependency,
|
||||||
|
kind: QueryKind,
|
||||||
f: &mut dyn FnMut(Summary),
|
f: &mut dyn FnMut(Summary),
|
||||||
fuzzy: bool,
|
|
||||||
) -> Poll<CargoResult<()>> {
|
) -> Poll<CargoResult<()>> {
|
||||||
assert!(self.patches_locked);
|
assert!(self.patches_locked);
|
||||||
let (override_summary, n, to_warn) = {
|
let (override_summary, n, to_warn) = {
|
||||||
@ -671,11 +670,7 @@ impl<'cfg> Registry for PackageRegistry<'cfg> {
|
|||||||
}
|
}
|
||||||
f(lock(locked, all_patches, summary))
|
f(lock(locked, all_patches, summary))
|
||||||
};
|
};
|
||||||
return if fuzzy {
|
return source.query(dep, kind, callback);
|
||||||
source.fuzzy_query(dep, callback)
|
|
||||||
} else {
|
|
||||||
source.query(dep, callback)
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we have an override summary then we query the source
|
// If we have an override summary then we query the source
|
||||||
@ -694,11 +689,7 @@ impl<'cfg> Registry for PackageRegistry<'cfg> {
|
|||||||
n += 1;
|
n += 1;
|
||||||
to_warn = Some(summary);
|
to_warn = Some(summary);
|
||||||
};
|
};
|
||||||
let pend = if fuzzy {
|
let pend = source.query(dep, kind, callback);
|
||||||
source.fuzzy_query(dep, callback)?
|
|
||||||
} else {
|
|
||||||
source.query(dep, callback)?
|
|
||||||
};
|
|
||||||
if pend.is_pending() {
|
if pend.is_pending() {
|
||||||
return Poll::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.
|
// No summaries found, try to help the user figure out what is wrong.
|
||||||
if let Some(locked) = locked {
|
if let Some(locked) = locked {
|
||||||
// Since the locked patch did not match anything, try the unlocked one.
|
// 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::Pending => return Poll::Pending,
|
||||||
Poll::Ready(deps) => deps,
|
Poll::Ready(deps) => deps,
|
||||||
}
|
}
|
||||||
@ -914,7 +905,7 @@ fn summary_for_patch(
|
|||||||
// Try checking if there are *any* packages that match this by name.
|
// 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_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::Pending => return Poll::Pending,
|
||||||
Poll::Ready(deps) => deps,
|
Poll::Ready(deps) => deps,
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,9 @@ use crate::core::resolver::{
|
|||||||
ActivateError, ActivateResult, CliFeatures, RequestedFeatures, ResolveOpts, VersionOrdering,
|
ActivateError, ActivateResult, CliFeatures, RequestedFeatures, ResolveOpts, VersionOrdering,
|
||||||
VersionPreferences,
|
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::errors::CargoResult;
|
||||||
use crate::util::interning::InternedString;
|
use crate::util::interning::InternedString;
|
||||||
|
|
||||||
@ -100,13 +102,9 @@ impl<'a> RegistryQueryer<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let mut ret = Vec::new();
|
let mut ret = Vec::new();
|
||||||
let ready = self.registry.query(
|
let ready = self.registry.query(dep, QueryKind::Exact, &mut |s| {
|
||||||
dep,
|
ret.push(s);
|
||||||
&mut |s| {
|
})?;
|
||||||
ret.push(s);
|
|
||||||
},
|
|
||||||
false,
|
|
||||||
)?;
|
|
||||||
if ready.is_pending() {
|
if ready.is_pending() {
|
||||||
self.registry_cache.insert(dep.clone(), Poll::Pending);
|
self.registry_cache.insert(dep.clone(), Poll::Pending);
|
||||||
return Poll::Pending;
|
return Poll::Pending;
|
||||||
@ -127,7 +125,7 @@ impl<'a> RegistryQueryer<'a> {
|
|||||||
dep.version_req()
|
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::Ready(s) => s.into_iter(),
|
||||||
Poll::Pending => {
|
Poll::Pending => {
|
||||||
self.registry_cache.insert(dep.clone(), Poll::Pending);
|
self.registry_cache.insert(dep.clone(), Poll::Pending);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::task::Poll;
|
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::lev_distance::lev_distance;
|
||||||
use crate::util::{Config, VersionExt};
|
use crate::util::{Config, VersionExt};
|
||||||
use anyhow::Error;
|
use anyhow::Error;
|
||||||
@ -228,7 +228,7 @@ pub(super) fn activation_error(
|
|||||||
new_dep.set_version_req(all_req);
|
new_dep.set_version_req(all_req);
|
||||||
|
|
||||||
let mut candidates = loop {
|
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(Ok(candidates)) => break candidates,
|
||||||
Poll::Ready(Err(e)) => return to_resolve_err(e),
|
Poll::Ready(Err(e)) => return to_resolve_err(e),
|
||||||
Poll::Pending => match registry.block_until_ready() {
|
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`
|
// 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.
|
// was meant. So we try asking the registry for a `fuzzy` search for suggestions.
|
||||||
let mut candidates = loop {
|
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(Ok(candidates)) => break candidates,
|
||||||
Poll::Ready(Err(e)) => return to_resolve_err(e),
|
Poll::Ready(Err(e)) => return to_resolve_err(e),
|
||||||
Poll::Pending => match registry.block_until_ready() {
|
Poll::Pending => match registry.block_until_ready() {
|
||||||
|
@ -119,11 +119,12 @@ impl ResolveBehavior {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn to_manifest(&self) -> Option<String> {
|
pub fn to_manifest(&self) -> String {
|
||||||
match self {
|
match self {
|
||||||
ResolveBehavior::V1 => None,
|
ResolveBehavior::V1 => "1",
|
||||||
ResolveBehavior::V2 => Some("2".to_string()),
|
ResolveBehavior::V2 => "2",
|
||||||
}
|
}
|
||||||
|
.to_owned()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,21 +29,16 @@ pub trait Source {
|
|||||||
fn requires_precise(&self) -> bool;
|
fn requires_precise(&self) -> bool;
|
||||||
|
|
||||||
/// Attempts to find the packages that match a dependency request.
|
/// Attempts to find the packages that match a dependency request.
|
||||||
fn query(&mut self, dep: &Dependency, f: &mut dyn FnMut(Summary)) -> Poll<CargoResult<()>>;
|
fn query(
|
||||||
|
|
||||||
/// 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(
|
|
||||||
&mut self,
|
&mut self,
|
||||||
dep: &Dependency,
|
dep: &Dependency,
|
||||||
|
kind: QueryKind,
|
||||||
f: &mut dyn FnMut(Summary),
|
f: &mut dyn FnMut(Summary),
|
||||||
) -> Poll<CargoResult<()>>;
|
) -> 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();
|
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.
|
/// 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<()>;
|
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 {
|
pub enum MaybePackage {
|
||||||
Ready(Package),
|
Ready(Package),
|
||||||
Download { url: String, descriptor: String },
|
Download { url: String, descriptor: String },
|
||||||
@ -142,17 +146,13 @@ impl<'a, T: Source + ?Sized + 'a> Source for Box<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Forwards to `Source::query`.
|
/// Forwards to `Source::query`.
|
||||||
fn query(&mut self, dep: &Dependency, f: &mut dyn FnMut(Summary)) -> Poll<CargoResult<()>> {
|
fn query(
|
||||||
(**self).query(dep, f)
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Forwards to `Source::query`.
|
|
||||||
fn fuzzy_query(
|
|
||||||
&mut self,
|
&mut self,
|
||||||
dep: &Dependency,
|
dep: &Dependency,
|
||||||
|
kind: QueryKind,
|
||||||
f: &mut dyn FnMut(Summary),
|
f: &mut dyn FnMut(Summary),
|
||||||
) -> Poll<CargoResult<()>> {
|
) -> Poll<CargoResult<()>> {
|
||||||
(**self).fuzzy_query(dep, f)
|
(**self).query(dep, kind, f)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn invalidate_cache(&mut self) {
|
fn invalidate_cache(&mut self) {
|
||||||
@ -216,16 +216,13 @@ impl<'a, T: Source + ?Sized + 'a> Source for &'a mut T {
|
|||||||
(**self).requires_precise()
|
(**self).requires_precise()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn query(&mut self, dep: &Dependency, f: &mut dyn FnMut(Summary)) -> Poll<CargoResult<()>> {
|
fn query(
|
||||||
(**self).query(dep, f)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn fuzzy_query(
|
|
||||||
&mut self,
|
&mut self,
|
||||||
dep: &Dependency,
|
dep: &Dependency,
|
||||||
|
kind: QueryKind,
|
||||||
f: &mut dyn FnMut(Summary),
|
f: &mut dyn FnMut(Summary),
|
||||||
) -> Poll<CargoResult<()>> {
|
) -> Poll<CargoResult<()>> {
|
||||||
(**self).fuzzy_query(dep, f)
|
(**self).query(dep, kind, f)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn invalidate_cache(&mut self) {
|
fn invalidate_cache(&mut self) {
|
||||||
|
@ -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 {
|
if let Some(default) = default_members_paths {
|
||||||
for path in default {
|
for path in default {
|
||||||
let normalized_path = paths::normalize_path(&path);
|
let normalized_path = paths::normalize_path(&path);
|
||||||
@ -716,7 +718,7 @@ impl<'cfg> Workspace<'cfg> {
|
|||||||
self.default_members.push(self.current_manifest.clone())
|
self.default_members.push(self.current_manifest.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
self.find_path_deps(&root_manifest_path, &root_manifest_path, false)
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn find_path_deps(
|
fn find_path_deps(
|
||||||
@ -1702,10 +1704,17 @@ fn find_workspace_root_with_loader(
|
|||||||
mut loader: impl FnMut(&Path) -> CargoResult<Option<PathBuf>>,
|
mut loader: impl FnMut(&Path) -> CargoResult<Option<PathBuf>>,
|
||||||
) -> CargoResult<Option<PathBuf>> {
|
) -> CargoResult<Option<PathBuf>> {
|
||||||
// Check if there are any workspace roots that have already been found that would work
|
// 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) {
|
let roots = config.ws_roots.borrow();
|
||||||
// Add `Cargo.toml` since ws_root is the root and not the file
|
// Iterate through the manifests parent directories until we find a workspace
|
||||||
return Ok(Some(ws_root.join("Cargo.toml").clone()));
|
// 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")));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,8 +238,7 @@ impl str::FromStr for Manifest {
|
|||||||
|
|
||||||
impl std::fmt::Display for Manifest {
|
impl std::fmt::Display for Manifest {
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
let s = self.data.to_string();
|
self.data.fmt(f)
|
||||||
s.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)]
|
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
|
||||||
enum DependencyStatus {
|
enum DependencyStatus {
|
||||||
None,
|
None,
|
||||||
|
@ -19,6 +19,7 @@ use toml_edit::Item as TomlItem;
|
|||||||
use crate::core::dependency::DepKind;
|
use crate::core::dependency::DepKind;
|
||||||
use crate::core::registry::PackageRegistry;
|
use crate::core::registry::PackageRegistry;
|
||||||
use crate::core::Package;
|
use crate::core::Package;
|
||||||
|
use crate::core::QueryKind;
|
||||||
use crate::core::Registry;
|
use crate::core::Registry;
|
||||||
use crate::core::Shell;
|
use crate::core::Shell;
|
||||||
use crate::core::Workspace;
|
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 manifest_path = options.spec.manifest_path().to_path_buf();
|
||||||
let mut manifest = LocalManifest::try_new(&manifest_path)?;
|
let mut manifest = LocalManifest::try_new(&manifest_path)?;
|
||||||
|
let original_raw_manifest = manifest.to_string();
|
||||||
let legacy = manifest.get_legacy_sections();
|
let legacy = manifest.get_legacy_sections();
|
||||||
if !legacy.is_empty() {
|
if !legacy.is_empty() {
|
||||||
anyhow::bail!(
|
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 {
|
if options.dry_run {
|
||||||
options.config.shell().warn("aborting add due to dry run")?;
|
options.config.shell().warn("aborting add due to dry run")?;
|
||||||
} else {
|
} else {
|
||||||
@ -443,8 +455,7 @@ fn get_latest_dependency(
|
|||||||
}
|
}
|
||||||
MaybeWorkspace::Other(query) => {
|
MaybeWorkspace::Other(query) => {
|
||||||
let possibilities = loop {
|
let possibilities = loop {
|
||||||
let fuzzy = true;
|
match registry.query_vec(&query, QueryKind::Fuzzy) {
|
||||||
match registry.query_vec(&query, fuzzy) {
|
|
||||||
std::task::Poll::Ready(res) => {
|
std::task::Poll::Ready(res) => {
|
||||||
break res?;
|
break res?;
|
||||||
}
|
}
|
||||||
@ -485,8 +496,8 @@ fn select_package(
|
|||||||
}
|
}
|
||||||
MaybeWorkspace::Other(query) => {
|
MaybeWorkspace::Other(query) => {
|
||||||
let possibilities = loop {
|
let possibilities = loop {
|
||||||
let fuzzy = false; // Returns all for path/git
|
// Exact to avoid returning all for path/git
|
||||||
match registry.query_vec(&query, fuzzy) {
|
match registry.query_vec(&query, QueryKind::Exact) {
|
||||||
std::task::Poll::Ready(res) => {
|
std::task::Poll::Ready(res) => {
|
||||||
break res?;
|
break res?;
|
||||||
}
|
}
|
||||||
@ -600,7 +611,7 @@ fn populate_available_features(
|
|||||||
MaybeWorkspace::Other(query) => query,
|
MaybeWorkspace::Other(query) => query,
|
||||||
};
|
};
|
||||||
let possibilities = loop {
|
let possibilities = loop {
|
||||||
match registry.query_vec(&query, true) {
|
match registry.query_vec(&query, QueryKind::Fuzzy) {
|
||||||
std::task::Poll::Ready(res) => {
|
std::task::Poll::Ready(res) => {
|
||||||
break res?;
|
break res?;
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ use serde::{Deserialize, Serialize};
|
|||||||
use toml_edit::easy as toml;
|
use toml_edit::easy as toml;
|
||||||
|
|
||||||
use crate::core::compiler::Freshness;
|
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::ops::{self, CompileFilter, CompileOptions};
|
||||||
use crate::sources::PathSource;
|
use crate::sources::PathSource;
|
||||||
use crate::util::errors::CargoResult;
|
use crate::util::errors::CargoResult;
|
||||||
@ -540,7 +540,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
let deps = loop {
|
let deps = loop {
|
||||||
match source.query_vec(&dep)? {
|
match source.query_vec(&dep, QueryKind::Exact)? {
|
||||||
Poll::Ready(deps) => break deps,
|
Poll::Ready(deps) => break deps,
|
||||||
Poll::Pending => source.block_until_ready()?,
|
Poll::Pending => source.block_until_ready()?,
|
||||||
}
|
}
|
||||||
|
@ -209,7 +209,7 @@ fn resolve_with_registry<'cfg>(
|
|||||||
Ok(resolve)
|
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.
|
/// of resolve to guide the resolution process.
|
||||||
///
|
///
|
||||||
/// This also takes an optional hash set, `to_avoid`, which is a list of package
|
/// This also takes an optional hash set, `to_avoid`, which is a list of package
|
||||||
|
@ -60,7 +60,7 @@ struct VendorConfig {
|
|||||||
#[serde(rename_all = "lowercase", untagged)]
|
#[serde(rename_all = "lowercase", untagged)]
|
||||||
enum VendorSource {
|
enum VendorSource {
|
||||||
Directory {
|
Directory {
|
||||||
directory: PathBuf,
|
directory: String,
|
||||||
},
|
},
|
||||||
Registry {
|
Registry {
|
||||||
registry: Option<String>,
|
registry: Option<String>,
|
||||||
@ -298,7 +298,10 @@ fn sync(
|
|||||||
config.insert(
|
config.insert(
|
||||||
merged_source_name.to_string(),
|
merged_source_name.to_string(),
|
||||||
VendorSource::Directory {
|
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 {
|
} else if !dest_dir_already_exists {
|
||||||
|
@ -4,7 +4,7 @@ use std::path::{Path, PathBuf};
|
|||||||
use std::task::Poll;
|
use std::task::Poll;
|
||||||
|
|
||||||
use crate::core::source::MaybePackage;
|
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::sources::PathSource;
|
||||||
use crate::util::errors::CargoResult;
|
use crate::util::errors::CargoResult;
|
||||||
use crate::util::Config;
|
use crate::util::Config;
|
||||||
@ -46,28 +46,21 @@ impl<'cfg> Debug for DirectorySource<'cfg> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'cfg> Source for DirectorySource<'cfg> {
|
impl<'cfg> Source for DirectorySource<'cfg> {
|
||||||
fn query(&mut self, dep: &Dependency, f: &mut dyn FnMut(Summary)) -> Poll<CargoResult<()>> {
|
fn query(
|
||||||
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(
|
|
||||||
&mut self,
|
&mut self,
|
||||||
_dep: &Dependency,
|
dep: &Dependency,
|
||||||
|
kind: QueryKind,
|
||||||
f: &mut dyn FnMut(Summary),
|
f: &mut dyn FnMut(Summary),
|
||||||
) -> Poll<CargoResult<()>> {
|
) -> Poll<CargoResult<()>> {
|
||||||
if !self.updated {
|
if !self.updated {
|
||||||
return Poll::Pending;
|
return Poll::Pending;
|
||||||
}
|
}
|
||||||
let packages = self.packages.values().map(|p| &p.0);
|
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);
|
f(summary);
|
||||||
}
|
}
|
||||||
Poll::Ready(Ok(()))
|
Poll::Ready(Ok(()))
|
||||||
|
@ -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::GitReference;
|
||||||
use crate::core::{Dependency, Package, PackageId, Summary};
|
use crate::core::{Dependency, Package, PackageId, Summary};
|
||||||
use crate::sources::git::utils::GitRemote;
|
use crate::sources::git::utils::GitRemote;
|
||||||
@ -86,21 +86,14 @@ impl<'cfg> Debug for GitSource<'cfg> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'cfg> Source for GitSource<'cfg> {
|
impl<'cfg> Source for GitSource<'cfg> {
|
||||||
fn query(&mut self, dep: &Dependency, f: &mut dyn FnMut(Summary)) -> Poll<CargoResult<()>> {
|
fn query(
|
||||||
if let Some(src) = self.path_source.as_mut() {
|
|
||||||
src.query(dep, f)
|
|
||||||
} else {
|
|
||||||
Poll::Pending
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn fuzzy_query(
|
|
||||||
&mut self,
|
&mut self,
|
||||||
dep: &Dependency,
|
dep: &Dependency,
|
||||||
|
kind: QueryKind,
|
||||||
f: &mut dyn FnMut(Summary),
|
f: &mut dyn FnMut(Summary),
|
||||||
) -> Poll<CargoResult<()>> {
|
) -> Poll<CargoResult<()>> {
|
||||||
if let Some(src) = self.path_source.as_mut() {
|
if let Some(src) = self.path_source.as_mut() {
|
||||||
src.fuzzy_query(dep, f)
|
src.query(dep, kind, f)
|
||||||
} else {
|
} else {
|
||||||
Poll::Pending
|
Poll::Pending
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ use std::path::{Path, PathBuf};
|
|||||||
use std::task::Poll;
|
use std::task::Poll;
|
||||||
|
|
||||||
use crate::core::source::MaybePackage;
|
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::ops;
|
||||||
use crate::util::{internal, CargoResult, Config};
|
use crate::util::{internal, CargoResult, Config};
|
||||||
use anyhow::Context as _;
|
use anyhow::Context as _;
|
||||||
@ -497,24 +497,21 @@ impl<'cfg> Debug for PathSource<'cfg> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'cfg> Source for PathSource<'cfg> {
|
impl<'cfg> Source for PathSource<'cfg> {
|
||||||
fn query(&mut self, dep: &Dependency, f: &mut dyn FnMut(Summary)) -> Poll<CargoResult<()>> {
|
fn query(
|
||||||
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(
|
|
||||||
&mut self,
|
&mut self,
|
||||||
_dep: &Dependency,
|
dep: &Dependency,
|
||||||
|
kind: QueryKind,
|
||||||
f: &mut dyn FnMut(Summary),
|
f: &mut dyn FnMut(Summary),
|
||||||
) -> Poll<CargoResult<()>> {
|
) -> Poll<CargoResult<()>> {
|
||||||
self.update()?;
|
self.update()?;
|
||||||
for s in self.packages.iter().map(|p| p.summary()) {
|
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(()))
|
Poll::Ready(Ok(()))
|
||||||
}
|
}
|
||||||
|
@ -176,7 +176,7 @@ use tar::Archive;
|
|||||||
|
|
||||||
use crate::core::dependency::{DepKind, Dependency};
|
use crate::core::dependency::{DepKind, Dependency};
|
||||||
use crate::core::source::MaybePackage;
|
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::sources::PathSource;
|
||||||
use crate::util::hex;
|
use crate::util::hex;
|
||||||
use crate::util::interning::InternedString;
|
use crate::util::interning::InternedString;
|
||||||
@ -701,12 +701,18 @@ impl<'cfg> RegistrySource<'cfg> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'cfg> Source for 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
|
// 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
|
// theory the registry is known to contain this version. If, however, we
|
||||||
// come back with no summaries, then our registry may need to be
|
// come back with no summaries, then our registry may need to be
|
||||||
// updated, so we fall back to performing a lazy update.
|
// 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");
|
debug!("attempting query without update");
|
||||||
let mut called = false;
|
let mut called = false;
|
||||||
let pend =
|
let pend =
|
||||||
@ -731,21 +737,16 @@ impl<'cfg> Source for RegistrySource<'cfg> {
|
|||||||
|
|
||||||
self.index
|
self.index
|
||||||
.query_inner(dep, &mut *self.ops, &self.yanked_whitelist, &mut |s| {
|
.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);
|
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 {
|
fn supports_checksums(&self) -> bool {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use crate::core::source::MaybePackage;
|
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 crate::util::errors::CargoResult;
|
||||||
use std::task::Poll;
|
use std::task::Poll;
|
||||||
|
|
||||||
@ -42,32 +42,17 @@ impl<'cfg> Source for ReplacedSource<'cfg> {
|
|||||||
self.inner.requires_precise()
|
self.inner.requires_precise()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn query(&mut self, dep: &Dependency, f: &mut dyn FnMut(Summary)) -> Poll<CargoResult<()>> {
|
fn query(
|
||||||
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(
|
|
||||||
&mut self,
|
&mut self,
|
||||||
dep: &Dependency,
|
dep: &Dependency,
|
||||||
|
kind: QueryKind,
|
||||||
f: &mut dyn FnMut(Summary),
|
f: &mut dyn FnMut(Summary),
|
||||||
) -> Poll<CargoResult<()>> {
|
) -> Poll<CargoResult<()>> {
|
||||||
let (replace_with, to_replace) = (self.replace_with, self.to_replace);
|
let (replace_with, to_replace) = (self.replace_with, self.to_replace);
|
||||||
let dep = dep.clone().map_source(to_replace, replace_with);
|
let dep = dep.clone().map_source(to_replace, replace_with);
|
||||||
|
|
||||||
self.inner
|
self.inner
|
||||||
.fuzzy_query(&dep, &mut |summary| {
|
.query(&dep, kind, &mut |summary| {
|
||||||
f(summary.map_source(replace_with, to_replace))
|
f(summary.map_source(replace_with, to_replace))
|
||||||
})
|
})
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
|
@ -2248,13 +2248,7 @@ impl BuildTargetConfig {
|
|||||||
};
|
};
|
||||||
let values = match &self.inner.val {
|
let values = match &self.inner.val {
|
||||||
BuildTargetConfigInner::One(s) => vec![map(s)],
|
BuildTargetConfigInner::One(s) => vec![map(s)],
|
||||||
BuildTargetConfigInner::Many(v) => {
|
BuildTargetConfigInner::Many(v) => v.iter().map(map).collect(),
|
||||||
if !config.cli_unstable().multitarget {
|
|
||||||
bail!("specifying an array in `build.target` config value requires `-Zmultitarget`")
|
|
||||||
} else {
|
|
||||||
v.iter().map(map).collect()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
Ok(values)
|
Ok(values)
|
||||||
}
|
}
|
||||||
|
@ -1017,19 +1017,16 @@ pub enum MaybeWorkspace<T> {
|
|||||||
impl<T> MaybeWorkspace<T> {
|
impl<T> MaybeWorkspace<T> {
|
||||||
fn resolve<'a>(
|
fn resolve<'a>(
|
||||||
self,
|
self,
|
||||||
cargo_features: &Features,
|
|
||||||
label: &str,
|
label: &str,
|
||||||
get_ws_field: impl FnOnce() -> CargoResult<T>,
|
get_ws_field: impl FnOnce() -> CargoResult<T>,
|
||||||
) -> CargoResult<T> {
|
) -> CargoResult<T> {
|
||||||
match self {
|
match self {
|
||||||
MaybeWorkspace::Defined(value) => Ok(value),
|
MaybeWorkspace::Defined(value) => Ok(value),
|
||||||
MaybeWorkspace::Workspace(TomlWorkspaceField { workspace: true }) => {
|
MaybeWorkspace::Workspace(TomlWorkspaceField { workspace: true }) => get_ws_field()
|
||||||
cargo_features.require(Feature::workspace_inheritance())?;
|
.context(format!(
|
||||||
get_ws_field().context(format!(
|
|
||||||
"error inheriting `{}` from workspace root manifest's `workspace.package.{}`",
|
"error inheriting `{}` from workspace root manifest's `workspace.package.{}`",
|
||||||
label, label
|
label, label
|
||||||
))
|
)),
|
||||||
}
|
|
||||||
MaybeWorkspace::Workspace(TomlWorkspaceField { workspace: false }) => Err(anyhow!(
|
MaybeWorkspace::Workspace(TomlWorkspaceField { workspace: false }) => Err(anyhow!(
|
||||||
"`workspace=false` is unsupported for `package.{}`",
|
"`workspace=false` is unsupported for `package.{}`",
|
||||||
label,
|
label,
|
||||||
@ -1345,7 +1342,7 @@ impl TomlManifest {
|
|||||||
.unwrap()
|
.unwrap()
|
||||||
.clone();
|
.clone();
|
||||||
package.workspace = None;
|
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 {
|
if let Some(license_file) = &package.license_file {
|
||||||
let license_file = license_file
|
let license_file = license_file
|
||||||
.as_defined()
|
.as_defined()
|
||||||
@ -1592,7 +1589,7 @@ impl TomlManifest {
|
|||||||
let version = project
|
let version = project
|
||||||
.version
|
.version
|
||||||
.clone()
|
.clone()
|
||||||
.resolve(&features, "version", || inherit()?.version())?;
|
.resolve("version", || inherit()?.version())?;
|
||||||
|
|
||||||
project.version = MaybeWorkspace::Defined(version.clone());
|
project.version = MaybeWorkspace::Defined(version.clone());
|
||||||
|
|
||||||
@ -1600,7 +1597,7 @@ impl TomlManifest {
|
|||||||
|
|
||||||
let edition = if let Some(edition) = project.edition.clone() {
|
let edition = if let Some(edition) = project.edition.clone() {
|
||||||
let edition: Edition = edition
|
let edition: Edition = edition
|
||||||
.resolve(&features, "edition", || inherit()?.edition())?
|
.resolve("edition", || inherit()?.edition())?
|
||||||
.parse()
|
.parse()
|
||||||
.with_context(|| "failed to parse the `edition` key")?;
|
.with_context(|| "failed to parse the `edition` key")?;
|
||||||
project.edition = Some(MaybeWorkspace::Defined(edition.to_string()));
|
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 = if let Some(rust_version) = &project.rust_version {
|
||||||
let rust_version = rust_version
|
let rust_version = rust_version
|
||||||
.clone()
|
.clone()
|
||||||
.resolve(&features, "rust_version", || inherit()?.rust_version())?;
|
.resolve("rust_version", || inherit()?.rust_version())?;
|
||||||
let req = match semver::VersionReq::parse(&rust_version) {
|
let req = match semver::VersionReq::parse(&rust_version) {
|
||||||
// Exclude semver operators like `^` and pre-release identifiers
|
// Exclude semver operators like `^` and pre-release identifiers
|
||||||
Ok(req) if rust_version.chars().all(|c| c.is_ascii_digit() || c == '.') => req,
|
Ok(req) if rust_version.chars().all(|c| c.is_ascii_digit() || c == '.') => req,
|
||||||
@ -1716,7 +1713,6 @@ impl TomlManifest {
|
|||||||
};
|
};
|
||||||
|
|
||||||
fn process_dependencies(
|
fn process_dependencies(
|
||||||
features: &Features,
|
|
||||||
cx: &mut Context<'_, '_>,
|
cx: &mut Context<'_, '_>,
|
||||||
new_deps: Option<&BTreeMap<String, TomlDependency>>,
|
new_deps: Option<&BTreeMap<String, TomlDependency>>,
|
||||||
kind: Option<DepKind>,
|
kind: Option<DepKind>,
|
||||||
@ -1736,7 +1732,7 @@ impl TomlManifest {
|
|||||||
|
|
||||||
let mut deps: BTreeMap<String, TomlDependency> = BTreeMap::new();
|
let mut deps: BTreeMap<String, TomlDependency> = BTreeMap::new();
|
||||||
for (n, v) in dependencies.iter() {
|
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)?;
|
let dep = resolved.to_dependency(n, cx, kind)?;
|
||||||
validate_package_name(dep.name_in_toml().as_str(), "dependency name", "")?;
|
validate_package_name(dep.name_in_toml().as_str(), "dependency name", "")?;
|
||||||
cx.deps.push(dep);
|
cx.deps.push(dep);
|
||||||
@ -1747,7 +1743,6 @@ impl TomlManifest {
|
|||||||
|
|
||||||
// Collect the dependencies.
|
// Collect the dependencies.
|
||||||
let dependencies = process_dependencies(
|
let dependencies = process_dependencies(
|
||||||
&features,
|
|
||||||
&mut cx,
|
&mut cx,
|
||||||
me.dependencies.as_ref(),
|
me.dependencies.as_ref(),
|
||||||
None,
|
None,
|
||||||
@ -1762,7 +1757,6 @@ impl TomlManifest {
|
|||||||
.as_ref()
|
.as_ref()
|
||||||
.or_else(|| me.dev_dependencies2.as_ref());
|
.or_else(|| me.dev_dependencies2.as_ref());
|
||||||
let dev_deps = process_dependencies(
|
let dev_deps = process_dependencies(
|
||||||
&features,
|
|
||||||
&mut cx,
|
&mut cx,
|
||||||
dev_deps,
|
dev_deps,
|
||||||
Some(DepKind::Development),
|
Some(DepKind::Development),
|
||||||
@ -1777,7 +1771,6 @@ impl TomlManifest {
|
|||||||
.as_ref()
|
.as_ref()
|
||||||
.or_else(|| me.build_dependencies2.as_ref());
|
.or_else(|| me.build_dependencies2.as_ref());
|
||||||
let build_deps = process_dependencies(
|
let build_deps = process_dependencies(
|
||||||
&features,
|
|
||||||
&mut cx,
|
&mut cx,
|
||||||
build_deps,
|
build_deps,
|
||||||
Some(DepKind::Build),
|
Some(DepKind::Build),
|
||||||
@ -1793,7 +1786,6 @@ impl TomlManifest {
|
|||||||
Some(platform)
|
Some(platform)
|
||||||
};
|
};
|
||||||
let deps = process_dependencies(
|
let deps = process_dependencies(
|
||||||
&features,
|
|
||||||
&mut cx,
|
&mut cx,
|
||||||
platform.dependencies.as_ref(),
|
platform.dependencies.as_ref(),
|
||||||
None,
|
None,
|
||||||
@ -1809,7 +1801,6 @@ impl TomlManifest {
|
|||||||
.as_ref()
|
.as_ref()
|
||||||
.or_else(|| platform.build_dependencies2.as_ref());
|
.or_else(|| platform.build_dependencies2.as_ref());
|
||||||
let build_deps = process_dependencies(
|
let build_deps = process_dependencies(
|
||||||
&features,
|
|
||||||
&mut cx,
|
&mut cx,
|
||||||
build_deps,
|
build_deps,
|
||||||
Some(DepKind::Build),
|
Some(DepKind::Build),
|
||||||
@ -1825,7 +1816,6 @@ impl TomlManifest {
|
|||||||
.as_ref()
|
.as_ref()
|
||||||
.or_else(|| platform.dev_dependencies2.as_ref());
|
.or_else(|| platform.dev_dependencies2.as_ref());
|
||||||
let dev_deps = process_dependencies(
|
let dev_deps = process_dependencies(
|
||||||
&features,
|
|
||||||
&mut cx,
|
&mut cx,
|
||||||
dev_deps,
|
dev_deps,
|
||||||
Some(DepKind::Development),
|
Some(DepKind::Development),
|
||||||
@ -1872,13 +1862,13 @@ impl TomlManifest {
|
|||||||
let exclude = project
|
let exclude = project
|
||||||
.exclude
|
.exclude
|
||||||
.clone()
|
.clone()
|
||||||
.map(|mw| mw.resolve(&features, "exclude", || inherit()?.exclude()))
|
.map(|mw| mw.resolve("exclude", || inherit()?.exclude()))
|
||||||
.transpose()?
|
.transpose()?
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
let include = project
|
let include = project
|
||||||
.include
|
.include
|
||||||
.clone()
|
.clone()
|
||||||
.map(|mw| mw.resolve(&features, "include", || inherit()?.include()))
|
.map(|mw| mw.resolve("include", || inherit()?.include()))
|
||||||
.transpose()?
|
.transpose()?
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
let empty_features = BTreeMap::new();
|
let empty_features = BTreeMap::new();
|
||||||
@ -1895,67 +1885,63 @@ impl TomlManifest {
|
|||||||
description: project
|
description: project
|
||||||
.description
|
.description
|
||||||
.clone()
|
.clone()
|
||||||
.map(|mw| mw.resolve(&features, "description", || inherit()?.description()))
|
.map(|mw| mw.resolve("description", || inherit()?.description()))
|
||||||
.transpose()?,
|
.transpose()?,
|
||||||
homepage: project
|
homepage: project
|
||||||
.homepage
|
.homepage
|
||||||
.clone()
|
.clone()
|
||||||
.map(|mw| mw.resolve(&features, "homepage", || inherit()?.homepage()))
|
.map(|mw| mw.resolve("homepage", || inherit()?.homepage()))
|
||||||
.transpose()?,
|
.transpose()?,
|
||||||
documentation: project
|
documentation: project
|
||||||
.documentation
|
.documentation
|
||||||
.clone()
|
.clone()
|
||||||
.map(|mw| mw.resolve(&features, "documentation", || inherit()?.documentation()))
|
.map(|mw| mw.resolve("documentation", || inherit()?.documentation()))
|
||||||
.transpose()?,
|
.transpose()?,
|
||||||
readme: readme_for_project(
|
readme: readme_for_project(
|
||||||
package_root,
|
package_root,
|
||||||
project
|
project
|
||||||
.readme
|
.readme
|
||||||
.clone()
|
.clone()
|
||||||
.map(|mw| mw.resolve(&features, "readme", || inherit()?.readme(package_root)))
|
.map(|mw| mw.resolve("readme", || inherit()?.readme(package_root)))
|
||||||
.transpose()?,
|
.transpose()?,
|
||||||
),
|
),
|
||||||
authors: project
|
authors: project
|
||||||
.authors
|
.authors
|
||||||
.clone()
|
.clone()
|
||||||
.map(|mw| mw.resolve(&features, "authors", || inherit()?.authors()))
|
.map(|mw| mw.resolve("authors", || inherit()?.authors()))
|
||||||
.transpose()?
|
.transpose()?
|
||||||
.unwrap_or_default(),
|
.unwrap_or_default(),
|
||||||
license: project
|
license: project
|
||||||
.license
|
.license
|
||||||
.clone()
|
.clone()
|
||||||
.map(|mw| mw.resolve(&features, "license", || inherit()?.license()))
|
.map(|mw| mw.resolve("license", || inherit()?.license()))
|
||||||
.transpose()?,
|
.transpose()?,
|
||||||
license_file: project
|
license_file: project
|
||||||
.license_file
|
.license_file
|
||||||
.clone()
|
.clone()
|
||||||
.map(|mw| {
|
.map(|mw| mw.resolve("license", || inherit()?.license_file(package_root)))
|
||||||
mw.resolve(&features, "license", || {
|
|
||||||
inherit()?.license_file(package_root)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
.transpose()?,
|
.transpose()?,
|
||||||
repository: project
|
repository: project
|
||||||
.repository
|
.repository
|
||||||
.clone()
|
.clone()
|
||||||
.map(|mw| mw.resolve(&features, "repository", || inherit()?.repository()))
|
.map(|mw| mw.resolve("repository", || inherit()?.repository()))
|
||||||
.transpose()?,
|
.transpose()?,
|
||||||
keywords: project
|
keywords: project
|
||||||
.keywords
|
.keywords
|
||||||
.clone()
|
.clone()
|
||||||
.map(|mw| mw.resolve(&features, "keywords", || inherit()?.keywords()))
|
.map(|mw| mw.resolve("keywords", || inherit()?.keywords()))
|
||||||
.transpose()?
|
.transpose()?
|
||||||
.unwrap_or_default(),
|
.unwrap_or_default(),
|
||||||
categories: project
|
categories: project
|
||||||
.categories
|
.categories
|
||||||
.clone()
|
.clone()
|
||||||
.map(|mw| mw.resolve(&features, "categories", || inherit()?.categories()))
|
.map(|mw| mw.resolve("categories", || inherit()?.categories()))
|
||||||
.transpose()?
|
.transpose()?
|
||||||
.unwrap_or_default(),
|
.unwrap_or_default(),
|
||||||
badges: me
|
badges: me
|
||||||
.badges
|
.badges
|
||||||
.clone()
|
.clone()
|
||||||
.map(|mw| mw.resolve(&features, "badges", || inherit()?.badges()))
|
.map(|mw| mw.resolve("badges", || inherit()?.badges()))
|
||||||
.transpose()?
|
.transpose()?
|
||||||
.unwrap_or_default(),
|
.unwrap_or_default(),
|
||||||
links: project.links.clone(),
|
links: project.links.clone(),
|
||||||
@ -2015,11 +2001,10 @@ impl TomlManifest {
|
|||||||
profiles.validate(&features, &mut warnings)?;
|
profiles.validate(&features, &mut warnings)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
let publish = project.publish.clone().map(|publish| {
|
let publish = project
|
||||||
publish
|
.publish
|
||||||
.resolve(&features, "publish", || inherit()?.publish())
|
.clone()
|
||||||
.unwrap()
|
.map(|publish| publish.resolve("publish", || inherit()?.publish()).unwrap());
|
||||||
});
|
|
||||||
|
|
||||||
project.publish = publish.clone().map(|p| MaybeWorkspace::Defined(p));
|
project.publish = publish.clone().map(|p| MaybeWorkspace::Defined(p));
|
||||||
|
|
||||||
@ -2479,7 +2464,6 @@ impl<P: ResolveToPath + Clone> TomlDependency<P> {
|
|||||||
impl TomlDependency {
|
impl TomlDependency {
|
||||||
fn resolve<'a>(
|
fn resolve<'a>(
|
||||||
self,
|
self,
|
||||||
cargo_features: &Features,
|
|
||||||
label: &str,
|
label: &str,
|
||||||
cx: &mut Context<'_, '_>,
|
cx: &mut Context<'_, '_>,
|
||||||
get_inheritable: impl FnOnce() -> CargoResult<&'a InheritableFields>,
|
get_inheritable: impl FnOnce() -> CargoResult<&'a InheritableFields>,
|
||||||
@ -2492,7 +2476,6 @@ impl TomlDependency {
|
|||||||
features,
|
features,
|
||||||
optional,
|
optional,
|
||||||
}) => {
|
}) => {
|
||||||
cargo_features.require(Feature::workspace_inheritance())?;
|
|
||||||
let inheritable = get_inheritable()?;
|
let inheritable = get_inheritable()?;
|
||||||
inheritable.get_dependency(label).context(format!(
|
inheritable.get_dependency(label).context(format!(
|
||||||
"error reading `dependencies.{}` from workspace root manifest's `workspace.dependencies.{}`",
|
"error reading `dependencies.{}` from workspace root manifest's `workspace.dependencies.{}`",
|
||||||
|
@ -17,4 +17,5 @@
|
|||||||
- [Running Tests](./tests/running.md)
|
- [Running Tests](./tests/running.md)
|
||||||
- [Writing Tests](./tests/writing.md)
|
- [Writing Tests](./tests/writing.md)
|
||||||
- [Benchmarking and Profiling](./tests/profiling.md)
|
- [Benchmarking and Profiling](./tests/profiling.md)
|
||||||
|
- [Crater](./tests/crater.md)
|
||||||
- [Design Principles](./design.md)
|
- [Design Principles](./design.md)
|
||||||
|
@ -28,6 +28,46 @@ and stable releases.
|
|||||||
|
|
||||||
[`dist` bootstrap module]: https://github.com/rust-lang/rust/blob/master/src/bootstrap/dist.rs
|
[`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
|
## Version updates
|
||||||
|
|
||||||
Shortly after each major release, a Cargo team member will post a PR to update
|
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
|
avoid churning incompatible version numbers. This process should be improved
|
||||||
in the future!
|
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
|
[`crates/` directory]: https://github.com/rust-lang/cargo/tree/master/crates
|
||||||
|
|
||||||
## Docs publishing
|
## Docs publishing
|
||||||
|
122
src/doc/contrib/src/tests/crater.md
Normal file
122
src/doc/contrib/src/tests/crater.md
Normal 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.
|
@ -71,11 +71,11 @@ fn <description>() {
|
|||||||
#### Testing Nightly Features
|
#### Testing Nightly Features
|
||||||
|
|
||||||
If you are testing a Cargo feature that only works on "nightly" Cargo, then
|
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
|
you need to call `masquerade_as_nightly_cargo` on the process builder and pass
|
||||||
this:
|
the name of the feature as the reason, like this:
|
||||||
|
|
||||||
```rust,ignore
|
```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
|
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
|
#### Testing Nightly Features
|
||||||
|
|
||||||
If you are testing a Cargo feature that only works on "nightly" Cargo, then
|
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
|
you need to call `masquerade_as_nightly_cargo` on the process builder and pass
|
||||||
this:
|
the name of the feature as the reason, like this:
|
||||||
|
|
||||||
```rust,ignore
|
```rust,ignore
|
||||||
snapbox::cmd::Command::cargo()
|
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
|
If you are testing a feature that only works on *nightly rustc* (such as
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# cargo-bench(1)
|
# cargo-bench(1)
|
||||||
{{*set actionverb="Benchmark"}}
|
{{*set actionverb="Benchmark"}}
|
||||||
{{*set nouns="benchmarks"}}
|
{{*set nouns="benchmarks"}}
|
||||||
|
{{*set multitarget=true}}
|
||||||
|
|
||||||
## NAME
|
## NAME
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
# cargo-build(1)
|
# cargo-build(1)
|
||||||
{{*set actionverb="Build"}}
|
{{*set actionverb="Build"}}
|
||||||
|
{{*set multitarget=true}}
|
||||||
|
|
||||||
## NAME
|
## NAME
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
# cargo-check(1)
|
# cargo-check(1)
|
||||||
{{*set actionverb="Check"}}
|
{{*set actionverb="Check"}}
|
||||||
|
{{*set multitarget=true}}
|
||||||
|
|
||||||
## NAME
|
## NAME
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
# cargo-clean(1)
|
# cargo-clean(1)
|
||||||
{{*set actionverb="Clean"}}
|
{{*set actionverb="Clean"}}
|
||||||
|
{{*set multitarget=true}}
|
||||||
|
|
||||||
## NAME
|
## NAME
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
# cargo-doc(1)
|
# cargo-doc(1)
|
||||||
{{*set actionverb="Document"}}
|
{{*set actionverb="Document"}}
|
||||||
|
{{*set multitarget=true}}
|
||||||
|
|
||||||
## NAME
|
## NAME
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# cargo-fetch(1)
|
# cargo-fetch(1)
|
||||||
{{*set actionverb="Fetch"}}
|
{{*set actionverb="Fetch"}}
|
||||||
{{*set target-default-to-all-arch=true}}
|
{{*set target-default-to-all-arch=true}}
|
||||||
|
{{*set multitarget=true}}
|
||||||
|
|
||||||
## NAME
|
## NAME
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
# cargo-fix(1)
|
# cargo-fix(1)
|
||||||
{{*set actionverb="Fix"}}
|
{{*set actionverb="Fix"}}
|
||||||
|
{{*set multitarget=true}}
|
||||||
|
|
||||||
## NAME
|
## NAME
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# cargo-package(1)
|
# cargo-package(1)
|
||||||
{{*set actionverb="Package"}}
|
{{*set actionverb="Package"}}
|
||||||
{{*set noall=true}}
|
{{*set noall=true}}
|
||||||
|
{{*set multitarget=true}}
|
||||||
|
|
||||||
## NAME
|
## NAME
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
# cargo-publish(1)
|
# cargo-publish(1)
|
||||||
{{*set actionverb="Publish"}}
|
{{*set actionverb="Publish"}}
|
||||||
|
{{*set multitarget=true}}
|
||||||
|
|
||||||
## NAME
|
## NAME
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
# cargo-rustc(1)
|
# cargo-rustc(1)
|
||||||
{{*set actionverb="Build"}}
|
{{*set actionverb="Build"}}
|
||||||
|
{{*set multitarget=true}}
|
||||||
|
|
||||||
## NAME
|
## NAME
|
||||||
|
|
||||||
@ -70,6 +71,19 @@ See the [the reference](../reference/profiles.html) for more details on profiles
|
|||||||
|
|
||||||
{{> options-timings }}
|
{{> 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}}
|
{{/options}}
|
||||||
|
|
||||||
### Output 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
|
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
|
## SEE ALSO
|
||||||
{{man "cargo" 1}}, {{man "cargo-build" 1}}, {{man "rustc" 1}}
|
{{man "cargo" 1}}, {{man "cargo-build" 1}}, {{man "rustc" 1}}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
# cargo-rustdoc(1)
|
# cargo-rustdoc(1)
|
||||||
{{*set actionverb="Document"}}
|
{{*set actionverb="Document"}}
|
||||||
|
{{*set multitarget=true}}
|
||||||
|
|
||||||
## NAME
|
## NAME
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# cargo-test(1)
|
# cargo-test(1)
|
||||||
{{*set actionverb="Test"}}
|
{{*set actionverb="Test"}}
|
||||||
{{*set nouns="tests"}}
|
{{*set nouns="tests"}}
|
||||||
|
{{*set multitarget=true}}
|
||||||
|
|
||||||
## NAME
|
## NAME
|
||||||
|
|
||||||
|
@ -208,7 +208,8 @@ OPTIONS
|
|||||||
Benchmark for the given architecture. The default is the host
|
Benchmark for the given architecture. The default is the host
|
||||||
architecture. The general format of the triple is
|
architecture. The general format of the triple is
|
||||||
<arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
|
<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
|
This may also be specified with the build.target config value
|
||||||
<https://doc.rust-lang.org/cargo/reference/config.html>.
|
<https://doc.rust-lang.org/cargo/reference/config.html>.
|
||||||
|
@ -140,7 +140,8 @@ OPTIONS
|
|||||||
Build for the given architecture. The default is the host
|
Build for the given architecture. The default is the host
|
||||||
architecture. The general format of the triple is
|
architecture. The general format of the triple is
|
||||||
<arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
|
<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
|
This may also be specified with the build.target config value
|
||||||
<https://doc.rust-lang.org/cargo/reference/config.html>.
|
<https://doc.rust-lang.org/cargo/reference/config.html>.
|
||||||
|
@ -137,7 +137,8 @@ OPTIONS
|
|||||||
Check for the given architecture. The default is the host
|
Check for the given architecture. The default is the host
|
||||||
architecture. The general format of the triple is
|
architecture. The general format of the triple is
|
||||||
<arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
|
<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
|
This may also be specified with the build.target config value
|
||||||
<https://doc.rust-lang.org/cargo/reference/config.html>.
|
<https://doc.rust-lang.org/cargo/reference/config.html>.
|
||||||
|
@ -43,7 +43,8 @@ OPTIONS
|
|||||||
Clean for the given architecture. The default is the host
|
Clean for the given architecture. The default is the host
|
||||||
architecture. The general format of the triple is
|
architecture. The general format of the triple is
|
||||||
<arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
|
<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
|
This may also be specified with the build.target config value
|
||||||
<https://doc.rust-lang.org/cargo/reference/config.html>.
|
<https://doc.rust-lang.org/cargo/reference/config.html>.
|
||||||
|
@ -115,7 +115,8 @@ OPTIONS
|
|||||||
Document for the given architecture. The default is the host
|
Document for the given architecture. The default is the host
|
||||||
architecture. The general format of the triple is
|
architecture. The general format of the triple is
|
||||||
<arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
|
<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
|
This may also be specified with the build.target config value
|
||||||
<https://doc.rust-lang.org/cargo/reference/config.html>.
|
<https://doc.rust-lang.org/cargo/reference/config.html>.
|
||||||
|
@ -28,7 +28,8 @@ OPTIONS
|
|||||||
Fetch for the given architecture. The default is all architectures.
|
Fetch for the given architecture. The default is all architectures.
|
||||||
The general format of the triple is
|
The general format of the triple is
|
||||||
<arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
|
<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
|
This may also be specified with the build.target config value
|
||||||
<https://doc.rust-lang.org/cargo/reference/config.html>.
|
<https://doc.rust-lang.org/cargo/reference/config.html>.
|
||||||
|
@ -210,7 +210,8 @@ OPTIONS
|
|||||||
Fix for the given architecture. The default is the host
|
Fix for the given architecture. The default is the host
|
||||||
architecture. The general format of the triple is
|
architecture. The general format of the triple is
|
||||||
<arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
|
<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
|
This may also be specified with the build.target config value
|
||||||
<https://doc.rust-lang.org/cargo/reference/config.html>.
|
<https://doc.rust-lang.org/cargo/reference/config.html>.
|
||||||
|
@ -112,7 +112,8 @@ OPTIONS
|
|||||||
Package for the given architecture. The default is the host
|
Package for the given architecture. The default is the host
|
||||||
architecture. The general format of the triple is
|
architecture. The general format of the triple is
|
||||||
<arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
|
<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
|
This may also be specified with the build.target config value
|
||||||
<https://doc.rust-lang.org/cargo/reference/config.html>.
|
<https://doc.rust-lang.org/cargo/reference/config.html>.
|
||||||
|
@ -79,7 +79,8 @@ OPTIONS
|
|||||||
Publish for the given architecture. The default is the host
|
Publish for the given architecture. The default is the host
|
||||||
architecture. The general format of the triple is
|
architecture. The general format of the triple is
|
||||||
<arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
|
<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
|
This may also be specified with the build.target config value
|
||||||
<https://doc.rust-lang.org/cargo/reference/config.html>.
|
<https://doc.rust-lang.org/cargo/reference/config.html>.
|
||||||
|
@ -131,7 +131,8 @@ OPTIONS
|
|||||||
Build for the given architecture. The default is the host
|
Build for the given architecture. The default is the host
|
||||||
architecture. The general format of the triple is
|
architecture. The general format of the triple is
|
||||||
<arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
|
<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
|
This may also be specified with the build.target config value
|
||||||
<https://doc.rust-lang.org/cargo/reference/config.html>.
|
<https://doc.rust-lang.org/cargo/reference/config.html>.
|
||||||
@ -191,6 +192,19 @@ OPTIONS
|
|||||||
o json (unstable, requires -Zunstable-options): Emit
|
o json (unstable, requires -Zunstable-options): Emit
|
||||||
machine-readable JSON information about timing information.
|
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
|
Output Options
|
||||||
--target-dir directory
|
--target-dir directory
|
||||||
Directory for all generated artifacts and intermediate files. May
|
Directory for all generated artifacts and intermediate files. May
|
||||||
@ -341,6 +355,10 @@ EXAMPLES
|
|||||||
|
|
||||||
cargo rustc --lib -- -Z print-type-sizes
|
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
|
SEE ALSO
|
||||||
cargo(1), cargo-build(1), rustc(1)
|
cargo(1), cargo-build(1), rustc(1)
|
||||||
|
|
||||||
|
@ -131,7 +131,8 @@ OPTIONS
|
|||||||
Document for the given architecture. The default is the host
|
Document for the given architecture. The default is the host
|
||||||
architecture. The general format of the triple is
|
architecture. The general format of the triple is
|
||||||
<arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
|
<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
|
This may also be specified with the build.target config value
|
||||||
<https://doc.rust-lang.org/cargo/reference/config.html>.
|
<https://doc.rust-lang.org/cargo/reference/config.html>.
|
||||||
|
@ -222,7 +222,8 @@ OPTIONS
|
|||||||
Test for the given architecture. The default is the host
|
Test for the given architecture. The default is the host
|
||||||
architecture. The general format of the triple is
|
architecture. The general format of the triple is
|
||||||
<arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
|
<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
|
This may also be specified with the build.target config value
|
||||||
<https://doc.rust-lang.org/cargo/reference/config.html>.
|
<https://doc.rust-lang.org/cargo/reference/config.html>.
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
{{~/if}} The general format of the triple is
|
{{~/if}} The general format of the triple is
|
||||||
`<arch><sub>-<vendor>-<sys>-<abi>`. Run `rustc --print target-list` for a
|
`<arch><sub>-<vendor>-<sys>-<abi>`. Run `rustc --print target-list` for a
|
||||||
list of supported targets.
|
list of supported targets.
|
||||||
|
{{~#if multitarget }} This flag may be specified multiple times. {{~/if}}
|
||||||
|
|
||||||
This may also be specified with the `build.target`
|
This may also be specified with the `build.target`
|
||||||
[config value](../reference/config.html).
|
[config value](../reference/config.html).
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## NAME
|
## NAME
|
||||||
|
|
||||||
cargo-bench - Execute benchmarks of a package
|
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>
|
<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
|
<dd class="option-desc">Benchmark for the given architecture. The default is the host architecture. The general format of the triple is
|
||||||
<code><arch><sub>-<vendor>-<sys>-<abi></code>. Run <code>rustc --print target-list</code> for a
|
<code><arch><sub>-<vendor>-<sys>-<abi></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>
|
<p>This may also be specified with the <code>build.target</code>
|
||||||
<a href="../reference/config.html">config value</a>.</p>
|
<a href="../reference/config.html">config value</a>.</p>
|
||||||
<p>Note that specifying this flag makes Cargo run in a different mode where the
|
<p>Note that specifying this flag makes Cargo run in a different mode where the
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# cargo-build(1)
|
# cargo-build(1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## NAME
|
## NAME
|
||||||
|
|
||||||
cargo-build - Compile the current package
|
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>
|
<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
|
<dd class="option-desc">Build for the given architecture. The default is the host architecture. The general format of the triple is
|
||||||
<code><arch><sub>-<vendor>-<sys>-<abi></code>. Run <code>rustc --print target-list</code> for a
|
<code><arch><sub>-<vendor>-<sys>-<abi></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>
|
<p>This may also be specified with the <code>build.target</code>
|
||||||
<a href="../reference/config.html">config value</a>.</p>
|
<a href="../reference/config.html">config value</a>.</p>
|
||||||
<p>Note that specifying this flag makes Cargo run in a different mode where the
|
<p>Note that specifying this flag makes Cargo run in a different mode where the
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# cargo-check(1)
|
# cargo-check(1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## NAME
|
## NAME
|
||||||
|
|
||||||
cargo-check - Check the current package
|
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>
|
<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
|
<dd class="option-desc">Check for the given architecture. The default is the host architecture. The general format of the triple is
|
||||||
<code><arch><sub>-<vendor>-<sys>-<abi></code>. Run <code>rustc --print target-list</code> for a
|
<code><arch><sub>-<vendor>-<sys>-<abi></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>
|
<p>This may also be specified with the <code>build.target</code>
|
||||||
<a href="../reference/config.html">config value</a>.</p>
|
<a href="../reference/config.html">config value</a>.</p>
|
||||||
<p>Note that specifying this flag makes Cargo run in a different mode where the
|
<p>Note that specifying this flag makes Cargo run in a different mode where the
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# cargo-clean(1)
|
# cargo-clean(1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## NAME
|
## NAME
|
||||||
|
|
||||||
cargo-clean - Remove generated artifacts
|
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>
|
<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
|
<dd class="option-desc">Clean for the given architecture. The default is the host architecture. The general format of the triple is
|
||||||
<code><arch><sub>-<vendor>-<sys>-<abi></code>. Run <code>rustc --print target-list</code> for a
|
<code><arch><sub>-<vendor>-<sys>-<abi></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>
|
<p>This may also be specified with the <code>build.target</code>
|
||||||
<a href="../reference/config.html">config value</a>.</p>
|
<a href="../reference/config.html">config value</a>.</p>
|
||||||
<p>Note that specifying this flag makes Cargo run in a different mode where the
|
<p>Note that specifying this flag makes Cargo run in a different mode where the
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# cargo-doc(1)
|
# cargo-doc(1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## NAME
|
## NAME
|
||||||
|
|
||||||
cargo-doc - Build a package's documentation
|
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>
|
<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
|
<dd class="option-desc">Document for the given architecture. The default is the host architecture. The general format of the triple is
|
||||||
<code><arch><sub>-<vendor>-<sys>-<abi></code>. Run <code>rustc --print target-list</code> for a
|
<code><arch><sub>-<vendor>-<sys>-<abi></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>
|
<p>This may also be specified with the <code>build.target</code>
|
||||||
<a href="../reference/config.html">config value</a>.</p>
|
<a href="../reference/config.html">config value</a>.</p>
|
||||||
<p>Note that specifying this flag makes Cargo run in a different mode where the
|
<p>Note that specifying this flag makes Cargo run in a different mode where the
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## NAME
|
## NAME
|
||||||
|
|
||||||
cargo-fetch - Fetch dependencies of a package from the network
|
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>
|
<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
|
<dd class="option-desc">Fetch for the given architecture. The default is all architectures. The general format of the triple is
|
||||||
<code><arch><sub>-<vendor>-<sys>-<abi></code>. Run <code>rustc --print target-list</code> for a
|
<code><arch><sub>-<vendor>-<sys>-<abi></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>
|
<p>This may also be specified with the <code>build.target</code>
|
||||||
<a href="../reference/config.html">config value</a>.</p>
|
<a href="../reference/config.html">config value</a>.</p>
|
||||||
<p>Note that specifying this flag makes Cargo run in a different mode where the
|
<p>Note that specifying this flag makes Cargo run in a different mode where the
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# cargo-fix(1)
|
# cargo-fix(1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## NAME
|
## NAME
|
||||||
|
|
||||||
cargo-fix - Automatically fix lint warnings reported by rustc
|
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>
|
<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
|
<dd class="option-desc">Fix for the given architecture. The default is the host architecture. The general format of the triple is
|
||||||
<code><arch><sub>-<vendor>-<sys>-<abi></code>. Run <code>rustc --print target-list</code> for a
|
<code><arch><sub>-<vendor>-<sys>-<abi></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>
|
<p>This may also be specified with the <code>build.target</code>
|
||||||
<a href="../reference/config.html">config value</a>.</p>
|
<a href="../reference/config.html">config value</a>.</p>
|
||||||
<p>Note that specifying this flag makes Cargo run in a different mode where the
|
<p>Note that specifying this flag makes Cargo run in a different mode where the
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## NAME
|
## NAME
|
||||||
|
|
||||||
cargo-package - Assemble the local package into a distributable tarball
|
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>
|
<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
|
<dd class="option-desc">Package for the given architecture. The default is the host architecture. The general format of the triple is
|
||||||
<code><arch><sub>-<vendor>-<sys>-<abi></code>. Run <code>rustc --print target-list</code> for a
|
<code><arch><sub>-<vendor>-<sys>-<abi></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>
|
<p>This may also be specified with the <code>build.target</code>
|
||||||
<a href="../reference/config.html">config value</a>.</p>
|
<a href="../reference/config.html">config value</a>.</p>
|
||||||
<p>Note that specifying this flag makes Cargo run in a different mode where the
|
<p>Note that specifying this flag makes Cargo run in a different mode where the
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# cargo-publish(1)
|
# cargo-publish(1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## NAME
|
## NAME
|
||||||
|
|
||||||
cargo-publish - Upload a package to the registry
|
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>
|
<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
|
<dd class="option-desc">Publish for the given architecture. The default is the host architecture. The general format of the triple is
|
||||||
<code><arch><sub>-<vendor>-<sys>-<abi></code>. Run <code>rustc --print target-list</code> for a
|
<code><arch><sub>-<vendor>-<sys>-<abi></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>
|
<p>This may also be specified with the <code>build.target</code>
|
||||||
<a href="../reference/config.html">config value</a>.</p>
|
<a href="../reference/config.html">config value</a>.</p>
|
||||||
<p>Note that specifying this flag makes Cargo run in a different mode where the
|
<p>Note that specifying this flag makes Cargo run in a different mode where the
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# cargo-rustc(1)
|
# cargo-rustc(1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## NAME
|
## NAME
|
||||||
|
|
||||||
cargo-rustc - Compile the current package, and pass extra options to the compiler
|
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>
|
<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
|
<dd class="option-desc">Build for the given architecture. The default is the host architecture. The general format of the triple is
|
||||||
<code><arch><sub>-<vendor>-<sys>-<abi></code>. Run <code>rustc --print target-list</code> for a
|
<code><arch><sub>-<vendor>-<sys>-<abi></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>
|
<p>This may also be specified with the <code>build.target</code>
|
||||||
<a href="../reference/config.html">config value</a>.</p>
|
<a href="../reference/config.html">config value</a>.</p>
|
||||||
<p>Note that specifying this flag makes Cargo run in a different mode where the
|
<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>
|
</dl>
|
||||||
|
|
||||||
### Output Options
|
### Output Options
|
||||||
@ -412,5 +424,9 @@ details on environment variables that Cargo reads.
|
|||||||
|
|
||||||
cargo rustc --lib -- -Z print-type-sizes
|
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
|
## SEE ALSO
|
||||||
[cargo(1)](cargo.html), [cargo-build(1)](cargo-build.html), [rustc(1)](https://doc.rust-lang.org/rustc/index.html)
|
[cargo(1)](cargo.html), [cargo-build(1)](cargo-build.html), [rustc(1)](https://doc.rust-lang.org/rustc/index.html)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# cargo-rustdoc(1)
|
# cargo-rustdoc(1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## NAME
|
## NAME
|
||||||
|
|
||||||
cargo-rustdoc - Build a package's documentation, using specified custom flags
|
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>
|
<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
|
<dd class="option-desc">Document for the given architecture. The default is the host architecture. The general format of the triple is
|
||||||
<code><arch><sub>-<vendor>-<sys>-<abi></code>. Run <code>rustc --print target-list</code> for a
|
<code><arch><sub>-<vendor>-<sys>-<abi></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>
|
<p>This may also be specified with the <code>build.target</code>
|
||||||
<a href="../reference/config.html">config value</a>.</p>
|
<a href="../reference/config.html">config value</a>.</p>
|
||||||
<p>Note that specifying this flag makes Cargo run in a different mode where the
|
<p>Note that specifying this flag makes Cargo run in a different mode where the
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## NAME
|
## NAME
|
||||||
|
|
||||||
cargo-test - Execute unit and integration tests of a package
|
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>
|
<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
|
<dd class="option-desc">Test for the given architecture. The default is the host architecture. The general format of the triple is
|
||||||
<code><arch><sub>-<vendor>-<sys>-<abi></code>. Run <code>rustc --print target-list</code> for a
|
<code><arch><sub>-<vendor>-<sys>-<abi></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>
|
<p>This may also be specified with the <code>build.target</code>
|
||||||
<a href="../reference/config.html">config value</a>.</p>
|
<a href="../reference/config.html">config value</a>.</p>
|
||||||
<p>Note that specifying this flag makes Cargo run in a different mode where the
|
<p>Note that specifying this flag makes Cargo run in a different mode where the
|
||||||
|
@ -363,7 +363,8 @@ Sets the executable to use for `rustc`.
|
|||||||
* Environment: `CARGO_BUILD_RUSTC_WRAPPER` or `RUSTC_WRAPPER`
|
* Environment: `CARGO_BUILD_RUSTC_WRAPPER` or `RUSTC_WRAPPER`
|
||||||
|
|
||||||
Sets a wrapper to execute instead of `rustc`. The first argument passed to the
|
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`
|
##### `build.rustc-workspace-wrapper`
|
||||||
* Type: string (program path)
|
* 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`
|
* Environment: `CARGO_BUILD_RUSTC_WORKSPACE_WRAPPER` or `RUSTC_WORKSPACE_WRAPPER`
|
||||||
|
|
||||||
Sets a wrapper to execute instead of `rustc`, for workspace members only.
|
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.
|
It affects the filename hash so that artifacts produced by the wrapper are cached separately.
|
||||||
|
|
||||||
##### `build.rustdoc`
|
##### `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`.
|
Sets the executable to use for `rustdoc`.
|
||||||
|
|
||||||
##### `build.target`
|
##### `build.target`
|
||||||
* Type: string
|
* Type: string or array of strings
|
||||||
* Default: host platform
|
* Default: host platform
|
||||||
* Environment: `CARGO_BUILD_TARGET`
|
* 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.
|
Can be overridden with the `--target` CLI option.
|
||||||
|
|
||||||
|
```toml
|
||||||
|
[build]
|
||||||
|
target = ["x86_64-unknown-linux-gnu", "i686-unknown-linux-gnu"]
|
||||||
|
```
|
||||||
|
|
||||||
##### `build.target-dir`
|
##### `build.target-dir`
|
||||||
* Type: string (path)
|
* Type: string (path)
|
||||||
* Default: "target"
|
* Default: "target"
|
||||||
|
@ -21,15 +21,18 @@ system:
|
|||||||
* `RUSTC` — Instead of running `rustc`, Cargo will execute this specified
|
* `RUSTC` — Instead of running `rustc`, Cargo will execute this specified
|
||||||
compiler instead. See [`build.rustc`] to set via config.
|
compiler instead. See [`build.rustc`] to set via config.
|
||||||
* `RUSTC_WRAPPER` — Instead of simply running `rustc`, Cargo will execute this
|
* `RUSTC_WRAPPER` — Instead of simply running `rustc`, Cargo will execute this
|
||||||
specified wrapper instead, passing as its command-line arguments the rustc
|
specified wrapper, passing as its command-line arguments the rustc
|
||||||
invocation, with the first argument being `rustc`. Useful to set up a build
|
invocation, with the first argument being the path to the actual rustc.
|
||||||
cache tool such as `sccache`. See [`build.rustc-wrapper`] to set via config.
|
Useful to set up a build cache tool such as `sccache`. See
|
||||||
* `RUSTC_WORKSPACE_WRAPPER` — Instead of simply running `rustc`, Cargo will
|
[`build.rustc-wrapper`] to set via config. Setting this to the empty string
|
||||||
execute this specified wrapper instead for workspace members only, passing
|
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
|
as its command-line arguments the rustc invocation, with the first argument
|
||||||
being `rustc`. It affects the filename hash so that artifacts produced by
|
being the path to the actual rustc. It affects the filename hash
|
||||||
the wrapper are cached separately. See [`build.rustc-workspace-wrapper`]
|
so that artifacts produced by the wrapper are cached separately.
|
||||||
to set via config.
|
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` — Instead of running `rustdoc`, Cargo will execute this specified
|
||||||
`rustdoc` instance instead. See [`build.rustdoc`] to set via config.
|
`rustdoc` instance instead. See [`build.rustdoc`] to set via config.
|
||||||
* `RUSTDOCFLAGS` — A space-separated list of custom flags to pass to all `rustdoc`
|
* `RUSTDOCFLAGS` — A space-separated list of custom flags to pass to all `rustdoc`
|
||||||
|
@ -1,24 +1,37 @@
|
|||||||
### Future incompat report
|
### 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
|
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
|
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
|
notice is displayed indicating that the warnings were found, and provides
|
||||||
instructions on how to display a full report.
|
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
|
A full report can be displayed with the `cargo report future-incompatibilities
|
||||||
--id ID` command, or by running the build again with
|
--id ID` command, or by running the build again with
|
||||||
the `--future-incompat-report` flag. The developer should then update their
|
the `--future-incompat-report` flag. The developer should then update their
|
||||||
dependencies to a version where the issue is fixed, or work with the
|
dependencies to a version where the issue is fixed, or work with the
|
||||||
developers of the dependencies to help resolve the issue.
|
developers of the dependencies to help resolve the issue.
|
||||||
|
|
||||||
This feature can be configured through a `[future-incompat-report]`
|
## Configuration
|
||||||
section in `.cargo/config`. Currently, the supported options are:
|
|
||||||
|
|
||||||
```
|
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]
|
[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`.
|
whether or not a message is printed out at the end of `cargo build` / `cargo check`.
|
||||||
|
|
||||||
|
[config]: config.md#future-incompat-report
|
||||||
|
@ -246,7 +246,7 @@ whether or not [`rpath`] is enabled.
|
|||||||
#### dev
|
#### dev
|
||||||
|
|
||||||
The `dev` profile is used for normal development and debugging. It is the
|
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:
|
The default settings for the `dev` profile are:
|
||||||
|
|
||||||
|
@ -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
|
using the [`cargo login`] command, or by passing the token on the
|
||||||
command-line.
|
command-line.
|
||||||
|
|
||||||
Responses use a 200 response code for both success and errors. Cargo looks at
|
Responses use the 200 response code for success.
|
||||||
the JSON response to determine if there was success or failure. Failure
|
Errors should use an appropriate response code, such as 404.
|
||||||
responses have a JSON object with the following structure:
|
Failure
|
||||||
|
responses should have a JSON object with the following structure:
|
||||||
|
|
||||||
```javascript
|
```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
|
If the response has this structure Cargo will display the detailed message to the user, even if the response code is 200.
|
||||||
resource is not found (for example, an unknown crate name). However, using a
|
If the response code indicates an error and the content does not have this structure, Cargo will display to the user a
|
||||||
200 response with an `errors` object allows a registry to provide a more
|
message intended to help debugging the server error. A server returning an `errors` object allows a registry to provide a more
|
||||||
detailed error message if desired.
|
detailed or user-centric error message.
|
||||||
|
|
||||||
For backwards compatibility, servers should ignore any unexpected query
|
For backwards compatibility, servers should ignore any unexpected query
|
||||||
parameters or JSON fields. If a JSON field is missing, it should be assumed to
|
parameters or JSON fields. If a JSON field is missing, it should be assumed to
|
||||||
|
@ -454,8 +454,44 @@ following to the above manifest:
|
|||||||
log-debug = ['bar/log-debug'] # using 'foo/log-debug' would be an error!
|
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/
|
[crates.io]: https://crates.io/
|
||||||
[dev-dependencies]: #development-dependencies
|
[dev-dependencies]: #development-dependencies
|
||||||
|
[workspace.dependencies]: workspaces.md#the-workspacedependencies-table
|
||||||
|
[optional]: features.md#optional-dependencies
|
||||||
|
[features]: features.md
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
(function() {
|
(function() {
|
||||||
|
@ -6,7 +6,7 @@ takes, and tracks concurrency information over time.
|
|||||||
cargo build --timings
|
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
|
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.
|
filename, if you want to look at older runs.
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ how the feature works:
|
|||||||
```toml
|
```toml
|
||||||
[unstable]
|
[unstable]
|
||||||
mtime-on-use = true
|
mtime-on-use = true
|
||||||
multitarget = true
|
build-std = ["core", "alloc"]
|
||||||
```
|
```
|
||||||
|
|
||||||
Each new feature described below should explain how to use it.
|
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.
|
* [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.
|
* [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.
|
* [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
|
* Output behavior
|
||||||
* [out-dir](#out-dir) — Adds a directory where artifacts are copied to.
|
* [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.
|
* [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
|
* 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.
|
* [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.
|
* [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](#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.
|
* [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.
|
* [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.
|
* [`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/).
|
* [rustdoc-map](#rustdoc-map) — Provides mappings for documentation to link to external sites like [docs.rs](https://docs.rs/).
|
||||||
* `Cargo.toml` extensions
|
* `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.
|
* [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.
|
* [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.
|
* [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
|
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
|
#### New `dir-name` attribute
|
||||||
|
|
||||||
Some of the paths generated under `target/` have resulted in a de-facto "build
|
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
|
[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
|
### 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
|
`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
|
many crates in the dependency graph as possible, rather than aborting the build
|
||||||
@ -1275,7 +1229,7 @@ documentation = "https://example.github.io/example"
|
|||||||
```
|
```
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
# [PROGJCT_DIR]/bar/Cargo.toml
|
# [PROJECT_DIR]/bar/Cargo.toml
|
||||||
cargo-features = ["workspace-inheritance"]
|
cargo-features = ["workspace-inheritance"]
|
||||||
|
|
||||||
[package]
|
[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` CLI option has been stabilized in the 1.63 release. See
|
||||||
the [config documentation](config.html#command-line-overrides) for more
|
the [config documentation](config.html#command-line-overrides) for more
|
||||||
information.
|
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.
|
@ -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`,
|
to the data in `workspace.metadata` if data is missing from `package.metadata`,
|
||||||
if that makes sense for the tool in question.
|
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]: manifest.md#the-package-section
|
||||||
[package-metadata]: manifest.md#the-metadata-table
|
[package-metadata]: manifest.md#the-metadata-table
|
||||||
[output directory]: ../guide/build-cache.md
|
[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
|
[`package.workspace`]: manifest.md#the-workspace-field
|
||||||
[globs]: https://docs.rs/glob/0.3.0/glob/struct.Pattern.html
|
[globs]: https://docs.rs/glob/0.3.0/glob/struct.Pattern.html
|
||||||
[`cargo build`]: ../commands/cargo-build.md
|
[`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
|
||||||
|
@ -168,7 +168,7 @@ _cargo() {
|
|||||||
'(-f --force)'{-f,--force}'[force overwriting of existing crates or binaries]' \
|
'(-f --force)'{-f,--force}'[force overwriting of existing crates or binaries]' \
|
||||||
'--bin=[only install the specified binary]:binary' \
|
'--bin=[only install the specified binary]:binary' \
|
||||||
'--branch=[branch to use when installing from git]:branch' \
|
'--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' \
|
'--example=[install the specified example instead of binaries]:example:_cargo_example_names' \
|
||||||
'--git=[specify URL from which to install the crate]:url:_urls' \
|
'--git=[specify URL from which to install the crate]:url:_urls' \
|
||||||
'--path=[local filesystem path to crate to install]: :_directories' \
|
'--path=[local filesystem path to crate to install]: :_directories' \
|
||||||
|
@ -257,7 +257,7 @@ Do not activate the \fBdefault\fR feature of the selected packages.
|
|||||||
.RS 4
|
.RS 4
|
||||||
Benchmark for the given architecture. The default is the host architecture. The general format of the triple is
|
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
|
\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
|
.sp
|
||||||
This may also be specified with the \fBbuild.target\fR
|
This may also be specified with the \fBbuild.target\fR
|
||||||
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
|
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
|
||||||
|
@ -168,7 +168,7 @@ Do not activate the \fBdefault\fR feature of the selected packages.
|
|||||||
.RS 4
|
.RS 4
|
||||||
Build for the given architecture. The default is the host architecture. The general format of the triple is
|
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
|
\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
|
.sp
|
||||||
This may also be specified with the \fBbuild.target\fR
|
This may also be specified with the \fBbuild.target\fR
|
||||||
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
|
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
|
||||||
|
@ -164,7 +164,7 @@ Do not activate the \fBdefault\fR feature of the selected packages.
|
|||||||
.RS 4
|
.RS 4
|
||||||
Check for the given architecture. The default is the host architecture. The general format of the triple is
|
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
|
\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
|
.sp
|
||||||
This may also be specified with the \fBbuild.target\fR
|
This may also be specified with the \fBbuild.target\fR
|
||||||
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
|
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
|
||||||
|
@ -53,7 +53,7 @@ Defaults to \fBtarget\fR in the root of the workspace.
|
|||||||
.RS 4
|
.RS 4
|
||||||
Clean for the given architecture. The default is the host architecture. The general format of the triple is
|
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
|
\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
|
.sp
|
||||||
This may also be specified with the \fBbuild.target\fR
|
This may also be specified with the \fBbuild.target\fR
|
||||||
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
|
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
|
||||||
|
@ -137,7 +137,7 @@ Do not activate the \fBdefault\fR feature of the selected packages.
|
|||||||
.RS 4
|
.RS 4
|
||||||
Document for the given architecture. The default is the host architecture. The general format of the triple is
|
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
|
\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
|
.sp
|
||||||
This may also be specified with the \fBbuild.target\fR
|
This may also be specified with the \fBbuild.target\fR
|
||||||
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
|
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
|
||||||
|
@ -27,7 +27,7 @@ you plan to use Cargo without a network with the \fB\-\-offline\fR flag.
|
|||||||
.RS 4
|
.RS 4
|
||||||
Fetch for the given architecture. The default is all architectures. The general format of the triple is
|
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
|
\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
|
.sp
|
||||||
This may also be specified with the \fBbuild.target\fR
|
This may also be specified with the \fBbuild.target\fR
|
||||||
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
|
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
|
||||||
|
@ -259,7 +259,7 @@ Do not activate the \fBdefault\fR feature of the selected packages.
|
|||||||
.RS 4
|
.RS 4
|
||||||
Fix for the given architecture. The default is the host architecture. The general format of the triple is
|
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
|
\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
|
.sp
|
||||||
This may also be specified with the \fBbuild.target\fR
|
This may also be specified with the \fBbuild.target\fR
|
||||||
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
|
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
|
||||||
|
@ -148,7 +148,7 @@ single quotes or double quotes around each pattern.
|
|||||||
.RS 4
|
.RS 4
|
||||||
Package for the given architecture. The default is the host architecture. The general format of the triple is
|
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
|
\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
|
.sp
|
||||||
This may also be specified with the \fBbuild.target\fR
|
This may also be specified with the \fBbuild.target\fR
|
||||||
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
|
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
|
||||||
|
@ -98,7 +98,7 @@ format.
|
|||||||
.RS 4
|
.RS 4
|
||||||
Publish for the given architecture. The default is the host architecture. The general format of the triple is
|
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
|
\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
|
.sp
|
||||||
This may also be specified with the \fBbuild.target\fR
|
This may also be specified with the \fBbuild.target\fR
|
||||||
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
|
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
|
||||||
|
@ -154,7 +154,7 @@ Do not activate the \fBdefault\fR feature of the selected packages.
|
|||||||
.RS 4
|
.RS 4
|
||||||
Build for the given architecture. The default is the host architecture. The general format of the triple is
|
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
|
\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
|
.sp
|
||||||
This may also be specified with the \fBbuild.target\fR
|
This may also be specified with the \fBbuild.target\fR
|
||||||
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
|
\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.
|
information about timing information.
|
||||||
.RE
|
.RE
|
||||||
.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"
|
.SS "Output Options"
|
||||||
.sp
|
.sp
|
||||||
\fB\-\-target\-dir\fR \fIdirectory\fR
|
\fB\-\-target\-dir\fR \fIdirectory\fR
|
||||||
@ -434,5 +448,15 @@ cargo rustc \-\-lib \-\- \-Z print\-type\-sizes
|
|||||||
.fi
|
.fi
|
||||||
.RE
|
.RE
|
||||||
.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"
|
.SH "SEE ALSO"
|
||||||
\fBcargo\fR(1), \fBcargo\-build\fR(1), \fBrustc\fR(1)
|
\fBcargo\fR(1), \fBcargo\-build\fR(1), \fBrustc\fR(1)
|
||||||
|
@ -156,7 +156,7 @@ Do not activate the \fBdefault\fR feature of the selected packages.
|
|||||||
.RS 4
|
.RS 4
|
||||||
Document for the given architecture. The default is the host architecture. The general format of the triple is
|
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
|
\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
|
.sp
|
||||||
This may also be specified with the \fBbuild.target\fR
|
This may also be specified with the \fBbuild.target\fR
|
||||||
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
|
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
|
||||||
|
@ -269,7 +269,7 @@ Do not activate the \fBdefault\fR feature of the selected packages.
|
|||||||
.RS 4
|
.RS 4
|
||||||
Test for the given architecture. The default is the host architecture. The general format of the triple is
|
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
|
\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
|
.sp
|
||||||
This may also be specified with the \fBbuild.target\fR
|
This may also be specified with the \fBbuild.target\fR
|
||||||
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
|
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
|
||||||
|
@ -32,7 +32,7 @@ fn enable_build_std(e: &mut Execs, arg: Option<&str>) {
|
|||||||
None => "-Zbuild-std".to_string(),
|
None => "-Zbuild-std".to_string(),
|
||||||
};
|
};
|
||||||
e.arg(arg);
|
e.arg(arg);
|
||||||
e.masquerade_as_nightly_cargo();
|
e.masquerade_as_nightly_cargo(&["build-std"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper methods used in the tests below
|
// Helper methods used in the tests below
|
||||||
|
@ -31,7 +31,7 @@ fn source_config_env() {
|
|||||||
let path = paths::root().join("registry");
|
let path = paths::root().join("registry");
|
||||||
|
|
||||||
p.cargo("check -Zadvanced-env")
|
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_crates-io_REPLACE_WITH", "my-local-source")
|
||||||
.env("CARGO_SOURCE_my-local-source_LOCAL_REGISTRY", path)
|
.env("CARGO_SOURCE_my-local-source_LOCAL_REGISTRY", path)
|
||||||
.run();
|
.run();
|
||||||
|
@ -30,7 +30,7 @@ fn check_with_invalid_artifact_dependency() {
|
|||||||
.file("bar/src/lib.rs", "")
|
.file("bar/src/lib.rs", "")
|
||||||
.build();
|
.build();
|
||||||
p.cargo("check -Z bindeps")
|
p.cargo("check -Z bindeps")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["bindeps"])
|
||||||
.with_stderr(
|
.with_stderr(
|
||||||
"\
|
"\
|
||||||
[ERROR] failed to parse manifest at `[..]/Cargo.toml`
|
[ERROR] failed to parse manifest at `[..]/Cargo.toml`
|
||||||
@ -49,7 +49,7 @@ Caused by:
|
|||||||
) {
|
) {
|
||||||
assert(
|
assert(
|
||||||
p.cargo(&format!("{} -Z bindeps", cmd))
|
p.cargo(&format!("{} -Z bindeps", cmd))
|
||||||
.masquerade_as_nightly_cargo(),
|
.masquerade_as_nightly_cargo(&["bindeps"]),
|
||||||
);
|
);
|
||||||
assert(&mut p.cargo(cmd));
|
assert(&mut p.cargo(cmd));
|
||||||
}
|
}
|
||||||
@ -141,7 +141,7 @@ fn check_with_invalid_target_triple() {
|
|||||||
.file("bar/src/main.rs", "fn main() {}")
|
.file("bar/src/main.rs", "fn main() {}")
|
||||||
.build();
|
.build();
|
||||||
p.cargo("check -Z bindeps")
|
p.cargo("check -Z bindeps")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["bindeps"])
|
||||||
.with_stderr_contains(
|
.with_stderr_contains(
|
||||||
r#"[..]Could not find specification for target "unknown-target-triple"[..]"#,
|
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() {}")
|
.file("bar/src/main.rs", "fn main() {}")
|
||||||
.build();
|
.build();
|
||||||
p.cargo("check -Z bindeps")
|
p.cargo("check -Z bindeps")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["bindeps"])
|
||||||
.with_status(101)
|
.with_status(101)
|
||||||
.with_stderr("\
|
.with_stderr("\
|
||||||
[WARNING] foo v0.0.0 ([CWD]) ignoring invalid dependency `bar_stable` which is missing a lib target
|
[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();
|
.build();
|
||||||
|
|
||||||
p.cargo("build -Z bindeps")
|
p.cargo("build -Z bindeps")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["bindeps"])
|
||||||
.with_stderr(
|
.with_stderr(
|
||||||
"\
|
"\
|
||||||
[COMPILING] d2 v0.0.1 ([CWD]/d2)
|
[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();
|
.build();
|
||||||
|
|
||||||
p.cargo("build -Z bindeps")
|
p.cargo("build -Z bindeps")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["bindeps"])
|
||||||
.with_status(101)
|
.with_status(101)
|
||||||
.with_stderr_contains(
|
.with_stderr_contains(
|
||||||
"error[E0425]: cannot find function `f2` in crate `d2`\n --> d1/src/main.rs:6:17",
|
"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();
|
.build();
|
||||||
|
|
||||||
p.cargo("test -Z bindeps")
|
p.cargo("test -Z bindeps")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["bindeps"])
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -565,7 +565,7 @@ fn build_script_with_bin_artifacts() {
|
|||||||
.file("bar/src/lib.rs", "")
|
.file("bar/src/lib.rs", "")
|
||||||
.build();
|
.build();
|
||||||
p.cargo("build -Z bindeps")
|
p.cargo("build -Z bindeps")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["bindeps"])
|
||||||
.with_stderr_contains("[COMPILING] foo [..]")
|
.with_stderr_contains("[COMPILING] foo [..]")
|
||||||
.with_stderr_contains("[COMPILING] bar v0.5.0 ([CWD]/bar)")
|
.with_stderr_contains("[COMPILING] bar v0.5.0 ([CWD]/bar)")
|
||||||
.with_stderr_contains("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]")
|
.with_stderr_contains("[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]")
|
||||||
@ -648,7 +648,7 @@ fn build_script_with_bin_artifact_and_lib_false() {
|
|||||||
)
|
)
|
||||||
.build();
|
.build();
|
||||||
p.cargo("build -Z bindeps")
|
p.cargo("build -Z bindeps")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["bindeps"])
|
||||||
.with_status(101)
|
.with_status(101)
|
||||||
.with_stderr_does_not_contain("[..]sentinel[..]")
|
.with_stderr_does_not_contain("[..]sentinel[..]")
|
||||||
.run();
|
.run();
|
||||||
@ -689,7 +689,7 @@ fn lib_with_bin_artifact_and_lib_false() {
|
|||||||
)
|
)
|
||||||
.build();
|
.build();
|
||||||
p.cargo("build -Z bindeps")
|
p.cargo("build -Z bindeps")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["bindeps"])
|
||||||
.with_status(101)
|
.with_status(101)
|
||||||
.with_stderr_does_not_contain("[..]sentinel[..]")
|
.with_stderr_does_not_contain("[..]sentinel[..]")
|
||||||
.run();
|
.run();
|
||||||
@ -747,7 +747,7 @@ fn build_script_with_selected_dashed_bin_artifact_and_lib_true() {
|
|||||||
"#)
|
"#)
|
||||||
.build();
|
.build();
|
||||||
p.cargo("build -Z bindeps")
|
p.cargo("build -Z bindeps")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["bindeps"])
|
||||||
.with_stderr(
|
.with_stderr(
|
||||||
"\
|
"\
|
||||||
[COMPILING] bar-baz v0.5.0 ([CWD]/bar)
|
[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() {}")
|
.file("bar/src/lib.rs", "pub fn exists() {}")
|
||||||
.build();
|
.build();
|
||||||
p.cargo("build -Z bindeps")
|
p.cargo("build -Z bindeps")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["bindeps"])
|
||||||
.with_stderr(
|
.with_stderr(
|
||||||
"\
|
"\
|
||||||
[COMPILING] bar-baz v0.5.0 ([CWD]/bar)
|
[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", "")
|
.file("bar/src/lib.rs", "")
|
||||||
.build();
|
.build();
|
||||||
p.cargo("test -Z bindeps")
|
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("[COMPILING] bar v0.5.0 ([CWD]/bar)")
|
||||||
.with_stderr_contains("[FINISHED] test [unoptimized + debuginfo] target(s) in [..]")
|
.with_stderr_contains("[FINISHED] test [unoptimized + debuginfo] target(s) in [..]")
|
||||||
.run();
|
.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() {}")
|
.file("bar/src/lib.rs", "pub fn f() {}")
|
||||||
.build();
|
.build();
|
||||||
p.cargo("check -Z bindeps")
|
p.cargo("check -Z bindeps")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["bindeps"])
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -958,7 +958,7 @@ fn disallow_using_example_binaries_as_artifacts() {
|
|||||||
.file("bar/examples/one-example.rs", "fn main() {}")
|
.file("bar/examples/one-example.rs", "fn main() {}")
|
||||||
.build();
|
.build();
|
||||||
p.cargo("build -Z bindeps")
|
p.cargo("build -Z bindeps")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["bindeps"])
|
||||||
.with_status(101)
|
.with_status(101)
|
||||||
.with_stderr(r#"[ERROR] dependency `bar` in package `foo` requires a `bin:one-example` artifact to be present."#)
|
.with_stderr(r#"[ERROR] dependency `bar` in package `foo` requires a `bin:one-example` artifact to be present."#)
|
||||||
.run();
|
.run();
|
||||||
@ -1007,7 +1007,7 @@ fn allow_artifact_and_non_artifact_dependency_to_same_crate() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("check -Z bindeps")
|
p.cargo("check -Z bindeps")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["bindeps"])
|
||||||
.with_stderr_contains("[COMPILING] bar [..]")
|
.with_stderr_contains("[COMPILING] bar [..]")
|
||||||
.with_stderr_contains("[COMPILING] foo [..]")
|
.with_stderr_contains("[COMPILING] foo [..]")
|
||||||
.run();
|
.run();
|
||||||
@ -1051,7 +1051,7 @@ fn build_script_deps_adopt_specified_target_unconditionally() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("check -v -Z bindeps")
|
p.cargo("check -v -Z bindeps")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["bindeps"])
|
||||||
.with_stderr_does_not_contain(format!(
|
.with_stderr_does_not_contain(format!(
|
||||||
"[RUNNING] `rustc --crate-name build_script_build build.rs [..]--target {} [..]",
|
"[RUNNING] `rustc --crate-name build_script_build build.rs [..]--target {} [..]",
|
||||||
target
|
target
|
||||||
@ -1122,7 +1122,7 @@ fn build_script_deps_adopt_do_not_allow_multiple_targets_under_different_name_an
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("check -v -Z bindeps")
|
p.cargo("check -v -Z bindeps")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["bindeps"])
|
||||||
.with_status(101)
|
.with_status(101)
|
||||||
.with_stderr(format!(
|
.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",
|
"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();
|
.build();
|
||||||
|
|
||||||
p.cargo("check -v -Z bindeps")
|
p.cargo("check -v -Z bindeps")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["bindeps"])
|
||||||
.with_stderr_contains(format!(
|
.with_stderr_contains(format!(
|
||||||
"[RUNNING] `rustc --crate-name bar bar/src/lib.rs [..]--target {} [..]",
|
"[RUNNING] `rustc --crate-name bar bar/src/lib.rs [..]--target {} [..]",
|
||||||
target
|
target
|
||||||
@ -1224,7 +1224,7 @@ fn no_cross_doctests_works_with_artifacts() {
|
|||||||
let target = rustc_host();
|
let target = rustc_host();
|
||||||
p.cargo("test -Z bindeps --target")
|
p.cargo("test -Z bindeps --target")
|
||||||
.arg(&target)
|
.arg(&target)
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["bindeps"])
|
||||||
.with_stderr(&format!(
|
.with_stderr(&format!(
|
||||||
"\
|
"\
|
||||||
[COMPILING] bar v0.5.0 ([CWD]/bar)
|
[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.
|
// This should probably be a warning or error.
|
||||||
p.cargo("test -Z bindeps -v --doc --target")
|
p.cargo("test -Z bindeps -v --doc --target")
|
||||||
.arg(&target)
|
.arg(&target)
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["bindeps"])
|
||||||
.with_stderr_contains(format!(
|
.with_stderr_contains(format!(
|
||||||
"[COMPILING] bar v0.5.0 ([CWD]/bar)
|
"[COMPILING] bar v0.5.0 ([CWD]/bar)
|
||||||
[RUNNING] `rustc --crate-name bar bar/src/lib.rs [..]--target {triple} [..]
|
[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.
|
// This tests the library, but does not run the doc tests.
|
||||||
p.cargo("test -Z bindeps -v --target")
|
p.cargo("test -Z bindeps -v --target")
|
||||||
.arg(&target)
|
.arg(&target)
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["bindeps"])
|
||||||
.with_stderr_contains(&format!(
|
.with_stderr_contains(&format!(
|
||||||
"[FRESH] bar v0.5.0 ([CWD]/bar)
|
"[FRESH] bar v0.5.0 ([CWD]/bar)
|
||||||
[COMPILING] foo v0.0.1 ([CWD])
|
[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();
|
let alternate_target = cross_compile::alternate();
|
||||||
p.cargo("check -v -Z bindeps --target")
|
p.cargo("check -v -Z bindeps --target")
|
||||||
.arg(alternate_target)
|
.arg(alternate_target)
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["bindeps"])
|
||||||
.with_stderr_does_not_contain(format!(
|
.with_stderr_does_not_contain(format!(
|
||||||
"[RUNNING] `rustc --crate-name build_script_build build.rs [..]--target {} [..]",
|
"[RUNNING] `rustc --crate-name build_script_build build.rs [..]--target {} [..]",
|
||||||
alternate_target
|
alternate_target
|
||||||
@ -1363,7 +1363,7 @@ fn profile_override_basic() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("build -v -Z bindeps")
|
p.cargo("build -v -Z bindeps")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["bindeps"])
|
||||||
.with_stderr_contains(
|
.with_stderr_contains(
|
||||||
"[RUNNING] `rustc --crate-name build_script_build [..] -C opt-level=1 [..]`",
|
"[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()}"#)
|
.file("bar/src/main.rs", r#"fn main() {bar::bar()}"#)
|
||||||
.build();
|
.build();
|
||||||
p.cargo("build -Z bindeps")
|
p.cargo("build -Z bindeps")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["bindeps"])
|
||||||
.run();
|
.run();
|
||||||
|
|
||||||
// cargo tree sees artifacts as the dependency kind they are in and doesn't do anything special with it.
|
// cargo tree sees artifacts as the dependency kind they are in and doesn't do anything special with it.
|
||||||
p.cargo("tree -Z bindeps")
|
p.cargo("tree -Z bindeps")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["bindeps"])
|
||||||
.with_stdout(
|
.with_stdout(
|
||||||
"\
|
"\
|
||||||
foo v0.0.0 ([CWD])
|
foo v0.0.0 ([CWD])
|
||||||
@ -1490,7 +1490,7 @@ fn targets_are_picked_up_from_non_workspace_artifact_deps() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("build -Z bindeps")
|
p.cargo("build -Z bindeps")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["bindeps"])
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1529,7 +1529,7 @@ fn allow_dep_renames_with_multiple_versions() {
|
|||||||
.file("bar/src/main.rs", r#"fn main() {println!("0.5.0")}"#)
|
.file("bar/src/main.rs", r#"fn main() {println!("0.5.0")}"#)
|
||||||
.build();
|
.build();
|
||||||
p.cargo("check -Z bindeps")
|
p.cargo("check -Z bindeps")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["bindeps"])
|
||||||
.with_stderr_contains("[COMPILING] bar [..]")
|
.with_stderr_contains("[COMPILING] bar [..]")
|
||||||
.with_stderr_contains("[COMPILING] foo [..]")
|
.with_stderr_contains("[COMPILING] foo [..]")
|
||||||
.run();
|
.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() {}")
|
.file("bar/src/main.rs", "fn main() {}")
|
||||||
.build();
|
.build();
|
||||||
p.cargo("build -Z bindeps")
|
p.cargo("build -Z bindeps")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["bindeps"])
|
||||||
.with_stderr(
|
.with_stderr(
|
||||||
"\
|
"\
|
||||||
[COMPILING] bar [..]
|
[COMPILING] bar [..]
|
||||||
@ -1615,7 +1615,7 @@ fn prevent_no_lib_warning_with_artifact_dependencies() {
|
|||||||
.file("bar/src/main.rs", "fn main() {}")
|
.file("bar/src/main.rs", "fn main() {}")
|
||||||
.build();
|
.build();
|
||||||
p.cargo("check -Z bindeps")
|
p.cargo("check -Z bindeps")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["bindeps"])
|
||||||
.with_stderr(
|
.with_stderr(
|
||||||
"\
|
"\
|
||||||
[COMPILING] bar v0.5.0 ([CWD]/bar)\n\
|
[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() {}")
|
.file("bar/src/main.rs", "fn main() {}")
|
||||||
.build();
|
.build();
|
||||||
p.cargo("check -Z bindeps")
|
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("[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("[COMPILING] bar v0.5.0 ([CWD]/bar)")
|
||||||
.with_stderr_contains("[CHECKING] foo [..]")
|
.with_stderr_contains("[CHECKING] foo [..]")
|
||||||
@ -1684,7 +1684,7 @@ fn resolver_2_build_dep_without_lib() {
|
|||||||
.file("bar/src/main.rs", "fn main() {}")
|
.file("bar/src/main.rs", "fn main() {}")
|
||||||
.build();
|
.build();
|
||||||
p.cargo("check -Z bindeps")
|
p.cargo("check -Z bindeps")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["bindeps"])
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1712,7 +1712,7 @@ fn check_missing_crate_type_in_package_fails() {
|
|||||||
.file("bar/src/lib.rs", "")
|
.file("bar/src/lib.rs", "")
|
||||||
.build();
|
.build();
|
||||||
p.cargo("check -Z bindeps")
|
p.cargo("check -Z bindeps")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["bindeps"])
|
||||||
.with_status(101)
|
.with_status(101)
|
||||||
.with_stderr(
|
.with_stderr(
|
||||||
"[ERROR] dependency `bar` in package `foo` requires a `[..]` artifact to be present.",
|
"[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() {}")
|
.file("bar/src/main.rs", "fn main() {}")
|
||||||
.build();
|
.build();
|
||||||
p.cargo("check -Z bindeps")
|
p.cargo("check -Z bindeps")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["bindeps"])
|
||||||
.with_status(101)
|
.with_status(101)
|
||||||
.with_stderr_contains(
|
.with_stderr_contains(
|
||||||
" `target = \"target\"` in normal- or dev-dependencies has no effect (bar)",
|
" `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() {}")
|
.file("bar/src/main.rs", "fn main() {}")
|
||||||
.build();
|
.build();
|
||||||
p.cargo("test -Z bindeps")
|
p.cargo("test -Z bindeps")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["bindeps"])
|
||||||
.with_stderr(
|
.with_stderr(
|
||||||
"\
|
"\
|
||||||
[COMPILING] bar [..]
|
[COMPILING] bar [..]
|
||||||
@ -1901,7 +1901,7 @@ fn publish_artifact_dep() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("publish -Z bindeps --no-verify --token sekrit")
|
p.cargo("publish -Z bindeps --no-verify --token sekrit")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["bindeps"])
|
||||||
.with_stderr(
|
.with_stderr(
|
||||||
"\
|
"\
|
||||||
[UPDATING] [..]
|
[UPDATING] [..]
|
||||||
@ -2014,7 +2014,7 @@ fn doc_lib_true() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("doc -Z bindeps")
|
p.cargo("doc -Z bindeps")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["bindeps"])
|
||||||
.with_stderr(
|
.with_stderr(
|
||||||
"\
|
"\
|
||||||
[COMPILING] bar v0.0.1 ([CWD]/bar)
|
[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);
|
assert_eq!(p.glob("target/debug/deps/libbar-*.rmeta").count(), 2);
|
||||||
|
|
||||||
p.cargo("doc -Z bindeps")
|
p.cargo("doc -Z bindeps")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["bindeps"])
|
||||||
.env("CARGO_LOG", "cargo::ops::cargo_rustc::fingerprint")
|
.env("CARGO_LOG", "cargo::ops::cargo_rustc::fingerprint")
|
||||||
.with_stdout("")
|
.with_stdout("")
|
||||||
.run();
|
.run();
|
||||||
@ -2090,7 +2090,7 @@ fn rustdoc_works_on_libs_with_artifacts_and_lib_false() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("doc -Z bindeps")
|
p.cargo("doc -Z bindeps")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["bindeps"])
|
||||||
.with_stderr(
|
.with_stderr(
|
||||||
"\
|
"\
|
||||||
[COMPILING] bar v0.5.0 ([CWD]/bar)
|
[COMPILING] bar v0.5.0 ([CWD]/bar)
|
||||||
@ -2260,6 +2260,6 @@ fn build_script_features_for_shared_dependency() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("build -Z bindeps -v")
|
p.cargo("build -Z bindeps -v")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["bindeps"])
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ fn gated() {
|
|||||||
|
|
||||||
// Run cargo build.
|
// Run cargo build.
|
||||||
p.cargo("build")
|
p.cargo("build")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["different-binary-name"])
|
||||||
.with_status(101)
|
.with_status(101)
|
||||||
.with_stderr_contains("[..]feature `different-binary-name` is required")
|
.with_stderr_contains("[..]feature `different-binary-name` is required")
|
||||||
.run();
|
.run();
|
||||||
@ -58,7 +58,9 @@ fn binary_name1() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
// Run cargo 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.
|
// Check the name of the binary that cargo has generated.
|
||||||
// A binary with the name of the crate should NOT be created.
|
// 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.
|
// Run cargo second time, to verify fingerprint.
|
||||||
p.cargo("build -p foo -v")
|
p.cargo("build -p foo -v")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["different-binary-name"])
|
||||||
.with_stderr(
|
.with_stderr(
|
||||||
"\
|
"\
|
||||||
[FRESH] foo [..]
|
[FRESH] foo [..]
|
||||||
@ -100,7 +102,9 @@ fn binary_name1() {
|
|||||||
.run();
|
.run();
|
||||||
|
|
||||||
// Run cargo clean.
|
// 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.
|
// Check if the appropriate file was removed.
|
||||||
assert!(
|
assert!(
|
||||||
@ -156,7 +160,9 @@ fn binary_name2() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
// Run cargo 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.
|
// Check the name of the binary that cargo has generated.
|
||||||
// A binary with the name of the crate should NOT be created.
|
// A binary with the name of the crate should NOT be created.
|
||||||
@ -168,7 +174,7 @@ fn binary_name2() {
|
|||||||
|
|
||||||
// Check if `cargo test` works
|
// Check if `cargo test` works
|
||||||
p.cargo("test")
|
p.cargo("test")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["different-binary-name"])
|
||||||
.with_stderr(
|
.with_stderr(
|
||||||
"\
|
"\
|
||||||
[COMPILING] foo v0.0.1 ([CWD])
|
[COMPILING] foo v0.0.1 ([CWD])
|
||||||
@ -180,17 +186,19 @@ fn binary_name2() {
|
|||||||
|
|
||||||
// Check if `cargo run` is able to execute the binary
|
// Check if `cargo run` is able to execute the binary
|
||||||
p.cargo("run")
|
p.cargo("run")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["different-binary-name"])
|
||||||
.with_stdout("Hello, crabs!")
|
.with_stdout("Hello, crabs!")
|
||||||
.run();
|
.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");
|
assert_has_installed_exe(cargo_home(), "007bar");
|
||||||
|
|
||||||
p.cargo("uninstall")
|
p.cargo("uninstall")
|
||||||
.with_stderr("[REMOVING] [ROOT]/home/.cargo/bin/007bar[EXE]")
|
.with_stderr("[REMOVING] [ROOT]/home/.cargo/bin/007bar[EXE]")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["different-binary-name"])
|
||||||
.run();
|
.run();
|
||||||
|
|
||||||
assert_has_not_installed_exe(cargo_home(), "007bar");
|
assert_has_not_installed_exe(cargo_home(), "007bar");
|
||||||
@ -234,13 +242,15 @@ fn check_env_vars() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
// Run cargo 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")
|
p.cargo("run")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["different-binary-name"])
|
||||||
.with_stdout("007bar")
|
.with_stdout("007bar")
|
||||||
.run();
|
.run();
|
||||||
p.cargo("test")
|
p.cargo("test")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["different-binary-name"])
|
||||||
.with_status(0)
|
.with_status(0)
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
@ -285,7 +295,7 @@ fn check_msg_format_json() {
|
|||||||
|
|
||||||
// Run cargo build.
|
// Run cargo build.
|
||||||
p.cargo("build --message-format=json")
|
p.cargo("build --message-format=json")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["different-binary-name"])
|
||||||
.with_json(output)
|
.with_json(output)
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
@ -5382,7 +5382,7 @@ required by package `bar v0.1.0 ([..]/foo)`
|
|||||||
)
|
)
|
||||||
.run();
|
.run();
|
||||||
p.cargo("build -Zavoid-dev-deps")
|
p.cargo("build -Zavoid-dev-deps")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["avoid-dev-deps"])
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6132,7 +6132,7 @@ fn simple_terminal_width() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("build -Zterminal-width=20")
|
p.cargo("build -Zterminal-width=20")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["terminal-width"])
|
||||||
.with_status(101)
|
.with_status(101)
|
||||||
.with_stderr_contains("3 | ..._: () = 42;")
|
.with_stderr_contains("3 | ..._: () = 42;")
|
||||||
.run();
|
.run();
|
||||||
|
@ -11,7 +11,7 @@ fn cargo_build_plan_simple() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("build --build-plan -Zunstable-options")
|
p.cargo("build --build-plan -Zunstable-options")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["build-plan"])
|
||||||
.with_json(
|
.with_json(
|
||||||
r#"
|
r#"
|
||||||
{
|
{
|
||||||
@ -70,7 +70,7 @@ fn cargo_build_plan_single_dep() {
|
|||||||
.file("bar/src/lib.rs", "pub fn bar() {}")
|
.file("bar/src/lib.rs", "pub fn bar() {}")
|
||||||
.build();
|
.build();
|
||||||
p.cargo("build --build-plan -Zunstable-options")
|
p.cargo("build --build-plan -Zunstable-options")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["build-plan"])
|
||||||
.with_json(
|
.with_json(
|
||||||
r#"
|
r#"
|
||||||
{
|
{
|
||||||
@ -139,7 +139,7 @@ fn cargo_build_plan_build_script() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("build --build-plan -Zunstable-options")
|
p.cargo("build --build-plan -Zunstable-options")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["build-plan"])
|
||||||
.with_json(
|
.with_json(
|
||||||
r#"
|
r#"
|
||||||
{
|
{
|
||||||
@ -217,6 +217,6 @@ fn build_plan_with_dev_dep() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("build --build-plan -Zunstable-options")
|
p.cargo("build --build-plan -Zunstable-options")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["build-plan"])
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
@ -404,7 +404,7 @@ fn custom_build_env_var_rustc_linker_host_target() {
|
|||||||
// only if build.rs succeeds, despite linker binary not existing.
|
// only if build.rs succeeds, despite linker binary not existing.
|
||||||
p.cargo("build -Z target-applies-to-host --target")
|
p.cargo("build -Z target-applies-to-host --target")
|
||||||
.arg(&target)
|
.arg(&target)
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["target-applies-to-host"])
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -440,7 +440,7 @@ fn custom_build_env_var_rustc_linker_host_target_env() {
|
|||||||
p.cargo("build -Z target-applies-to-host --target")
|
p.cargo("build -Z target-applies-to-host --target")
|
||||||
.env("CARGO_TARGET_APPLIES_TO_HOST", "false")
|
.env("CARGO_TARGET_APPLIES_TO_HOST", "false")
|
||||||
.arg(&target)
|
.arg(&target)
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["target-applies-to-host"])
|
||||||
.run();
|
.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
|
// build.rs should fail due to -Zhost-config being set without -Ztarget-applies-to-host
|
||||||
p.cargo("build -Z host-config --target")
|
p.cargo("build -Z host-config --target")
|
||||||
.arg(&target)
|
.arg(&target)
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["host-config"])
|
||||||
.with_status(101)
|
.with_status(101)
|
||||||
.with_stderr_contains(
|
.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
|
// build.rs should fail due to bad host linker being set
|
||||||
p.cargo("build -Z target-applies-to-host -Z host-config --verbose --target")
|
p.cargo("build -Z target-applies-to-host -Z host-config --verbose --target")
|
||||||
.arg(&target)
|
.arg(&target)
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["target-applies-to-host", "host-config"])
|
||||||
.with_status(101)
|
.with_status(101)
|
||||||
.with_stderr_contains(
|
.with_stderr_contains(
|
||||||
"\
|
"\
|
||||||
@ -533,7 +533,7 @@ fn custom_build_linker_bad_host() {
|
|||||||
// build.rs should fail due to bad host linker being set
|
// build.rs should fail due to bad host linker being set
|
||||||
p.cargo("build -Z target-applies-to-host -Z host-config --verbose --target")
|
p.cargo("build -Z target-applies-to-host -Z host-config --verbose --target")
|
||||||
.arg(&target)
|
.arg(&target)
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["target-applies-to-host", "host-config"])
|
||||||
.with_status(101)
|
.with_status(101)
|
||||||
.with_stderr_contains(
|
.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
|
// build.rs should fail due to bad host linker being set
|
||||||
p.cargo("build -Z target-applies-to-host -Z host-config --verbose --target")
|
p.cargo("build -Z target-applies-to-host -Z host-config --verbose --target")
|
||||||
.arg(&target)
|
.arg(&target)
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["target-applies-to-host", "host-config"])
|
||||||
.with_status(101)
|
.with_status(101)
|
||||||
.with_stderr_contains(
|
.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
|
// assertion should succeed since it's still passed the target linker
|
||||||
p.cargo("build -Z target-applies-to-host -Z host-config --verbose --target")
|
p.cargo("build -Z target-applies-to-host -Z host-config --verbose --target")
|
||||||
.arg(&target)
|
.arg(&target)
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["target-applies-to-host", "host-config"])
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -646,7 +646,7 @@ fn custom_build_linker_bad_cross_arch_host() {
|
|||||||
// build.rs should fail due to bad host linker being set
|
// build.rs should fail due to bad host linker being set
|
||||||
p.cargo("build -Z target-applies-to-host -Z host-config --verbose --target")
|
p.cargo("build -Z target-applies-to-host -Z host-config --verbose --target")
|
||||||
.arg(&target)
|
.arg(&target)
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["target-applies-to-host", "host-config"])
|
||||||
.with_status(101)
|
.with_status(101)
|
||||||
.with_stderr_contains(
|
.with_stderr_contains(
|
||||||
"\
|
"\
|
||||||
@ -4870,7 +4870,7 @@ fn duplicate_script_with_extra_env() {
|
|||||||
if cargo_test_support::is_nightly() {
|
if cargo_test_support::is_nightly() {
|
||||||
p.cargo("test --workspace -Z doctest-xcompile --doc --target")
|
p.cargo("test --workspace -Z doctest-xcompile --doc --target")
|
||||||
.arg(&target)
|
.arg(&target)
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["doctest-xcompile"])
|
||||||
.with_stdout_contains("test src/lib.rs - (line 2) ... ok")
|
.with_stdout_contains("test src/lib.rs - (line 2) ... ok")
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ fn rustc_bootstrap() {
|
|||||||
.run();
|
.run();
|
||||||
// nightly should warn whether or not RUSTC_BOOTSTRAP is set
|
// nightly should warn whether or not RUSTC_BOOTSTRAP is set
|
||||||
p.cargo("build")
|
p.cargo("build")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["RUSTC_BOOTSTRAP"])
|
||||||
// NOTE: uses RUSTC_BOOTSTRAP so it will be propagated to rustc
|
// NOTE: uses RUSTC_BOOTSTRAP so it will be propagated to rustc
|
||||||
// (this matters when tests are being run with a beta or stable cargo)
|
// (this matters when tests are being run with a beta or stable cargo)
|
||||||
.env("RUSTC_BOOTSTRAP", "1")
|
.env("RUSTC_BOOTSTRAP", "1")
|
||||||
@ -159,7 +159,7 @@ fn rustc_bootstrap() {
|
|||||||
.build();
|
.build();
|
||||||
// nightly should warn when there's no library whether or not RUSTC_BOOTSTRAP is set
|
// nightly should warn when there's no library whether or not RUSTC_BOOTSTRAP is set
|
||||||
p.cargo("build")
|
p.cargo("build")
|
||||||
.masquerade_as_nightly_cargo()
|
.masquerade_as_nightly_cargo(&["RUSTC_BOOTSTRAP"])
|
||||||
// NOTE: uses RUSTC_BOOTSTRAP so it will be propagated to rustc
|
// NOTE: uses RUSTC_BOOTSTRAP so it will be propagated to rustc
|
||||||
// (this matters when tests are being run with a beta or stable cargo)
|
// (this matters when tests are being run with a beta or stable cargo)
|
||||||
.env("RUSTC_BOOTSTRAP", "1")
|
.env("RUSTC_BOOTSTRAP", "1")
|
||||||
|
@ -23,7 +23,6 @@ fn build_script_extra_link_arg_bin() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("build -v")
|
p.cargo("build -v")
|
||||||
.masquerade_as_nightly_cargo()
|
|
||||||
.without_status()
|
.without_status()
|
||||||
.with_stderr_contains(
|
.with_stderr_contains(
|
||||||
"[RUNNING] `rustc --crate-name foo [..]-C link-arg=--this-is-a-bogus-flag[..]",
|
"[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();
|
.build();
|
||||||
|
|
||||||
p.cargo("build -v")
|
p.cargo("build -v")
|
||||||
.masquerade_as_nightly_cargo()
|
|
||||||
.without_status()
|
.without_status()
|
||||||
.with_stderr_contains(
|
.with_stderr_contains(
|
||||||
"[RUNNING] `rustc --crate-name foo [..]-C link-arg=--bogus-flag-all -C link-arg=--bogus-flag-foo[..]",
|
"[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();
|
.build();
|
||||||
|
|
||||||
p.cargo("build -v")
|
p.cargo("build -v")
|
||||||
.masquerade_as_nightly_cargo()
|
|
||||||
.without_status()
|
.without_status()
|
||||||
.with_stderr_contains(
|
.with_stderr_contains(
|
||||||
"[RUNNING] `rustc --crate-name foo [..]-C link-arg=--this-is-a-bogus-flag[..]",
|
"[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")
|
p.cargo("check")
|
||||||
.masquerade_as_nightly_cargo()
|
|
||||||
.with_status(101)
|
.with_status(101)
|
||||||
.with_stderr("\
|
.with_stderr("\
|
||||||
[COMPILING] foo [..]
|
[COMPILING] foo [..]
|
||||||
@ -141,7 +137,6 @@ The package foo v0.0.1 ([ROOT]/foo) does not have a bin target.
|
|||||||
);
|
);
|
||||||
|
|
||||||
p.cargo("check")
|
p.cargo("check")
|
||||||
.masquerade_as_nightly_cargo()
|
|
||||||
.with_status(101)
|
.with_status(101)
|
||||||
.with_stderr(
|
.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")
|
p.cargo("check")
|
||||||
.masquerade_as_nightly_cargo()
|
|
||||||
.with_status(101)
|
.with_status(101)
|
||||||
.with_stderr(
|
.with_stderr(
|
||||||
"\
|
"\
|
||||||
@ -261,7 +255,6 @@ fn link_arg_transitive_not_allowed() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("build -v")
|
p.cargo("build -v")
|
||||||
.masquerade_as_nightly_cargo()
|
|
||||||
.with_stderr(
|
.with_stderr(
|
||||||
"\
|
"\
|
||||||
[UPDATING] [..]
|
[UPDATING] [..]
|
||||||
@ -303,7 +296,6 @@ fn link_arg_with_doctest() {
|
|||||||
.build();
|
.build();
|
||||||
|
|
||||||
p.cargo("test --doc -v")
|
p.cargo("test --doc -v")
|
||||||
.masquerade_as_nightly_cargo()
|
|
||||||
.without_status()
|
.without_status()
|
||||||
.with_stderr_contains(
|
.with_stderr_contains(
|
||||||
"[RUNNING] `rustdoc [..]--crate-name foo [..]-C link-arg=--this-is-a-bogus-flag[..]",
|
"[RUNNING] `rustdoc [..]--crate-name foo [..]-C link-arg=--this-is-a-bogus-flag[..]",
|
||||||
|
@ -3,3 +3,7 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "cargo-list-test-fixture-dependency"
|
name = "cargo-list-test-fixture-dependency"
|
||||||
version = "0.0.0"
|
version = "0.0.0"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
one = []
|
||||||
|
two = []
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user