pub struct CliUnstable {Show 19 fields
pub print_im_a_teapot: bool,
pub unstable_options: bool,
pub no_index_update: bool,
pub avoid_dev_deps: bool,
pub minimal_versions: bool,
pub package_features: bool,
pub advanced_env: bool,
pub config_include: bool,
pub dual_proc_macros: bool,
pub mtime_on_use: bool,
pub named_profiles: bool,
pub binary_dep_depinfo: bool,
pub build_std: Option<Vec<String>>,
pub timings: Option<Vec<String>>,
pub doctest_xcompile: bool,
pub panic_abort_tests: bool,
pub jobserver_per_rustc: bool,
pub features: Option<Vec<String>>,
pub crate_versions: bool,
}Expand description
A parsed representation of all unstable flags that Cargo accepts.
Cargo, like rustc, accepts a suite of -Z flags which are intended for
gating unstable functionality to Cargo. These flags are only available on
the nightly channel of Cargo.
This struct doesn’t have quite the same convenience macro that the features have above, but the procedure should still be relatively stable for adding a new unstable flag:
-
First, add a field to this
CliUnstablestructure. All flags are allowed to have a value as the-Zflags are either of the form-Z fooor-Z foo=bar, and it’s up to you how to parsebar. -
Add an arm to the match statement in
CliUnstable::addbelow to match on your new flag. The key (k) is what you’re matching on and the value is inv. -
(optional) Add a new parsing function to parse your datatype. As of now there’s an example for
bool, but more can be added! -
In Cargo use
config.cli_unstable()to get a reference to this structure and then test for your flag or your value and act accordingly.
If you have any trouble with this, please let us know!
Fields§
§print_im_a_teapot: bool§unstable_options: bool§no_index_update: bool§avoid_dev_deps: bool§minimal_versions: bool§package_features: bool§advanced_env: bool§config_include: bool§dual_proc_macros: bool§mtime_on_use: bool§named_profiles: bool§binary_dep_depinfo: bool§build_std: Option<Vec<String>>§timings: Option<Vec<String>>§doctest_xcompile: bool§panic_abort_tests: bool§jobserver_per_rustc: bool§features: Option<Vec<String>>§crate_versions: boolImplementations§
Source§impl CliUnstable
impl CliUnstable
pub fn parse(&mut self, flags: &[String]) -> CargoResult<()>
Sourcepub fn fail_if_stable_opt(&self, flag: &str, issue: u32) -> CargoResult<()>
pub fn fail_if_stable_opt(&self, flag: &str, issue: u32) -> CargoResult<()>
Generates an error if -Z unstable-options was not used.
Intended to be used when a user passes a command-line flag that
requires -Z unstable-options.