summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-10-24 01:52:59 -0500
committerGitHub <noreply@github.com>2017-10-24 01:52:59 -0500
commitdc1e546586b8f90cf280ed8b07799e878486961f (patch)
treec74fe31df6e63799c4d552410d28bbcef4ae4e1c /src
parent17adb13417f5d6cbd718753f0dea4371a4646c5e (diff)
parentfa9b5e3c3fa4f81ec2b945d8b8645f538020c934 (diff)
Auto merge of #1094 - photoszzt:fix_hash_incomplete_arr, r=emilio
Fix mistakenly derive hash for struct that contains IncompleteArrayField Fix #1093 r? @fitzgen or @emilio
Diffstat (limited to 'src')
-rw-r--r--src/ir/analysis/derive_hash.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/ir/analysis/derive_hash.rs b/src/ir/analysis/derive_hash.rs
index 569c7246..d2eac677 100644
--- a/src/ir/analysis/derive_hash.rs
+++ b/src/ir/analysis/derive_hash.rs
@@ -187,7 +187,10 @@ impl<'ctx> MonotoneFramework for CannotDeriveHash<'ctx> {
return self.insert(id);
}
- if len <= RUST_DERIVE_IN_ARRAY_LIMIT {
+ if len == 0 {
+ trace!(" cannot derive `Hash` for incomplete arrays");
+ self.insert(id)
+ } else if len <= RUST_DERIVE_IN_ARRAY_LIMIT {
trace!(" array is small enough to derive Hash");
ConstrainResult::Same
} else {