Skip to content

Commit 17d2001

Browse files
authored
replace object-safe with dyn-compatible flexibility.md
1 parent 97a0969 commit 17d2001

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/flexibility.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ needs to make about its arguments.
155155

156156

157157
<a id="c-object"></a>
158-
## Traits are object-safe if they may be useful as a trait object (C-OBJECT)
158+
## Traits are dyn-compatible if they may be useful as a trait object (C-OBJECT)
159159

160160
Trait objects have some significant limitations: methods invoked through a trait
161161
object cannot use generics, and cannot use `Self` except in receiver position.
@@ -167,25 +167,25 @@ If a trait is meant to be used as an object, its methods should take and return
167167
trait objects rather than use generics.
168168

169169
A `where` clause of `Self: Sized` may be used to exclude specific methods from
170-
the trait's object. The following trait is not object-safe due to the generic
170+
the trait's object. The following trait is not dyn-compatible due to the generic
171171
method.
172172

173173
```rust
174174
trait MyTrait {
175-
fn object_safe(&self, i: i32);
175+
fn dyn_compatible(&self, i: i32);
176176

177-
fn not_object_safe<T>(&self, t: T);
177+
fn not_dyn_compatible<T>(&self, t: T);
178178
}
179179
```
180180

181181
Adding a requirement of `Self: Sized` to the generic method excludes it from the
182-
trait object and makes the trait object-safe.
182+
trait object and makes the trait dyn-compatible.
183183

184184
```rust
185185
trait MyTrait {
186-
fn object_safe(&self, i: i32);
186+
fn dyn_compatible(&self, i: i32);
187187

188-
fn not_object_safe<T>(&self, t: T) where Self: Sized;
188+
fn not_dyn_compatible<T>(&self, t: T) where Self: Sized;
189189
}
190190
```
191191

0 commit comments

Comments
 (0)