Closed Bug 1535486 Opened 6 years ago Closed 6 years ago

Array<octet> doesn't come out as expected in rust xpidl bindings

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla68
Tracking Status
firefox68 --- fixed

People

(Reporter: keeler, Assigned: nika)

References

Details

Attachments

(2 files)

If I declare something in an idl like:

void passArrayOfOctets(in Array<octet> arr);

and then I want to implement this in rust, the function I have to implement is:

unsafe fn PassArrayOfOctets(&self, arr: *const ThinVec<*mut u8>) -> nsresult {

I would expect this to be:

unsafe fn PassArrayOfOctets(&self, arr: *const ThinVec<u8>) -> nsresult {

If I actually attempt to use arr as its declared type, gecko crashes. If I cast it to essentially be the type I'm expecting, it seems to work. I've attached a gtest I mocked up that demonstrates this.

Nika, is this how this is supposed to work? Or is there an underlying issue I'm not aware of here?

Flags: needinfo?(nika)

Yup, this is a bug in the codegen, my bad! The types we're generating on the Rust side are wrong. I'll put up a patch to fix this inconsistency.

Assignee: nobody → nika
Flags: needinfo?(nika)
Pushed by nlayzell@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/36f24a4ffdd6 Handle the element type correctly with rust XPCOM types, r=mccr8
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: