Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix examples for rustc 1.68.0-nightly (935dc0721 2022-12-19) (#1556) #1557

Merged
merged 4 commits into from
Jan 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions examples/rustc-driver-example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// NOTE: For the example to compile, you will need to first run the following:
// rustup component add rustc-dev llvm-tools-preview

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

extern crate rustc_error_codes;
extern crate rustc_errors;
Expand Down Expand Up @@ -50,7 +50,6 @@ fn main() {
output_dir: None, // Option<PathBuf>
output_file: None, // Option<PathBuf>
file_loader: None, // Option<Box<dyn FileLoader + Send + Sync>>
diagnostic_output: rustc_session::DiagnosticOutput::Default,
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>>
Expand Down
6 changes: 1 addition & 5 deletions examples/rustc-driver-getting-diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// NOTE: For the example to compile, you will need to first run the following:
// rustup component add rustc-dev llvm-tools-preview

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

extern crate rustc_error_codes;
extern crate rustc_errors;
Expand Down Expand Up @@ -65,10 +65,6 @@ fn main() {
"
.into(),
},
// Redirect the diagnostic output of the compiler to a buffer.
diagnostic_output: rustc_session::DiagnosticOutput::Raw(Box::from(DiagnosticSink(
buffer.clone(),
))),
crate_cfg: rustc_hash::FxHashSet::default(),
crate_check_cfg: CheckCfg::default(),
input_path: None,
Expand Down
3 changes: 1 addition & 2 deletions examples/rustc-driver-interacting-with-the-ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// NOTE: For the example to compile, you will need to first run the following:
// rustup component add rustc-dev llvm-tools-preview

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

extern crate rustc_ast_pretty;
extern crate rustc_error_codes;
Expand Down Expand Up @@ -43,7 +43,6 @@ fn main() {
"#
.to_string(),
},
diagnostic_output: rustc_session::DiagnosticOutput::Default,
crate_cfg: rustc_hash::FxHashSet::default(),
crate_check_cfg: CheckCfg::default(),
input_path: None,
Expand Down
8 changes: 2 additions & 6 deletions src/rustc-driver-getting-diagnostics.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: June 2022 --> `nightly-2022-06-05` (See [here][example]
with <!-- date-check: Jan 2023 --> `nightly-2022-12-19` (See [here][example]
for the complete example):

[example]: https://github.com/rust-lang/rustc-dev-guide/blob/master/examples/rustc-driver-getting-diagnostics.rs
Expand All @@ -24,11 +24,7 @@ let config = rustc_interface::Config {
),
},
/* other config */
},
// Redirect the diagnostic output of the compiler to a buffer.
diagnostic_output: rustc_session::DiagnosticOutput::Raw(Box::from(DiagnosticSink(
buffer.clone(),
))),
},
/* other config */
};
rustc_interface::run_compiler(config, |compiler| {
Expand Down
2 changes: 1 addition & 1 deletion src/rustc-driver-interacting-with-the-ast.md
Original file line number Diff line number Diff line change
Expand Up @@ -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: June 2022 --> `nightly-2022-06-05`
The following was tested with <!-- date-check: Jan 2023 --> `nightly-2022-12-19`
(see [here][example] for the complete example):

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