Skip to content

Commit 55883c4

Browse files
committed
first round of link fixes
1 parent 13f38be commit 55883c4

12 files changed

+68
-67
lines changed

src/SUMMARY.md

+26-26
Original file line numberDiff line numberDiff line change
@@ -22,34 +22,34 @@
2222
- [The HIR (High-level IR)](./hir.md)
2323
- [The `ty` module: representing types](./ty.md)
2424
- [Type inference](./type-inference.md)
25-
- [Trait solving (old-style)](./trait-resolution.md)
26-
- [Higher-ranked trait bounds](./trait-hrtb.md)
27-
- [Caching subtleties](./trait-caching.md)
28-
- [Specialization](./trait-specialization.md)
25+
- [Trait solving (old-style)](./traits/resolution.md)
26+
- [Higher-ranked trait bounds](./traits/hrtb.md)
27+
- [Caching subtleties](./traits/caching.md)
28+
- [Specialization](./traits/specialization.md)
2929
- [Trait solving (new-style)](./traits.md)
30-
- [Lowering to logic](./traits-lowering-to-logic.md)
31-
- [Goals and clauses](./traits-goals-and-clauses.md)
32-
- [Equality and associated types](./traits-associated-types.md)
33-
- [Implied bounds](./traits-implied-bounds.md)
34-
- [Region constraints](./traits-regions.md)
35-
- [Canonical queries](./traits-canonical-queries.md)
36-
- [Canonicalization](./traits-canonicalization.md)
37-
- [Lowering rules](./traits-lowering-rules.md)
38-
- [The lowering module in rustc](./traits-lowering-module.md)
39-
- [Well-formedness checking](./traits-wf.md)
40-
- [The SLG solver](./traits-slg.md)
30+
- [Lowering to logic](./traits/lowering-to-logic.md)
31+
- [Goals and clauses](./traits/goals-and-clauses.md)
32+
- [Equality and associated types](./traits/associated-types.md)
33+
- [Implied bounds](./traits/implied-bounds.md)
34+
- [Region constraints](./traits/regions.md)
35+
- [Canonical queries](./traits/canonical-queries.md)
36+
- [Canonicalization](./traits/canonicalization.md)
37+
- [Lowering rules](./traits/lowering-rules.md)
38+
- [The lowering module in rustc](./traits/lowering-module.md)
39+
- [Well-formedness checking](./traits/wf.md)
40+
- [The SLG solver](./traits/slg.md)
4141
- [An Overview of Chalk](./chalk-overview.md)
42-
- [Bibliography](./traits-bibliography.md)
42+
- [Bibliography](./traits/bibliography.md)
4343
- [Type checking](./type-checking.md)
4444
- [Method Lookup](./method-lookup.md)
4545
- [Variance](./variance.md)
4646
- [The MIR (Mid-level IR)](./mir.md)
47-
- [MIR construction](./mir-construction.md)
48-
- [MIR visitor and traversal](./mir-visitor.md)
49-
- [MIR passes: getting the MIR for a function](./mir-passes.md)
50-
- [MIR borrowck](./mir-borrowck.md)
51-
- [MIR-based region checking (NLL)](./mir-regionck.md)
52-
- [MIR optimizations](./mir-optimizations.md)
47+
- [MIR construction](./mir/construction.md)
48+
- [MIR visitor and traversal](./mir/visitor.md)
49+
- [MIR passes: getting the MIR for a function](./mir/passes.md)
50+
- [MIR borrowck](./mir/borrowck.md)
51+
- [MIR-based region checking (NLL)](./mir/regionck.md)
52+
- [MIR optimizations](./mir/optimizations.md)
5353
- [Constant evaluation](./const-eval.md)
5454
- [miri const evaluator](./miri.md)
5555
- [Parameter Environments](./param_env.md)
@@ -58,7 +58,7 @@
5858

5959
---
6060

61-
- [Appendix A: Stupid Stats](./appendix-stupid-stats.md)
62-
- [Appendix B: Background material](./appendix-background.md)
63-
- [Appendix C: Glossary](./appendix-glossary.md)
64-
- [Appendix D: Code Index](./appendix-code-index.md)
61+
- [Appendix A: Stupid Stats](./appendix/stupid-stats.md)
62+
- [Appendix B: Background material](./appendix/background.md)
63+
- [Appendix C: Glossary](./appendix/glossary.md)
64+
- [Appendix D: Code Index](./appendix/code-index.md)

src/rustc-driver.md

+11-11
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ of each phase.
2020
From `rustc_driver`'s perspective, the main phases of the compiler are:
2121

2222
1. *Parse Input:* Initial crate parsing
23-
2. *Configure and Expand:* Resolve `#[cfg]` attributes, name resolution, and
23+
2. *Configure and Expand:* Resolve `#[cfg]` attributes, name resolution, and
2424
expand macros
2525
3. *Run Analysis Passes:* Run trait resolution, typechecking, region checking
2626
and other miscellaneous analysis passes on the crate
27-
4. *Translate to LLVM:* Translate to the in-memory form of LLVM IR and turn it
27+
4. *Translate to LLVM:* Translate to the in-memory form of LLVM IR and turn it
2828
into an executable/object files
2929

30-
The `CompileController` then gives users the ability to inspect the ongoing
30+
The `CompileController` then gives users the ability to inspect the ongoing
3131
compilation process
3232

3333
- after parsing
@@ -39,31 +39,31 @@ compilation process
3939
The `CompileState`'s various `state_after_*()` constructors can be inspected to
4040
determine what bits of information are available to which callback.
4141

42-
For a more detailed explanation on using `rustc_driver`, check out the
42+
For a more detailed explanation on using `rustc_driver`, check out the
4343
[stupid-stats] guide by `@nrc` (attached as [Appendix A]).
4444

4545
> **Warning:** By its very nature, the internal compiler APIs are always going
4646
> to be unstable. That said, we do try not to break things unnecessarily.
4747
4848
## A Note On Lifetimes
4949

50-
The Rust compiler is a fairly large program containing lots of big data
50+
The Rust compiler is a fairly large program containing lots of big data
5151
structures (e.g. the AST, HIR, and the type system) and as such, arenas and
52-
references are heavily relied upon to minimize unnecessary memory use. This
52+
references are heavily relied upon to minimize unnecessary memory use. This
5353
manifests itself in the way people can plug into the compiler, preferring a
5454
"push"-style API (callbacks) instead of the more Rust-ic "pull" style (think
5555
the `Iterator` trait).
5656

57-
For example the [`CompileState`], the state passed to callbacks after each
57+
For example the [`CompileState`], the state passed to callbacks after each
5858
phase, is essentially just a box of optional references to pieces inside the
5959
compiler. The lifetime bound on the `CompilerCalls` trait then helps to ensure
60-
compiler internals don't "escape" the compiler (e.g. if you tried to keep a
60+
compiler internals don't "escape" the compiler (e.g. if you tried to keep a
6161
reference to the AST after the compiler is finished), while still letting users
6262
record *some* state for use after the `run_compiler()` function finishes.
6363

6464
Thread-local storage and interning are used a lot through the compiler to reduce
65-
duplication while also preventing a lot of the ergonomic issues due to many
66-
pervasive lifetimes. The `rustc::ty::tls` module is used to access these
65+
duplication while also preventing a lot of the ergonomic issues due to many
66+
pervasive lifetimes. The `rustc::ty::tls` module is used to access these
6767
thread-locals, although you should rarely need to touch it.
6868

6969

@@ -73,4 +73,4 @@ thread-locals, although you should rarely need to touch it.
7373
[`TyCtxt`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc/ty/struct.TyCtxt.html
7474
[`CodeMap`]: https://doc.rust-lang.org/nightly/nightly-rustc/syntax/codemap/struct.CodeMap.html
7575
[stupid-stats]: https://github.com/nrc/stupid-stats
76-
[Appendix A]: appendix-stupid-stats.html
76+
[Appendix A]: appendix/stupid-stats.html

src/traits/caching.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ On the other hand, if there is no hit, we need to go through the [selection
2424
process] from scratch. Suppose, we come to the conclusion that the only
2525
possible impl is this one, with def-id 22:
2626

27-
[selection process]: ./trait-resolution.html#selection
27+
[selection process]: ./traits/resolution.html#selection
2828

2929
```rust,ignore
3030
impl Foo<isize> for usize { ... } // Impl #22
@@ -34,7 +34,7 @@ We would then record in the cache `usize : Foo<$0> => ImplCandidate(22)`. Next
3434
we would [confirm] `ImplCandidate(22)`, which would (as a side-effect) unify
3535
`$t` with `isize`.
3636

37-
[confirm]: ./trait-resolution.html#confirmation
37+
[confirm]: ./traits/resolution.html#confirmation
3838

3939
Now, at some later time, we might come along and see a `usize :
4040
Foo<$u>`. When skolemized, this would yield `usize : Foo<$0>`, just as

src/traits/canonical-queries.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ would like to know the answer to -- and in the
77
checker or other parts of the system, may in the course of doing their
88
thing want to know whether some trait is implemented for some type
99
(e.g., is `u32: Debug` true?). Or they may want to
10-
[normalize some associated type](./traits-associated-types.html).
10+
[normalize some associated type](./traits/associated-types.html).
1111

1212
This section covers queries at a fairly high level of abstraction. The
1313
subsections look a bit more closely at how these ideas are implemented
@@ -106,7 +106,7 @@ value for a type variable, that means that this is the **only possible
106106
instantiation** that you could use, given the current set of impls and
107107
where-clauses, that would be provable. (Internally within the solver,
108108
though, they can potentially enumerate all possible answers. See
109-
[the description of the SLG solver](./traits-slg.html) for details.)
109+
[the description of the SLG solver](./traits/slg.html) for details.)
110110

111111
The response to a trait query in rustc is typically a
112112
`Result<QueryResult<T>, NoSolution>` (where the `T` will vary a bit
@@ -132,7 +132,7 @@ we did find. It consists of four parts:
132132
- **Region constraints:** these are relations that must hold between
133133
the lifetimes that you supplied as inputs. We'll ignore these here,
134134
but see the
135-
[section on handling regions in traits](./traits-regions.html) for
135+
[section on handling regions in traits](./traits/regions.html) for
136136
more details.
137137
- **Value:** The query result also comes with a value of type `T`. For
138138
some specialized queries -- like normalizing associated types --

src/traits/canonicalization.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ starting from zero and numbered in a fixed order (left to right, for
1616
the most part, but really it doesn't matter as long as it is
1717
consistent).
1818

19-
[cq]: ./traits-canonical-queries.html
19+
[cq]: ./traits/canonical-queries.html
2020

2121
So, for example, if we have the type `X = (?T, ?U)`, where `?T` and
2222
`?U` are distinct, unbound inference variables, then the canonical
@@ -98,12 +98,12 @@ Remember that substitution S though! We're going to need it later.
9898

9999
OK, now that we have a fresh inference context and an instantiated
100100
query, we can go ahead and try to solve it. The trait solver itself is
101-
explained in more detail in [another section](./traits-slg.html), but
101+
explained in more detail in [another section](./traits/slg.html), but
102102
suffice to say that it will compute a [certainty value][cqqr] (`Proven` or
103103
`Ambiguous`) and have side-effects on the inference variables we've
104104
created. For example, if there were only one impl of `Foo`, like so:
105105

106-
[cqqr]: ./traits-canonical-queries.html#query-response
106+
[cqqr]: ./traits/canonical-queries.html#query-response
107107

108108
```rust,ignore
109109
impl<'a, X> Foo<'a, X> for Vec<X>

src/traits/goals-and-clauses.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
In logic programming terms, a **goal** is something that you must
44
prove and a **clause** is something that you know is true. As
5-
described in the [lowering to logic](./traits-lowering-to-logic.html)
5+
described in the [lowering to logic](./traits/lowering-to-logic.html)
66
chapter, Rust's trait solver is based on an extension of hereditary
77
harrop (HH) clauses, which extend traditional Prolog Horn clauses with
88
a few new superpowers.
@@ -37,7 +37,7 @@ paper
3737
["A Proof Procedure for the Logic of Hereditary Harrop Formulas"][pphhf]
3838
gives the details.
3939

40-
[pphhf]: ./traits-bibliography.html#pphhf
40+
[pphhf]: ./traits/bibliography.html#pphhf
4141

4242
<a name="domain-goals"></a>
4343

@@ -94,19 +94,20 @@ e.g. `ProjectionEq<T as Iterator>::Item = u8`
9494

9595
The given associated type `Projection` is equal to `Type`; this can be proved
9696
with either normalization or using skolemized types. See [the section
97-
on associated types](./traits-associated-types.html).
97+
on associated types](./traits/associated-types.html).
9898

9999
#### Normalize(Projection -> Type)
100100
e.g. `ProjectionEq<T as Iterator>::Item -> u8`
101101

102102
The given associated type `Projection` can be [normalized][n] to `Type`.
103103

104104
As discussed in [the section on associated
105-
types](./traits-associated-types.html), `Normalize` implies `ProjectionEq`,
105+
types](./traits/associated-types.html), `Normalize` implies `ProjectionEq`,
106106
but not vice versa. In general, proving `Normalize(<T as Trait>::Item -> U)`
107107
also requires proving `Implemented(T: Trait)`.
108108

109-
[n]: ./traits-associated-types.html#normalize
109+
[n]: ./traits/associated-types.html#normalize
110+
[at]: ./traits/associated-types.html
110111

111112
#### FromEnv(TraitRef), FromEnv(Projection = Type)
112113
e.g. `FromEnv(Self: Add<i32>)`
@@ -211,7 +212,7 @@ In addition to auto traits, `WellFormed` predicates are co-inductive.
211212
These are used to achieve a similar "enumerate all the cases" pattern,
212213
as described in the section on [implied bounds].
213214

214-
[implied bounds]: ./traits-lowering-rules.html#implied-bounds
215+
[implied bounds]: ./traits/lowering-rules.html#implied-bounds
215216

216217
## Incomplete chapter
217218

src/traits/index.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,20 @@ instructions for getting involved in the
1313

1414
Trait solving is based around a few key ideas:
1515

16-
- [Lowering to logic](./traits-lowering-to-logic.html), which expresses
16+
- [Lowering to logic](./traits/lowering-to-logic.html), which expresses
1717
Rust traits in terms of standard logical terms.
18-
- The [goals and clauses](./traits-goals-and-clauses.html) chapter
18+
- The [goals and clauses](./traits/goals-and-clauses.html) chapter
1919
describes the precise form of rules we use, and
20-
[lowering rules](./traits-lowering-rules.html) gives the complete set of
20+
[lowering rules](./traits/lowering-rules.html) gives the complete set of
2121
lowering rules in a more reference-like form.
22-
- [Canonical queries](./traits-canonical-queries.html), which allow us
22+
- [Canonical queries](./traits/canonical-queries.html), which allow us
2323
to solve trait problems (like "is `Foo` implemented for the type
2424
`Bar`?") once, and then apply that same result independently in many
2525
different inference contexts.
26-
- [Lazy normalization](./traits-associated-types.html), which is the
26+
- [Lazy normalization](./traits/associated-types.html), which is the
2727
technique we use to accommodate associated types when figuring out
2828
whether types are equal.
29-
- [Region constraints](./traits-regions.html), which are accumulated
29+
- [Region constraints](./traits/regions.html), which are accumulated
3030
during trait solving but mostly ignored. This means that trait
3131
solving effectively ignores the precise regions involved, always --
3232
but we still remember the constraints on them so that those

src/traits/lowering-module.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# The lowering module in rustc
22

33
The program clauses described in the
4-
[lowering rules](./traits-lowering-rules.html) section are actually
4+
[lowering rules](./traits/lowering-rules.html) section are actually
55
created in the [`rustc_traits::lowering`][lowering] module.
66

77
[lowering]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_traits/lowering/

src/traits/lowering-rules.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ This section gives the complete lowering rules for Rust traits into
44
[program clauses][pc]. It is a kind of reference. These rules
55
reference the [domain goals][dg] defined in an earlier section.
66

7-
[pc]: ./traits-goals-and-clauses.html
8-
[dg]: ./traits-goals-and-clauses.html#domain-goals
7+
[pc]: ./traits/goals-and-clauses.html
8+
[dg]: ./traits/goals-and-clauses.html#domain-goals
99

1010
## Notation
1111

@@ -16,7 +16,7 @@ The nonterminal `Ai` is used to mean some generic *argument*, which
1616
might be a lifetime like `'a` or a type like `Vec<A>`.
1717

1818
When defining the lowering rules, we will give goals and clauses in
19-
the [notation given in this section](./traits-goals-and-clauses.html).
19+
the [notation given in this section](./traits/goals-and-clauses.html).
2020
We sometimes insert "macros" like `LowerWhereClause!` into these
2121
definitions; these macros reference other sections within this chapter.
2222

@@ -141,7 +141,7 @@ This `WellFormed` rule states that `T: Trait` is well-formed if (a)
141141
`T: Trait` is implemented and (b) all the where-clauses declared on
142142
`Trait` are well-formed (and hence they are implemented). Remember
143143
that the `WellFormed` predicate is
144-
[coinductive](./traits-goals-and-clauses.html#coinductive); in this
144+
[coinductive](./traits/goals-and-clauses.html#coinductive); in this
145145
case, it is serving as a kind of "carrier" that allows us to enumerate
146146
all the where clauses that are transitively implied by `T: Trait`.
147147

@@ -192,7 +192,7 @@ where WC
192192

193193
We will produce a number of program clauses. The first two define
194194
the rules by which `ProjectionEq` can succeed; these two clauses are discussed
195-
in detail in the [section on associated types](./traits-associated-types.html),
195+
in detail in the [section on associated types](./traits/associated-types.html),
196196
but reproduced here for reference:
197197

198198
```text

src/traits/lowering-to-logic.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ example Gopalan Nadathur's excellent
170170
["A Proof Procedure for the Logic of Hereditary Harrop Formulas"][pphhf]
171171
in [the bibliography].
172172

173-
[the bibliography]: ./traits-bibliography.html
174-
[pphhf]: ./traits-bibliography.html#pphhf
173+
[the bibliography]: ./traits/bibliography.html
174+
[pphhf]: ./traits/bibliography.html#pphhf
175175

176176
It turns out that supporting FOHH is not really all that hard. And
177177
once we are able to do that, we can easily describe the type-checking

src/traits/resolution.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ some non-obvious things.
66
**Note:** This chapter (and its subchapters) describe how the trait
77
solver **currently** works. However, we are in the process of
88
designing a new trait solver. If you'd prefer to read about *that*,
9-
see [*this* traits chapter](./traits.html).
9+
see [*this* traits chapter](./traits/index.html).
1010

1111
## Major concepts
1212

src/type-inference.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ actual return type is not `()`, but rather `InferOk<()>`. The
125125
to ensure that these are fulfilled (typically by enrolling them in a
126126
fulfillment context). See the [trait chapter] for more background on that.
127127

128-
[trait chapter]: trait-resolution.html
128+
[trait chapter]: traits/resolution.html
129129

130130
You can similarly enforce subtyping through `infcx.at(..).sub(..)`. The same
131131
basic concepts as above apply.

0 commit comments

Comments
 (0)