Skip to content

Commit 5d9c4d8

Browse files
Tbkhitshepang
andauthored
update rustc-driver-interacting-with-the-ast.md (rust-lang#1930)
* adding links * Update src/rustc-driver-interacting-with-the-ast.md Co-authored-by: Tshepang Mbambo <tshepang@gmail.com> * redo links and formatting * Update rustc-driver-interacting-with-the-ast.md --------- Co-authored-by: Tshepang Mbambo <tshepang@gmail.com>
1 parent 10809fe commit 5d9c4d8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
# Example: Type checking through `rustc_interface`
22

3-
`rustc_interface` allows you to interact with Rust code at various stages of compilation.
3+
The [`rustc_interface`] allows you to interact with Rust code at various stages of compilation.
44

55
## Getting the type of an expression
66

7-
To get the type of an expression, use the `global_ctxt` to get a `TyCtxt`.
7+
To get the type of an expression, use the [`global_ctxt`] query to [get] a [`TyCtxt`].
88
The following was tested with <!-- date-check: jan 2024 --> `nightly-2024-01-19`:
99

1010
```rust
1111
{{#include ../examples/rustc-driver-interacting-with-the-ast.rs}}
1212
```
13+
[get]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.GlobalCtxt.html#method.enter
14+
[`global_ctxt`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_interface/queries/struct.Queries.html#method.global_ctxt
15+
[`rustc_interface`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_interface
16+
[`TyCtxt`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html

0 commit comments

Comments
 (0)