diff --git a/src/rustc-driver-interacting-with-the-ast.md b/src/rustc-driver-interacting-with-the-ast.md index 1339fdce8a88b..5de22d8b014f1 100644 --- a/src/rustc-driver-interacting-with-the-ast.md +++ b/src/rustc-driver-interacting-with-the-ast.md @@ -1,12 +1,16 @@ # Example: Type checking through `rustc_interface` -`rustc_interface` allows you to interact with Rust code at various stages of compilation. +The [`rustc_interface`] allows you to interact with Rust code at various stages of compilation. ## Getting the type of an expression -To get the type of an expression, use the `global_ctxt` 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 `nightly-2024-01-19`: ```rust {{#include ../examples/rustc-driver-interacting-with-the-ast.rs}} ``` +[get]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.GlobalCtxt.html#method.enter +[`global_ctxt`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_interface/queries/struct.Queries.html#method.global_ctxt +[`rustc_interface`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_interface +[`TyCtxt`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/context/struct.TyCtxt.html