rust/compiler/rustc_const_eval
Stuart Cook b5c92233fb
Rollup merge of #148165 - nnethercote:less-mut-Analysis, r=cjgillot
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`
2025-10-31 22:41:18 +11:00
..