Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve documentation links #649

Merged
merged 6 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions ast/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub enum TypeKind {

/// A type argument, i.e. when performing a specific generic call or specifying a variable's type
///
/// ```ignore
/// ```text
/// a: int = id[int](15);
///
/// a: int = 15;
Expand Down Expand Up @@ -49,7 +49,7 @@ pub enum TypeContent {
/// A named tuple, or tuple type: `type Foo(Bar, Baz);`
Tuple(Vec<Type>),
/// A type alias: `type Foo = Bar;`
/// This can be an alias to a multi type - a single [`TypeArgument`] of kind [`TypeKind::Multi`]
/// This can be an alias to a multi type - a single [`Type`] of kind [`TypeKind::Multi`]
Alias(Type),
}

Expand Down Expand Up @@ -189,8 +189,8 @@ pub enum Node {
Empty,
}

/// The [`Ast`] structure is a wrapper around the [`AstNode`] sum type, which contains
/// extra information such as the node's [`Location`]
/// The [`Ast`] structure is a wrapper around the [`Node`] sum type, which contains
/// extra information such as the node's location
#[derive(Debug, Clone)]
pub struct Ast {
pub location: SpanTuple,
Expand Down
2 changes: 1 addition & 1 deletion fir/src/checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ impl<T: Debug> Fir<T> {
})
}

/// Check that the [`Fir`] is in a valid state. This means that all [`OriginIdx`] should be unique,
/// Check that the [`Fir`] is in a valid state. This means that all [`crate::OriginIdx`] should be unique,
/// and that all links between nodes should be allowed
///
/// # Panic
Expand Down
2 changes: 1 addition & 1 deletion fir/src/iter/multi_mapper.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::{Fir, Incomplete, Kind, Node, OriginIdx, RefIdx};

pub trait MultiMapper<T, U: Default + From<T>, E> {
/// Each implementer of [`Pass`] should keep its own [`OriginIdx`] counter in order to supply the [`Fir`]
/// Each implementer of [`MultiMapper`] should keep its own [`OriginIdx`] counter in order to supply the [`Fir`]
/// with new nodes. This can be done by keeping an [`OriginIdx`] as part of the context, and repeatedly
/// calling [`OriginIdx::next`] on it.
fn next_origin(&mut self) -> OriginIdx;
Expand Down
10 changes: 5 additions & 5 deletions fir/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ pub enum RefIdx {
/// yet.
Unresolved,
/// A resolved reference to a definition/origin point. If you are certain that a [`RefIdx`] points to a valid
/// [`OriginIdx`], you can use [`RefIdx::unwrap`].
/// [`OriginIdx`], you can use [`RefIdx::expect_resolved`].
Resolved(OriginIdx),
}

Expand All @@ -140,7 +140,7 @@ pub struct OriginIdx(pub u64);

impl OriginIdx {
/// Get the next origin from an existing one. This allows [`Pass`]es to simply keep an [`OriginIdx`] in their context
/// and repeatedly call [`next`] on it.
/// and repeatedly call [`OriginIdx::next`] on it.
pub fn next(&self) -> OriginIdx {
OriginIdx(self.0 + 1)
}
Expand Down Expand Up @@ -296,9 +296,9 @@ pub trait Pass<T: Debug, U: Debug, E> {
/// The actual pass algorithm which transforms the [`Fir`] and returns a new one.
fn transform(&mut self, fir: Fir<T>) -> Result<Fir<U>, E>;

/// The [`pass`] function is implemented by default in the [`Pass`] trait. It calls into the
/// [`pre_condition`] function, then executes the [`transform`] one, before finally executing
/// the [`post_condition`] one.
/// The [`Pass::pass`] function is implemented by default in the [`Pass`] trait. It calls into the
/// [`Pass::pre_condition`] function, then executes the [`Pass::transform`] one, before finally executing
/// the [`Pass::post_condition`] one.
///
/// ## Return value
///
Expand Down
2 changes: 1 addition & 1 deletion fire/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl Interpret for Fir<FlattenData<'_>> {
}
}

/// It's called [`GarbajKollector`] because this way you have "jk" in the middle of the word :)
/// It's called [`GarbaJKollector`] because this way you have "jk" in the middle of the word :)
pub struct GarbaJKollector(HashMap<OriginIdx, Instance>);

// FIXME: Add documentation for all methods
Expand Down
2 changes: 1 addition & 1 deletion flatten/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ impl<'ast> AstInfo<'ast> {
}
}

/// Fetch the [`AstInfo::Node`] from an [`AstInfo`]. This function will panic if the [`AstInfo`] is *not* an [`AstInfo::Ast`]
/// Fetch the [`AstInfo::Node`] from an [`AstInfo`]. This function will panic if the [`AstInfo`] is *not* an [`AstInfo::Node`]
pub fn node(&self) -> &Ast {
match self {
AstInfo::Node(node) => node,
Expand Down
4 changes: 1 addition & 3 deletions location/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,7 @@ impl SpanTuple {
/// Write the content in the range included by the [`SpanTuple`]. This
/// methods splits the input in lines and starts printing from the
/// `start.line()` line at the `start.column()` character until the
/// `end.line()` and `end.column()`. The "algorithm" is repeated in this
/// struct's [`to_string`] method, which is only for testing
/// purposes and contains extra allocations.
/// `end.line()` and `end.column()`.
pub fn emit<T1: Display, T2: Display>(&self, separator: T1, repetitor: T2) {
// FIXME: As the API and behavior is still young, use self.to_string()
// for now. This is quite slow, but since emitting an error is already
Expand Down
3 changes: 1 addition & 2 deletions name_resolve/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl Index<OriginIdx> for EnclosingScope<'_> {

type Bindings = HashMap<Symbol, OriginIdx>;

/// Each scope in the [`scopes`] map contains the bindings associated with a given scope,
/// Each scope in the `scopes` map contains the bindings associated with a given scope,
/// meaning that each scope contains a list of definitions. A definition can be thought of as the
/// mapping of a name ([`Symbol`]) to the node's index in the [`Fir`].
#[derive(Clone, Debug)]
Expand Down Expand Up @@ -190,7 +190,6 @@ impl<'enclosing> NameResolveCtx<'enclosing> {
}
}

/// Extension type of [`Error`] to be able to implement [`IterError`].
enum NameResolutionError {
NonUnique(SpanTuple, OriginIdx, &'static str),
Unresolved(ResolveKind, Symbol, SpanTuple),
Expand Down
Loading