We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6dfa053 commit 3311536Copy full SHA for 3311536
compiler/rustc_mir_transform/src/gvn.rs
@@ -96,7 +96,11 @@ fn propagate_ssa<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
96
97
for (local, rvalue, _) in ssa.assignments(body) {
98
let value = state.insert_rvalue(rvalue).or_else(|| state.new_opaque()).unwrap();
99
- state.assign(local, value);
+ // FIXME(#112651) `rvalue` may have a subtype to `local`. We can only mark `local` as
100
+ // reusable if we have an exact type match.
101
+ if state.local_decls[local].ty == rvalue.ty(state.local_decls, tcx) {
102
+ state.assign(local, value);
103
+ }
104
}
105
106
// Stop creating opaques during replacement as it is useless.
0 commit comments