Rollup merge of #91462 - b-naber:use-try-normalize-erasing-regions, r=jackh726

Use try_normalize_erasing_regions in needs_drop

Fixes https://github.com/rust-lang/rust/issues/81199

r? ``@jackh726``
This commit is contained in:
Matthias Krüger
2021-12-03 06:24:17 +01:00
committed by GitHub
4 changed files with 60 additions and 4 deletions

View File

@@ -788,10 +788,14 @@ impl<'tcx> ty::TyS<'tcx> {
[component_ty] => component_ty,
_ => self,
};
// This doesn't depend on regions, so try to minimize distinct
// query keys used.
let erased = tcx.normalize_erasing_regions(param_env, query_ty);
tcx.needs_drop_raw(param_env.and(erased))
// If normalization fails, we just use `query_ty`.
let query_ty =
tcx.try_normalize_erasing_regions(param_env, query_ty).unwrap_or(query_ty);
tcx.needs_drop_raw(param_env.and(query_ty))
}
}
}