add unstable support for outputting file checksums for use in cargo
This commit is contained in:
parent
bfe5e8cef6
commit
bb5a8276be
16 changed files with 321 additions and 28 deletions
|
@ -1242,6 +1242,10 @@ impl UnstableOptions {
|
|||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub fn checksum_hash_algorithm(&self) -> Option<SourceFileHashAlgorithm> {
|
||||
self.checksum_hash_algorithm
|
||||
}
|
||||
}
|
||||
|
||||
// The type of entry function, so users can have their own entry functions
|
||||
|
|
|
@ -418,7 +418,8 @@ mod desc {
|
|||
"one of: `legacy`, `v0` (RFC 2603), or `hashed`";
|
||||
pub(crate) const parse_opt_symbol_visibility: &str =
|
||||
"one of: `hidden`, `protected`, or `interposable`";
|
||||
pub(crate) const parse_src_file_hash: &str = "either `md5` or `sha1`";
|
||||
pub(crate) const parse_cargo_src_file_hash: &str = "one of `md5`, `sha1`, or `sha256`";
|
||||
pub(crate) const parse_src_file_hash: &str = "one of `md5`, `sha1`, or `sha256`";
|
||||
pub(crate) const parse_relocation_model: &str =
|
||||
"one of supported relocation models (`rustc --print relocation-models`)";
|
||||
pub(crate) const parse_code_model: &str =
|
||||
|
@ -1288,6 +1289,23 @@ mod parse {
|
|||
true
|
||||
}
|
||||
|
||||
pub(crate) fn parse_cargo_src_file_hash(
|
||||
slot: &mut Option<SourceFileHashAlgorithm>,
|
||||
v: Option<&str>,
|
||||
) -> bool {
|
||||
match v.and_then(|s| SourceFileHashAlgorithm::from_str(s).ok()) {
|
||||
Some(hash_kind) => {
|
||||
if hash_kind.supported_in_cargo() {
|
||||
*slot = Some(hash_kind);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
_ => return false,
|
||||
}
|
||||
true
|
||||
}
|
||||
|
||||
pub(crate) fn parse_target_feature(slot: &mut String, v: Option<&str>) -> bool {
|
||||
match v {
|
||||
Some(s) => {
|
||||
|
@ -1688,6 +1706,8 @@ options! {
|
|||
"instrument control-flow architecture protection"),
|
||||
check_cfg_all_expected: bool = (false, parse_bool, [UNTRACKED],
|
||||
"show all expected values in check-cfg diagnostics (default: no)"),
|
||||
checksum_hash_algorithm: Option<SourceFileHashAlgorithm> = (None, parse_cargo_src_file_hash, [TRACKED],
|
||||
"hash algorithm of source files used to check freshness in cargo (`sha256`)"),
|
||||
codegen_backend: Option<String> = (None, parse_opt_string, [TRACKED],
|
||||
"the backend to use"),
|
||||
combine_cgu: bool = (false, parse_bool, [TRACKED],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue