Skip to content

Commit 3942ab9

Browse files
committed
make the core::raw struct representation defined
Closes #18313
1 parent 80e5fe1 commit 3942ab9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/libcore/raw.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,21 @@
2121
use mem;
2222

2323
/// The representation of a Rust slice
24+
#[repr(C)]
2425
pub struct Slice<T> {
2526
pub data: *const T,
2627
pub len: uint,
2728
}
2829

2930
/// The representation of a Rust closure
31+
#[repr(C)]
3032
pub struct Closure {
3133
pub code: *mut (),
3234
pub env: *mut (),
3335
}
3436

3537
/// The representation of a Rust procedure (`proc()`)
38+
#[repr(C)]
3639
pub struct Procedure {
3740
pub code: *mut (),
3841
pub env: *mut (),
@@ -42,6 +45,7 @@ pub struct Procedure {
4245
///
4346
/// This struct does not have a `Repr` implementation
4447
/// because there is no way to refer to all trait objects generically.
48+
#[repr(C)]
4549
pub struct TraitObject {
4650
pub data: *mut (),
4751
pub vtable: *mut (),
@@ -60,4 +64,3 @@ pub trait Repr<T> {
6064

6165
impl<'a, T> Repr<Slice<T>> for &'a [T] {}
6266
impl<'a> Repr<Slice<u8>> for &'a str {}
63-

0 commit comments

Comments
 (0)