blob: 3c2102a50b4a4bfc8c2da509c24ff06b903718fb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
# Example: Getting diagnostic through `rustc_interface`
`rustc_interface` allows you to intercept diagnostics that would otherwise be printed to stderr.
## Getting diagnostics
To get diagnostics from the compiler,
configure `rustc_interface::Config` to output diagnostic to a buffer,
and run `TyCtxt.analysis`. The following was tested
with <!-- date-check: Feb 2023 --> `nightly-2023-02-13`:
```rust
{{#include ../examples/rustc-driver-getting-diagnostics.rs}}
```
|