Skip to content

Commit cff9c6f

Browse files
committed
Adjust rule names
Adjusts rule names for style, to fix some bugs, and to make some of them more specific.
1 parent 96f57ca commit cff9c6f

File tree

6 files changed

+225
-226
lines changed

6 files changed

+225
-226
lines changed

src/lifetime-elision.md

+4-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ In order to make common patterns more ergonomic, lifetime arguments can be
1414
*elided* in [function item], [function pointer], and [closure trait] signatures.
1515
The following rules are used to infer lifetime parameters for elided lifetimes.
1616

17-
r[lifetime-elision.function.constraint]
17+
r[lifetime-elision.function.lifetimes-not-inferred]
1818
It is an error to elide lifetime parameters that cannot be inferred.
1919

2020
r[lifetime-elision.function.explicit-placeholder]
@@ -184,11 +184,10 @@ impl<'a> dyn Bar<'a> {}
184184
impl<'a> dyn Bar<'a> + 'a {}
185185
```
186186

187+
r[lifetime-elision.const-static]
187188
## `const` and `static` elision
188189

189-
r[lifetime-elision.item]
190-
191-
r[lifetime-elision.item.intro]
190+
r[lifetime-elision.const-static.implicit-static]
192191
Both [constant] and [static] declarations of reference types have *implicit*
193192
`'static` lifetimes unless an explicit lifetime is specified. As such, the
194193
constant declarations involving `'static` above may be written without the
@@ -210,7 +209,7 @@ const BITS_N_STRINGS: BitsNStrings<'_> = BitsNStrings {
210209
};
211210
```
212211

213-
r[lifetime-elision.item.fn-types]
212+
r[lifetime-elision.const-static.fn-references]
214213
Note that if the `static` or `const` items include function or closure
215214
references, which themselves include references, the compiler will first try
216215
the standard elision rules. If it is unable to resolve the lifetimes by its

src/macros.md

-3
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@ syntax: `some_extension!(...)`.
99

1010
There are two ways to define new macros:
1111

12-
r[macro.rules]
1312
* [Macros by Example] define new syntax in a higher-level, declarative way.
14-
15-
r[macro.proc]
1613
* [Procedural Macros] define function-like macros, custom derives, and custom
1714
attributes using functions that operate on input tokens.
1815

src/names.md

+31-31
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,49 @@
11
# Names
22

3-
r[name]
3+
r[names]
44

5-
r[name.intro]
5+
r[names.intro]
66
An *entity* is a language construct that can be referred to in some way within
77
the source program, usually via a [path]. Entities include [types], [items],
88
[generic parameters], [variable bindings], [loop labels], [lifetimes],
99
[fields], [attributes], and [lints].
1010

11-
r[name.decl]
11+
r[names.decl]
1212
A *declaration* is a syntactical construct that can introduce a *name* to
1313
refer to an entity. Entity names are valid within a [*scope*] --- a region of
1414
source text where that name may be referenced.
1515

16-
r[name.explicit-decl]
16+
r[names.explicit-decl]
1717
Some entities are [explicitly declared](#explicitly-declared-entities) in the
1818
source code, and some are [implicitly declared](#implicitly-declared-entities)
1919
as part of the language or compiler extensions.
2020

21-
r[name.path]
21+
r[names.path]
2222
[*Paths*] are used to refer to an entity, possibly in another module or type.
2323

24-
r[name.lifetime]
24+
r[names.lifetime]
2525
Lifetimes and loop labels use a [dedicated syntax][lifetimes-and-loop-labels] using a
2626
leading quote.
2727

28-
r[name.namespace]
28+
r[names.namespace]
2929
Names are segregated into different [*namespaces*], allowing entities in
3030
different namespaces to share the same name without conflict.
3131

32-
r[name.resolution]
32+
r[names.resolution]
3333
[*Name resolution*] is the compile-time process of tying paths, identifiers,
3434
and labels to entity declarations.
3535

36-
r[name.visibility]
36+
r[names.visibility]
3737
Access to certain names may be restricted based on their [*visibility*].
3838

3939
## Explicitly declared entities
4040

41-
r[name.explicit]
41+
r[names.explicit]
4242

43-
r[name.explicit.list]
43+
r[names.explicit.list]
4444
Entities that explicitly introduce a name in the source code are:
4545

46-
r[name.explicit.item-decl]
46+
r[names.explicit.item-decl]
4747
* [Items]:
4848
* [Module declarations]
4949
* [External crate declarations]
@@ -59,7 +59,7 @@ r[name.explicit.item-decl]
5959
* [`macro_rules` declarations] and [matcher metavariables]
6060
* [Implementation] associated items
6161

62-
r[name.explicit.expr]
62+
r[names.explicit.expr]
6363
* [Expressions]:
6464
* [Closure] parameters
6565
* [`while let`] pattern bindings
@@ -68,66 +68,66 @@ r[name.explicit.expr]
6868
* [`match`] pattern bindings
6969
* [Loop labels]
7070

71-
r[name.explicit.generics]
71+
r[names.explicit.generics]
7272
* [Generic parameters]
7373

74-
r[name.explicit.higher-ranked-bounds]
74+
r[names.explicit.higher-ranked-bounds]
7575
* [Higher ranked trait bounds]
7676

77-
r[name.explicit.binding]
77+
r[names.explicit.binding]
7878
* [`let` statement] pattern bindings
7979

80-
r[name.explicit.macro_use]
80+
r[names.explicit.macro_use]
8181
* The [`macro_use` attribute] can introduce macro names from another crate
8282

83-
r[name.explicit.macro_export]
83+
r[names.explicit.macro_export]
8484
* The [`macro_export` attribute] can introduce an alias for the macro into the crate root
8585

86-
r[name.explicit.macro-invocation]
86+
r[names.explicit.macro-invocation]
8787
Additionally, [macro invocations] and [attributes] can introduce names by
8888
expanding to one of the above items.
8989

9090
## Implicitly declared entities
9191

92-
r[name.implicit]
92+
r[names.implicit]
9393

94-
r[name.implicit.list]
94+
r[names.implicit.list]
9595
The following entities are implicitly defined by the language, or are
9696
introduced by compiler options and extensions:
9797

98-
r[name.implicit.primitive-types]
98+
r[names.implicit.primitive-types]
9999
* [Language prelude]:
100100
* [Boolean type] --- `bool`
101101
* [Textual types] --- `char` and `str`
102102
* [Integer types] --- `i8`, `i16`, `i32`, `i64`, `i128`, `u8`, `u16`, `u32`, `u64`, `u128`
103103
* [Machine-dependent integer types] --- `usize` and `isize`
104104
* [floating-point types] --- `f32` and `f64`
105105

106-
r[name.implicit.builtin-attributes]
106+
r[names.implicit.builtin-attributes]
107107
* [Built-in attributes]
108108

109-
r[name.implicit.prelude]
109+
r[names.implicit.prelude]
110110
* [Standard library prelude] items, attributes, and macros
111111

112-
r[name.implicit.stdlib]
112+
r[names.implicit.stdlib]
113113
* [Standard library][extern-prelude] crates in the root module
114114

115-
r[name.implicit.extern-prelude]
115+
r[names.implicit.extern-prelude]
116116
* [External crates][extern-prelude] linked by the compiler
117117

118-
r[name.implicit.tool-attributes]
118+
r[names.implicit.tool-attributes]
119119
* [Tool attributes]
120120

121-
r[name.implicit.lints]
121+
r[names.implicit.lints]
122122
* [Lints] and [tool lint attributes]
123123

124-
r[name.implicit.derive-helpers]
124+
r[names.implicit.derive-helpers]
125125
* [Derive helper attributes] are valid within an item without being explicitly imported
126126

127-
r[name.implicit.lifetime-static]
127+
r[names.implicit.lifetime-static]
128128
* The [`'static`] lifetime
129129

130-
r[name.implicit.root]
130+
r[names.implicit.root]
131131
Additionally, the crate root module does not have a name, but can be referred
132132
to with certain [path qualifiers] or aliases.
133133

0 commit comments

Comments
 (0)