diff --git a/crates/aep/src/export/emit.rs b/crates/aep/src/export/emit.rs index 0f49f995f..25d69d7bb 100644 --- a/crates/aep/src/export/emit.rs +++ b/crates/aep/src/export/emit.rs @@ -930,8 +930,10 @@ mod tests { } } - /// Exports running at the same time on several threads, the first of them possibly building - /// the shared template, all give the single-threaded bytes. + /// Exports running at the same time on several threads all give the single-threaded bytes. + /// This checks concurrent exports from a template that is already built: other tests in this + /// binary usually fill the shared template first, so the race on the first build is not + /// reliably exercised here (the `static OnceLock` makes that race safe by construction). #[test] fn concurrent_exports_give_the_same_bytes() { let plans: Vec = ["", " x", " y", " z"].iter().map(|t| plan_of(&varied(t))).collect(); diff --git a/crates/aep/src/export/template.rs b/crates/aep/src/export/template.rs index 608fa75e1..f26be4c84 100644 --- a/crates/aep/src/export/template.rs +++ b/crates/aep/src/export/template.rs @@ -94,6 +94,7 @@ pub(crate) fn shared() -> R<&'static Template> { if let Some(t) = SHARED.get() { return Ok(t); } + // A failed build returns here, before `get_or_init`, so it is never kept. let t = Template::load()?; Ok(SHARED.get_or_init(|| t)) }