Contributing to Rustc, Episode 4(a): MIR passes, MIR visitors, and a very simple MIR transform
Channel: Felix K
Date: 2023-02-09

This is the first part of a two-part episode. In this part, we motivate a specific MIR transformation and prototype a quick proof-of-concept.

You can see the second part (that fixes some problems in the code presented here) at: https://www.youtube.com/watch?v=_Hbfr17OkOs

0:00 - Introduction to future parameter duplication issue
2:38 - Using unpretty compiler flag
6:23 - Looking at MIR output and coming up with solution
15:05 - Starting to look at MIR transformations in the codebase
24:00 - Talking about MIR visitors
35:22 - Adding a new MIR transformation (upvar_to_local_prop)
48:16 - Looking at trace output (logging)
1:00:40 - Adding a -Z flag to control whether transformation is enabled
1:09:00 - Writing transformation logic to replace upvars (using visit_place)
1:20:25 - Talking about and using projections
1:39:54 - Triggering an ICE, and comparing our new MIR output