Skip to content

Commit c3ac40d

Browse files
spastorinoJohnTitorcamelid
authored
We use HIR to do type inference, trait solving and type checking (#1139)
* We use HIR to do type inference, trait solving and type checking * Update src/overview.md Co-authored-by: Yuki Okushi <[email protected]> * Update src/overview.md Co-authored-by: Yuki Okushi <[email protected]> * Update src/overview.md Co-authored-by: Noah Lev <[email protected]> * Fix type checking brief explanation Co-authored-by: Yuki Okushi <[email protected]> Co-authored-by: Noah Lev <[email protected]>
1 parent 6e4f0cb commit c3ac40d

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/overview.md

+10-4
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,14 @@ we'll talk about that later.
6868
- We then take the AST and [convert it to High-Level Intermediate
6969
Representation (HIR)][hir]. This is a compiler-friendly representation of the
7070
AST. This involves a lot of desugaring of things like loops and `async fn`.
71-
- We use the HIR to do [type inference]. This is the process of automatic
72-
detection of the type of an expression.
73-
- **TODO: Maybe some other things are done here? I think initial type checking
74-
happens here? And trait solving?**
71+
- We use the HIR to do [type inference] (the process of automatic
72+
detection of the type of an expression), [trait solving] (the process
73+
of pairing up an impl with each reference to a trait), and [type
74+
checking] (the process of converting the types found in the HIR
75+
(`hir::Ty`), which represent the syntactic things that the user wrote,
76+
into the internal representation used by the compiler (`Ty<'tcx>`),
77+
and using that information to verify the type safety, correctness and
78+
coherence of the types used in the program).
7579
- The HIR is then [lowered to Mid-Level Intermediate Representation (MIR)][mir].
7680
- Along the way, we construct the THIR, which is an even more desugared HIR.
7781
THIR is used for pattern and exhaustiveness checking. It is also more
@@ -111,6 +115,8 @@ we'll talk about that later.
111115
[parser]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_parse/index.html
112116
[hir]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/index.html
113117
[type inference]: https://rustc-dev-guide.rust-lang.org/type-inference.html
118+
[trait solving]: https://rustc-dev-guide.rust-lang.org/traits/resolution.html
119+
[type checking]: https://rustc-dev-guide.rust-lang.org/type-checking.html
114120
[mir]: https://rustc-dev-guide.rust-lang.org/mir/index.html
115121
[borrow checking]: https://rustc-dev-guide.rust-lang.org/borrow_check.html
116122
[mir-opt]: https://rustc-dev-guide.rust-lang.org/mir/optimizations.html

0 commit comments

Comments
 (0)