Skip to content

Commit 5f7bb5f

Browse files
committed
Replace "dyn-compatible" with "dyn compatible"
See rust-lang#126554 (comment)
1 parent 55d16b9 commit 5f7bb5f

File tree

145 files changed

+311
-311
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+311
-311
lines changed

compiler/rustc_const_eval/src/interpret/call.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ impl<'tcx, M: Machine<'tcx>> InterpCx<'tcx, M> {
614614
// codegen'd / interpreted as virtual calls through the vtable.
615615
ty::InstanceKind::Virtual(def_id, idx) => {
616616
let mut args = args.to_vec();
617-
// We have to implement all "dyn-compatible receivers". So we have to go search for a
617+
// We have to implement all "dyn compatible receivers". So we have to go search for a
618618
// pointer or `dyn Trait` type, but it could be wrapped in newtypes. So recursively
619619
// unwrap those newtypes until we are there.
620620
// An `InPlace` does nothing here, we keep the original receiver intact. We can't

compiler/rustc_error_codes/src/error_codes/E0038.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ trait, written in type positions) but this was a bit too confusing, so we now
55
write `dyn Trait`.
66

77
Some traits are not allowed to be used as trait object types. The traits that
8-
are allowed to be used as trait object types are called "dyn-compatible"[^1]
8+
are allowed to be used as trait object types are called "dyn compatible"[^1]
99
traits. Attempting to use a trait object type for a trait that is not
10-
dyn-compatible will trigger error E0038.
10+
dyn compatible will trigger error E0038.
1111

1212
Two general aspects of trait object types give rise to the restrictions:
1313

@@ -34,7 +34,7 @@ aspects.
3434
### The trait requires `Self: Sized`
3535

3636
Traits that are declared as `Trait: Sized` or which otherwise inherit a
37-
constraint of `Self:Sized` are not dyn-compatible.
37+
constraint of `Self:Sized` are not dyn compatible.
3838

3939
The reasoning behind this is somewhat subtle. It derives from the fact that Rust
4040
requires (and defines) that every trait object type `dyn Trait` automatically
@@ -61,7 +61,7 @@ implement a sized trait like `Trait:Sized`. So, rather than allow an exception
6161
to the rule that `dyn Trait` always implements `Trait`, Rust chooses to prohibit
6262
such a `dyn Trait` from existing at all.
6363

64-
Only unsized traits are considered dyn-compatible.
64+
Only unsized traits are considered dyn compatible.
6565

6666
Generally, `Self: Sized` is used to indicate that the trait should not be used
6767
as a trait object. If the trait comes from your own crate, consider removing
@@ -106,7 +106,7 @@ fn call_foo(x: Box<dyn Trait>) {
106106
}
107107
```
108108

109-
If only some methods aren't dyn-compatible, you can add a `where Self: Sized`
109+
If only some methods aren't dyn compatible, you can add a `where Self: Sized`
110110
bound on them to mark them as explicitly unavailable to trait objects. The
111111
functionality will still be available to all other implementers, including
112112
`Box<dyn Trait>` which is itself sized (assuming you `impl Trait for Box<dyn
@@ -120,7 +120,7 @@ trait Trait {
120120
```
121121

122122
Now, `foo()` can no longer be called on a trait object, but you will now be
123-
allowed to make a trait object, and that will be able to call any dyn-compatible
123+
allowed to make a trait object, and that will be able to call any dyn compatible
124124
methods. With such a bound, one can still call `foo()` on types implementing
125125
that trait that aren't behind trait objects.
126126

@@ -309,7 +309,7 @@ Here, the supertrait might have methods as follows:
309309

310310
```
311311
trait Super<A: ?Sized> {
312-
fn get_a(&self) -> &A; // note that this is dyn-compatible!
312+
fn get_a(&self) -> &A; // note that this is dyn compatible!
313313
}
314314
```
315315

@@ -318,8 +318,8 @@ If the trait `Trait` was deriving from something like `Super<String>` or
318318
`get_a()` will definitely return an object of that type.
319319

320320
However, if it derives from `Super<Self>`, even though `Super` is
321-
dyn-compatible, the method `get_a()` would return an object of unknown type when
322-
called on the function. `Self` type parameters let us make dyn-compatible traits
321+
dyn compatible, the method `get_a()` would return an object of unknown type when
322+
called on the function. `Self` type parameters let us make dyn compatible traits
323323
no longer compatible, so they are forbidden when specifying supertraits.
324324

325325
There's no easy fix for this. Generally, code will need to be refactored so that

compiler/rustc_error_codes/src/error_codes/E0802.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
The `Async{Fn, FnMut, FnOnce}` traits are not yet `dyn`-compatible.
1+
The `Async{Fn, FnMut, FnOnce}` traits are not yet dyn compatible.
22

33
Erroneous code example:
44

compiler/rustc_error_codes/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ E0802: 0802,
625625
// E0314, // closure outlives stack frame
626626
// E0315, // cannot invoke closure outside of its lifetime
627627
// E0319, // trait impls for defaulted traits allowed just for structs/enums
628-
// E0372, // coherence not dyn-compatible
628+
// E0372, // coherence not dyn compatible
629629
// E0385, // {} in an aliasable location
630630
// E0402, // cannot use an outer type parameter in this context
631631
// E0406, // merged into 420

compiler/rustc_feature/src/removed.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ declare_features! (
159159
/// then removed. But there was no utility storing it separately, so now
160160
/// it's in this list.
161161
(removed, no_stack_check, "1.0.0", None, None),
162-
/// Allows making `dyn Trait` well-formed even if `Trait` is not dyn-compatible (object safe).
162+
/// Allows making `dyn Trait` well-formed even if `Trait` is not dyn compatible (object safe).
163163
/// Renamed to `dyn_compatible_for_dispatch`.
164164
(removed, object_safe_for_dispatch, "1.83.0", Some(43561),
165165
Some("renamed to `dyn_compatible_for_dispatch`")),

compiler/rustc_feature/src/unstable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ declare_features! (
269269
(unstable, doc_notable_trait, "1.52.0", Some(45040)),
270270
/// Allows using the `may_dangle` attribute (RFC 1327).
271271
(unstable, dropck_eyepatch, "1.10.0", Some(34761)),
272-
/// Allows making `dyn Trait` well-formed even if `Trait` is not dyn-compatible[^1].
272+
/// Allows making `dyn Trait` well-formed even if `Trait` is not dyn compatible[^1].
273273
/// In that case, `dyn Trait: Trait` does not hold. Moreover, coercions and
274274
/// casts in safe Rust to `dyn Trait` for such a `Trait` is also forbidden.
275275
///

compiler/rustc_hir_analysis/src/coherence/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ fn check_object_overlap<'tcx>(
184184
// check for overlap with the automatic `impl Trait for dyn Trait`
185185
if let ty::Dynamic(data, ..) = trait_ref.self_ty().kind() {
186186
// This is something like `impl Trait1 for Trait2`. Illegal if
187-
// Trait1 is a supertrait of Trait2 or Trait2 is not dyn-compatible.
187+
// Trait1 is a supertrait of Trait2 or Trait2 is not dyn compatible.
188188

189189
let component_def_ids = data.iter().flat_map(|predicate| {
190190
match predicate.skip_binder() {

compiler/rustc_hir_analysis/src/coherence/orphan.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ pub(crate) fn orphan_check_impl(
116116
// We can allow f to be called on `dyn DynCompatibleTrait + AutoTrait`.
117117
//
118118
// If we didn't deny `impl AutoTrait for dyn Trait`, it would be unsound
119-
// for the `DynCompatibleTrait` shown above to be dyn-compatible because someone
119+
// for the `DynCompatibleTrait` shown above to be dyn compatible because someone
120120
// could take some type implementing `DynCompatibleTrait` but not `AutoTrait`,
121121
// unsize it to `dyn DynCompatibleTrait`, and call `.f()` which has no
122122
// concrete implementation (issue #50781).

compiler/rustc_hir_analysis/src/hir_ty_lowering/lint.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
8080
if self_ty.span.can_be_used_for_suggestions()
8181
&& !self.maybe_suggest_impl_trait(self_ty, &mut diag)
8282
{
83-
// FIXME: Only emit this suggestion if the trait is dyn-compatible.
83+
// FIXME: Only emit this suggestion if the trait is dyn compatible.
8484
diag.multipart_suggestion_verbose(label, sugg, Applicability::MachineApplicable);
8585
}
8686
// Check if the impl trait that we are considering is an impl of a local trait.
@@ -102,7 +102,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
102102
lint.primary_message("trait objects without an explicit `dyn` are deprecated");
103103
if self_ty.span.can_be_used_for_suggestions() {
104104
lint.multipart_suggestion_verbose(
105-
"if this is a dyn-compatible trait, use `dyn`",
105+
"if this is a dyn compatible trait, use `dyn`",
106106
sugg,
107107
Applicability::MachineApplicable,
108108
);

compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -771,7 +771,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
771771
// give us a `QPath::TypeRelative` with a trait object as
772772
// `qself`. In that case, we want to avoid registering a WF obligation
773773
// for `dyn MyTrait`, since we don't actually need the trait
774-
// to be dyn-compatible.
774+
// to be dyn compatible.
775775
// We manually call `register_wf_obligation` in the success path
776776
// below.
777777
let ty = self.lowerer().lower_ty(qself);

0 commit comments

Comments
 (0)