-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Description
Monomorphization (assuming I'll be able to land it anytime soon) has removed the need to pass type descriptors to generics. The only place were we still are passing type descriptors is to rust-intrinsic functions. I'd like to switch those over to explicit type-descriptor passing (most of them don't even use their type descriptors), but sys::get_type_desc
is currently implemented as an intrinsic that returns the type descriptor it is passed. Thus, we'd have to provide some other way to get at tydescs.
Ideally, this would be some hack in core and not add anything to the language. But when our compiler stops passing tydescs to things, it becomes very hard to get hold of them. You can box something and then unsafely fetch the tydesc from the box, but that's definitely not how we want to create tydescs. So the compiler will have to cooperate in some way.
I'm having trouble coming up with a non-invasive way to do this. We could hard-code core::sys::get_type_desc
to always magically return the type desc of its type parameter. We could do something with attributes.
Do others have ideas? Do you think I'm even going in the right direction here? The code to handle passing tydescs to intrinsics is very awkward, now that normal functions no longer take tydescs. It seems like an undesirable wart.