Skip to content

Commit f4ee2fb

Browse files
committed
syntax: switch to rustdoc intra links
Get rid of those old crusty HTML links! Also, if an intradoc link is used that is bunk, fail the build.
1 parent eacf0a5 commit f4ee2fb

File tree

9 files changed

+59
-72
lines changed

9 files changed

+59
-72
lines changed

regex-syntax/src/ast/parse.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,7 @@ impl ParserBuilder {
229229
/// abstract syntax tree. The size of the tree is proportional to the length
230230
/// of the regular expression pattern.
231231
///
232-
/// A `Parser` can be configured in more detail via a
233-
/// [`ParserBuilder`](struct.ParserBuilder.html).
232+
/// A `Parser` can be configured in more detail via a [`ParserBuilder`].
234233
#[derive(Clone, Debug)]
235234
pub struct Parser {
236235
/// The current position of the parser.
@@ -336,8 +335,7 @@ impl Parser {
336335
/// The parser can be run with either the `parse` or `parse_with_comments`
337336
/// methods. The parse methods return an abstract syntax tree.
338337
///
339-
/// To set configuration options on the parser, use
340-
/// [`ParserBuilder`](struct.ParserBuilder.html).
338+
/// To set configuration options on the parser, use [`ParserBuilder`].
341339
pub fn new() -> Parser {
342340
ParserBuilder::new().build()
343341
}

regex-syntax/src/ast/visitor.rs

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,12 @@ use crate::ast::{self, Ast};
1111
/// may be proportional to end user input.
1212
///
1313
/// Typical usage of this trait involves providing an implementation and then
14-
/// running it using the [`visit`](fn.visit.html) function.
14+
/// running it using the [`visit`] function.
1515
///
1616
/// Note that the abstract syntax tree for a regular expression is quite
17-
/// complex. Unless you specifically need it, you might be able to use the
18-
/// much simpler
19-
/// [high-level intermediate representation](../hir/struct.Hir.html)
20-
/// and its
21-
/// [corresponding `Visitor` trait](../hir/trait.Visitor.html)
22-
/// instead.
17+
/// complex. Unless you specifically need it, you might be able to use the much
18+
/// simpler [high-level intermediate representation](crate::hir::Hir) and its
19+
/// [corresponding `Visitor` trait](crate::hir::Visitor) instead.
2320
pub trait Visitor {
2421
/// The result of visiting an AST.
2522
type Output;
@@ -46,13 +43,12 @@ pub trait Visitor {
4643
}
4744

4845
/// This method is called between child nodes of an
49-
/// [`Alternation`](struct.Alternation.html).
46+
/// [`Alternation`](ast::Alternation).
5047
fn visit_alternation_in(&mut self) -> Result<(), Self::Err> {
5148
Ok(())
5249
}
5350

54-
/// This method is called on every
55-
/// [`ClassSetItem`](enum.ClassSetItem.html)
51+
/// This method is called on every [`ClassSetItem`](ast::ClassSetItem)
5652
/// before descending into child nodes.
5753
fn visit_class_set_item_pre(
5854
&mut self,
@@ -61,8 +57,7 @@ pub trait Visitor {
6157
Ok(())
6258
}
6359

64-
/// This method is called on every
65-
/// [`ClassSetItem`](enum.ClassSetItem.html)
60+
/// This method is called on every [`ClassSetItem`](ast::ClassSetItem)
6661
/// after descending into child nodes.
6762
fn visit_class_set_item_post(
6863
&mut self,
@@ -72,8 +67,8 @@ pub trait Visitor {
7267
}
7368

7469
/// This method is called on every
75-
/// [`ClassSetBinaryOp`](struct.ClassSetBinaryOp.html)
76-
/// before descending into child nodes.
70+
/// [`ClassSetBinaryOp`](ast::ClassSetBinaryOp) before descending into
71+
/// child nodes.
7772
fn visit_class_set_binary_op_pre(
7873
&mut self,
7974
_ast: &ast::ClassSetBinaryOp,
@@ -82,8 +77,8 @@ pub trait Visitor {
8277
}
8378

8479
/// This method is called on every
85-
/// [`ClassSetBinaryOp`](struct.ClassSetBinaryOp.html)
86-
/// after descending into child nodes.
80+
/// [`ClassSetBinaryOp`](ast::ClassSetBinaryOp) after descending into child
81+
/// nodes.
8782
fn visit_class_set_binary_op_post(
8883
&mut self,
8984
_ast: &ast::ClassSetBinaryOp,
@@ -92,7 +87,7 @@ pub trait Visitor {
9287
}
9388

9489
/// This method is called between the left hand and right hand child nodes
95-
/// of a [`ClassSetBinaryOp`](struct.ClassSetBinaryOp.html).
90+
/// of a [`ClassSetBinaryOp`](ast::ClassSetBinaryOp).
9691
fn visit_class_set_binary_op_in(
9792
&mut self,
9893
_ast: &ast::ClassSetBinaryOp,
@@ -104,8 +99,7 @@ pub trait Visitor {
10499
/// Executes an implementation of `Visitor` in constant stack space.
105100
///
106101
/// This function will visit every node in the given `Ast` while calling the
107-
/// appropriate methods provided by the
108-
/// [`Visitor`](trait.Visitor.html) trait.
102+
/// appropriate methods provided by the [`Visitor`] trait.
109103
///
110104
/// The primary use case for this method is when one wants to perform case
111105
/// analysis over an `Ast` without using a stack size proportional to the depth

regex-syntax/src/hir/literal/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ use crate::hir::{self, Hir, HirKind};
3030
/// bounded to some low number by default using heuristics, but the limits can
3131
/// be tweaked.
3232
///
33-
/// **WARNING**: Literal extraction uses stack space proportional to the size
34-
/// of the `Hir` expression. At some point, this drawback will be eliminated.
35-
/// To protect yourself, set a reasonable
36-
/// [`nest_limit` on your `Parser`](../../struct.ParserBuilder.html#method.nest_limit).
37-
/// This is done for you by default.
33+
/// **WARNING**: Literal extraction uses stack space proportional to the
34+
/// size of the `Hir` expression. At some point, this drawback will be
35+
/// eliminated. To protect yourself, set a reasonable [`nest_limit` on your
36+
/// `Parser`](crate::ParserBuilder::nest_limit). This is done for you by
37+
/// default.
3838
#[derive(Clone, Eq, PartialEq)]
3939
pub struct Literals {
4040
lits: Vec<Literal>,

regex-syntax/src/hir/mod.rs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -681,8 +681,8 @@ impl HirKind {
681681
/// Return true if and only if this HIR is the empty regular expression.
682682
///
683683
/// Note that this is not defined inductively. That is, it only tests if
684-
/// this kind is the `Empty` variant. To get the inductive definition,
685-
/// use the `is_match_empty` method on [`Hir`](struct.Hir.html).
684+
/// this kind is the `Empty` variant. To get the inductive definition, use
685+
/// the `is_match_empty` method on [`Hir`].
686686
pub fn is_empty(&self) -> bool {
687687
match *self {
688688
HirKind::Empty => true,
@@ -756,12 +756,12 @@ impl Literal {
756756
/// A character class, regardless of its character type, is represented by a
757757
/// sequence of non-overlapping non-adjacent ranges of characters.
758758
///
759-
/// Note that unlike [`Literal`](enum.Literal.html), a `Bytes` variant may
760-
/// be produced even when it exclusively matches valid UTF-8. This is because
761-
/// a `Bytes` variant represents an intention by the author of the regular
762-
/// expression to disable Unicode mode, which in turn impacts the semantics of
763-
/// case insensitive matching. For example, `(?i)k` and `(?i-u)k` will not
764-
/// match the same set of strings.
759+
/// Note that unlike [`Literal`], a `Bytes` variant may be produced even when
760+
/// it exclusively matches valid UTF-8. This is because a `Bytes` variant
761+
/// represents an intention by the author of the regular expression to disable
762+
/// Unicode mode, which in turn impacts the semantics of case insensitive
763+
/// matching. For example, `(?i)k` and `(?i-u)k` will not match the same set of
764+
/// strings.
765765
#[derive(Clone, Debug, Eq, PartialEq)]
766766
pub enum Class {
767767
/// A set of characters represented by Unicode scalar values.
@@ -1424,10 +1424,9 @@ impl Repetition {
14241424
///
14251425
/// Note that this is not defined inductively. For example, while `a*`
14261426
/// will report `true`, `()+` will not, even though `()` matches the empty
1427-
/// string and one or more occurrences of something that matches the empty
1428-
/// string will always match the empty string. In order to get the
1429-
/// inductive definition, see the corresponding method on
1430-
/// [`Hir`](struct.Hir.html).
1427+
/// string and one or more occurrences of something that matches the
1428+
/// empty string will always match the empty string. In order to get the
1429+
/// inductive definition, see the corresponding method on [`Hir`].
14311430
pub fn is_match_empty(&self) -> bool {
14321431
match self.kind {
14331432
RepetitionKind::ZeroOrOne => true,

regex-syntax/src/hir/translate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ impl TranslatorBuilder {
103103
/// many abstract syntax trees.
104104
///
105105
/// A `Translator` can be configured in more detail via a
106-
/// [`TranslatorBuilder`](struct.TranslatorBuilder.html).
106+
/// [`TranslatorBuilder`].
107107
#[derive(Clone, Debug)]
108108
pub struct Translator {
109109
/// Our call stack, but on the heap.

regex-syntax/src/hir/visitor.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use crate::hir::{self, Hir, HirKind};
1111
/// important since the size of an HIR may be proportional to end user input.
1212
///
1313
/// Typical usage of this trait involves providing an implementation and then
14-
/// running it using the [`visit`](fn.visit.html) function.
14+
/// running it using the [`visit`] function.
1515
pub trait Visitor {
1616
/// The result of visiting an HIR.
1717
type Output;
@@ -46,8 +46,7 @@ pub trait Visitor {
4646
/// Executes an implementation of `Visitor` in constant stack space.
4747
///
4848
/// This function will visit every node in the given `Hir` while calling
49-
/// appropriate methods provided by the
50-
/// [`Visitor`](trait.Visitor.html) trait.
49+
/// appropriate methods provided by the [`Visitor`] trait.
5150
///
5251
/// The primary use case for this method is when one wants to perform case
5352
/// analysis over an `Hir` without using a stack size proportional to the depth

regex-syntax/src/lib.rs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ This crate provides a robust regular expression parser.
33
44
This crate defines two primary types:
55
6-
* [`Ast`](ast/enum.Ast.html) is the abstract syntax of a regular expression.
6+
* [`Ast`](ast::Ast) is the abstract syntax of a regular expression.
77
An abstract syntax corresponds to a *structured representation* of the
88
concrete syntax of a regular expression, where the concrete syntax is the
99
pattern string itself (e.g., `foo(bar)+`). Given some abstract syntax, it
1010
can be converted back to the original concrete syntax (modulo some details,
1111
like whitespace). To a first approximation, the abstract syntax is complex
1212
and difficult to analyze.
13-
* [`Hir`](hir/struct.Hir.html) is the high-level intermediate representation
13+
* [`Hir`](hir::Hir) is the high-level intermediate representation
1414
("HIR" or "high-level IR" for short) of regular expression. It corresponds to
1515
an intermediate state of a regular expression that sits between the abstract
1616
syntax and the low level compiled opcodes that are eventually responsible for
@@ -22,14 +22,14 @@ This crate defines two primary types:
2222
2323
These two types come with conversion routines:
2424
25-
* An [`ast::parse::Parser`](ast/parse/struct.Parser.html) converts concrete
26-
syntax (a `&str`) to an [`Ast`](ast/enum.Ast.html).
27-
* A [`hir::translate::Translator`](hir/translate/struct.Translator.html)
28-
converts an [`Ast`](ast/enum.Ast.html) to a [`Hir`](hir/struct.Hir.html).
25+
* An [`ast::parse::Parser`] converts concrete syntax (a `&str`) to an
26+
[`Ast`](ast::Ast).
27+
* A [`hir::translate::Translator`] converts an [`Ast`](ast::Ast) to a
28+
[`Hir`](hir::Hir).
2929
3030
As a convenience, the above two conversion routines are combined into one via
31-
the top-level [`Parser`](struct.Parser.html) type. This `Parser` will first
32-
convert your pattern to an `Ast` and then convert the `Ast` to an `Hir`.
31+
the top-level [`Parser`] type. This `Parser` will first convert your pattern to
32+
an `Ast` and then convert the `Ast` to an `Hir`.
3333
3434
3535
# Example
@@ -81,10 +81,10 @@ in a monospace font.
8181
8282
# Literal extraction
8383
84-
This crate provides limited support for
85-
[literal extraction from `Hir` values](hir/literal/struct.Literals.html).
86-
Be warned that literal extraction currently uses recursion, and therefore,
87-
stack size proportional to the size of the `Hir`.
84+
This crate provides limited support for [literal extraction from `Hir`
85+
values](hir::literal::Literals). Be warned that literal extraction currently
86+
uses recursion, and therefore, stack size proportional to the size of the
87+
`Hir`.
8888
8989
The purpose of literal extraction is to speed up searches. That is, if you
9090
know a regular expression must match a prefix or suffix literal, then it is
@@ -159,11 +159,12 @@ The following features are available:
159159
`\p{sb=ATerm}`.
160160
*/
161161

162+
#![no_std]
162163
#![forbid(unsafe_code)]
163-
#![deny(missing_docs)]
164+
#![deny(missing_docs, rustdoc::broken_intra_doc_links)]
165+
#![doc(test(attr(deny(warnings))))]
164166
#![warn(missing_debug_implementations)]
165167
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
166-
#![no_std]
167168

168169
#[cfg(any(test, feature = "std"))]
169170
extern crate std;
@@ -240,10 +241,9 @@ pub fn is_meta_character(c: char) -> bool {
240241
///
241242
/// # Panics
242243
///
243-
/// If the `unicode-perl` feature is not enabled, then this function panics.
244-
/// For this reason, it is recommended that callers use
245-
/// [`try_is_word_character`](fn.try_is_word_character.html)
246-
/// instead.
244+
/// If the `unicode-perl` feature is not enabled, then this function
245+
/// panics. For this reason, it is recommended that callers use
246+
/// [`try_is_word_character`] instead.
247247
pub fn is_word_character(c: char) -> bool {
248248
try_is_word_character(c).expect("unicode-perl feature must be enabled")
249249
}

regex-syntax/src/parser.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ use crate::{ast, hir, Result};
44
///
55
/// This builder permits modifying configuration options for the parser.
66
///
7-
/// This type combines the builder options for both the
8-
/// [AST `ParserBuilder`](ast/parse/struct.ParserBuilder.html)
9-
/// and the
10-
/// [HIR `TranslatorBuilder`](hir/translate/struct.TranslatorBuilder.html).
7+
/// This type combines the builder options for both the [AST
8+
/// `ParserBuilder`](ast::parse::ParserBuilder) and the [HIR
9+
/// `TranslatorBuilder`](hir::translate::TranslatorBuilder).
1110
#[derive(Clone, Debug, Default)]
1211
pub struct ParserBuilder {
1312
ast: ast::parse::ParserBuilder,
@@ -164,10 +163,9 @@ impl ParserBuilder {
164163
/// convenience for never having to deal with it at all.
165164
///
166165
/// If callers have more fine grained use cases that need an AST, then please
167-
/// see the [`ast::parse`](ast/parse/index.html) module.
166+
/// see the [`ast::parse`] module.
168167
///
169-
/// A `Parser` can be configured in more detail via a
170-
/// [`ParserBuilder`](struct.ParserBuilder.html).
168+
/// A `Parser` can be configured in more detail via a [`ParserBuilder`].
171169
#[derive(Clone, Debug)]
172170
pub struct Parser {
173171
ast: ast::parse::Parser,
@@ -181,8 +179,7 @@ impl Parser {
181179
/// a high level intermediate representation of the given regular
182180
/// expression.
183181
///
184-
/// To set configuration options on the parser, use
185-
/// [`ParserBuilder`](struct.ParserBuilder.html).
182+
/// To set configuration options on the parser, use [`ParserBuilder`].
186183
pub fn new() -> Parser {
187184
ParserBuilder::new().build()
188185
}

regex-syntax/src/utf8.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Converts ranges of Unicode scalar values to equivalent ranges of UTF-8 bytes.
33
44
This is sub-module is useful for constructing byte based automatons that need
55
to embed UTF-8 decoding. The most common use of this module is in conjunction
6-
with the [`hir::ClassUnicodeRange`](../hir/struct.ClassUnicodeRange.html) type.
6+
with the [`hir::ClassUnicodeRange`](crate::hir::ClassUnicodeRange) type.
77
88
See the documentation on the `Utf8Sequences` iterator for more details and
99
an example.

0 commit comments

Comments
 (0)