Skip to content
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

Fix compile errors of all the examples #2289

Merged
merged 2 commits into from
Mar 29, 2025

Conversation

y1lan
Copy link
Contributor

@y1lan y1lan commented Mar 16, 2025

examples/rustc-driver-example.rs, examples/rustc-driver-interacting-with-the-ast.rs and examples/rustc-interface-example.rs cannot be compiled with the latest nightly toolchain (even nightly-2025-02-13 currently), the reason is that some methods of Map were move to TyCtxt. I reimplement them by using new version of these methods.

examples/rustc-interface-getting-diagnostics.rs cannot output as expected due to ErrorGuaranteed was replaced by fatal errors. I reimplement it by calling typeck function directly.

y1lan added 2 commits March 16, 2025 23:27
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.
(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.
@jieyouxu jieyouxu added S-waiting-on-review Status: this PR is waiting for a reviewer to verify its content A-driver Area: rustc driver T-compiler Relevant to compiler team A-custom-driver Area: custom driver and removed A-driver Area: rustc driver labels Mar 17, 2025
@tshepang tshepang merged commit 01bbdec into rust-lang:master Mar 29, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-custom-driver Area: custom driver S-waiting-on-review Status: this PR is waiting for a reviewer to verify its content T-compiler Relevant to compiler team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants