Skip to content

Commit 7352353

Browse files
authored
fix examples for rustc 1.68.0-nightly (935dc0721 2022-12-19) (#1556) (#1557)
Co-authored-by: Yuki Okushi <jtitor@2k36.org> Closes #1556
1 parent de053e2 commit 7352353

5 files changed

+6
-16
lines changed

examples/rustc-driver-example.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// NOTE: For the example to compile, you will need to first run the following:
44
// rustup component add rustc-dev llvm-tools-preview
55

6-
// version: 1.62.0-nightly (7c4b47696 2022-04-30)
6+
// version: rustc 1.68.0-nightly (935dc0721 2022-12-19)
77

88
extern crate rustc_error_codes;
99
extern crate rustc_errors;
@@ -50,7 +50,6 @@ fn main() {
5050
output_dir: None, // Option<PathBuf>
5151
output_file: None, // Option<PathBuf>
5252
file_loader: None, // Option<Box<dyn FileLoader + Send + Sync>>
53-
diagnostic_output: rustc_session::DiagnosticOutput::Default,
5453
lint_caps: FxHashMap::default(), // FxHashMap<lint::LintId, lint::Level>
5554
// This is a callback from the driver that is called when [`ParseSess`] is created.
5655
parse_sess_created: None, //Option<Box<dyn FnOnce(&mut ParseSess) + Send>>

examples/rustc-driver-getting-diagnostics.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// NOTE: For the example to compile, you will need to first run the following:
44
// rustup component add rustc-dev llvm-tools-preview
55

6-
// version: 1.62.0-nightly (7c4b47696 2022-04-30)
6+
// version: rustc 1.68.0-nightly (935dc0721 2022-12-19)
77

88
extern crate rustc_error_codes;
99
extern crate rustc_errors;
@@ -65,10 +65,6 @@ fn main() {
6565
"
6666
.into(),
6767
},
68-
// Redirect the diagnostic output of the compiler to a buffer.
69-
diagnostic_output: rustc_session::DiagnosticOutput::Raw(Box::from(DiagnosticSink(
70-
buffer.clone(),
71-
))),
7268
crate_cfg: rustc_hash::FxHashSet::default(),
7369
crate_check_cfg: CheckCfg::default(),
7470
input_path: None,

examples/rustc-driver-interacting-with-the-ast.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// NOTE: For the example to compile, you will need to first run the following:
44
// rustup component add rustc-dev llvm-tools-preview
55

6-
// version: 1.62.0-nightly (7c4b47696 2022-04-30)
6+
// version: rustc 1.68.0-nightly (935dc0721 2022-12-19)
77

88
extern crate rustc_ast_pretty;
99
extern crate rustc_error_codes;
@@ -43,7 +43,6 @@ fn main() {
4343
"#
4444
.to_string(),
4545
},
46-
diagnostic_output: rustc_session::DiagnosticOutput::Default,
4746
crate_cfg: rustc_hash::FxHashSet::default(),
4847
crate_check_cfg: CheckCfg::default(),
4948
input_path: None,

src/rustc-driver-getting-diagnostics.md

+2-6
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: June 2022 --> `nightly-2022-06-05` (See [here][example]
10+
with <!-- date-check: Jan 2023 --> `nightly-2022-12-19` (See [here][example]
1111
for the complete example):
1212

1313
[example]: https://github.com/rust-lang/rustc-dev-guide/blob/master/examples/rustc-driver-getting-diagnostics.rs
@@ -24,11 +24,7 @@ let config = rustc_interface::Config {
2424
),
2525
},
2626
/* other config */
27-
},
28-
// Redirect the diagnostic output of the compiler to a buffer.
29-
diagnostic_output: rustc_session::DiagnosticOutput::Raw(Box::from(DiagnosticSink(
30-
buffer.clone(),
31-
))),
27+
},
3228
/* other config */
3329
};
3430
rustc_interface::run_compiler(config, |compiler| {

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: June 2022 --> `nightly-2022-06-05`
8+
The following was tested with <!-- date-check: Jan 2023 --> `nightly-2022-12-19`
99
(see [here][example] for the complete example):
1010

1111
[example]: https://github.com/rust-lang/rustc-dev-guide/blob/master/examples/rustc-driver-interacting-with-the-ast.rs

0 commit comments

Comments
 (0)