Skip to content

Commit 668f388

Browse files
authored
Merge pull request #18490 from ShoyuVanilla/dyn-compat-rename
minor: Rename `dyn compatible` to `dyn-compatible`
2 parents 69437d1 + 902a2c5 commit 668f388

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

src/tools/rust-analyzer/crates/hir-ty/src/chalk_db.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,9 @@ impl chalk_solve::RustIrDatabase<Interner> for ChalkContext<'_> {
381381
TyKind::Error.intern(Interner)
382382
}
383383

384+
// object safety was renamed to dyn-compatibility but still remains here in chalk.
385+
// This will be removed since we are going to migrate to next-gen trait solver.
384386
fn is_object_safe(&self, trait_id: chalk_ir::TraitId<Interner>) -> bool {
385-
// FIXME: When cargo is updated, change to dyn_compatibility
386387
let trait_ = from_chalk_trait_id(trait_id);
387388
crate::dyn_compatibility::dyn_compatibility(self.db, trait_).is_none()
388389
}

src/tools/rust-analyzer/crates/hir-ty/src/dyn_compatibility.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ fn receiver_is_dispatchable(
472472
return false;
473473
};
474474

475-
// `self: Self` can't be dispatched on, but this is already considered dyn compatible
475+
// `self: Self` can't be dispatched on, but this is already considered dyn-compatible
476476
// See rustc's comment on https://github.com/rust-lang/rust/blob/3f121b9461cce02a703a0e7e450568849dfaa074/compiler/rustc_trait_selection/src/traits/object_safety.rs#L433-L437
477477
if sig
478478
.skip_binders()

src/tools/rust-analyzer/crates/hir-ty/src/dyn_compatibility/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ fn check_dyn_compatibility<'a>(
6666
});
6767
ControlFlow::Continue(())
6868
});
69-
assert_eq!(osvs, expected, "Dyn Compatibility violations for `{name}` do not match;");
69+
assert_eq!(osvs, expected, "dyn-compatibility violations for `{name}` do not match;");
7070
}
7171

7272
let remains: Vec<_> = expected.keys().collect();

src/tools/rust-analyzer/crates/ide/src/hover/render.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,10 +1009,10 @@ fn render_dyn_compatibility(
10091009
safety: Option<DynCompatibilityViolation>,
10101010
) {
10111011
let Some(osv) = safety else {
1012-
buf.push_str("Is Dyn compatible");
1012+
buf.push_str("Is dyn-compatible");
10131013
return;
10141014
};
1015-
buf.push_str("Is not Dyn compatible due to ");
1015+
buf.push_str("Is not dyn-compatible due to ");
10161016
match osv {
10171017
DynCompatibilityViolation::SizedSelf => {
10181018
buf.push_str("having a `Self: Sized` bound");
@@ -1055,7 +1055,7 @@ fn render_dyn_compatibility(
10551055
}
10561056
DynCompatibilityViolation::HasNonCompatibleSuperTrait(super_trait) => {
10571057
let name = hir::Trait::from(super_trait).name(db);
1058-
format_to!(buf, "having a dyn incompatible supertrait `{}`", name.as_str());
1058+
format_to!(buf, "having a dyn-incompatible supertrait `{}`", name.as_str());
10591059
}
10601060
}
10611061
}

src/tools/rust-analyzer/crates/ide/src/hover/tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9371,7 +9371,7 @@ trait Compat$0 {}
93719371
93729372
---
93739373
9374-
Is Dyn compatible
9374+
Is dyn-compatible
93759375
"#]],
93769376
);
93779377
check(
@@ -9393,7 +9393,7 @@ trait UnCompat$0 {
93939393
93949394
---
93959395
9396-
Is not Dyn compatible due to having a method `f` that is not dispatchable due to missing a receiver
9396+
Is not dyn-compatible due to having a method `f` that is not dispatchable due to missing a receiver
93979397
"#]],
93989398
);
93999399
check(

0 commit comments

Comments
 (0)