The interface and implement macros, while powerful, suffer from the fact that they have no contextual information. They can only parse the tokens provided to them and don't necessarily know what those types and paths refer to. There are two areas where I think we might be able to practically improve upon the existing experience:
Detect non-copyable types used in interface macro. Such types, specifically with a Drop implementation, can't be used on the ABI/FFI boundary as it violates calling convention rules. This is currently not detected but I suspect we can force a compiler error by checking for copyability.
When declaring an interface to implement with the implement macro, all the necessary features must be enabled both for the interface itself and the implementation trait. I'm hoping we can provide a more helpful error message when features are simply missing, perhaps using the new diagnostics attributes feature.
The
interface
andimplement
macros, while powerful, suffer from the fact that they have no contextual information. They can only parse the tokens provided to them and don't necessarily know what those types and paths refer to. There are two areas where I think we might be able to practically improve upon the existing experience:Detect non-copyable types used in
interface
macro. Such types, specifically with aDrop
implementation, can't be used on the ABI/FFI boundary as it violates calling convention rules. This is currently not detected but I suspect we can force a compiler error by checking for copyability.When declaring an interface to implement with the
implement
macro, all the necessary features must be enabled both for the interface itself and the implementation trait. I'm hoping we can provide a more helpful error message when features are simply missing, perhaps using the new diagnostics attributes feature.