Hi, I am trying to understand a few things to complete my project. I have been reading about MIR passes and I get a sense they are somehow similar to LLVM passes. I would like to modify some structs that implement a specific trait, perhaps even add new fields to them. I'm wondering whether is possible at MIR level. I have also been looking at hir::intravist, but I'm not proficient enough to confirm this is possible or where to do it. Any guidance in this direction is much appreciated.
MIR is after typechecking, and typechecking can use
sizeof(Foo) in const generics, so adding new fields to them might just be fundamentally impossible at that point.
What are you trying to accomplish with this pass?
Thank you for the response. I am would like to wrap some struct fields with the Box, to ensure they are allocated on the heap all the time regardless of whether the enclosing struct object is on the stack or not.