vorner/arc-swap

!Sized support

Ten0 opened this issue · 6 comments

Ten0 commented

Arc does not have a Sized requirement for its use, however due to a lacking ?Sized bound on impl RefCnt for Arc, this library can't be used to store e.g. ArcSwap<dyn Config>.

Is there a technical limitation that prevents this? Or could it be implemented?

Ten0 commented

Dupe of #27

Ten0 commented

I haven't found it in the documentation though

It is indeed a bit buried in there. But AFAIK this is not the first thing someone coming to the crate needs to know.

https://docs.rs/arc-swap/1.3.1/arc_swap/docs/limitations/index.html

It would be great if the crate could somehow supply an error hint when that happens, but I don't know of a way to do that :-|

Ten0 commented

It would be great if the crate could somehow supply an error hint when that happens, but I don't know of a way to do that :-|

Unfortunately that feature does not exist. This is something Diesel has been looking for for a while as well.

The feature doesn't, but I wouldn't be too surprised if someone came up with a hack, like making the compiler output something like types don't match, expected: WeDontSupportUnsizedSeeTheDocsWhy 😈

Ten0 commented

The feature doesn't, but I wouldn't be too surprised if someone came up with a hack, like making the compiler output something like types don't match, expected: WeDontSupportUnsizedSeeTheDocsWhy smiling_imp

https://github.com/diesel-rs/diesel/blob/a39dd2ebc5acccb8cde73d40b0d81dde3e073170/diesel/src/query_source/mod.rs#L129-L158