Enforce object-safety when coercing to an object - #255
Conversation
Restrict which objects can be coerced to trait objects, rather than which methods can be called on a trait object.
|
It would be nice to allow |
|
@sfackler do you have an example? I had not considered having different rules for different kinds of trait objects, I fear that would be too much complexity unless there is a really important use case. |
|
There's some discussion at rust-lang/rust#10672. Most notably, @pcwalton points out that it's required to allow |
|
It'd also seem to me that you couldn't allow |
|
@sfackler thanks for the link! I need to check, but I think that the Box case is OK - Why do you think |
… rather than restricting value to reference types.
|
I remember @glaebhoerl arguing that the diffculties around DSTs are signs that we indeed need full-on existential types. I am not sure if this particular problem applies, but here is his (somewhat random) thought about existential types. And I'll leave it here just in case this is relevant. :) |
|
Oops, I misinterpreted the proposal wrt |
|
In general, the rules around |
|
Perhaps a more accurate rule would be to say "modified rules around |
|
This also intersects the proposed |
|
@CloudiDust That's a pretty interesting set of notes. I hadn't thought much about existential types as they apply to Rust, but it seems like it could be a really fantastic fit. |
Make join_all() concurrent.
Restrict which objects can be coerced to trait objects, rather than which methods can be called on a trait object.