gcmodule icon indicating copy to clipboard operation
gcmodule copied to clipboard

Box<dyn _>

Open mio-19 opened this issue 5 years ago • 1 comments

fix https://github.com/quark-zju/gcmodule/issues/8

mio-19 avatar Apr 04 '20 04:04 mio-19

This removes an optimization. The old code will not track types like Box<T> where T is known to be untracked. That means Cc<Box<T>> won't be inserted to the linked list and Cc<Box<T>> takes less space in memory.

Could you use the customize type instead? That is, define struct MyBox(Box<dyn MyTrait>) and implement Trace on MyBox. That would preserve the optimization and makes Cc<MyBox> compile.

quark-zju avatar Apr 04 '20 05:04 quark-zju