Skip to content

Commit

Permalink
Highlight the nightly version needed to compile the examples
Browse files Browse the repository at this point in the history
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
  • Loading branch information
JohnTitor committed Feb 4, 2023
1 parent 5c65222 commit 00643c7
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 6 deletions.
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
5 changes: 3 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,9 @@
## 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

0 comments on commit 00643c7

Please sign in to comment.