]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_mir_transform/src/remove_unneeded_drops.rs
Add rationale for `RemoveUnneededDrops`
[rust.git] / compiler / rustc_mir_transform / src / remove_unneeded_drops.rs
index c71bc512c31b5e8403eb59e59d5702ecec8d4813..39f78e9555e2f6a0d660624dd0094901c0c99d28 100644 (file)
@@ -1,4 +1,8 @@
-//! This pass replaces a drop of a type that does not need dropping, with a goto
+//! This pass replaces a drop of a type that does not need dropping, with a goto.
+//!
+//! When the MIR is built, we check `needs_drop` before emitting a `Drop` for a place. This pass is
+//! useful because (unlike MIR building) it runs after type checking, so it can make use of
+//! `Reveal::All` to provide more precies type information.
 
 use crate::MirPass;
 use rustc_middle::mir::*;