mirror of
https://github.com/typst/typst
synced 2025-07-27 14:27:56 +08:00
Compare commits
3 Commits
1bf812915c
...
2589e86a1f
Author | SHA1 | Date | |
---|---|---|---|
|
2589e86a1f | ||
|
da51d79d61 | ||
|
790153098d |
12
Cargo.lock
generated
12
Cargo.lock
generated
@ -451,17 +451,19 @@ checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990"
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "comemo"
|
name = "comemo"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
source = "git+https://github.com/typst/comemo?rev=60b30c6#60b30c6ae54f3c940dc4f778ca5090bd2a42a72e"
|
source = "git+https://github.com/typst/comemo?rev=9473663#947366304aad8840fa72eab413e07260cc34b6b4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"bumpalo",
|
||||||
"comemo-macros",
|
"comemo-macros",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"siphasher",
|
"siphasher",
|
||||||
|
"slab",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "comemo-macros"
|
name = "comemo-macros"
|
||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
source = "git+https://github.com/typst/comemo?rev=60b30c6#60b30c6ae54f3c940dc4f778ca5090bd2a42a72e"
|
source = "git+https://github.com/typst/comemo?rev=9473663#947366304aad8840fa72eab413e07260cc34b6b4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@ -2496,6 +2498,12 @@ dependencies = [
|
|||||||
"read-fonts",
|
"read-fonts",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "slab"
|
||||||
|
version = "0.4.10"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "04dc19736151f35336d325007ac991178d504a119863a2fcb3758cdb5e52c50d"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "slotmap"
|
name = "slotmap"
|
||||||
version = "1.0.7"
|
version = "1.0.7"
|
||||||
|
@ -165,4 +165,4 @@ uninlined_format_args = "warn"
|
|||||||
wildcard_in_or_patterns = "allow"
|
wildcard_in_or_patterns = "allow"
|
||||||
|
|
||||||
[patch.crates-io]
|
[patch.crates-io]
|
||||||
comemo = { git = "https://github.com/typst/comemo", rev = "60b30c6" }
|
comemo = { git = "https://github.com/typst/comemo", rev = "9473663" }
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||||
|
|
||||||
use comemo::{Track, Tracked, TrackedMut, Validate};
|
use comemo::{Track, Tracked, TrackedMut};
|
||||||
use ecow::EcoVec;
|
use ecow::EcoVec;
|
||||||
use rayon::iter::{IndexedParallelIterator, IntoParallelIterator, ParallelIterator};
|
use rayon::iter::{IndexedParallelIterator, IntoParallelIterator, ParallelIterator};
|
||||||
use typst_syntax::{FileId, Span};
|
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
|
// 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
|
// covariant over the constraint. If it becomes invariant, we're in for a
|
||||||
// world of lifetime pain.
|
// world of lifetime pain.
|
||||||
outer: Option<Tracked<'a, Self, <Route<'static> as Validate>::Constraint>>,
|
outer: Option<Tracked<'a, Self, <Route<'static> as Track>::Call>>,
|
||||||
/// This is set if this route segment was inserted through the start of a
|
/// This is set if this route segment was inserted through the start of a
|
||||||
/// module evaluation.
|
/// module evaluation.
|
||||||
id: Option<FileId>,
|
id: Option<FileId>,
|
||||||
|
@ -3,7 +3,7 @@ use std::fmt::{self, Debug, Formatter};
|
|||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
use std::sync::OnceLock;
|
use std::sync::OnceLock;
|
||||||
|
|
||||||
use comemo::{Tracked, Validate};
|
use comemo::{Track, Tracked};
|
||||||
|
|
||||||
use crate::introspection::{Introspector, Location};
|
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
|
/// 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
|
/// covariant over the constraint. If it becomes invariant, we're in for a
|
||||||
/// world of lifetime pain.
|
/// world of lifetime pain.
|
||||||
Outer(Tracked<'a, Locator<'a>, <Locator<'static> as Validate>::Constraint>),
|
Outer(Tracked<'a, Locator<'a>, <Locator<'static> as Track>::Call>),
|
||||||
/// A link which indicates that we are in measurement mode.
|
/// A link which indicates that we are in measurement mode.
|
||||||
Measure(Location),
|
Measure(Location),
|
||||||
}
|
}
|
||||||
|
@ -39,9 +39,9 @@ pub use typst_syntax as syntax;
|
|||||||
pub use typst_utils as utils;
|
pub use typst_utils as utils;
|
||||||
|
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use std::sync::LazyLock;
|
use std::sync::{LazyLock, Mutex};
|
||||||
|
|
||||||
use comemo::{Track, Tracked, Validate};
|
use comemo::{Track, Tracked};
|
||||||
use ecow::{EcoString, EcoVec, eco_format, eco_vec};
|
use ecow::{EcoString, EcoVec, eco_format, eco_vec};
|
||||||
use typst_html::HtmlDocument;
|
use typst_html::HtmlDocument;
|
||||||
use typst_library::diag::{
|
use typst_library::diag::{
|
||||||
@ -135,10 +135,11 @@ fn compile_impl<D: Document>(
|
|||||||
|
|
||||||
subsink = Sink::new();
|
subsink = Sink::new();
|
||||||
|
|
||||||
let constraint = <Introspector as Validate>::Constraint::new();
|
let constraint = Mutex::new(comemo::Constraint::new());
|
||||||
|
let push = |call, ret| constraint.lock().unwrap().push(call, ret);
|
||||||
let mut engine = Engine {
|
let mut engine = Engine {
|
||||||
world,
|
world,
|
||||||
introspector: introspector.track_with(&constraint),
|
introspector: introspector.track_with(&push),
|
||||||
traced,
|
traced,
|
||||||
sink: subsink.track_mut(),
|
sink: subsink.track_mut(),
|
||||||
route: Route::default(),
|
route: Route::default(),
|
||||||
@ -150,7 +151,10 @@ fn compile_impl<D: Document>(
|
|||||||
introspector = document.introspector();
|
introspector = document.introspector();
|
||||||
iter += 1;
|
iter += 1;
|
||||||
|
|
||||||
if timed!("check stabilized", introspector.validate(&constraint)) {
|
if timed!(
|
||||||
|
"check stabilized",
|
||||||
|
constraint.into_inner().unwrap().validate(introspector)
|
||||||
|
) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user