How to emit LLVM-IR from Cargo
问题 How can I get cargo to emit LLVM-IR instead of a binary for my project? I know that you can use the --emit=llvm-ir flag in rustc , but I've read some Github issues that show it's impossible to pass arbitrary compiler flags to cargo. Is there any way I can get cargo to emit LLVM-IR directly? 回答1: There is cargo rustc to pass arbitrary compiler flags through Cargo to rustc . So I think: cargo rustc -- --emit=llvm-ir is what you want! 回答2: EDIT: You should use Jacob's answer instead; a lot