Skip to content

Latest commit

 

History

History
15 lines (11 loc) · 743 Bytes

interacting-with-the-ast.md

File metadata and controls

15 lines (11 loc) · 743 Bytes

Example: Type checking through rustc_driver

rustc_driver 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 after_analysis callback to get a TyCtxt. The following was tested with nightly-2024-12-15:

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