@@ -813,12 +813,6 @@ impl Visitor<'tcx> for Validator<'mir, 'tcx> {
813
813
// projections that cannot be `NeedsDrop`.
814
814
TerminatorKind :: Drop { place : dropped_place, .. }
815
815
| TerminatorKind :: DropAndReplace { place : dropped_place, .. } => {
816
- // If we are checking live drops after drop-elaboration, don't emit duplicate
817
- // errors here.
818
- if super :: post_drop_elaboration:: checking_enabled ( self . ccx ) {
819
- return ;
820
- }
821
-
822
816
let mut err_span = self . span ;
823
817
824
818
// Check to see if the type of this place can ever have a drop impl. If not, this
@@ -830,20 +824,30 @@ impl Visitor<'tcx> for Validator<'mir, 'tcx> {
830
824
return ;
831
825
}
832
826
833
- let needs_drop = if let Some ( local) = dropped_place. as_local ( ) {
827
+ let local_needs_drop = if let Some ( local) = dropped_place. as_local ( ) {
834
828
// Use the span where the local was declared as the span of the drop error.
835
829
err_span = self . body . local_decls [ local] . source_info . span ;
836
830
self . qualifs . needs_drop ( self . ccx , local, location)
837
831
} else {
838
832
true
839
833
} ;
840
834
841
- if needs_drop {
842
- self . check_op_spanned (
843
- ops:: LiveDrop { dropped_at : Some ( terminator. source_info . span ) } ,
844
- err_span,
845
- ) ;
835
+ if !local_needs_drop {
836
+ return ;
846
837
}
838
+
839
+ self . passes_checks_without_unstable_features = false ;
840
+
841
+ // If we are checking live drops after drop-elaboration, don't emit duplicate
842
+ // errors here.
843
+ if super :: post_drop_elaboration:: checking_enabled ( self . ccx ) {
844
+ return ;
845
+ }
846
+
847
+ self . check_op_spanned (
848
+ ops:: LiveDrop { dropped_at : Some ( terminator. source_info . span ) } ,
849
+ err_span,
850
+ ) ;
847
851
}
848
852
849
853
TerminatorKind :: InlineAsm { .. } => self . check_op ( ops:: InlineAsm ) ,
0 commit comments