summaryrefslogtreecommitdiff
path: root/dhall/src/normalize.rs
diff options
context:
space:
mode:
authorNadrieril2019-04-30 17:44:12 +0200
committerNadrieril2019-04-30 17:57:25 +0200
commit5240d3fd393816a6eb59b9d78baa3be45298c931 (patch)
treec5491f567ecb80c5fefa54c80dcd229e936d0879 /dhall/src/normalize.rs
parent0ce663a74da1fbb87133b694f38d57b7086015f5 (diff)
Don't borrow from thunk more than necessary
Diffstat (limited to '')
-rw-r--r--dhall/src/normalize.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/dhall/src/normalize.rs b/dhall/src/normalize.rs
index 26b23c2..17996cf 100644
--- a/dhall/src/normalize.rs
+++ b/dhall/src/normalize.rs
@@ -954,11 +954,15 @@ mod thunk {
self.clone()
}
+ // WARNING: avoid normalizing any thunk while holding on to this ref
+ // or you will run into BorrowMut panics
pub(crate) fn normalize_whnf(&self) -> Ref<Value> {
self.0.borrow_mut().normalize_whnf();
Ref::map(self.0.borrow(), ThunkInternal::as_whnf)
}
+ // WARNING: avoid normalizing any thunk while holding on to this ref
+ // or you will run into BorrowMut panics
pub(crate) fn normalize_nf(&self) -> Ref<Value> {
self.0.borrow_mut().normalize_nf();
Ref::map(self.0.borrow(), ThunkInternal::as_nf)