Commit Graph

7 Commits

Author SHA1 Message Date
Nicholas Nethercote 3c5e7e8969 Simplify Config::track_state.
This is a callback used to track otherwise untracked state. It was added
in #116731 for Clippy. (It was originally named `hash_untracked_state`,
and examples in the rustc-dev-guide still use that name.) The
`StableHasher` argument is unused, and probably has never been used.
There is a FIXME comment pointing this out, which was added more than a
year ago.

This commit removes the `StableHasher` callback argument. This also
removes the need for `Options::untracked_state_hash`.
2026-04-23 15:02:55 +10:00
Jonathan Brouwer 875c5908c7 Update examples for diagnostics changes
Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>
2026-02-08 20:39:57 +01:00
Tshepang Mbambo 1faf7ff9a4 update rustc-{driver,interface} examples 2025-03-29 23:52:57 +02:00
Yang Lin 9a2d1fdb14 Following commit 401dd84 in the Rust project
(https://github.com/rust-lang/rust),
`ErrorGuaranteed` was replaced by fatal errors.
As a result, `tcx.analysis()` now aborts directly
instead of returning an error guard.
To accommodate this change, this update replaces
`tcx.analysis()` with `typeck()`
to perform type checking in the example.
2025-03-16 23:43:17 +08:00
Florian Brucker dce265224a Fix examples to work with nightly-2025-02-13
While there were comments indicating which nightly versions the examples
were tested with, those versions did not work for me: neither did the
examples compile, nor did they produce the expected output.

This commit fixes the compilation issues, using nightly-2025-02-13 for
all examples (previously the version differed between the examples) and,
in the case of the `rustc_driver` examples, also fixes the argument
passing: rustc ignores the first argument, so we need to pass the
filename as the second (otherwise we only get the help text printed).

Note that the `rustc-interface-getting-diagnostics.rs` example still
does not produce any output, which I assume is not how it is intended.
However, I don't know enough to fix it.

To avoid inconsistencies between the documented version and the actually
required version I've moved the version comment from the Markdown into
the Rust code where it hopefully won't be forgotten as easily.

Finally I've clarified in the examples' README that you also need to use
the proper nightly version when compiling the examples, not just when
running them.
2025-02-15 19:44:32 +01:00
bjorn3 6a566ee092 Replace ParseSess::set_dcx with DiagCtxt::set_emitter
Replacing the error emitter doesn't accidentally clear the error count.
2025-02-02 16:09:39 +00:00
bjorn3 1289e54d58 Rework the driver docs (#2162) 2024-12-27 20:40:32 +08:00