Removed free_glue from tydesc (the code is still generated, but inlined in drop_glue).

This commit is contained in:
Eduard Burtescu 2014-01-01 14:45:31 +02:00
parent 5ad2a7825b
commit 7a305f9e83
8 changed files with 79 additions and 171 deletions

View file

@ -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 { }