Commit Graph

24 Commits

Author SHA1 Message Date
Tshepang Mbambo 550dc9b31b update rustc-{driver,interface} examples 2025-03-29 23:52:57 +02:00
Yang Lin 971366b58b Adapt to rust-lang/rust#136466:
Start removing `rustc_middle::hir::map::Map`

Following commit f86f7ad from pull request #136466
in the Rust project
(https://github.com/rust-lang/rust),
some methods in `Map` were moved to `TyCtxt`.
This update reimplements `rustc-drive-example.rs`,
`rustc-driver-interacting-with-the-ast.rs`,
and `rustc-interface-example.rs` using the new
versions of these methods, ensuring compatibility
with the nightly-2025-03-08 toolchain.
2025-03-16 23:27:10 +08:00
Florian Brucker 1979d85189 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
Askar Safin 9f683c9070 tree-wide: parallel: Fully removed all `Lrc`, replaced with `Arc` 2025-02-03 13:25:57 +03:00
Mohammad Omidvar 936683c1c9 Make crate AST mutation accessible for driver callback 2025-01-28 19:45:20 +00:00
bjorn3 76f7584f6a Remove RunCompiler
It has become nothing other than a wrapper around run_compiler.
2025-01-23 09:38:58 +00:00
bjorn3 851d9a5b20 Remove set_make_codegen_backend and set_file_loader
They can both be set inside the config callback too.
2025-01-23 09:38:58 +00:00
bjorn3 e70f551db6 Rework the driver docs (#2162) 2024-12-27 20:40:32 +08:00
Matthew Woodcraft 0bfce7989f Update the rustc_interface examples for current rustc (#1974) 2024-05-11 00:06:30 +01:00
Shoyu Vanilla a51498f7ed Update examples (#1856)
Co-authored-by: Yuki Okushi <jtitor@2k36.org>
2024-01-21 22:26:41 +09:00
Timo 1b826bea1d update rustc_driver examples (#1803) 2023-10-05 19:19:12 +09:00
Tshepang Mbambo 7cb957b26f update rustc_driver examples (#1655) 2023-04-01 09:35:35 -04:00
Tshepang Mbambo c816f20abe howto run the examples (#1593) 2023-02-15 11:40:25 -03:00
Hiroki Fujino 342f72310d update examples for rustc 1.69.0-nightly (e1eaa2d5d 2023-02-06) (#1590)
Closes https://github.com/rust-lang/rustc-dev-guide/issues/1581
2023-02-09 18:56:06 +09:00
gftea c58e6d14df fix examples for rustc 1.68.0-nightly (935dc0721 2022-12-19) (#1556) (#1557)
Co-authored-by: Yuki Okushi <jtitor@2k36.org>
Closes https://github.com/rust-lang/rustc-dev-guide/issues/1556
2023-01-15 05:34:23 +09:00
Tshepang Mbambo 6445e007fe improve rustc_interface examples a little (#1362) 2022-06-07 08:42:07 +09:00
Yuki Okushi 388142f167 Update rustc-driver related examples 2022-05-30 13:57:16 +02:00
Ujjawal 211776c627 Update examples with 1.61.0-nightly (latest version) (#1330)
Co-authored-by: Ujjawal Kumar <u.kumar@ukumar-ltmit1s.internal.salesforce.com>
2022-04-11 22:48:30 +09:00
Simon Perriard 80eae9a303 make it compile with 1.56.0 2021-11-24 09:00:37 -05:00
Undxxx 64504ada90 Update rustc-driver-*.rs examples (#1095) 2021-03-28 19:15:09 +09:00
Takayuki Nakata f28f707be4 Fix examples not working 2020-08-03 08:50:58 -05:00
George Fraser 3a5328d4f7 Reference complete examples 2020-05-07 17:30:27 -05:00
George Fraser ea4db5371c run_compiler is exported by rustc_interface 2020-03-22 14:33:47 -05:00
George Fraser 68905c231d Example of rustc interface (#621)
* Example of rustc interface (https://internals.rust-lang.org/t/using-the-rustc-interface-crate/11982)
2020-03-22 08:26:04 +09:00