Closed
Description
As part of looking into #38 I found that if you don't mark the QObject struct in Rust as public you get a non obvious warning.
[build] error[E0432]: unresolved import `super`
[build] --> examples/qml_minimal/rust/src/cxxqt_object.rs:24:12
[build] |
[build] 24 | struct MyObject {
[build] | ^^^^^^^^ no `MyObject` in `cxxqt_object`
[build] |
[build] help: consider importing this type alias instead
[build] |
[build] 24 | struct crate::cxxqt_object::qobject::MyObject;
[build] | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This happens because we put the QObject struct into a child module, then in the CXX module it has a type MyObject
where it looks in the parent module for the QObject, but the import pub use self::cxx_qt_ffi::*;
has failed to reexport the QObject as it was not public.
Our options seem to be
- Fail in the parser if the QObject struct is not
pub
with a nicer error message (this is also potentially a candidate then to go into the checks phase (WIP: cxx-qt-gen: add checks phase #213) if we ever create it with the potential refactor of the parser phase to be a true syn Parse) - Implicitly mark all our QObject structs as
pub
even if the developer doesn't (might be odd?)