mirror of
https://github.com/rust-lang/cargo
synced 2024-10-13 11:12:25 +00:00
fix(cli): Help people find possible --target values
This commit is contained in:
parent
fe37a3672c
commit
adea3d148e
|
@ -4,6 +4,7 @@ use crate::core::{Edition, Workspace};
|
|||
use crate::ops::{CompileFilter, CompileOptions, NewOptions, Packages, VersionControl};
|
||||
use crate::util::important_paths::find_root_manifest_for_wd;
|
||||
use crate::util::interning::InternedString;
|
||||
use crate::util::is_rustup;
|
||||
use crate::util::restricted_names::is_glob_pattern;
|
||||
use crate::util::toml::{StringOrVec, TomlProfile};
|
||||
use crate::util::validate_package_name;
|
||||
|
@ -445,7 +446,16 @@ pub trait ArgMatchesExt {
|
|||
|
||||
fn targets(&self) -> CargoResult<Vec<String>> {
|
||||
if self.is_present_with_zero_values("target") {
|
||||
bail!("\"--target\" takes an argument.");
|
||||
let cmd = if is_rustup() {
|
||||
"rustup target list"
|
||||
} else {
|
||||
"rustc --print target-list"
|
||||
};
|
||||
bail!(
|
||||
"\"--target\" takes an argument.
|
||||
|
||||
Run `{cmd}` to see possible targets."
|
||||
);
|
||||
}
|
||||
Ok(self._values_of("target"))
|
||||
}
|
||||
|
|
|
@ -167,6 +167,8 @@ No tests available.
|
|||
.with_stderr(
|
||||
"\
|
||||
error: \"--target\" takes an argument.
|
||||
|
||||
Run `[..]` to see possible targets.
|
||||
",
|
||||
)
|
||||
.with_status(101)
|
||||
|
|
Loading…
Reference in a new issue