Skip to content

Commit 1ac1635

Browse files
committed
reorganized directory
1 parent da9e815 commit 1ac1635

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed
Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
# Example: Getting diagnostic through `rustc_interface`
22

3-
`rustc_interface` allows you to intercept diagnostics that would otherwise be printed to stderr.
3+
The [`rustc_interface`] allows you to intercept diagnostics that would
4+
otherwise be printed to stderr.
45

56
## Getting diagnostics
67

78
To get diagnostics from the compiler,
8-
configure `rustc_interface::Config` to output diagnostic to a buffer,
9-
and run `TyCtxt.analysis`. The following was tested
9+
configure [`rustc_interface::Config`] to output diagnostic to a buffer,
10+
and run [`TyCtxt.analysis`]. The following was tested
1011
with <!-- date-check: jan 2024 --> `nightly-2024-01-19`:
1112

1213
```rust
1314
{{#include ../examples/rustc-driver-getting-diagnostics.rs}}
1415
```
16+
17+
[`rustc_interface`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_interface/index.html
18+
[`rustc_interface::Config`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_interface/interface/struct.Config.html
19+
[`TyCtxt.analysis`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_interface/passes/fn.analysis.html
Lines changed: 6 additions & 2 deletions
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)