Hacking on rustc - Negative literals in indexing expressions
Channel: Esteban Küber
Date: 2021-09-26

This video is unscripted, rambling and not very focused, but it shows my reasoning to do this, how I go about actually making one of these diagnostic improvement changes and during the way mentions some tidbits of information. If you have an hour to spare where you don't have *anything* else to do, and you're intrigued about what it looks like to work on the compiler while trying to explain yourself to unseen observers, this is your video.

While talking on twitter about the reasons you can't currently use negative values in the indexing operation in Rust, the lightbulb when on that we *can* support it as part of the compiler for better diagnostics, at least until we resolve the discussed issues: https://twitter.com/ekuber/status/1441727909207625730

The resulting code is available at this pull request: https://github.com/rust-lang/rust/pull/89251

0:00 - The current problem and why we don't just solve it
5:40 - An alternative solution
8:46 - Solving the problem in the parser
19:10 - Finding a closer place to change the behavior
24:30 - Jackpot: finding where rustc evaluates indices
28:45 - Interlude
30:00 - Continuing our research
35:03 - Making the change
1:00:12 - Going the extra mile
1:12:51 - Outro