simplCore: Correctly extend in-scope set in rule matching
Note [Matching lets]
in GHC.Core.Rules
claims the following:
We use
GHC.Core.Subst.substBind
to freshen the binding, using an in-scope set that is the original in-scope variables plus thers_bndrs
(currently floated let-bindings).
However, previously the implementation didn't actually do extend the
in-scope set with rs_bndrs. This appears to be a regression which was
introduced by 4ff4d434. Reintroduce
rs_bndrs
into the in-scope set, ensuring that let-binders cannot
shadow one another due to rule rewrites.
Fixes #21122 (closed).
Also includes two other trivial commits fixing other issues which I noticed while investigating this.