Replace TyDesc and its uses with trait vtables and a type_name intrinsic.
This commit is contained in:
parent
3e98ab560a
commit
e256b7f049
15 changed files with 88 additions and 307 deletions
|
|
@ -44,10 +44,12 @@
|
|||
|
||||
use marker::Sized;
|
||||
|
||||
#[cfg(stage0)] // SNAP 270a677
|
||||
pub type GlueFn = extern "Rust" fn(*const i8);
|
||||
|
||||
#[lang="ty_desc"]
|
||||
#[derive(Copy)]
|
||||
#[cfg(stage0)] // SNAP 270a677
|
||||
pub struct TyDesc {
|
||||
// sizeof(T)
|
||||
pub size: usize,
|
||||
|
|
@ -197,8 +199,13 @@ extern "rust-intrinsic" {
|
|||
pub fn pref_align_of<T>() -> usize;
|
||||
|
||||
/// Get a static pointer to a type descriptor.
|
||||
#[cfg(stage0)] // SNAP 270a677
|
||||
pub fn get_tydesc<T: ?Sized>() -> *const TyDesc;
|
||||
|
||||
/// Gets a static string slice containing the name of a type.
|
||||
#[cfg(not(stage0))] // SNAP 270a677
|
||||
pub fn type_name<T: ?Sized>() -> &'static str;
|
||||
|
||||
/// Gets an identifier which is globally unique to the specified type. This
|
||||
/// function will return the same value for a type regardless of whichever
|
||||
/// crate it is invoked in.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue