Skip to content

Latest commit

 

History

History
16 lines (12 loc) · 866 Bytes

rustc-driver-interacting-with-the-ast.md

File metadata and controls

16 lines (12 loc) · 866 Bytes

Example: Type checking through rustc_interface

The rustc_interface allows you to interact with Rust code at various stages of compilation.

Getting the type of an expression

To get the type of an expression, use the global_ctxt query to get a TyCtxt. The following was tested with nightly-2024-01-19:

{{#include ../examples/rustc-driver-interacting-with-the-ast.rs}}