Skip to content

Commit ff80cde

Browse files
committed
Rollup merge of rust-lang#48971 - mark-i-m:fix_readmes, r=nikomatsakis
Move librustc_typeck READMEs to rustc guide cc rust-lang/rustc-dev-guide#2 and rust-lang#48478 Don't merge this before rust-lang/rustc-dev-guide#85 r? @nikomatsakis
2 parents c144fb7 + 5a073d4 commit ff80cde

File tree

6 files changed

+15
-438
lines changed

6 files changed

+15
-438
lines changed

src/librustc_typeck/README.md

+4-47
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,5 @@
1-
NB: This crate is part of the Rust compiler. For an overview of the
2-
compiler as a whole, see
3-
[the README.md file found in `librustc`](../librustc/README.md).
1+
For high-level intro to how type checking works in rustc, see the
2+
[type checking] chapter of the [rustc guide].
43

5-
The `rustc_typeck` crate contains the source for "type collection" and
6-
"type checking", as well as a few other bits of related functionality.
7-
(It draws heavily on the [type inferencing][infer] and
8-
[trait solving][traits] code found in librustc.)
9-
10-
[infer]: ../librustc/infer/README.md
11-
[traits]: ../librustc/traits/README.md
12-
13-
## Type collection
14-
15-
Type "collection" is the process of converting the types found in the
16-
HIR (`hir::Ty`), which represent the syntactic things that the user
17-
wrote, into the **internal representation** used by the compiler
18-
(`Ty<'tcx>`) -- we also do similar conversions for where-clauses and
19-
other bits of the function signature.
20-
21-
To try and get a sense for the difference, consider this function:
22-
23-
```rust
24-
struct Foo { }
25-
fn foo(x: Foo, y: self::Foo) { .. }
26-
// ^^^ ^^^^^^^^^
27-
```
28-
29-
Those two parameters `x` and `y` each have the same type: but they
30-
will have distinct `hir::Ty` nodes. Those nodes will have different
31-
spans, and of course they encode the path somewhat differently. But
32-
once they are "collected" into `Ty<'tcx>` nodes, they will be
33-
represented by the exact same internal type.
34-
35-
Collection is defined as a bundle of queries (e.g., `type_of`) for
36-
computing information about the various functions, traits, and other
37-
items in the crate being compiled. Note that each of these queries is
38-
concerned with *interprocedural* things -- for example, for a function
39-
definition, collection will figure out the type and signature of the
40-
function, but it will not visit the *body* of the function in any way,
41-
nor examine type annotations on local variables (that's the job of
42-
type *checking*).
43-
44-
For more details, see the `collect` module.
45-
46-
## Type checking
47-
48-
TODO
4+
[type checking]: https://rust-lang-nursery.github.io/rustc-guide/type-checking.html
5+
[rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/

src/librustc_typeck/check/method/README.md

-111
This file was deleted.

src/librustc_typeck/check/method/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//! Method lookup: the secret sauce of Rust. See `README.md`.
11+
//! Method lookup: the secret sauce of Rust. See the [rustc guide] chapter.
12+
//!
13+
//! [rustc guide]: https://rust-lang-nursery.github.io/rustc-guide/method-lookup.html
1214
1315
use check::FnCtxt;
1416
use hir::def::Def;

0 commit comments

Comments
 (0)