-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Non public QObject struct has non obvious error message #457
Labels
Comments
ahayzen-kdab
added a commit
to ahayzen-kdab/cxx-qt
that referenced
this issue
Mar 1, 2023
Before this patch if you didn't mark a qobject struct as private the following error would occur. ``` [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] | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` After this patch the error is explicit. ``` [build] error: qobject marked structs must be public [build] --> examples/qml_minimal/rust/src/cxxqt_object.rs:24:5 [build] | [build] 24 | struct MyObject { [build] | ^^^^^^ ``` Closes KDAB#457
ahayzen-kdab
added a commit
to ahayzen-kdab/cxx-qt
that referenced
this issue
Mar 1, 2023
Before this patch if you didn't mark a qobject struct as private the following error would occur. ``` [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] | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` After this patch the error is explicit. ``` [build] error: qobject marked structs must be public [build] --> examples/qml_minimal/rust/src/cxxqt_object.rs:24:5 [build] | [build] 24 | struct MyObject { [build] | ^^^^^^ ``` Closes KDAB#457
ahayzen-kdab
added a commit
to ahayzen-kdab/cxx-qt
that referenced
this issue
Mar 2, 2023
Before this patch if you didn't mark a qobject struct as public the following error would occur. ``` [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] | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` After this patch the error is explicit. ``` [build] error: qobject marked structs must be public [build] --> examples/qml_minimal/rust/src/cxxqt_object.rs:24:5 [build] | [build] 24 | struct MyObject { [build] | ^^^^^^ ``` Closes KDAB#457
ahayzen-kdab
added a commit
that referenced
this issue
Mar 2, 2023
Before this patch if you didn't mark a qobject struct as public the following error would occur. ``` [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] | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` After this patch the error is explicit. ``` [build] error: qobject marked structs must be public [build] --> examples/qml_minimal/rust/src/cxxqt_object.rs:24:5 [build] | [build] 24 | struct MyObject { [build] | ^^^^^^ ``` Closes #457
przempore
pushed a commit
to przempore/cxx-qt
that referenced
this issue
Mar 15, 2023
Before this patch if you didn't mark a qobject struct as public the following error would occur. ``` [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] | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` After this patch the error is explicit. ``` [build] error: qobject marked structs must be public [build] --> examples/qml_minimal/rust/src/cxxqt_object.rs:24:5 [build] | [build] 24 | struct MyObject { [build] | ^^^^^^ ``` Closes KDAB#457
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
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 importpub use self::cxx_qt_ffi::*;
has failed to reexport the QObject as it was not public.Our options seem to be
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)pub
even if the developer doesn't (might be odd?)The text was updated successfully, but these errors were encountered: