Lifting this from a discussion on Zulip.
core::any::try_as_dyn doesn't work (always returns None) when trying to access builtin impls in any way:
trait SyncAble {}
impl<T> SyncAble for T where T: Sync /* <- builtin */ {}
println!("{}", core::any::try_as_dyn::<u32, dyn SyncAble>(&0).is_some());
Thats quite annoying because checking whether T: Sync holds would potentially allow for optimizations (offloading computations). The same applies to all other builtin impl's. This can be quite confusing, especially because its not consistent for a single trait either.
Lifting this from a discussion on Zulip.
core::any::try_as_dyndoesn't work (always returnsNone) when trying to access builtin impls in any way:Thats quite annoying because checking whether
T: Syncholds would potentially allow for optimizations (offloading computations). The same applies to all other builtin impl's. This can be quite confusing, especially because its not consistent for a single trait either.