Skip to content

Commit adc0db1

Browse files
committed
generator: Mark QNX c_void types as opaque to get raw pointers
Long ago in #339 I added "opaque" types to ensure that pointers to it stay as pointers in FFI rather than get converted to `&mut` borrows which don't carry the load of an arbitrary pointer value to "something unknown" (= opaque). When the QNX types were added in #429 and #760 some time later, they weren't added to this list and turned into borrows making them impossible to be handled safely in user code.
1 parent 5916329 commit adc0db1

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

ash/src/vk/definitions.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9264,12 +9264,12 @@ impl<'a> ScreenSurfaceCreateInfoQNX<'a> {
92649264
self
92659265
}
92669266
#[inline]
9267-
pub fn context(mut self, context: &'a mut _screen_context) -> Self {
9267+
pub fn context(mut self, context: *mut _screen_context) -> Self {
92689268
self.context = context;
92699269
self
92709270
}
92719271
#[inline]
9272-
pub fn window(mut self, window: &'a mut _screen_window) -> Self {
9272+
pub fn window(mut self, window: *mut _screen_window) -> Self {
92739273
self.window = window;
92749274
self
92759275
}
@@ -56278,7 +56278,7 @@ unsafe impl<'a> TaggedStructure for ImportScreenBufferInfoQNX<'a> {
5627856278
unsafe impl ExtendsMemoryAllocateInfo for ImportScreenBufferInfoQNX<'_> {}
5627956279
impl<'a> ImportScreenBufferInfoQNX<'a> {
5628056280
#[inline]
56281-
pub fn buffer(mut self, buffer: &'a mut _screen_buffer) -> Self {
56281+
pub fn buffer(mut self, buffer: *mut _screen_buffer) -> Self {
5628256282
self.buffer = buffer;
5628356283
self
5628456284
}

generator/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,9 @@ fn is_opaque_type(ty: &str) -> bool {
290290
| "CAMetalLayer"
291291
| "IDirectFB"
292292
| "IDirectFBSurface"
293+
| "_screen_buffer"
294+
| "_screen_context"
295+
| "_screen_window"
293296
)
294297
}
295298

0 commit comments

Comments
 (0)