Skip to content

Commit 7cb957b

Browse files
authored
update rustc_driver examples (rust-lang#1655)
1 parent 1a0aa93 commit 7cb957b

4 files changed

+7
-5
lines changed

examples/rustc-driver-example.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ fn main() {
4242
"#
4343
.into(),
4444
},
45-
output_dir: None, // Option<PathBuf>
46-
output_file: None, // Option<PathBuf>
47-
file_loader: None, // Option<Box<dyn FileLoader + Send + Sync>>
45+
output_dir: None, // Option<PathBuf>
46+
output_file: None, // Option<PathBuf>
47+
file_loader: None, // Option<Box<dyn FileLoader + Send + Sync>>
48+
locale_resources: rustc_driver::DEFAULT_LOCALE_RESOURCES,
4849
lint_caps: FxHashMap::default(), // FxHashMap<lint::LintId, lint::Level>
4950
// This is a callback from the driver that is called when [`ParseSess`] is created.
5051
parse_sess_created: None, //Option<Box<dyn FnOnce(&mut ParseSess) + Send>>

examples/rustc-driver-getting-diagnostics.rs

+1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ fn main() {
6666
output_dir: None,
6767
output_file: None,
6868
file_loader: None,
69+
locale_resources: rustc_driver::DEFAULT_LOCALE_RESOURCES,
6970
lint_caps: rustc_hash::FxHashMap::default(),
7071
parse_sess_created: None,
7172
register_lints: None,

src/rustc-driver-getting-diagnostics.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
To get diagnostics from the compiler,
88
configure `rustc_interface::Config` to output diagnostic to a buffer,
99
and run `TyCtxt.analysis`. The following was tested
10-
with <!-- date-check: Feb 2023 --> `nightly-2023-02-13`:
10+
with <!-- date-check: mar 2023 --> `nightly-2023-03-27`:
1111

1212
```rust
1313
{{#include ../examples/rustc-driver-getting-diagnostics.rs}}

src/rustc-driver-interacting-with-the-ast.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
## Getting the type of an expression
66

77
To get the type of an expression, use the `global_ctxt` to get a `TyCtxt`.
8-
The following was tested with <!-- date-check: Feb 2023 --> `nightly-2023-02-13`:
8+
The following was tested with <!-- date-check: mar 2023 --> `nightly-2023-03-27`:
99

1010
```rust
1111
{{#include ../examples/rustc-driver-interacting-with-the-ast.rs}}

0 commit comments

Comments
 (0)