Skip to content

Commit 33a4806

Browse files
committed
Clean up std::raw docs
There is no longer a `Repr` trait, so mentioning a missing impl of it was potentially confusing.
1 parent 9316ae5 commit 33a4806

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/libcore/raw.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,13 @@
3434
/// only designed to be used by unsafe code that needs to manipulate
3535
/// the low-level details.
3636
///
37-
/// There is no `Repr` implementation for `TraitObject` because there
38-
/// is no way to refer to all trait objects generically, so the only
37+
/// There is no way to refer to all trait objects generically, so the only
3938
/// way to create values of this type is with functions like
40-
/// `std::mem::transmute`. Similarly, the only way to create a true
39+
/// [`std::mem::transmute`][transmute]. Similarly, the only way to create a true
4140
/// trait object from a `TraitObject` value is with `transmute`.
4241
///
42+
/// [transmute]: ../mem/fn.transmute.html
43+
///
4344
/// Synthesizing a trait object with mismatched types—one where the
4445
/// vtable does not correspond to the type of the value to which the
4546
/// data pointer points—is highly likely to lead to undefined
@@ -50,13 +51,13 @@
5051
/// ```
5152
/// #![feature(raw)]
5253
///
53-
/// use std::mem;
54-
/// use std::raw;
54+
/// use std::{mem, raw};
5555
///
5656
/// // an example trait
5757
/// trait Foo {
5858
/// fn bar(&self) -> i32;
5959
/// }
60+
///
6061
/// impl Foo for i32 {
6162
/// fn bar(&self) -> i32 {
6263
/// *self + 1
@@ -74,19 +75,18 @@
7475
/// // the data pointer is the address of `value`
7576
/// assert_eq!(raw_object.data as *const i32, &value as *const _);
7677
///
77-
///
7878
/// let other_value: i32 = 456;
7979
///
8080
/// // construct a new object, pointing to a different `i32`, being
8181
/// // careful to use the `i32` vtable from `object`
8282
/// let synthesized: &Foo = unsafe {
8383
/// mem::transmute(raw::TraitObject {
8484
/// data: &other_value as *const _ as *mut (),
85-
/// vtable: raw_object.vtable
85+
/// vtable: raw_object.vtable,
8686
/// })
8787
/// };
8888
///
89-
/// // it should work just like we constructed a trait object out of
89+
/// // it should work just as if we had constructed a trait object out of
9090
/// // `other_value` directly
9191
/// assert_eq!(synthesized.bar(), 457);
9292
/// ```

0 commit comments

Comments
 (0)