Missing impl Constructor<()> for ... {}
in the bridge silently fails
#1233
Labels
⏮️ backport-candidate
Change which could be backported to the stable series
🤔 discussion
Feedback welcome
If you miss adding the
impl Constructor for ...
shim trait impl in the bridge, but implement the trait outside the bridge, you don't get a warning, CXX-Qt will just skip using your constructor.This is especially bad in combination with
cxx_qt::Initialize
, as that requires you to declare a default constructor, which you also get if you don't add the declaration, but the one generated by CXX-Qt won't actually call yourinitialize
function.Idea to remedy this
We could introduce a new trait:
ConstructorDeclaration<()>
(name TBD), whereConstructor
requiresConstructorDeclaration
.And ConstructorDeclaration would only be implemented by the bridge if you add
impl Constructor<()> for ... {}
.That way you would get a compiler error if you implement the Constructor or Initialize trait without declaring it in the bridge.
The text was updated successfully, but these errors were encountered: