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> {
1368
1368
/// 2229 drop reorder migration analysis.
1369
1369
#[ inline]
1370
1370
pub fn has_significant_drop ( self , tcx : TyCtxt < ' tcx > , typing_env : ty:: TypingEnv < ' tcx > ) -> bool {
1371
- assert ! ( !self . has_non_region_infer( ) ) ;
1372
1371
// Avoid querying in simple cases.
1373
1372
match needs_drop_components ( tcx, self ) {
1374
1373
Err ( AlwaysRequiresDrop ) => true ,
@@ -1381,6 +1380,16 @@ impl<'tcx> Ty<'tcx> {
1381
1380
_ => self ,
1382
1381
} ;
1383
1382
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
+
1384
1393
// This doesn't depend on regions, so try to minimize distinct
1385
1394
// query keys used.
1386
1395
let erased = tcx. normalize_erasing_regions ( typing_env, query_ty) ;
Original file line number Diff line number Diff line change 2
2
// Inference, canonicalization, and significant drops should work nicely together.
3
3
// Related issue: #86868
4
4
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
-
16
5
fn main ( ) {
17
- dropper ( ) ;
6
+ let mut state = 0 ;
7
+ Box :: new ( move || state)
18
8
}
You can’t perform that action at this time.
0 commit comments