Skip to content

Highlight the nightly version needed to compile the examples #1582

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

Closed
wants to merge 1 commit into from
Closed
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
1 change: 1 addition & 0 deletions examples/rustc-driver-example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// NOTE: For the example to compile, you will need to first run the following:
// rustup component add rustc-dev llvm-tools-preview

// You need the below nightly version to compile:
// version: rustc 1.68.0-nightly (935dc0721 2022-12-19)

extern crate rustc_error_codes;
Expand Down
1 change: 1 addition & 0 deletions examples/rustc-driver-getting-diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// NOTE: For the example to compile, you will need to first run the following:
// rustup component add rustc-dev llvm-tools-preview

// You need the below nightly version to compile:
// version: rustc 1.68.0-nightly (935dc0721 2022-12-19)

extern crate rustc_error_codes;
Expand Down
1 change: 1 addition & 0 deletions examples/rustc-driver-interacting-with-the-ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// NOTE: For the example to compile, you will need to first run the following:
// rustup component add rustc-dev llvm-tools-preview

// You need the below nightly version to compile:
// version: rustc 1.68.0-nightly (935dc0721 2022-12-19)

extern crate rustc_ast_pretty;
Expand Down
10 changes: 6 additions & 4 deletions src/rustc-driver-getting-diagnostics.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@

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: Jan 2023 --> `nightly-2022-12-19` (See [here][example]
for the complete example):
and run `TyCtxt.analysis`.

> **Note**: We expect you to compile the 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,7 +26,7 @@ let config = rustc_interface::Config {
),
},
/* other config */
},
},
/* other config */
};
rustc_interface::run_compiler(config, |compiler| {
Expand Down
6 changes: 4 additions & 2 deletions src/rustc-driver-interacting-with-the-ast.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@
## 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: Jan 2023 --> `nightly-2022-12-19`
(see [here][example] for the complete example):

> **Note**: We expect you to compile the 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-interacting-with-the-ast.rs

Expand Down
3 changes: 3 additions & 0 deletions src/rustc-driver.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ configuration and passes it to the closure. Inside the closure, you can use the
to drive queries to compile a crate and get the results. This is what the `rustc_driver` does too.
You can see a minimal example of how to use `rustc_interface` [here][example].

> **Note**: As changes can be made to the rustc internal APIs at any time,
> we expect you to compile the example with <!-- date-check: Jan 2023 --> `nightly-2022-12-19`.

You can see what queries are currently available through the rustdocs for [`Compiler`].
You can see an example of how to use them by looking at the `rustc_driver` implementation,
specifically the [`rustc_driver::run_compiler` function][rd_rc] (not to be confused with
Expand Down