summaryrefslogtreecommitdiff
path: root/crates/typst-library/src
diff options
context:
space:
mode:
author+merlan #flirora <flirora@flirora.xyz>2025-04-07 14:42:29 -0400
committerGitHub <noreply@github.com>2025-04-07 18:42:29 +0000
commit14a0565d95b40bb58a07da554b7d05d4712efcd7 (patch)
tree9255cb3d95bae3520642de6430c15208314a6102 /crates/typst-library/src
parentbd2e76e11d487d1e825217db155e45d3fb6f6584 (diff)
Show warnings from eval (#6100)
Co-authored-by: Laurenz <laurmaedje@gmail.com>
Diffstat (limited to 'crates/typst-library/src')
-rw-r--r--crates/typst-library/src/foundations/mod.rs12
-rw-r--r--crates/typst-library/src/model/bibliography.rs6
-rw-r--r--crates/typst-library/src/routines.rs1
3 files changed, 16 insertions, 3 deletions
diff --git a/crates/typst-library/src/foundations/mod.rs b/crates/typst-library/src/foundations/mod.rs
index 8e3aa060..d42be15b 100644
--- a/crates/typst-library/src/foundations/mod.rs
+++ b/crates/typst-library/src/foundations/mod.rs
@@ -77,6 +77,7 @@ pub use {
indexmap::IndexMap,
};
+use comemo::TrackedMut;
use ecow::EcoString;
use typst_syntax::Spanned;
@@ -297,5 +298,14 @@ pub fn eval(
for (key, value) in dict {
scope.bind(key.into(), Binding::new(value, span));
}
- (engine.routines.eval_string)(engine.routines, engine.world, &text, span, mode, scope)
+
+ (engine.routines.eval_string)(
+ engine.routines,
+ engine.world,
+ TrackedMut::reborrow_mut(&mut engine.sink),
+ &text,
+ span,
+ mode,
+ scope,
+ )
}
diff --git a/crates/typst-library/src/model/bibliography.rs b/crates/typst-library/src/model/bibliography.rs
index b11c6178..51e3b03b 100644
--- a/crates/typst-library/src/model/bibliography.rs
+++ b/crates/typst-library/src/model/bibliography.rs
@@ -6,7 +6,7 @@ use std::num::NonZeroUsize;
use std::path::Path;
use std::sync::{Arc, LazyLock};
-use comemo::Tracked;
+use comemo::{Track, Tracked};
use ecow::{eco_format, EcoString, EcoVec};
use hayagriva::archive::ArchivedStyle;
use hayagriva::io::BibLaTeXError;
@@ -20,7 +20,7 @@ use typst_syntax::{Span, Spanned};
use typst_utils::{Get, ManuallyHash, NonZeroExt, PicoStr};
use crate::diag::{bail, error, At, FileError, HintedStrResult, SourceResult, StrResult};
-use crate::engine::Engine;
+use crate::engine::{Engine, Sink};
use crate::foundations::{
elem, Bytes, CastInfo, Content, Derived, FromValue, IntoValue, Label, NativeElement,
OneOrMultiple, Packed, Reflect, Scope, Show, ShowSet, Smart, StyleChain, Styles,
@@ -999,6 +999,8 @@ impl ElemRenderer<'_> {
(self.routines.eval_string)(
self.routines,
self.world,
+ // TODO: propagate warnings
+ Sink::new().track_mut(),
math,
self.span,
EvalMode::Math,
diff --git a/crates/typst-library/src/routines.rs b/crates/typst-library/src/routines.rs
index b283052a..6f0cb32b 100644
--- a/crates/typst-library/src/routines.rs
+++ b/crates/typst-library/src/routines.rs
@@ -55,6 +55,7 @@ routines! {
fn eval_string(
routines: &Routines,
world: Tracked<dyn World + '_>,
+ sink: TrackedMut<Sink>,
string: &str,
span: Span,
mode: EvalMode,