Macro rustc_smir::run

source ·
macro_rules! run {
    ($args:expr, $callback_fn:ident) => { ... };
    ($args:expr, $callback:expr) => { ... };
}
Expand description

Instantiate and run the compiler with the provided arguments and callback.

The callback will be invoked after the compiler ran all its analyses, but before code generation. Note that this macro accepts two different formats for the callback:

  1. An ident that resolves to a function that accepts no argument and returns ControlFlow<B, C>
    fn analyze_code() -> ControlFlow<(), ()> {
        // Your code goes in here.
    }
    let result = run!(args, analyze_code);
  1. A closure expression:
    fn analyze_code(extra_args: Vec<String>) -> ControlFlow<(), ()> {
        // Your code goes in here.
    }
    let result = run!(args, || analyze_code(extra_args));