tree-wide: fix rustdoc warnings, add some links

This commit is contained in:
Jade 2021-08-03 20:57:31 -07:00
parent 8a8431133e
commit e3a67ccec6
7 changed files with 23 additions and 20 deletions

View file

@ -51,7 +51,7 @@
//! The `GetDeclaredType` takes `Syntax` as input, and returns `Symbol` as //! The `GetDeclaredType` takes `Syntax` as input, and returns `Symbol` as
//! output. First, it retrieves a `Symbol` for parent `Syntax`: //! output. First, it retrieves a `Symbol` for parent `Syntax`:
//! //!
//! * https://sourceroslyn.io/#Microsoft.CodeAnalysis.CSharp/Compilation/SyntaxTreeSemanticModel.cs,1423 //! * <https://sourceroslyn.io/#Microsoft.CodeAnalysis.CSharp/Compilation/SyntaxTreeSemanticModel.cs,1423>
//! //!
//! Then, it iterates parent symbol's children, looking for one which has the //! Then, it iterates parent symbol's children, looking for one which has the
//! same text span as the original node: //! same text span as the original node:

View file

@ -39,8 +39,7 @@
//! //!
//! Splitting is implemented in the [`Constructor::split`] function. We don't do splitting for //! Splitting is implemented in the [`Constructor::split`] function. We don't do splitting for
//! or-patterns; instead we just try the alternatives one-by-one. For details on splitting //! or-patterns; instead we just try the alternatives one-by-one. For details on splitting
//! wildcards, see [`SplitWildcard`]; for integer ranges, see [`SplitIntRange`]; for slices, see //! wildcards, see [`SplitWildcard`]; for integer ranges, see [`SplitIntRange`].
//! [`SplitVarLenSlice`].
use std::{ use std::{
cmp::{max, min}, cmp::{max, min},

View file

@ -120,8 +120,8 @@ pub fn visit_file_defs(
/// ///
/// Note that, by default, rust-analyzer tests **do not** include core or std /// Note that, by default, rust-analyzer tests **do not** include core or std
/// libraries. If you are writing tests for functionality using [`FamousDefs`], /// libraries. If you are writing tests for functionality using [`FamousDefs`],
/// you'd want to include [minicore](test_utils::MiniCore) declaration at the /// you'd want to include minicore (see `test_utils::MiniCore`) declaration at
/// start of your tests: /// the start of your tests:
/// ///
/// ``` /// ```
/// //- minicore: iterator, ord, derive /// //- minicore: iterator, ord, derive

View file

@ -6,9 +6,9 @@
//! each submodule starts with `use super::*` import and exports //! each submodule starts with `use super::*` import and exports
//! "public" productions via `pub(super)`. //! "public" productions via `pub(super)`.
//! //!
//! See docs for `Parser` to learn about API, available to the grammar, //! See docs for [`Parser`](super::parser::Parser) to learn about API,
//! and see docs for `Event` to learn how this actually manages to //! available to the grammar, and see docs for [`Event`](super::event::Event)
//! produce parse trees. //! to learn how this actually manages to produce parse trees.
//! //!
//! Code in this module also contains inline tests, which start with //! Code in this module also contains inline tests, which start with
//! `// test name-of-the-test` comment and look like this: //! `// test name-of-the-test` comment and look like this:

View file

@ -1,17 +1,20 @@
//! The Rust parser. //! The Rust parser.
//! //!
//! The parser doesn't know about concrete representation of tokens and syntax //! The parser doesn't know about concrete representation of tokens and syntax
//! trees. Abstract `TokenSource` and `TreeSink` traits are used instead. As a //! trees. Abstract [`TokenSource`] and [`TreeSink`] traits are used instead.
//! consequence, this crates does not contain a lexer. //! As a consequence, this crate does not contain a lexer.
//! //!
//! The `Parser` struct from the `parser` module is a cursor into the sequence //! The [`Parser`] struct from the [`parser`] module is a cursor into the
//! of tokens. Parsing routines use `Parser` to inspect current state and //! sequence of tokens. Parsing routines use [`Parser`] to inspect current
//! advance the parsing. //! state and advance the parsing.
//! //!
//! The actual parsing happens in the `grammar` module. //! The actual parsing happens in the [`grammar`] module.
//! //!
//! Tests for this crate live in `syntax` crate. //! Tests for this crate live in the `syntax` crate.
//!
//! [`Parser`]: crate::parser::Parser
#![allow(rustdoc::private_intra_doc_links)]
#[macro_use] #[macro_use]
mod token_set; mod token_set;
#[macro_use] #[macro_use]

View file

@ -14,7 +14,7 @@ use crate::{
/// `Parser` struct provides the low-level API for /// `Parser` struct provides the low-level API for
/// navigating through the stream of tokens and /// navigating through the stream of tokens and
/// constructing the parse tree. The actual parsing /// constructing the parse tree. The actual parsing
/// happens in the `grammar` module. /// happens in the [`grammar`](super::grammar) module.
/// ///
/// However, the result of this `Parser` is not a real /// However, the result of this `Parser` is not a real
/// tree, but rather a flat stream of events of the form /// tree, but rather a flat stream of events of the form
@ -262,7 +262,7 @@ impl<'t> Parser<'t> {
} }
} }
/// See `Parser::start`. /// See [`Parser::start`].
pub(crate) struct Marker { pub(crate) struct Marker {
pos: u32, pos: u32,
bomb: DropBomb, bomb: DropBomb,
@ -320,7 +320,8 @@ impl CompletedMarker {
/// node `A`, then complete it, and then after parsing the /// node `A`, then complete it, and then after parsing the
/// whole `A`, decide that it should have started some node /// whole `A`, decide that it should have started some node
/// `B` before starting `A`. `precede` allows to do exactly /// `B` before starting `A`. `precede` allows to do exactly
/// that. See also docs about `forward_parent` in `Event::Start`. /// that. See also docs about
/// [`Event::Start::forward_parent`](crate::event::Event::Start::forward_parent).
/// ///
/// Given completed events `[START, FINISH]` and its corresponding /// Given completed events `[START, FINISH]` and its corresponding
/// `CompletedMarker(pos: 0, _)`. /// `CompletedMarker(pos: 0, _)`.

View file

@ -197,12 +197,12 @@ pub enum AttrKind {
} }
impl AttrKind { impl AttrKind {
/// Returns `true` if the attr_kind is [`Inner`]. /// Returns `true` if the attr_kind is [`Inner`](Self::Inner).
pub fn is_inner(&self) -> bool { pub fn is_inner(&self) -> bool {
matches!(self, Self::Inner) matches!(self, Self::Inner)
} }
/// Returns `true` if the attr_kind is [`Outer`]. /// Returns `true` if the attr_kind is [`Outer`](Self::Outer).
pub fn is_outer(&self) -> bool { pub fn is_outer(&self) -> bool {
matches!(self, Self::Outer) matches!(self, Self::Outer)
} }