resolve: the slot splice clones through grow; stack-bound tests reach the bound for every nesting; map line for the 16 MiB thread
This commit is contained in:
parent
c6a2e21e2b
commit
293cddb80e
3 changed files with 43 additions and 5 deletions
|
|
@ -294,7 +294,7 @@ impl<'a> Expander<'a> {
|
|||
(Node::Slot(slot), Some(scope)) => match Self::arg_of(&slot.param, scope)? {
|
||||
ArgValue::Slot(arg) => {
|
||||
self.count(arg.nodes.iter().map(validate::size).sum())?;
|
||||
out.extend(arg.nodes.iter().cloned());
|
||||
out.extend(arg.nodes.iter().map(clone_deep));
|
||||
}
|
||||
other => return wrong_kind(&slot.param, other, "a slot"),
|
||||
},
|
||||
|
|
@ -541,6 +541,42 @@ impl<'a> Expander<'a> {
|
|||
}
|
||||
|
||||
/// The id of a body root. A Slot has none, and the body fails on it before an id is read.
|
||||
/// A copy of an expanded subtree that grows its own stack. The derived `Clone` of `Node` costs about
|
||||
/// 12 KiB of debug stack per level, so a spliced slot argument up to `STACK_BOUND` levels deep would
|
||||
/// overflow it; each container here recurses through `grow`. An expanded subtree holds no Slot and no
|
||||
/// Use with arguments, so the four containers are the only nodes that hold nodes.
|
||||
fn clone_deep(node: &Node) -> Node {
|
||||
super::grow(|| match node {
|
||||
Node::Box(b) => Node::Box(BoxNode {
|
||||
common: b.common.clone(),
|
||||
style: b.style.clone(),
|
||||
paint: b.paint.clone(),
|
||||
role: b.role.clone(),
|
||||
children: b.children.iter().map(clone_deep).collect(),
|
||||
}),
|
||||
Node::Button(b) => Node::Button(ButtonNode {
|
||||
common: b.common.clone(),
|
||||
content: b.content.iter().map(clone_deep).collect(),
|
||||
on_activate: b.on_activate.clone(),
|
||||
enabled: b.enabled.clone(),
|
||||
}),
|
||||
Node::Overlay(o) => Node::Overlay(OverlayNode {
|
||||
common: o.common.clone(),
|
||||
anchor: o.anchor.clone(),
|
||||
modal: o.modal,
|
||||
dismiss: o.dismiss.clone(),
|
||||
children: o.children.iter().map(clone_deep).collect(),
|
||||
}),
|
||||
Node::Repeat(r) => Node::Repeat(RepeatNode {
|
||||
common: r.common.clone(),
|
||||
collection: r.collection.clone(),
|
||||
key_member: r.key_member.clone(),
|
||||
template: std::boxed::Box::new(clone_deep(&r.template)),
|
||||
}),
|
||||
other => other.clone(),
|
||||
})
|
||||
}
|
||||
|
||||
fn body_id(node: &Node) -> NodeId {
|
||||
match node {
|
||||
Node::Box(n) => n.common.id.clone(),
|
||||
|
|
|
|||
|
|
@ -954,8 +954,11 @@ fn a_chain_past_the_depth_rule_and_within_the_stack_bound_resolves_then_is_refus
|
|||
assert!(!too_deep_to_resolve(&resolution), "{:?}", resolution.diagnostics);
|
||||
}
|
||||
|
||||
/// One level past the stack bound is `TooDeepToResolve`, whichever way the levels nest.
|
||||
/// The bound is reached without overflow (the splice's clone and every drop run on the same default
|
||||
/// thread), and one level past it is `TooDeepToResolve`, whichever way the levels nest.
|
||||
fn stack_bound_counts(through: Through) {
|
||||
let at_bound = resolve_nested(1024, through);
|
||||
assert!(!too_deep_to_resolve(&at_bound), "{through:?}: {:?}", at_bound.diagnostics);
|
||||
let past = resolve_nested(1025, through);
|
||||
assert!(past.tree.is_none(), "{through:?}");
|
||||
assert!(too_deep_to_resolve(&past), "{through:?}: {:?}", past.diagnostics);
|
||||
|
|
|
|||
|
|
@ -509,9 +509,8 @@ summary.
|
|||
`file:` path to the published version, and both packages get a release
|
||||
line. Until then both read CultLib from the sibling checkout at the Cargo
|
||||
rev (P22).
|
||||
- CultLib pin bump: when `cultlib-gaps:follow_up:decode-stack-safety` lands,
|
||||
move the pin and run `deep_tree` on the default thread (its 16 MiB thread
|
||||
goes); the crate docs' hazard note goes with it.
|
||||
- CultLib pin bump: done at CultLib `4c9af401` (cut bind-pin); `deep_tree`
|
||||
runs on the default thread and the crate docs' hazard note is gone.
|
||||
- Missing-slot golden: re-added only when
|
||||
`cultlib-gaps:follow_up:rust-missing-slot-vs-reference` settles the rule.
|
||||
2. **Core**, in three cuts: (a) resolution, compositions with `thing.std`,
|
||||
|
|
|
|||
Loading…
Reference in a new issue