-> impl Trait and object safety

I read the latest blog post and I understand there's a desire to make traits with RPITIT object safe. I don't know how you intend to do this (would it be enough to store type layout information in the vtable?), but if this can be done, wouldn't it also let trait methods that return Self become object safe? -> Self would essentially be an alias for -> impl current_trait

(This could let us do things like e.g. let cloned: Box<dyn Trait> = Box::new(trait_object.clone()) without the currently required workarounds for cloning trait objects)

I'm sorry if this belongs in the users forum; I posted it here because it asks about internal details.

5 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.