diff options
| author | Eduard Burtescu <edy.burt@gmail.com> | 2014-01-01 14:45:31 +0200 |
|---|---|---|
| committer | Eduard Burtescu <edy.burt@gmail.com> | 2014-01-11 16:40:23 +0200 |
| commit | 7a305f9e832901018e5f1aa1901eff04652fdbbd (patch) | |
| tree | 3ccab1847d0885f6e661a57b58b9a1c64e695148 /src/libstd | |
| parent | 5ad2a7825bd9821b8ef554046c8d81eb94ab7dfe (diff) | |
| download | rust-7a305f9e832901018e5f1aa1901eff04652fdbbd.tar.gz rust-7a305f9e832901018e5f1aa1901eff04652fdbbd.zip | |
Removed free_glue from tydesc (the code is still generated, but inlined in drop_glue).
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/unstable/intrinsics.rs | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/src/libstd/unstable/intrinsics.rs b/src/libstd/unstable/intrinsics.rs index d6b33fda745..acd1cfcf901 100644 --- a/src/libstd/unstable/intrinsics.rs +++ b/src/libstd/unstable/intrinsics.rs @@ -47,9 +47,9 @@ pub use realstd::unstable::intrinsics::{TyDesc, Opaque, TyVisitor, TypeId}; pub type GlueFn = extern "Rust" fn(*i8); -// NB: this has to be kept in sync with `type_desc` in `rt` +// NOTE remove after next snapshot #[lang="ty_desc"] -#[cfg(not(test))] +#[cfg(not(test), stage0)] pub struct TyDesc { // sizeof(T) size: uint, @@ -80,6 +80,35 @@ pub struct TyDesc { name: &'static str } +#[lang="ty_desc"] +#[cfg(not(test), not(stage0))] +pub struct TyDesc { + // sizeof(T) + size: uint, + + // alignof(T) + align: uint, + + // Called on a copy of a value of type `T` *after* memcpy + take_glue: GlueFn, + + // Called when a value of type `T` is no longer needed + drop_glue: GlueFn, + + // Called by reflection visitor to visit a value of type `T` + visit_glue: GlueFn, + + // If T represents a box pointer (`@U` or `~U`), then + // `borrow_offset` is the amount that the pointer must be adjusted + // to find the payload. This is always derivable from the type + // `U`, but in the case of `@Trait` or `~Trait` objects, the type + // `U` is unknown. + borrow_offset: uint, + + // Name corresponding to the type + name: &'static str +} + #[lang="opaque"] #[cfg(not(test))] pub enum Opaque { } |
