update rustc_driver examples (#1655)

This commit is contained in:
Tshepang Mbambo 2023-04-01 15:35:35 +02:00 committed by GitHub
parent 1a0aa9321a
commit 7cb957b26f
4 changed files with 7 additions and 5 deletions

View File

@ -42,9 +42,10 @@ fn main() {
"#
.into(),
},
output_dir: None, // Option<PathBuf>
output_file: None, // Option<PathBuf>
file_loader: None, // Option<Box<dyn FileLoader + Send + Sync>>
output_dir: None, // Option<PathBuf>
output_file: None, // Option<PathBuf>
file_loader: None, // Option<Box<dyn FileLoader + Send + Sync>>
locale_resources: rustc_driver::DEFAULT_LOCALE_RESOURCES,
lint_caps: FxHashMap::default(), // FxHashMap<lint::LintId, lint::Level>
// This is a callback from the driver that is called when [`ParseSess`] is created.
parse_sess_created: None, //Option<Box<dyn FnOnce(&mut ParseSess) + Send>>

View File

@ -66,6 +66,7 @@ fn main() {
output_dir: None,
output_file: None,
file_loader: None,
locale_resources: rustc_driver::DEFAULT_LOCALE_RESOURCES,
lint_caps: rustc_hash::FxHashMap::default(),
parse_sess_created: None,
register_lints: None,

View File

@ -7,7 +7,7 @@
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`:
with <!-- date-check: mar 2023 --> `nightly-2023-03-27`:
```rust
{{#include ../examples/rustc-driver-getting-diagnostics.rs}}

View File

@ -5,7 +5,7 @@
## Getting the type of an expression
To get the type of an expression, use the `global_ctxt` to get a `TyCtxt`.
The following was tested with <!-- date-check: Feb 2023 --> `nightly-2023-02-13`:
The following was tested with <!-- date-check: mar 2023 --> `nightly-2023-03-27`:
```rust
{{#include ../examples/rustc-driver-interacting-with-the-ast.rs}}