From 408588ee281c185f2b17fefe3856b0d2c1f83c25 Mon Sep 17 00:00:00 2001 From: Miguel Young de la Sota Date: Wed, 1 Jan 2025 16:53:33 -0800 Subject: [PATCH] ilex: Unbreak docs --- ilex/src/file/context.rs | 6 ++++-- ilex/src/file/mod.rs | 4 ++-- ilex/src/report/mod.rs | 7 +++++-- ilex/src/rule.rs | 2 +- ilex/src/token/mod.rs | 2 +- ilex/src/token/stream.rs | 2 +- 6 files changed, 14 insertions(+), 9 deletions(-) diff --git a/ilex/src/file/context.rs b/ilex/src/file/context.rs index 97e1103..5d774e7 100644 --- a/ilex/src/file/context.rs +++ b/ilex/src/file/context.rs @@ -11,11 +11,13 @@ use crate::report; use crate::report::Fatal; use crate::report::Report; +#[cfg(doc)] +use crate::Span; + /// A source context, which owns source code files. /// /// A `Context` contains the full text of all the loaded source files, which -/// [`SpanId`]s ultimately refer to. Most [`SpanId`] operations need their -/// corresponding `Context` available. +/// [`Span`]s ultimately refer to. #[derive(Default)] pub struct Context { state: Arc>, diff --git a/ilex/src/file/mod.rs b/ilex/src/file/mod.rs index 139e11a..10924e4 100644 --- a/ilex/src/file/mod.rs +++ b/ilex/src/file/mod.rs @@ -302,7 +302,7 @@ pub trait Spanned<'ctx> { /// Returns the span in this syntax element. fn span(&self) -> Span<'ctx>; - /// Forwards to [`SpanId::file()`]. + /// Forwards to [`Span::file()`]. fn file(&self) -> File<'ctx> { self.span().file() } @@ -327,7 +327,7 @@ pub trait Spanned<'ctx> { self.span().len() } - /// Forwards to [`SpanId::text()`]. + /// Forwards to [`Span::text()`]. fn text(&self) -> &'ctx str { self.span().text() } diff --git a/ilex/src/report/mod.rs b/ilex/src/report/mod.rs index 98a3f5c..2c19d0e 100644 --- a/ilex/src/report/mod.rs +++ b/ilex/src/report/mod.rs @@ -2,7 +2,7 @@ //! //! This module contains types for generating an *error report*: a collection of //! diagnostics that describe why an operation failed in detail. Diagnostics -//! are basically fancy compiler errors: they use [`SpanId`]s to present faulty +//! are basically fancy compiler errors: they use [`Span`]s to present faulty //! input in context. //! //! The [`Report`] type is a reference-counted list of diagnostics, which is @@ -28,10 +28,13 @@ pub use builtin::Expected; pub use diagnostic::Diagnostic; use diagnostic::Kind; +#[cfg(doc)] +use crate::Span; + /// A collection of errors can may built up over the course of an operation. /// /// To construct a report, see [`Context::new_report()`]. The context that -/// constructs a report is the only one whose [`SpanId`]s should be passed into +/// constructs a report is the only one whose [`Span`]s should be passed into /// it; doing otherwise will result in unspecified output (or probably a panic). pub struct Report { ctx: Context, diff --git a/ilex/src/rule.rs b/ilex/src/rule.rs index 1c12304..cadd086 100644 --- a/ilex/src/rule.rs +++ b/ilex/src/rule.rs @@ -1060,7 +1060,7 @@ impl TryFrom for Digital { /// /// Comments do not generate tokens, unlike most rules. Instead, they are /// attached to the span of a token, and can be inspected through -/// [`Span::comments()`][crate::Span::comments]. +/// [`Token::comments()`][crate::Token::comments]. #[derive(Debug)] pub struct Comment { pub(crate) bracket: Bracket, diff --git a/ilex/src/token/mod.rs b/ilex/src/token/mod.rs index 1644b00..92c2742 100644 --- a/ilex/src/token/mod.rs +++ b/ilex/src/token/mod.rs @@ -1000,7 +1000,7 @@ impl<'lex> Quoted<'lex> { /// Returns the raw content of this token. /// /// There are two kinds of content: either a literal span of Unicode scalars - /// (represented as a [`SpanId`] pointing to those characters) or a single + /// (represented as a [`Span`] pointing to those characters) or a single /// escape, potentially with some side data. /// /// It is up to the user of the library to decode these two content types into diff --git a/ilex/src/token/stream.rs b/ilex/src/token/stream.rs index 504fac9..e25c7ac 100644 --- a/ilex/src/token/stream.rs +++ b/ilex/src/token/stream.rs @@ -534,7 +534,7 @@ pub struct Comments<'lex> { } impl<'lex> Comments<'lex> { - /// Adapts this iterator to return just the text contents of each [`SpanId`]. + /// Adapts this iterator to return just the text contents of each [`Span`]. pub fn as_strings(self) -> impl Iterator + 'lex { self.map(Span::text) }