remove FIXME from has_significant_drop, replaced with checking non_region_infer
This commit is contained in:
parent
f3fd3efe4f
commit
fa7e474f9c
2 changed files with 19 additions and 8 deletions
|
|
@ -1359,6 +1359,7 @@ impl<'tcx> Ty<'tcx> {
|
|||
/// 2229 drop reorder migration analysis.
|
||||
#[inline]
|
||||
pub fn has_significant_drop(self, tcx: TyCtxt<'tcx>, typing_env: ty::TypingEnv<'tcx>) -> bool {
|
||||
assert!(!self.has_non_region_infer());
|
||||
// Avoid querying in simple cases.
|
||||
match needs_drop_components(tcx, self) {
|
||||
Err(AlwaysRequiresDrop) => true,
|
||||
|
|
@ -1371,14 +1372,6 @@ impl<'tcx> Ty<'tcx> {
|
|||
_ => self,
|
||||
};
|
||||
|
||||
// FIXME(#86868): We should be canonicalizing, or else moving this to a method of inference
|
||||
// context, or *something* like that, but for now just avoid passing inference
|
||||
// variables to queries that can't cope with them. Instead, conservatively
|
||||
// return "true" (may change drop order).
|
||||
if query_ty.has_infer() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// This doesn't depend on regions, so try to minimize distinct
|
||||
// query keys used.
|
||||
let erased = tcx.normalize_erasing_regions(typing_env, query_ty);
|
||||
|
|
|
|||
18
tests/ui/type-inference/has_sigdrop.rs
Normal file
18
tests/ui/type-inference/has_sigdrop.rs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
//@ run-pass
|
||||
// Inference, canonicalization, and significant drops should work nicely together.
|
||||
// Related issue: #86868
|
||||
|
||||
#[clippy::has_significant_drop]
|
||||
struct DropGuy {}
|
||||
|
||||
fn creator() -> DropGuy {
|
||||
DropGuy {}
|
||||
}
|
||||
|
||||
fn dropper() {
|
||||
let _ = creator();
|
||||
}
|
||||
|
||||
fn main() {
|
||||
dropper();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue