mirror of
https://github.com/typst/typst
synced 2025-08-24 03:34:14 +08:00
docs: update some comments
This commit is contained in:
parent
0e8c2e080d
commit
80491a459c
@ -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,
|
||||
|
@ -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(", "));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user