- Use rustc -O to generate optimized LLVM IR code. What happened to your code?
Solution: With rustc -O, quite a lot of boilerplate code vanishes. But also potentially useful things get lost in optimization, such as integer overflow checks.
- Make a new String value in main and see what kind of IR code gets generated.
Solution: There are heap allocations for String.
- Add a println! macro to your code. How did it affect the IR code?
Solution: The println! macro adds quite a lot of IR code due to formatting and console output.
- Take your second favorite programming language and try to figure out if ownership of variables plays any part. Perhaps behind the curtain, hidden?
Solution: C allocates everything in the stack by default, ...