Skip to content

Commit 511f1cf

Browse files
check_is_object_safe -> is_object_safe
1 parent de6b219 commit 511f1cf

File tree

16 files changed

+18
-18
lines changed

16 files changed

+18
-18
lines changed

compiler/rustc_hir_analysis/src/check/wfcheck.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,7 @@ fn check_object_unsafe_self_trait_by_name(tcx: TyCtxt<'_>, item: &hir::TraitItem
881881
_ => {}
882882
}
883883
if !trait_should_be_self.is_empty() {
884-
if tcx.check_is_object_safe(trait_def_id) {
884+
if tcx.is_object_safe(trait_def_id) {
885885
return;
886886
}
887887
let sugg = trait_should_be_self.iter().map(|span| (*span, "Self".to_string())).collect();

compiler/rustc_hir_analysis/src/coherence/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ fn check_object_overlap<'tcx>(
191191
});
192192

193193
for component_def_id in component_def_ids {
194-
if !tcx.check_is_object_safe(component_def_id) {
194+
if !tcx.is_object_safe(component_def_id) {
195195
// Without the 'object_safe_for_dispatch' feature this is an error
196196
// which will be reported by wfcheck. Ignore it here.
197197
// This is tested by `coherence-impl-trait-for-trait-object-safe.rs`.

compiler/rustc_hir_analysis/src/hir_ty_lowering/lint.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
182182
// For recursive traits, don't downgrade the error. (#119652)
183183
is_downgradable = false;
184184
}
185-
tcx.check_is_object_safe(id)
185+
tcx.is_object_safe(id)
186186
}
187187
_ => false,
188188
})

compiler/rustc_interface/src/passes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ fn analysis(tcx: TyCtxt<'_>, (): ()) -> Result<()> {
832832
let traits = tcx.traits(LOCAL_CRATE);
833833

834834
for &tr in traits {
835-
if !tcx.check_is_object_safe(tr) {
835+
if !tcx.is_object_safe(tr) {
836836
continue;
837837
}
838838

compiler/rustc_lint/src/multiple_supertrait_upcastable.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ declare_lint_pass!(MultipleSupertraitUpcastable => [MULTIPLE_SUPERTRAIT_UPCASTAB
3838
impl<'tcx> LateLintPass<'tcx> for MultipleSupertraitUpcastable {
3939
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::Item<'tcx>) {
4040
let def_id = item.owner_id.to_def_id();
41-
// NOTE(nbdd0121): use `object_safety_violations` instead of `check_is_object_safe` because
41+
// NOTE(nbdd0121): use `object_safety_violations` instead of `is_object_safe` because
4242
// the latter will report `where_clause_object_safety` lint.
4343
if let hir::ItemKind::Trait(_, _, _, _, _) = item.kind
44-
&& cx.tcx.object_safety_violations(def_id).is_empty()
44+
&& cx.tcx.is_object_safe(def_id)
4545
{
4646
let direct_super_traits_iter = cx
4747
.tcx

compiler/rustc_middle/src/query/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1309,7 +1309,7 @@ rustc_queries! {
13091309
query object_safety_violations(trait_id: DefId) -> &'tcx [ObjectSafetyViolation] {
13101310
desc { |tcx| "determining object safety of trait `{}`", tcx.def_path_str(trait_id) }
13111311
}
1312-
query check_is_object_safe(trait_id: DefId) -> bool {
1312+
query is_object_safe(trait_id: DefId) -> bool {
13131313
desc { |tcx| "checking if trait `{}` is object safe", tcx.def_path_str(trait_id) }
13141314
}
13151315

compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/transform.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ pub fn transform_instance<'tcx>(
367367
let trait_method = tcx.associated_item(method_id);
368368
let trait_id = trait_ref.skip_binder().def_id;
369369
if traits::is_vtable_safe_method(tcx, trait_id, trait_method)
370-
&& tcx.object_safety_violations(trait_id).is_empty()
370+
&& tcx.is_object_safe(trait_id)
371371
{
372372
// Trait methods will have a Self polymorphic parameter, where the concreteized
373373
// implementatation will not. We need to walk back to the more general trait method

compiler/rustc_trait_selection/src/solve/assembly/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ impl<'tcx> EvalCtxt<'_, InferCtxt<'tcx>> {
714714
};
715715

716716
// Do not consider built-in object impls for non-object-safe types.
717-
if bounds.principal_def_id().is_some_and(|def_id| !tcx.check_is_object_safe(def_id)) {
717+
if bounds.principal_def_id().is_some_and(|def_id| !tcx.is_object_safe(def_id)) {
718718
return;
719719
}
720720

compiler/rustc_trait_selection/src/solve/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ impl<'a, 'tcx> EvalCtxt<'a, InferCtxt<'tcx>> {
133133
}
134134

135135
fn compute_object_safe_goal(&mut self, trait_def_id: DefId) -> QueryResult<'tcx> {
136-
if self.interner().check_is_object_safe(trait_def_id) {
136+
if self.interner().is_object_safe(trait_def_id) {
137137
self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
138138
} else {
139139
Err(NoSolution)

compiler/rustc_trait_selection/src/solve/trait_goals.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,7 @@ impl<'tcx> EvalCtxt<'_, InferCtxt<'tcx>> {
789789
let Goal { predicate: (a_ty, _), .. } = goal;
790790

791791
// Can only unsize to an object-safe trait.
792-
if b_data.principal_def_id().is_some_and(|def_id| !tcx.check_is_object_safe(def_id)) {
792+
if b_data.principal_def_id().is_some_and(|def_id| !tcx.is_object_safe(def_id)) {
793793
return Err(NoSolution);
794794
}
795795

compiler/rustc_trait_selection/src/traits/fulfill.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
411411
}
412412

413413
ty::PredicateKind::ObjectSafe(trait_def_id) => {
414-
if !self.selcx.tcx().check_is_object_safe(trait_def_id) {
414+
if !self.selcx.tcx().is_object_safe(trait_def_id) {
415415
ProcessResult::Error(FulfillmentErrorCode::Select(Unimplemented))
416416
} else {
417417
ProcessResult::Changed(vec![])

compiler/rustc_trait_selection/src/traits/object_safety.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ fn object_safety_violations(tcx: TyCtxt<'_>, trait_def_id: DefId) -> &'_ [Object
6464
)
6565
}
6666

67-
fn check_is_object_safe(tcx: TyCtxt<'_>, trait_def_id: DefId) -> bool {
67+
fn is_object_safe(tcx: TyCtxt<'_>, trait_def_id: DefId) -> bool {
6868
tcx.object_safety_violations(trait_def_id).is_empty()
6969
}
7070

@@ -854,7 +854,7 @@ pub fn contains_illegal_impl_trait_in_trait<'tcx>(
854854
pub fn provide(providers: &mut Providers) {
855855
*providers = Providers {
856856
object_safety_violations,
857-
check_is_object_safe,
857+
is_object_safe,
858858
generics_require_sized_self,
859859
..*providers
860860
};

compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
870870
if let Some(principal) = data.principal() {
871871
if !self.infcx.tcx.features().object_safe_for_dispatch {
872872
principal.with_self_ty(self.tcx(), self_ty)
873-
} else if self.tcx().check_is_object_safe(principal.def_id()) {
873+
} else if self.tcx().is_object_safe(principal.def_id()) {
874874
principal.with_self_ty(self.tcx(), self_ty)
875875
} else {
876876
return;

compiler/rustc_trait_selection/src/traits/select/confirmation.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1222,7 +1222,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
12221222
// `T` -> `Trait`
12231223
(_, &ty::Dynamic(data, r, ty::Dyn)) => {
12241224
let mut object_dids = data.auto_traits().chain(data.principal_def_id());
1225-
if let Some(did) = object_dids.find(|did| !tcx.check_is_object_safe(*did)) {
1225+
if let Some(did) = object_dids.find(|did| !tcx.is_object_safe(*did)) {
12261226
return Err(TraitNotObjectSafe(did));
12271227
}
12281228

compiler/rustc_trait_selection/src/traits/select/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
798798
}
799799

800800
ty::PredicateKind::ObjectSafe(trait_def_id) => {
801-
if self.tcx().check_is_object_safe(trait_def_id) {
801+
if self.tcx().is_object_safe(trait_def_id) {
802802
Ok(EvaluatedToOk)
803803
} else {
804804
Ok(EvaluatedToErr)

src/librustdoc/clean/types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1451,7 +1451,7 @@ impl Trait {
14511451
tcx.trait_def(self.def_id).safety
14521452
}
14531453
pub(crate) fn is_object_safe(&self, tcx: TyCtxt<'_>) -> bool {
1454-
tcx.check_is_object_safe(self.def_id)
1454+
tcx.is_object_safe(self.def_id)
14551455
}
14561456
}
14571457

0 commit comments

Comments
 (0)