mirror of
https://github.com/rust-lang/rust.git
synced 2025-11-22 21:56:30 +00:00
Use `mut` less in dataflow analysis `&mut Analysis` is used a lot: - In results visitors, even though only one visitor needs mutability. - In all the `apply_*` methods, even though only one visitor needs mutability. I've lost track of the number of times I've thought "why are these `mut` again?" and had to look through the code to remind myself. It's really unexpected, and most `Analysis` instances are immutable, because the `state` values are what get mutated. This commit introduces `RefCell` in one analysis and one results visitor. This then lets another existing `RefCell` be removed, and a ton of `&mut Analysis` arguments become `&Analysis`. And then `Analysis` and `Results` can be recombined. r? `@cjgillot`