Skip to content

Commit 2f3caee

Browse files
authored
Unrolled build for #145181
Rollup merge of #145181 - Borgerr:remove-fixme-from-has-sigdrop, r=lcnr remove FIXME block from `has_significant_drop`, it never encounters inference variables The `FIXME` block in `Ty::has_significant_drop` is outdated as related queries can now handle type inference. https://github.com/rust-lang/rust/blob/321a89bec57b8ca723d1af8f784490b950458c6a/compiler/rustc_middle/src/ty/util.rs#L1378-L1389 Closes #86868 (other places mentioned in the issue have been resolved, or moved to other issues) r? types
2 parents ba4b643 + fa7e474 commit 2f3caee

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

compiler/rustc_middle/src/ty/util.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1359,6 +1359,7 @@ impl<'tcx> Ty<'tcx> {
13591359
/// 2229 drop reorder migration analysis.
13601360
#[inline]
13611361
pub fn has_significant_drop(self, tcx: TyCtxt<'tcx>, typing_env: ty::TypingEnv<'tcx>) -> bool {
1362+
assert!(!self.has_non_region_infer());
13621363
// Avoid querying in simple cases.
13631364
match needs_drop_components(tcx, self) {
13641365
Err(AlwaysRequiresDrop) => true,
@@ -1371,14 +1372,6 @@ impl<'tcx> Ty<'tcx> {
13711372
_ => self,
13721373
};
13731374

1374-
// FIXME(#86868): We should be canonicalizing, or else moving this to a method of inference
1375-
// context, or *something* like that, but for now just avoid passing inference
1376-
// variables to queries that can't cope with them. Instead, conservatively
1377-
// return "true" (may change drop order).
1378-
if query_ty.has_infer() {
1379-
return true;
1380-
}
1381-
13821375
// This doesn't depend on regions, so try to minimize distinct
13831376
// query keys used.
13841377
let erased = tcx.normalize_erasing_regions(typing_env, query_ty);
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//@ run-pass
2+
// Inference, canonicalization, and significant drops should work nicely together.
3+
// Related issue: #86868
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+
fn main() {
17+
dropper();
18+
}

0 commit comments

Comments
 (0)