docs: update some comments

This commit is contained in:
Tobias Schmitz 2025-05-20 14:35:57 +02:00
parent 0e8c2e080d
commit 80491a459c
No known key found for this signature in database
2 changed files with 7 additions and 4 deletions

View File

@ -151,7 +151,7 @@ pub struct Warned<T> {
pub warnings: EcoVec<SourceDiagnostic>,
}
/// An error or warning in a source file.
/// An error or warning in a source or text file.
///
/// The contained spans will only be detached if any of the input source files
/// were detached.
@ -574,8 +574,11 @@ impl From<PackageError> for EcoString {
pub type LoadResult<T> = Result<T, LoadError>;
/// A callsite independent error that occurred during data loading.
/// This avoids polluting the memoization with [`Span`]s and [`FileId`]s from source files.
/// Can be turned into a [`SourceDiagnostic`] using the [`LoadedAt::in_text`]
/// or [`LoadedAt::in_invalid_text`] methods available on [`LoadResult`].
///
/// [`FileId`]: typst_syntax::FileId
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub struct LoadError {
pub pos: ReportPos,

View File

@ -307,7 +307,6 @@ impl Bibliography {
#[typst_macros::time(name = "load bibliography")]
fn decode(data: &[Loaded]) -> SourceResult<Bibliography> {
let mut map = IndexMap::new();
// TODO: store spans of entries for duplicate key error messages
let mut duplicates = Vec::<EcoString>::new();
// We might have multiple bib/yaml files
@ -326,8 +325,9 @@ impl Bibliography {
}
if !duplicates.is_empty() {
// TODO: errors with spans of source files,
// requires hayagriva entries to store the range
// TODO: Store spans of entries for duplicate key error messages.
// Requires hayagriva entries to store their location, which should
// be fine, since they are 1kb anyway.
let span = data.first().unwrap().source.span;
bail!(span, "duplicate bibliography keys: {}", duplicates.join(", "));
}