diff options
| author | bors <bors@rust-lang.org> | 2016-08-06 05:02:16 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-08-06 05:02:16 -0700 |
| commit | 444ff9fbfb1f2a8e6645f67684f8a9ad99b343d3 (patch) | |
| tree | dad9595deade059b82952d7c38ccef3140686537 /src/libcore | |
| parent | ecdd51b7bb7fd993acd2ff5dbd72209244b1e4aa (diff) | |
| parent | 67f082287d49320af9042678b861437cd8d0224c (diff) | |
| download | rust-444ff9fbfb1f2a8e6645f67684f8a9ad99b343d3.tar.gz rust-444ff9fbfb1f2a8e6645f67684f8a9ad99b343d3.zip | |
Auto merge of #35407 - eddyb:rollup, r=eddyb
Rollup of 21 pull requests - Successful merges: #33951, #34916, #35287, #35288, #35351, #35353, #35356, #35362, #35363, #35364, #35366, #35368, #35370, #35372, #35373, #35374, #35375, #35376, #35380, #35393, #35394 - Failed merges: #35331, #35395
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/raw.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/libcore/raw.rs b/src/libcore/raw.rs index 6b2122451db..a7d0d3899b1 100644 --- a/src/libcore/raw.rs +++ b/src/libcore/raw.rs @@ -34,12 +34,13 @@ /// only designed to be used by unsafe code that needs to manipulate /// the low-level details. /// -/// There is no `Repr` implementation for `TraitObject` because there -/// is no way to refer to all trait objects generically, so the only +/// There is no way to refer to all trait objects generically, so the only /// way to create values of this type is with functions like -/// `std::mem::transmute`. Similarly, the only way to create a true +/// [`std::mem::transmute`][transmute]. Similarly, the only way to create a true /// trait object from a `TraitObject` value is with `transmute`. /// +/// [transmute]: ../intrinsics/fn.transmute.html +/// /// Synthesizing a trait object with mismatched types—one where the /// vtable does not correspond to the type of the value to which the /// data pointer points—is highly likely to lead to undefined @@ -50,13 +51,13 @@ /// ``` /// #![feature(raw)] /// -/// use std::mem; -/// use std::raw; +/// use std::{mem, raw}; /// /// // an example trait /// trait Foo { /// fn bar(&self) -> i32; /// } +/// /// impl Foo for i32 { /// fn bar(&self) -> i32 { /// *self + 1 @@ -74,7 +75,6 @@ /// // the data pointer is the address of `value` /// assert_eq!(raw_object.data as *const i32, &value as *const _); /// -/// /// let other_value: i32 = 456; /// /// // construct a new object, pointing to a different `i32`, being @@ -82,11 +82,11 @@ /// let synthesized: &Foo = unsafe { /// mem::transmute(raw::TraitObject { /// data: &other_value as *const _ as *mut (), -/// vtable: raw_object.vtable +/// vtable: raw_object.vtable, /// }) /// }; /// -/// // it should work just like we constructed a trait object out of +/// // it should work just as if we had constructed a trait object out of /// // `other_value` directly /// assert_eq!(synthesized.bar(), 457); /// ``` |
