1
Fork 0

Compiler: Rename "object safe" to "dyn compatible"

This commit is contained in:
León Orell Valerian Liehr 2024-09-25 10:38:40 +02:00
parent f5cd2c5888
commit 01a063f9df
No known key found for this signature in database
GPG key ID: D17A07215F68E713
183 changed files with 523 additions and 510 deletions

View file

@ -639,8 +639,8 @@ where
ty::Dynamic(bounds, ..) => bounds,
};
// Do not consider built-in object impls for non-object-safe types.
if bounds.principal_def_id().is_some_and(|def_id| !cx.trait_is_object_safe(def_id)) {
// Do not consider built-in object impls for dyn-incompatible types.
if bounds.principal_def_id().is_some_and(|def_id| !cx.trait_is_dyn_compatible(def_id)) {
return;
}

View file

@ -423,8 +423,8 @@ where
ty::PredicateKind::Coerce(predicate) => {
self.compute_coerce_goal(Goal { param_env, predicate })
}
ty::PredicateKind::ObjectSafe(trait_def_id) => {
self.compute_object_safe_goal(trait_def_id)
ty::PredicateKind::DynCompatible(trait_def_id) => {
self.compute_dyn_compatible_goal(trait_def_id)
}
ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(arg)) => {
self.compute_well_formed_goal(Goal { param_env, predicate: arg })

View file

@ -111,8 +111,8 @@ where
}
}
fn compute_object_safe_goal(&mut self, trait_def_id: I::DefId) -> QueryResult<I> {
if self.cx().trait_is_object_safe(trait_def_id) {
fn compute_dyn_compatible_goal(&mut self, trait_def_id: I::DefId) -> QueryResult<I> {
if self.cx().trait_is_dyn_compatible(trait_def_id) {
self.evaluate_added_goals_and_make_canonical_response(Certainty::Yes)
} else {
Err(NoSolution)

View file

@ -832,8 +832,8 @@ where
let cx = self.cx();
let Goal { predicate: (a_ty, _), .. } = goal;
// Can only unsize to an object-safe trait.
if b_data.principal_def_id().is_some_and(|def_id| !cx.trait_is_object_safe(def_id)) {
// Can only unsize to an dyn-compatible trait.
if b_data.principal_def_id().is_some_and(|def_id| !cx.trait_is_dyn_compatible(def_id)) {
return Err(NoSolution);
}