]>
git.proxmox.com Git - rustc.git/blob - compiler/rustc_mir_transform/src/remove_storage_markers.rs
1 //! This pass removes storage markers if they won't be emitted during codegen.
4 use rustc_middle
::mir
::*;
5 use rustc_middle
::ty
::TyCtxt
;
7 pub struct RemoveStorageMarkers
;
9 impl<'tcx
> MirPass
<'tcx
> for RemoveStorageMarkers
{
10 fn run_pass(&self, tcx
: TyCtxt
<'tcx
>, body
: &mut Body
<'tcx
>) {
11 if tcx
.sess
.emit_lifetime_markers() {
15 trace
!("Running RemoveStorageMarkers on {:?}", body
.source
);
16 for data
in body
.basic_blocks_mut() {
17 data
.statements
.retain(|statement
| match statement
.kind
{
18 StatementKind
::StorageLive(..)
19 | StatementKind
::StorageDead(..)
20 | StatementKind
::Nop
=> false,