Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module gunbc.recurring_failure_mode.ownership_branch_join_discards_whole_value_read

import std.types { NonEmptyStr }
import gunbc.recurring_failure_mode { RecurringFailureMode }

// Consumer: gunbc.design_ledgers renders this class through directory-derived row membership.
data ownership_branch_join_discards_whole_value_read: RecurringFailureMode = RecurringFailureMode {
identity: "ownership_branch_join_discards_whole_value_read" as NonEmptyStr,
receipts: [
"INVALID STATE: ownership.max_usage_by_fan_out selects a branch usage list with more projections and discards another branch's whole-value Read. build_movable_set then admits a move while another use still needs the value.",
"HARM AND FOUND RUNG: emit_var_ref emits a move into a constructor before a subsequent projection; rustc refuses E0382. The defect is loudly mitigated by the target borrow check, not silently accepted.",
"REPAIR: max_usage_by_fan_out retains missing Read evidence from either binding usage, deduplicating shared-prefix reads and keeping Projected distinct. The emitter carries no new rule. Corpus-grain prevention is mechanical through the required regen-fixed-point phase, which re-derives the committed stage0 mirrors and refuses divergence.",
"FIXTURE EVIDENCE: ownership_branch_read Rust integration tests call the emitted ownership mirror with the same three BindingUsage fixtures and compile_sources on the authored move probe. cargo test -p v1-compiler --test ownership_branch_read executes them directly. Required clippy --all-targets compiles them, but no CI step runs them; gunbc.rung_drop.rust_unit_tests_off_the_merge_path declares that execution drop.",
"NEXT-RUNG HARNESS TRIGGER: a required phase in an existing lane that executes seed-rooted claims and writes same-identity, candidate-bound terminals into the disposition receipt. The fixture controls return to .dag when that capability lands. The missing harness is the next-rung trigger, not a permanent ceiling. Work item node://adhoc-babdd2de-8db, owned by eager-raven-113, carries this model-first harness in an existing lane and dissolves with v1 deletion. Witness roots remain dag and src/v2; adding the compiler root for one fixture would widen the floor's subject.",
"COST RESIDUE: Read is non-tail residue in the existing ownership model, so both constructor orders conservatively clone. This is bounded cost, not a correctness gap. Its separate next-rung capability is per-path last-use evidence at the ownership fold.",
],
evidence: [],
}
17 changes: 16 additions & 1 deletion src/v1/ownership.dag
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,23 @@ fn record_use(accum: UsageAccum, name: String, kind: EdgeKind, site: String, bin
}
}

// Consumer: build_movable_set must see whole-value Read evidence from every branch.
// Fan-out still selects the path for semantic consumer counts; reads on another path must not
// disappear merely because that path has fewer projections. Shared-prefix reads are retained
// once, so repeated joins do not manufacture extra uses. Projected remains distinct from Read.
// Read is non-tail residue: retaining it conservatively clones until the ownership fold carries
// per-path last-use evidence. No emitter ordering or move rule is introduced here.
fn max_usage_by_fan_out(a: BindingUsage, b: BindingUsage) -> BindingUsage {
if binding_fan_out(usage: b) > binding_fan_out(usage: a) { b } else { a }
let b_is_larger = binding_fan_out(usage: b) > binding_fan_out(usage: a)
let selected = if b_is_larger { b } else { a }
let other = if b_is_larger { a } else { b }
let missing_reads = other.consumers |> filter(edge =>
match edge.kind {
Read => selected.consumers |> any(existing => existing.kind == Read && existing.span_start == edge.span_start && existing.site == edge.site) == false
_ => false
}
)
BindingUsage { name: selected.name, binding_kind: selected.binding_kind, consumers: concat(selected.consumers, missing_reads) }
}

fn map_usage_merge_at(base: Map<String, BindingUsage>, key: String, new_val: BindingUsage) -> Map<String, BindingUsage> {
Expand Down
4 changes: 2 additions & 2 deletions src/v1/stage0/src/extdeps_container_oci_digest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ pub fn oci_digest_algorithm_syntax_valid(
) -> bool {
loop {
if (index.clone() >= v1_rt::string_length(&text)) {
break in_component;
break in_component.clone();
} else {
let cp = v1_rt::code_point(v1_rt::substring(&text, index.clone(), (index.clone() + 1)));
if in_component {
if in_component.clone() {
if oci_digest_algorithm_component_char_allowed(cp.clone()) {
{
let __tco_0 = (index + 1);
Expand Down
4 changes: 2 additions & 2 deletions src/v1/stage0/src/extdeps_version_semver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,10 @@ pub fn semver_version_label(v: Rc<SemVerVersion>) -> String {
)
};
if ((v.build.clone().len() as i64) == 0) {
with_pre
with_pre.clone()
} else {
v1_rt::concat(
with_pre,
with_pre.clone(),
v1_rt::concat("+".to_string(), semver_identifiers_label(v.build.clone())),
)
}
Expand Down
4 changes: 2 additions & 2 deletions src/v1/stage0/src/std_dissolution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ pub fn dissolution_trigger_fired(
present_decls.clone(),
);
match (*trigger.clone()).clone() {
DissolutionTrigger::DeclarationAppears { ref_: _, .. } => present,
DissolutionTrigger::DeclarationRetires { ref_: _, .. } => !present,
DissolutionTrigger::DeclarationAppears { ref_: _, .. } => present.clone(),
DissolutionTrigger::DeclarationRetires { ref_: _, .. } => !present.clone(),
}
}
}
Expand Down
36 changes: 17 additions & 19 deletions src/v1/stage0/src/std_induction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,13 +344,13 @@ pub fn compose_sub_value_relations(
callee_rel: Rc<SubValueRelation>,
) -> Rc<SubValueRelation> {
match (*callee_rel.clone()).clone() {
SubValueRelation::PreservedValue => arg_rel,
SubValueRelation::PreservedValue => arg_rel.clone(),
SubValueRelation::SubValueUnknown => Rc::new(SubValueRelation::SubValueUnknown),
SubValueRelation::NonIncreasingValue => match (*arg_rel).clone() {
SubValueRelation::NonIncreasingValue => match (*arg_rel.clone()).clone() {
SubValueRelation::SubValueUnknown => Rc::new(SubValueRelation::SubValueUnknown),
_ => Rc::new(SubValueRelation::NonIncreasingValue),
},
SubValueRelation::StrictAxisErased => match (*arg_rel).clone() {
SubValueRelation::StrictAxisErased => match (*arg_rel.clone()).clone() {
SubValueRelation::SubValueUnknown => Rc::new(SubValueRelation::SubValueUnknown),
SubValueRelation::PreservedValue => Rc::new(SubValueRelation::StrictAxisErased),
SubValueRelation::StrictSubValue { .. } => Rc::new(SubValueRelation::StrictAxisErased),
Expand All @@ -364,12 +364,12 @@ pub fn compose_sub_value_relations(
SubValueRelation::NonIncreasingValue => Rc::new(SubValueRelation::NonIncreasingValue),
SubValueRelation::MixedTop => Rc::new(SubValueRelation::MixedTop),
},
SubValueRelation::MixedTop => match (*arg_rel).clone() {
SubValueRelation::MixedTop => match (*arg_rel.clone()).clone() {
SubValueRelation::SubValueUnknown => Rc::new(SubValueRelation::SubValueUnknown),
SubValueRelation::NonIncreasingValue => Rc::new(SubValueRelation::NonIncreasingValue),
_ => Rc::new(SubValueRelation::MixedTop),
},
SubValueRelation::StrictSubValue { .. } => match (*arg_rel).clone() {
SubValueRelation::StrictSubValue { .. } => match (*arg_rel.clone()).clone() {
SubValueRelation::PreservedValue => callee_rel.clone(),
SubValueRelation::SubValueUnknown => Rc::new(SubValueRelation::SubValueUnknown),
SubValueRelation::StrictSubValue { field: f, .. } => {
Expand All @@ -391,7 +391,7 @@ pub fn compose_sub_value_relations(
SubValueRelation::StrictAxisErased => Rc::new(SubValueRelation::StrictAxisErased),
SubValueRelation::MixedTop => Rc::new(SubValueRelation::MixedTop),
},
SubValueRelation::IteratedSubValue { field: _, .. } => match (*arg_rel).clone() {
SubValueRelation::IteratedSubValue { field: _, .. } => match (*arg_rel.clone()).clone() {
SubValueRelation::PreservedValue => callee_rel.clone(),
SubValueRelation::SubValueUnknown => Rc::new(SubValueRelation::SubValueUnknown),
SubValueRelation::StrictSubValue { field: f, .. } => {
Expand All @@ -417,7 +417,7 @@ pub fn compose_sub_value_relations(
param: p,
factor: f,
..
} => match (*arg_rel).clone() {
} => match (*arg_rel.clone()).clone() {
SubValueRelation::PreservedValue => Rc::new(SubValueRelation::ArithmeticDescent {
param: p.clone(),
factor: f.clone(),
Expand Down Expand Up @@ -962,27 +962,25 @@ pub fn cost_bound_params_of_factors(

pub fn cost_bound_params_into(b: Rc<CostBound>, seen: Rc<Vec<String>>) -> Rc<Vec<String>> {
stacker::maybe_grow(512 * 1024, 2 * 1024 * 1024, || match (*b.clone()).clone() {
CostBound::ConstantBound => seen,
CostBound::ConstantBound => seen.clone(),
CostBound::AtomicBound { cost: c, .. } => {
cost_bound_params_of_factors(Rc::new(vec![c.clone()]), seen)
cost_bound_params_of_factors(Rc::new(vec![c.clone()]), seen.clone())
}
CostBound::ProductBound { factors: fs, .. } => {
cost_bound_params_of_factors(fs.clone(), seen)
cost_bound_params_of_factors(fs.clone(), seen.clone())
}
CostBound::SumOfProductsBound { terms: ts, .. } => ts.iter().cloned().fold(
seen,
seen.clone(),
|acc: Rc<Vec<String>>, factors: Rc<Vec<Rc<AtomicCost>>>| {
cost_bound_params_of_factors(factors.clone(), acc)
},
),
CostBound::SumBound { terms: ts, .. } => ts
.iter()
.cloned()
.fold(seen, |acc: Rc<Vec<String>>, inner: Rc<CostBound>| {
cost_bound_params_into(inner.clone(), acc)
}),
CostBound::ForeverBound => seen,
CostBound::ErrorBound => seen,
CostBound::SumBound { terms: ts, .. } => ts.iter().cloned().fold(
seen.clone(),
|acc: Rc<Vec<String>>, inner: Rc<CostBound>| cost_bound_params_into(inner.clone(), acc),
),
CostBound::ForeverBound => seen.clone(),
CostBound::ErrorBound => seen.clone(),
})
}

Expand Down
2 changes: 1 addition & 1 deletion src/v1/stage0/src/std_nat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub fn nat_range_inclusive(lo: Nat, hi: Nat) -> Rc<Vec<i64>> {
pub fn nat_range_accumulate(mut lo: Nat, mut hi: Nat, mut acc: Rc<Vec<i64>>) -> Rc<Vec<i64>> {
loop {
if (lo.clone() > hi.clone()) {
break acc;
break acc.clone();
} else {
{
let __tco_0 = (lo.clone() + 1);
Expand Down
4 changes: 2 additions & 2 deletions src/v1/stage0/src/std_occurrence_identity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -646,9 +646,9 @@ pub fn occurrence_transport_role_index_build(
},
);
match declaration_build.refusal.clone() {
Some(_) => declaration_build,
Some(_) => declaration_build.clone(),
std::option::Option::None => references.iter().cloned().fold(
declaration_build,
declaration_build.clone(),
|build: Rc<OccurrenceTransportRoleIndexBuild>,
reference: Rc<ReferenceOccurrence>| match build.refusal.clone() {
Some(_) => build.clone(),
Expand Down
8 changes: 4 additions & 4 deletions src/v1/stage0/src/std_termination.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ pub fn descent_evidence_lattice_meet(a: DescentEvidence, b: DescentEvidence) ->

pub fn descent_evidence_lattice_join(a: DescentEvidence, b: DescentEvidence) -> DescentEvidence {
match a.clone() {
DescentEvidence::DescentUnknown => b,
DescentEvidence::NonIncreasing => match b {
DescentEvidence::DescentUnknown => b.clone(),
DescentEvidence::NonIncreasing => match b.clone() {
DescentEvidence::Strict => DescentEvidence::Strict,
_ => DescentEvidence::NonIncreasing,
},
Expand Down Expand Up @@ -88,8 +88,8 @@ pub fn optional_evidence_meet(
b: Option<DescentEvidence>,
) -> Option<DescentEvidence> {
match a.clone() {
std::option::Option::None => b,
Some(va) => match b {
std::option::Option::None => b.clone(),
Some(va) => match b.clone() {
std::option::Option::None => a.clone(),
Some(vb) => Some(descent_evidence_lattice_meet(va.clone(), vb.clone())),
},
Expand Down
4 changes: 2 additions & 2 deletions src/v1/stage0/src/v1_compiler_compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2868,8 +2868,8 @@ pub enum CensusModuleRetention {

pub fn census_retain_module(module: Rc<Node>, retention: CensusModuleRetention) -> Rc<Node> {
match retention.clone() {
CensusModuleRetention::RetainParsedModules => module,
CensusModuleRetention::RetainDeclarationHeads => census_heads_module_node(module),
CensusModuleRetention::RetainParsedModules => module.clone(),
CensusModuleRetention::RetainDeclarationHeads => census_heads_module_node(module.clone()),
}
}

Expand Down
30 changes: 15 additions & 15 deletions src/v1/stage0/src/v1_compiler_emit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1738,13 +1738,13 @@ pub fn render_named_type_base(
};
let param_names = v1_rt::concat(explicit_params.clone(), inferred_params.clone());
if ((param_names.clone().len() as i64) == 0) {
base
base.clone()
} else {
{
let spec = crate::v1_compiler_emit_core_support::language_spec(target.clone());
v1_rt::concat(
v1_rt::concat(
v1_rt::concat(base, spec.type_arg_open.clone()),
v1_rt::concat(base.clone(), spec.type_arg_open.clone()),
param_names.clone().join(&", ".to_string()),
),
spec.type_arg_close.clone(),
Expand Down Expand Up @@ -3874,14 +3874,14 @@ pub fn shared_tco_block(
std::option::Option::None => spec.tco.clone().break_return.clone(),
};
if ((init_state.text.clone().len() as i64) == 0) {
last_str
last_str.clone()
} else {
v1_rt::concat(
v1_rt::concat(
init_state.text.clone().join(&"\n".to_string()),
"\n".to_string(),
),
last_str,
last_str.clone(),
)
}
}
Expand Down Expand Up @@ -4582,14 +4582,14 @@ pub fn emit_unified_typed_func_body(
),
};
if ((init_state.text.clone().len() as i64) == 0) {
last_str
last_str.clone()
} else {
v1_rt::concat(
v1_rt::concat(
init_state.text.clone().join(&"\n".to_string()),
"\n".to_string(),
),
last_str,
last_str.clone(),
)
}
}
Expand Down Expand Up @@ -4800,7 +4800,7 @@ pub fn hex_digit_char(d: i64) -> String {
pub fn int_to_upper_hex_inner(mut n: i64, mut acc: String) -> String {
loop {
if (n.clone() == 0) {
break acc;
break acc.clone();
} else {
{
let __tco_0 = (n.clone() / 16);
Expand Down Expand Up @@ -4831,20 +4831,20 @@ pub fn escape_emoji_codepoints_inner(
) -> String {
loop {
if (pos.clone() >= n.clone()) {
break acc;
break acc.clone();
} else {
let ch_str = v1_rt::char_at(&s, pos.clone());
let cp = v1_rt::code_point(ch_str.clone());
let next_acc = if v1_rt::is_emoji_ident(cp.clone()) {
v1_rt::concat(
v1_rt::concat(
v1_rt::concat(acc, prefix.clone()),
v1_rt::concat(acc.clone(), prefix.clone()),
int_to_upper_hex(cp.clone()),
),
suffix.clone(),
)
} else {
v1_rt::concat(acc, ch_str.clone())
v1_rt::concat(acc.clone(), ch_str.clone())
};
{
let __tco_0 = (pos + 1);
Expand Down Expand Up @@ -4872,9 +4872,9 @@ pub fn apply_char_sanitization(name: String, rule: CharSanitization) -> String {
{
let esc = crate::v1_compiler_languages::canonical_emoji_char_escape();
match rule.clone() {
CharSanitization::NoCharSanitization => name,
CharSanitization::NoCharSanitization => name.clone(),
CharSanitization::EmojiEscape => {
escape_emoji_codepoints(name, esc.prefix.clone(), esc.suffix.clone())
escape_emoji_codepoints(name.clone(), esc.prefix.clone(), esc.suffix.clone())
}
}
}
Expand Down Expand Up @@ -6009,23 +6009,23 @@ pub fn emit_typed_cast_shared(
_ => "".to_string(),
};
if ((src_ty.clone() != "".to_string()) && (src_ty.clone() == ty_str.clone())) {
expr_str
expr_str.clone()
} else {
if cast_source_representation_identical(
expr.clone(),
cast_target_node.clone(),
env.clone(),
target.clone(),
) {
expr_str
expr_str.clone()
} else {
if crate::v1_compiler_coercion::can_cast(
target.clone(),
src_ty.clone(),
ty_str.clone(),
) {
crate::v1_compiler_coercion::render_cast(
expr_str,
expr_str.clone(),
ty_str.clone(),
target.clone(),
)
Expand Down
5 changes: 3 additions & 2 deletions src/v1/stage0/src/v1_compiler_emit_core_support.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ pub fn to_string(value: i64) -> String {
pub fn to_string_helper(mut value: i64, mut acc: Rc<Vec<String>>) -> Rc<Vec<String>> {
loop {
if (value.clone() == 0) {
break acc;
break acc.clone();
} else {
let rest = (value.clone() / 10);
let digit = (value.clone() - (rest.clone() * 10));
Expand Down Expand Up @@ -538,7 +538,7 @@ pub fn apply_named_template_nested(
) -> String {
stacker::maybe_grow(512 * 1024, 2 * 1024 * 1024, || {
match keys.clone().first().cloned() {
std::option::Option::None => template,
std::option::Option::None => template.clone(),
Some(key) => {
let rest = Rc::new(
keys.clone()
Expand All @@ -553,6 +553,7 @@ pub fn apply_named_template_nested(
Some(val) => {
let parts = Rc::new(
template
.clone()
.split(&placeholder.clone())
.map(|s| s.to_string())
.collect::<Vec<_>>(),
Expand Down
Loading
Loading