File tree 1 file changed +6
-2
lines changed
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 1
1
# Example: Type checking through ` rustc_interface `
2
2
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.
4
4
5
5
## Getting the type of an expression
6
6
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 ` ] .
8
8
The following was tested with <!-- date-check: jan 2024 --> ` nightly-2024-01-19 ` :
9
9
10
10
``` rust
11
11
{{#include .. / examples / rustc - driver - interacting - with - the - ast . rs}}
12
12
```
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
You can’t perform that action at this time.
0 commit comments