Skip to content

Commit

Permalink
Update src/rustc-driver-interacting-with-the-ast.md
Browse files Browse the repository at this point in the history
Co-authored-by: Tshepang Mbambo <tshepang@gmail.com>
  • Loading branch information
Tbkhi and tshepang authored Mar 11, 2024
1 parent 65e8c5b commit db21369
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/rustc-driver-interacting-with-the-ast.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,10 @@ The [`rustc_interface`] allows you to interact with Rust code at various stages

## Getting the type of an expression

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

```rust
{{#include ../examples/rustc-driver-interacting-with-the-ast.rs}}
```
[`rustc_interface`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_interface/index.html
[`global_ctxt()`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_interface/queries/struct.Queries.html#method.global_ctxt
[get]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.GlobalCtxt.html#method.enter
[`TyCtxt`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html

0 comments on commit db21369

Please sign in to comment.