wip: miri stress tets

This commit is contained in:
Jonathan Kelley committed 2021-12-18 23:03:59 -05:00
1 parent 1c516aba6a
commit 934de21dd6
16 files changed
+641 -335

No files matched your search

+18 -1
View File
@@ -35,7 +35,6 @@ enum StackNodeStorage<'a, 'b> {
}
impl<'a, 'b> LazyNodes<'a, 'b> {
pub fn new_some<F>(_val: F) -> Option<Self>
where
F: FnOnce(NodeFactory<'a>) -> VNode<'a> + 'b,
@@ -43,6 +42,24 @@ impl<'a, 'b> LazyNodes<'a, 'b> {
Some(Self::new(_val))
}
/// force this call onto the stack
pub fn new_boxed<F>(_val: F) -> Option<Self>
where
F: FnOnce(NodeFactory<'a>) -> VNode<'a> + 'b,
{
// there's no way to call FnOnce without a box, so we need to store it in a slot and use static dispatch
let mut slot = Some(_val);
let val = move |fac: Option<NodeFactory<'a>>| {
let inner = slot.take().unwrap();
fac.map(inner)
};
Some(Self {
inner: StackNodeStorage::Heap(Box::new(val)),
})
}
pub fn new<F>(_val: F) -> Self
where
F: FnOnce(NodeFactory<'a>) -> VNode<'a> + 'b,