diff options
author | Adam Joseph <adam@westernsemico.com> | 2022-11-22T06·56-0800 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2022-11-23T13·20+0000 |
commit | 4e33bc2390966d23580f64a60073452e20e67519 (patch) | |
tree | 46d047a498e2fc59ab8cab12db1ed4a1e2dc68e7 | |
parent | de89dc9cfc63f6f02c02d382c73482429e845e72 (diff) |
feat(tvix/eval): improve panic!() messages in Thunk::value() r/5303
Change-Id: I3b1284e28c350bfed84d643ae7f922f3487e1f2a Reviewed-on: https://cl.tvl.fyi/c/depot/+/7355 Autosubmit: Adam Joseph <adam@westernsemico.com> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
-rw-r--r-- | tvix/eval/src/value/thunk.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tvix/eval/src/value/thunk.rs b/tvix/eval/src/value/thunk.rs index 5eee07a9e7ac..5107c6328da4 100644 --- a/tvix/eval/src/value/thunk.rs +++ b/tvix/eval/src/value/thunk.rs @@ -144,8 +144,8 @@ impl Thunk { // difficult to represent in the type system without impacting the // API too much. pub fn value(&self) -> Ref<Value> { - Ref::map(self.0.borrow(), |thunk| { - if let ThunkRepr::Evaluated(value) = thunk { + Ref::map(self.0.borrow(), |thunk| match thunk { + ThunkRepr::Evaluated(value) => { #[cfg(debug_assertions)] if matches!( value, @@ -158,8 +158,8 @@ impl Thunk { } return value; } - - panic!("Thunk::value called on non-evaluated thunk"); + ThunkRepr::Blackhole => panic!("Thunk::value called on a black-holed thunk"), + ThunkRepr::Suspended { .. } => panic!("Thunk::value called on a suspended thunk"), }) } |