Skip to content

Commit

Permalink
make the core::raw struct representation defined
Browse files Browse the repository at this point in the history
Closes #18313
  • Loading branch information
thestinger committed Oct 25, 2014
1 parent 80e5fe1 commit 3942ab9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/libcore/raw.rs
Expand Up @@ -21,18 +21,21 @@
use mem;

/// The representation of a Rust slice
#[repr(C)]
pub struct Slice<T> {
pub data: *const T,
pub len: uint,
}

/// The representation of a Rust closure
#[repr(C)]
pub struct Closure {
pub code: *mut (),
pub env: *mut (),
}

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

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

0 comments on commit 3942ab9

Please sign in to comment.