Skip to content
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

library_postprocessing: Don't expect c:type for FixedArray #752

Merged
merged 1 commit into from Apr 25, 2019

Conversation

Projects
None yet
2 participants
@BrainBlasted
Copy link
Contributor

commented Apr 25, 2019

As of https://gitlab.gnome.org/GNOME/gobject-introspection/commit/1f0965e379035be51ae96d5761358ec088fb3421,
fixed-size arrays are no longer generated with c:type, thus
we should not expect it of them.

Fixes #749

@BrainBlasted

This comment has been minimized.

Copy link
Contributor Author

commented Apr 25, 2019

This isn't actually a proper solution, sorry. I just ended up breaking the build at the library stage:

error[E0204]: the trait `Copy` may not be implemented for this type
    --> libdazzle-sys/src/lib.rs:2404:10
     |
2404 | #[derive(Copy, Clone)]
     |          ^^^^
...
2409 |     _truncated_record_marker: c_void,
     |     -------------------------------- this field does not implement `Copy`

Any guidance on how to properly fix #749?

@EPashkin

This comment has been minimized.

Copy link
Member

commented Apr 25, 2019

Try this

+++ b/src/library_postprocessing.rs
@@ -316,8 +316,9 @@ impl Library {
                                 actions.push((tid, fid, Action::SetCType("void*".to_owned())));
                                 continue;
                             }
-                            if let Type::FixedArray(_, _, _) = *field_type {
-                                // fixed-size Arrays should not have c_type.
+                            if let Type::FixedArray(_, _, Some(ref c_type)) = *field_type {
+                                // fixed-size Arrays can only have inner c_type.
+                                actions.push((tid, fid, Action::SetCType(c_type.clone())));
                                 continue;
                             }
                             error!("Field `{}::{}` is missing c:type", name, &field.name);
library_postprocessing: Don't expect c:type for FixedArray
As of https://gitlab.gnome.org/GNOME/gobject-introspection/commit/1f0965e379035be51ae96d5761358ec088fb3421,
fixed-size arrays are no longer generated with c:type, thus
we need to set c_type manually.

Fixes #749

@BrainBlasted BrainBlasted force-pushed the BrainBlasted:fixed-array-ctype branch from 3d61844 to 5295402 Apr 25, 2019

@BrainBlasted

This comment has been minimized.

Copy link
Contributor Author

commented Apr 25, 2019

Thank you! that fixed it.

@EPashkin

This comment has been minimized.

Copy link
Member

commented Apr 25, 2019

@BrainBlasted Thanks

@EPashkin EPashkin merged commit 251be82 into gtk-rs:master Apr 25, 2019

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.