Skip to content

Commit 7728476

Browse files
committed
Link reference in dyn keyword documentation
The "read more" sentence formatted "object safety" as inline code instead of providing a link to more information. This PR adds a link to the Reference about this matter, as well as the page regarding trait objects.
1 parent a50d721 commit 7728476

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

library/std/src/keyword_docs.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -2259,6 +2259,9 @@ mod await_keyword {}
22592259
/// At run-time, when a method needs to be called on the `dyn Trait`, the vtable is consulted to get
22602260
/// the function pointer and then that function pointer is called.
22612261
///
2262+
/// See the Reference for more information on [trait objects][ref-trait-obj]
2263+
/// and [object safety][ref-obj-safety].
2264+
///
22622265
/// ## Trade-offs
22632266
///
22642267
/// The above indirection is the additional runtime cost of calling a function on a `dyn Trait`.
@@ -2267,9 +2270,9 @@ mod await_keyword {}
22672270
/// However, `dyn Trait` is likely to produce smaller code than `impl Trait` / generic parameters as
22682271
/// the method won't be duplicated for each concrete type.
22692272
///
2270-
/// Read more about `object safety` and [trait object]s.
2271-
///
22722273
/// [trait object]: ../book/ch17-02-trait-objects.html
2274+
/// [ref-trait-obj]: ../reference/types/trait-object.html
2275+
/// [ref-obj-safety]: ../reference/items/traits.html#object-safety
22732276
/// [erased]: https://en.wikipedia.org/wiki/Type_erasure
22742277
mod dyn_keyword {}
22752278

0 commit comments

Comments
 (0)