Skip to content

Commit af9fbd7

Browse files
JohnTitorgitbot
authored and
gitbot
committed
Rollup merge of rust-lang#86141 - amorison:link-ref-in-doc-dyn-keyword, r=kennytm
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. --- We could also put these links in the very first line (instead of the link to the Book) and in the first paragraph which mentions the "object safe" requirement. Personally, I think it's good to keep the link to the Book up-front as it's more accessible than the Reference.
2 parents ae7c428 + 2c2ea22 commit af9fbd7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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)