From 47dff3765de863554ca296448555599fc50d4a8a Mon Sep 17 00:00:00 2001 From: Laurenz Date: Thu, 11 May 2023 10:50:30 +0200 Subject: Remove 'static bound on `World` Thanks to improvements in comemo, tracked types don't need to be 'static anymore. This means that the 'static bound on the `World` is now lifted and that the `Route` doesn't need to use unsafe code anymore to manage its lifetime. --- src/model/mod.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/model/mod.rs') diff --git a/src/model/mod.rs b/src/model/mod.rs index 4ec7311a..92c4293b 100644 --- a/src/model/mod.rs +++ b/src/model/mod.rs @@ -14,7 +14,7 @@ pub use self::styles::*; pub use typst_macros::element; -use comemo::{Constraint, Track, Tracked, TrackedMut}; +use comemo::{Track, Tracked, TrackedMut, Validate}; use crate::diag::SourceResult; use crate::doc::Document; @@ -25,7 +25,7 @@ use crate::World; #[comemo::memoize] #[tracing::instrument(skip(world, tracer, content))] pub fn typeset( - world: Tracked, + world: Tracked, mut tracer: TrackedMut, content: &Content, ) -> SourceResult { @@ -42,8 +42,8 @@ pub fn typeset( loop { tracing::info!("Layout iteration {iter}"); - let constraint = Constraint::new(); let mut provider = StabilityProvider::new(); + let constraint = ::Constraint::new(); let mut vt = Vt { world, tracer: TrackedMut::reborrow_mut(&mut tracer), @@ -56,7 +56,7 @@ pub fn typeset( introspector = Introspector::new(&document.pages); - if iter >= 5 || introspector.valid(&constraint) { + if iter >= 5 || introspector.validate(&constraint) { break; } } @@ -69,7 +69,7 @@ pub fn typeset( /// Holds the state needed to [typeset] content. pub struct Vt<'a> { /// The compilation environment. - pub world: Tracked<'a, dyn World>, + pub world: Tracked<'a, dyn World + 'a>, /// The tracer for inspection of the values an expression produces. pub tracer: TrackedMut<'a, Tracer>, /// Provides stable identities to elements. -- cgit v1.2.3