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

fail to compile the examples #1556

Closed
gftea opened this issue Jan 13, 2023 · 2 comments · Fixed by #1557
Closed

fail to compile the examples #1556

gftea opened this issue Jan 13, 2023 · 2 comments · Fixed by #1557

Comments

@gftea
Copy link
Contributor

gftea commented Jan 13, 2023

I tried to compile the examples below

rustup +nightly component add rust-src rustc-dev llvm-tools-preview
rustc +nightly rustc-driver-interacting-with-the-ast.rs 

I got below errors

error[E0433]: failed to resolve: could not find `DiagnosticOutput` in `rustc_session`
  --> rustc-driver-interacting-with-the-ast.rs:46:43
   |
46 |         diagnostic_output: rustc_session::DiagnosticOutput::Default,
   |                                           ^^^^^^^^^^^^^^^^ could not find `DiagnosticOutput` in `rustc_session`

error[E0560]: struct `rustc_interface::Config` has no field named `diagnostic_output`
  --> rustc-driver-interacting-with-the-ast.rs:46:9
   |
46 |         diagnostic_output: rustc_session::DiagnosticOutput::Default,
   |         ^^^^^^^^^^^^^^^^^ `rustc_interface::Config` does not have this field
   |
   = note: available fields are: `opts`, `crate_cfg`, `crate_check_cfg`, `input`, `input_path` ... and 9 others

error: aborting due to 2 previous errors
@gftea gftea changed the title how to compile the examples fail to compile the examples Jan 13, 2023
@JohnTitor
Copy link
Member

As noted in https://rustc-dev-guide.rust-lang.org/rustc-driver-interacting-with-the-ast.html#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 nightly-2022-06-05 (see here for the complete example):

A PR is welcome to update the nightly version :)

gftea added a commit to gftea/rustc-dev-guide that referenced this issue Jan 13, 2023
@gftea
Copy link
Contributor Author

gftea commented Jan 13, 2023

DiagnosticOutput is removed from Config by commit rust-lang/rust@641f824

#1557 submitted

JohnTitor pushed a commit that referenced this issue Jan 14, 2023
Kobzol pushed a commit to Kobzol/rust that referenced this issue Dec 30, 2024
bors pushed a commit to rust-lang-ci/rust that referenced this issue Jan 2, 2025
Kobzol pushed a commit to Kobzol/rustc-dev-guide that referenced this issue Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants