Remove the queries
This commit is contained in:
@@ -792,35 +792,6 @@ impl<'tcx> ty::TyS<'tcx> {
|
||||
}
|
||||
}
|
||||
}
|
||||
/// If `ty.needs_non_const_drop(...)` returns true, then `ty` is definitely
|
||||
/// non-copy and *might* have a non-const destructor attached; if it returns
|
||||
/// `false`, then `ty` definitely has a const destructor or no destructor at all.
|
||||
///
|
||||
/// (Note that this implies that if `ty` has a non-const destructor attached,
|
||||
/// then `needs_non_const_drop` will definitely return `true` for `ty`.)
|
||||
pub fn needs_non_const_drop(
|
||||
&'tcx self,
|
||||
tcx: TyCtxt<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
) -> bool {
|
||||
// Avoid querying in simple cases.
|
||||
match needs_drop_components(self, &tcx.data_layout) {
|
||||
Err(AlwaysRequiresDrop) => true,
|
||||
Ok(components) => {
|
||||
let query_ty = match *components {
|
||||
[] => return false,
|
||||
// if we've got a single component, call the query with that
|
||||
// to increase the chance that we hit the query cache.
|
||||
[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_non_const_drop_raw(param_env.and(erased))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Checks if `ty` has has a significant drop.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user