]> git.lizzy.rs Git - rust.git/commit - src/tools/rustfmt
Auto merge of #73210 - wesleywiser:consts_in_debuginfo, r=oli-obk
authorbors <bors@rust-lang.org>
Tue, 15 Dec 2020 08:46:00 +0000 (08:46 +0000)
committerbors <bors@rust-lang.org>
Tue, 15 Dec 2020 08:46:00 +0000 (08:46 +0000)
commite99a89c7c0b6865a680a2d6169847ec8acc001d3
tree7924a9c9ef4585a7007f141e5994a9b0ceb00b49
parente261649593cf9c2707f7b30a61c46c4469c67ebb
parent0b18ed833c4406d8fc654b9f4990d2f80dc205c4
Auto merge of #73210 - wesleywiser:consts_in_debuginfo, r=oli-obk

[mir-opt] Allow debuginfo to be generated for a constant or a Place

Prior to this commit, debuginfo was always generated by mapping a name
to a Place. This has the side-effect that `SimplifyLocals` cannot remove
locals that are only used for debuginfo because their other uses have
been const-propagated.

To allow these locals to be removed, we now allow debuginfo to point to
a constant value. The `ConstProp` pass detects when debuginfo points to
a local with a known constant value and replaces it with the value. This
allows the later `SimplifyLocals` pass to remove the local.
compiler/rustc_mir/src/borrow_check/mod.rs
compiler/rustc_mir_build/src/build/matches/mod.rs
compiler/rustc_mir_build/src/build/mod.rs