File tree Expand file tree Collapse file tree 2 files changed +12
-13
lines changed
compiler/rustc_middle/src/ty Expand file tree Collapse file tree 2 files changed +12
-13
lines changed Original file line number Diff line number Diff line change @@ -1368,7 +1368,6 @@ impl<'tcx> Ty<'tcx> {
13681368 /// 2229 drop reorder migration analysis.
13691369 #[ inline]
13701370 pub fn has_significant_drop ( self , tcx : TyCtxt < ' tcx > , typing_env : ty:: TypingEnv < ' tcx > ) -> bool {
1371- assert ! ( !self . has_non_region_infer( ) ) ;
13721371 // Avoid querying in simple cases.
13731372 match needs_drop_components ( tcx, self ) {
13741373 Err ( AlwaysRequiresDrop ) => true ,
@@ -1381,6 +1380,16 @@ impl<'tcx> Ty<'tcx> {
13811380 _ => self ,
13821381 } ;
13831382
1383+ // FIXME
1384+ // We should be canonicalizing, or else moving this to a method of inference
1385+ // context, or *something* like that,
1386+ // but for now just avoid passing inference variables
1387+ // to queries that can't cope with them.
1388+ // Instead, conservatively return "true" (may change drop order).
1389+ if query_ty. has_infer ( ) {
1390+ return true ;
1391+ }
1392+
13841393 // This doesn't depend on regions, so try to minimize distinct
13851394 // query keys used.
13861395 let erased = tcx. normalize_erasing_regions ( typing_env, query_ty) ;
Original file line number Diff line number Diff line change 22// Inference, canonicalization, and significant drops should work nicely together.
33// Related issue: #86868
44
5- #[ clippy:: has_significant_drop]
6- struct DropGuy { }
7-
8- fn creator ( ) -> DropGuy {
9- DropGuy { }
10- }
11-
12- fn dropper ( ) {
13- let _ = creator ( ) ;
14- }
15-
165fn main ( ) {
17- dropper ( ) ;
6+ let mut state = 0 ;
7+ Box :: new ( move || state)
188}
You can’t perform that action at this time.
0 commit comments