//! we'll be sure to update this documentation!
use std::env;
+use std::fmt;
use std::str::FromStr;
use util::errors::CargoResult;
Epoch2018,
}
+impl fmt::Display for Epoch {
+ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ match *self {
+ Epoch::Epoch2015 => f.write_str("2015"),
+ Epoch::Epoch2018 => f.write_str("2018"),
+ }
+ }
+}
impl FromStr for Epoch {
type Err = ();
fn from_str(s: &str) -> Result<Self, ()> {
bail!("{}", msg);
}
}
+
+ pub fn is_enabled(&self, feature: &Feature) -> bool {
+ feature.is_enabled(self)
+ }
}
/// A parsed representation of all unstable flags that Cargo accepts.
use same_file::is_same_file;
use serde_json;
-use core::{Package, PackageId, PackageSet, Target, Resolve};
+use core::{Feature, Package, PackageId, PackageSet, Target, Resolve};
use core::{Profile, Profiles, Workspace};
use core::manifest::Lto;
use core::shell::ColorChoice;
cmd.arg("-C").arg(format!("panic={}", panic));
}
}
+ let manifest = unit.pkg.manifest();
+
+ if manifest.features().is_enabled(Feature::epoch()) {
+ cmd.arg(format!("-Zepoch={}", manifest.epoch()));
+ }
// Disable LTO for host builds as prefer_dynamic and it are mutually
// exclusive.