Skip to content

Commit

Permalink
Make is_object_safe a method.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjgillot committed Feb 19, 2020
1 parent 6e15faf commit 310f470
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
3 changes: 0 additions & 3 deletions src/librustc/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) }
}
Expand Down
4 changes: 4 additions & 0 deletions src/librustc/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_incremental/persist/dirty_clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 1 addition & 5 deletions src/librustc_infer/traits/object_safety.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
}

0 comments on commit 310f470

Please sign in to comment.