I have been reading reading about the rustc_driver module in the compiler. I also found out I could write a tool based off of that without modifying the compiler directly. I am wondering whether it's possible to modify the AST after the 'queries.analysis()' part of the driver. I realize I would have to rebuild the HIR and repeat the type-checking, but is it at all possible? I have so far failed to get hold of a mutable ast::Crate at that point of the compilation process. I also didn't see a MutVisitor for the HIR, so I was wondering if there's any way to modify HIR if the AST fails. My current plan is to "hack" the ast lowering phase if everything fails. I'm wondering whether that's really all I can do. I don't want to use an MIR pass because what I need to do requires type-checking after then modifications. Thanks in advance.
Please note when you cross post.