summaryrefslogtreecommitdiff
path: root/dhall/src/syntax/ast
diff options
context:
space:
mode:
authorBasile Henry2020-11-03 23:32:51 +0100
committerBasile Henry2020-11-03 23:32:51 +0100
commita56cd6021705ebfd310bc902c4f549bea9b06a5b (patch)
tree8cd7429e654d31b9fbc68a97d71db92e7571c08a /dhall/src/syntax/ast
parent559f64fd866fc74e930ddf8984fa11199a57ca2c (diff)
parentf87ffe7a590c9e0a3e0a57854c739a0f89c3784d (diff)
Merge remote-tracking branch 'upstream/master' into text-replace
Diffstat (limited to '')
-rw-r--r--dhall/src/syntax/ast/expr.rs5
-rw-r--r--dhall/src/syntax/ast/import.rs2
2 files changed, 3 insertions, 4 deletions
diff --git a/dhall/src/syntax/ast/expr.rs b/dhall/src/syntax/ast/expr.rs
index b1a978f..eba2735 100644
--- a/dhall/src/syntax/ast/expr.rs
+++ b/dhall/src/syntax/ast/expr.rs
@@ -178,10 +178,9 @@ impl Expr {
}
// Compute the sha256 hash of the binary form of the expression.
- pub fn hash(&self) -> Result<Box<[u8]>, Error> {
- use sha2::Digest;
+ pub fn sha256_hash(&self) -> Result<Box<[u8]>, Error> {
let data = binary::encode(self)?;
- Ok(sha2::Sha256::digest(&data).as_slice().into())
+ Ok(crate::utils::sha256_hash(&data))
}
}
diff --git a/dhall/src/syntax/ast/import.rs b/dhall/src/syntax/ast/import.rs
index c45fe51..69f4021 100644
--- a/dhall/src/syntax/ast/import.rs
+++ b/dhall/src/syntax/ast/import.rs
@@ -52,7 +52,7 @@ pub enum ImportMode {
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum Hash {
- SHA256(Vec<u8>),
+ SHA256(Box<[u8]>),
}
/// Reference to an external resource