Make is_object_safe a method.
This commit is contained in:
parent
6e15faf68a
commit
310f4707e5
|
@ -653,9 +653,6 @@ rustc_queries! {
|
|||
desc { |tcx| "building specialization graph of trait `{}`", tcx.def_path_str(key) }
|
||||
cache_on_disk_if { true }
|
||||
}
|
||||
query is_object_safe(key: DefId) -> bool {
|
||||
desc { |tcx| "determine object safety of trait `{}`", tcx.def_path_str(key) }
|
||||
}
|
||||
query object_safety_violations(key: DefId) -> Vec<traits::ObjectSafetyViolation> {
|
||||
desc { |tcx| "determine object safety of trait `{}`", tcx.def_path_str(key) }
|
||||
}
|
||||
|
|
|
@ -2998,6 +2998,10 @@ impl<'tcx> TyCtxt<'tcx> {
|
|||
};
|
||||
(ident, scope)
|
||||
}
|
||||
|
||||
pub fn is_object_safe(self, key: DefId) -> bool {
|
||||
self.object_safety_violations(key).is_empty()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, HashStable)]
|
||||
|
|
|
@ -78,7 +78,7 @@ const BASE_STRUCT: &[&str] =
|
|||
const BASE_TRAIT_DEF: &[&str] = &[
|
||||
label_strs::associated_item_def_ids,
|
||||
label_strs::generics_of,
|
||||
label_strs::is_object_safe,
|
||||
label_strs::object_safety_violations,
|
||||
label_strs::predicates_of,
|
||||
label_strs::specialization_graph_of,
|
||||
label_strs::trait_def,
|
||||
|
|
|
@ -772,10 +772,6 @@ fn contains_illegal_self_type_reference<'tcx>(
|
|||
error
|
||||
}
|
||||
|
||||
fn is_object_safe(tcx: TyCtxt<'_>, trait_def_id: DefId) -> bool {
|
||||
tcx.object_safety_violations(trait_def_id).is_empty()
|
||||
}
|
||||
|
||||
pub fn provide(providers: &mut ty::query::Providers<'_>) {
|
||||
*providers = ty::query::Providers { is_object_safe, object_safety_violations, ..*providers };
|
||||
*providers = ty::query::Providers { object_safety_violations, ..*providers };
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue