Auto merge of #78711 - m-ou-se:rollup-pxqnny7, r=m-ou-se
Rollup of 7 pull requests Successful merges: - #77950 (Add support for SHA256 source file hashing) - #78624 (Sync rustc_codegen_cranelift) - #78626 (Improve errors about #[deprecated] attribute) - #78659 (Corrected suggestion for generic parameters in `function_item_references` lint) - #78687 (Suggest library/std when running all stage 0 tests) - #78699 (Show more error information in lldb_batchmode) - #78709 (Fix panic in bootstrap for non-workspace path dependencies.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
56293097f7
77 changed files with 884 additions and 486 deletions
|
@ -59,6 +59,7 @@ use std::str::FromStr;
|
|||
use md5::Md5;
|
||||
use sha1::Digest;
|
||||
use sha1::Sha1;
|
||||
use sha2::Sha256;
|
||||
|
||||
use tracing::debug;
|
||||
|
||||
|
@ -1034,6 +1035,7 @@ pub struct OffsetOverflowError;
|
|||
pub enum SourceFileHashAlgorithm {
|
||||
Md5,
|
||||
Sha1,
|
||||
Sha256,
|
||||
}
|
||||
|
||||
impl FromStr for SourceFileHashAlgorithm {
|
||||
|
@ -1043,6 +1045,7 @@ impl FromStr for SourceFileHashAlgorithm {
|
|||
match s {
|
||||
"md5" => Ok(SourceFileHashAlgorithm::Md5),
|
||||
"sha1" => Ok(SourceFileHashAlgorithm::Sha1),
|
||||
"sha256" => Ok(SourceFileHashAlgorithm::Sha256),
|
||||
_ => Err(()),
|
||||
}
|
||||
}
|
||||
|
@ -1055,7 +1058,7 @@ rustc_data_structures::impl_stable_hash_via_hash!(SourceFileHashAlgorithm);
|
|||
#[derive(HashStable_Generic, Encodable, Decodable)]
|
||||
pub struct SourceFileHash {
|
||||
pub kind: SourceFileHashAlgorithm,
|
||||
value: [u8; 20],
|
||||
value: [u8; 32],
|
||||
}
|
||||
|
||||
impl SourceFileHash {
|
||||
|
@ -1071,6 +1074,9 @@ impl SourceFileHash {
|
|||
SourceFileHashAlgorithm::Sha1 => {
|
||||
value.copy_from_slice(&Sha1::digest(data));
|
||||
}
|
||||
SourceFileHashAlgorithm::Sha256 => {
|
||||
value.copy_from_slice(&Sha256::digest(data));
|
||||
}
|
||||
}
|
||||
hash
|
||||
}
|
||||
|
@ -1090,6 +1096,7 @@ impl SourceFileHash {
|
|||
match self.kind {
|
||||
SourceFileHashAlgorithm::Md5 => 16,
|
||||
SourceFileHashAlgorithm::Sha1 => 20,
|
||||
SourceFileHashAlgorithm::Sha256 => 32,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue