Skip to content

Commit 3eb02eb

Browse files
committed
minor edits
1 parent 226a2d4 commit 3eb02eb

File tree

2 files changed

+19
-20
lines changed

2 files changed

+19
-20
lines changed

src/rustc-driver/getting-diagnostics.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ otherwise be printed to stderr.
77

88
To get diagnostics from the compiler,
99
configure [`rustc_interface::Config`] to output diagnostic to a buffer,
10-
and run [`TyCtxt.analysis`]. The following was tested
11-
with <!-- date-check: jan 2024 --> `nightly-2024-01-19`:
10+
and run [`TyCtxt.analysis`].
11+
The following was tested with <!-- date-check: jan 2024 --> `nightly-2024-01-19`:
1212

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

1717
[`rustc_interface`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_interface/index.html
1818
[`rustc_interface::Config`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_interface/interface/struct.Config.html
19-
[`TyCtxt.analysis`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_interface/passes/fn.analysis.html
19+
[`TyCtxt.analysis`]: https://doc.rust-lang.org/nightly/nightly-rustc/rustc_interface/passes/fn.analysis.html

src/rustc-driver/intro.md

+16-17
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# `rustc_driver` and `rustc_interface`
22

3-
The [`rustc_driver`] is essentially `rustc`'s `main` function. It acts as
4-
the glue for running the various phases of the compiler in the correct order,
3+
The [`rustc_driver`] is essentially `rustc`'s `main` function.
4+
It acts as the glue for running the various phases of the compiler in the correct order,
55
using the interface defined in the [`rustc_interface`] crate.
66

77
Generally the [`rustc_interface`] crate provides external users with an (unstable) API
@@ -11,26 +11,25 @@ analyzing a crate or for ad hoc emulating of the compiler (i.e. `rustdoc`
1111
compiling code and serving output).
1212

1313
More specifically the [`rustc_interface::run_compiler`][i_rc] function is the
14-
main entrypoint for using [`nightly-rustc`] as a library. Initially
15-
[`run_compiler`][i_rc] takes a configuration variable for the compiler and a
16-
`closure` taking a yet unresolved [`Compiler`]. Operationally
17-
[`run_compiler`][i_rc] creates a `Compiler` from the configuration and passes
14+
main entrypoint for using [`nightly-rustc`] as a library.
15+
Initially [`run_compiler`][i_rc] takes a configuration variable for the compiler
16+
and a `closure` taking a yet unresolved [`Compiler`].
17+
Operationally [`run_compiler`][i_rc] creates a `Compiler` from the configuration and passes
1818
it to the `closure`. Inside the `closure` you can use the `Compiler` to drive
19-
queries to compile a crate and get the results. Providing results about the
20-
internal state of the compiler what the [`rustc_driver`] does too. You can see
21-
a minimal example of how to use [`rustc_interface`] [here][example].
19+
queries to compile a crate and get the results.
20+
Providing results about the internal state of the compiler what the [`rustc_driver`] does too.
21+
You can see a minimal example of how to use [`rustc_interface`] [here][example].
2222

2323
You can see what queries are currently available in the [`Compiler`] rustdocs.
24-
You can see an example of how to use the queries by looking at the
25-
`rustc_driver` implementation, specifically
26-
[`rustc_driver::run_compiler`][rd_rc] (not to be confused with
27-
[`rustc_interface::run_compiler`][i_rc]). Generally
28-
[`rustc_driver::run_compiler`][i_rc] takes a bunch of command-line args and
29-
some other configurations and drives the compilation to completion.
24+
You can see an example of how to use the queries by looking at the `rustc_driver` implementation,
25+
specifically [`rustc_driver::run_compiler`][rd_rc]
26+
(not to be confused with [`rustc_interface::run_compiler`][i_rc]).
27+
Generally [`rustc_driver::run_compiler`][i_rc] takes a bunch of command-line args
28+
and some other configurations and drives the compilation to completion.
3029

3130
Finally [`rustc_driver::run_compiler`][rd_rc] also takes a [`Callbacks`][cb],
32-
which is a `trait` that allows for custom compiler configuration, as well as
33-
allowing custom code to run after different phases of the compilation.
31+
which is a `trait` that allows for custom compiler configuration,
32+
as well as allowing custom code to run after different phases of the compilation.
3433

3534
> **Warning:** By its very nature, the internal compiler APIs are always going
3635
> to be unstable. That said, we do try not to break things unnecessarily.

0 commit comments

Comments
 (0)