Compare commits

..

No commits in common. "2589e86a1ff3f81ec1dad35ac2b7cca2be756bb9" and "1bf812915c4c921610ac9ce9c21a9b00a5dc65b9" have entirely different histories.

5 changed files with 12 additions and 24 deletions

12
Cargo.lock generated
View File

@ -451,19 +451,17 @@ checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990"
[[package]]
name = "comemo"
version = "0.4.0"
source = "git+https://github.com/typst/comemo?rev=9473663#947366304aad8840fa72eab413e07260cc34b6b4"
source = "git+https://github.com/typst/comemo?rev=60b30c6#60b30c6ae54f3c940dc4f778ca5090bd2a42a72e"
dependencies = [
"bumpalo",
"comemo-macros",
"parking_lot",
"siphasher",
"slab",
]
[[package]]
name = "comemo-macros"
version = "0.4.0"
source = "git+https://github.com/typst/comemo?rev=9473663#947366304aad8840fa72eab413e07260cc34b6b4"
source = "git+https://github.com/typst/comemo?rev=60b30c6#60b30c6ae54f3c940dc4f778ca5090bd2a42a72e"
dependencies = [
"proc-macro2",
"quote",
@ -2498,12 +2496,6 @@ dependencies = [
"read-fonts",
]
[[package]]
name = "slab"
version = "0.4.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "04dc19736151f35336d325007ac991178d504a119863a2fcb3758cdb5e52c50d"
[[package]]
name = "slotmap"
version = "1.0.7"

View File

@ -165,4 +165,4 @@ uninlined_format_args = "warn"
wildcard_in_or_patterns = "allow"
[patch.crates-io]
comemo = { git = "https://github.com/typst/comemo", rev = "9473663" }
comemo = { git = "https://github.com/typst/comemo", rev = "60b30c6" }

View File

@ -3,7 +3,7 @@
use std::collections::HashSet;
use std::sync::atomic::{AtomicUsize, Ordering};
use comemo::{Track, Tracked, TrackedMut};
use comemo::{Track, Tracked, TrackedMut, Validate};
use ecow::EcoVec;
use rayon::iter::{IndexedParallelIterator, IntoParallelIterator, ParallelIterator};
use typst_syntax::{FileId, Span};
@ -219,7 +219,7 @@ pub struct Route<'a> {
// We need to override the constraint's lifetime here so that `Tracked` is
// covariant over the constraint. If it becomes invariant, we're in for a
// world of lifetime pain.
outer: Option<Tracked<'a, Self, <Route<'static> as Track>::Call>>,
outer: Option<Tracked<'a, Self, <Route<'static> as Validate>::Constraint>>,
/// This is set if this route segment was inserted through the start of a
/// module evaluation.
id: Option<FileId>,

View File

@ -3,7 +3,7 @@ use std::fmt::{self, Debug, Formatter};
use std::hash::Hash;
use std::sync::OnceLock;
use comemo::{Track, Tracked};
use comemo::{Tracked, Validate};
use crate::introspection::{Introspector, Location};
@ -312,7 +312,7 @@ enum LinkKind<'a> {
/// We need to override the constraint's lifetime here so that `Tracked` is
/// covariant over the constraint. If it becomes invariant, we're in for a
/// world of lifetime pain.
Outer(Tracked<'a, Locator<'a>, <Locator<'static> as Track>::Call>),
Outer(Tracked<'a, Locator<'a>, <Locator<'static> as Validate>::Constraint>),
/// A link which indicates that we are in measurement mode.
Measure(Location),
}

View File

@ -39,9 +39,9 @@ pub use typst_syntax as syntax;
pub use typst_utils as utils;
use std::collections::HashSet;
use std::sync::{LazyLock, Mutex};
use std::sync::LazyLock;
use comemo::{Track, Tracked};
use comemo::{Track, Tracked, Validate};
use ecow::{EcoString, EcoVec, eco_format, eco_vec};
use typst_html::HtmlDocument;
use typst_library::diag::{
@ -135,11 +135,10 @@ fn compile_impl<D: Document>(
subsink = Sink::new();
let constraint = Mutex::new(comemo::Constraint::new());
let push = |call, ret| constraint.lock().unwrap().push(call, ret);
let constraint = <Introspector as Validate>::Constraint::new();
let mut engine = Engine {
world,
introspector: introspector.track_with(&push),
introspector: introspector.track_with(&constraint),
traced,
sink: subsink.track_mut(),
route: Route::default(),
@ -151,10 +150,7 @@ fn compile_impl<D: Document>(
introspector = document.introspector();
iter += 1;
if timed!(
"check stabilized",
constraint.into_inner().unwrap().validate(introspector)
) {
if timed!("check stabilized", introspector.validate(&constraint)) {
break;
}