Skip to content

Commit

Permalink
Merge pull request #18490 from ShoyuVanilla/dyn-compat-rename
Browse files Browse the repository at this point in the history
minor: Rename `dyn compatible` to `dyn-compatible`
  • Loading branch information
lnicola authored Nov 7, 2024
2 parents b51f9bc + 05e5f9e commit 1042a8c
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion crates/hir-ty/src/chalk_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,9 @@ impl chalk_solve::RustIrDatabase<Interner> for ChalkContext<'_> {
TyKind::Error.intern(Interner)
}

// object safety was renamed to dyn-compatibility but still remains here in chalk.
// This will be removed since we are going to migrate to next-gen trait solver.
fn is_object_safe(&self, trait_id: chalk_ir::TraitId<Interner>) -> bool {
// FIXME: When cargo is updated, change to dyn_compatibility
let trait_ = from_chalk_trait_id(trait_id);
crate::dyn_compatibility::dyn_compatibility(self.db, trait_).is_none()
}
Expand Down
2 changes: 1 addition & 1 deletion crates/hir-ty/src/dyn_compatibility.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ fn receiver_is_dispatchable(
return false;
};

// `self: Self` can't be dispatched on, but this is already considered dyn compatible
// `self: Self` can't be dispatched on, but this is already considered dyn-compatible
// See rustc's comment on https://github.com/rust-lang/rust/blob/3f121b9461cce02a703a0e7e450568849dfaa074/compiler/rustc_trait_selection/src/traits/object_safety.rs#L433-L437
if sig
.skip_binders()
Expand Down
2 changes: 1 addition & 1 deletion crates/hir-ty/src/dyn_compatibility/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ fn check_dyn_compatibility<'a>(
});
ControlFlow::Continue(())
});
assert_eq!(osvs, expected, "Dyn Compatibility violations for `{name}` do not match;");
assert_eq!(osvs, expected, "dyn-compatibility violations for `{name}` do not match;");
}

let remains: Vec<_> = expected.keys().collect();
Expand Down
6 changes: 3 additions & 3 deletions crates/ide/src/hover/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1009,10 +1009,10 @@ fn render_dyn_compatibility(
safety: Option<DynCompatibilityViolation>,
) {
let Some(osv) = safety else {
buf.push_str("Is Dyn compatible");
buf.push_str("Is dyn-compatible");
return;
};
buf.push_str("Is not Dyn compatible due to ");
buf.push_str("Is not dyn-compatible due to ");
match osv {
DynCompatibilityViolation::SizedSelf => {
buf.push_str("having a `Self: Sized` bound");
Expand Down Expand Up @@ -1055,7 +1055,7 @@ fn render_dyn_compatibility(
}
DynCompatibilityViolation::HasNonCompatibleSuperTrait(super_trait) => {
let name = hir::Trait::from(super_trait).name(db);
format_to!(buf, "having a dyn incompatible supertrait `{}`", name.as_str());
format_to!(buf, "having a dyn-incompatible supertrait `{}`", name.as_str());
}
}
}
4 changes: 2 additions & 2 deletions crates/ide/src/hover/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9371,7 +9371,7 @@ trait Compat$0 {}
---
Is Dyn compatible
Is dyn-compatible
"#]],
);
check(
Expand All @@ -9393,7 +9393,7 @@ trait UnCompat$0 {
---
Is not Dyn compatible due to having a method `f` that is not dispatchable due to missing a receiver
Is not dyn-compatible due to having a method `f` that is not dispatchable due to missing a receiver
"#]],
);
check(
Expand Down

0 comments on commit 1042a8c

Please sign in to comment.