Contracts of the Clone trait?

Actually that would not work, because Drop does not capture drop glue, i.e. it would leak

struct Wrapper(String);
1 Like

T: Drop is almost never correct, as it misses the case where some inner part of T needs dropping.

There's a clippy lint for this: Clippy Lints

2 Likes

Thanks. I found a RustBelt article which treats this pretty rigorously. In section 6, they discuss the formalism to model types with interior mutabilities.

1 Like

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