From 05e5f9e4fd2f10d0fd1f697c01ff48987664b99b Mon Sep 17 00:00:00 2001 From: Shoyu Vanilla Date: Thu, 7 Nov 2024 23:00:29 +0900 Subject: [PATCH] minor: Rename `dyn compatible` to `dyn-compatible` --- crates/hir-ty/src/chalk_db.rs | 3 ++- crates/hir-ty/src/dyn_compatibility.rs | 2 +- crates/hir-ty/src/dyn_compatibility/tests.rs | 2 +- crates/ide/src/hover/render.rs | 6 +++--- crates/ide/src/hover/tests.rs | 4 ++-- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/crates/hir-ty/src/chalk_db.rs b/crates/hir-ty/src/chalk_db.rs index 05cd7bd37b..53795c0b60 100644 --- a/crates/hir-ty/src/chalk_db.rs +++ b/crates/hir-ty/src/chalk_db.rs @@ -381,8 +381,9 @@ impl chalk_solve::RustIrDatabase 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) -> 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() } diff --git a/crates/hir-ty/src/dyn_compatibility.rs b/crates/hir-ty/src/dyn_compatibility.rs index 3d21785a70..fadf8aca99 100644 --- a/crates/hir-ty/src/dyn_compatibility.rs +++ b/crates/hir-ty/src/dyn_compatibility.rs @@ -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() diff --git a/crates/hir-ty/src/dyn_compatibility/tests.rs b/crates/hir-ty/src/dyn_compatibility/tests.rs index 3f3e68eeb1..8a56bd28b5 100644 --- a/crates/hir-ty/src/dyn_compatibility/tests.rs +++ b/crates/hir-ty/src/dyn_compatibility/tests.rs @@ -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(); diff --git a/crates/ide/src/hover/render.rs b/crates/ide/src/hover/render.rs index 51a7728345..e9857e5122 100644 --- a/crates/ide/src/hover/render.rs +++ b/crates/ide/src/hover/render.rs @@ -1003,10 +1003,10 @@ fn render_dyn_compatibility( safety: Option, ) { 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"); @@ -1049,7 +1049,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()); } } } diff --git a/crates/ide/src/hover/tests.rs b/crates/ide/src/hover/tests.rs index 1fad3d6bd6..448bcd22d6 100644 --- a/crates/ide/src/hover/tests.rs +++ b/crates/ide/src/hover/tests.rs @@ -9371,7 +9371,7 @@ trait Compat$0 {} --- - Is Dyn compatible + Is dyn-compatible "#]], ); check( @@ -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(