You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think there may be a rustc bug causing the error message to show the wrong span of source, and a bindgen bug causing an invalid cast to be emitted. It would help to look at the generated jsapi.rs file to see what u64 value is cast to [u32; 2] with the as operator and why.
Yeah, this is because uint64_t is 4-byte aligned in that arch. This is a bindgen bug since it's not supposed to care about alignment in this case, but I couldn't repro with:
structTable
{
unsigned long longfoo: 56;
unsigned long longbar: 8;
};
Which generates the following for ./target/debug/bindgen test.h -- -x c++ --target=android-i686:
which includes the foo and bar methods that cause the problem. These methods aren't generated by the command-line bindgen, but apparently are when servo uses bindgen. Is there a flag to bindgen to get it to treat a type as a bitfield rather than an opaque.
Also, the opaque type generated is [u32; 2usize] which looks wrong to me, shouldn't it be [u32; 4usize]?
Activity
paulrouget commentedon Jun 25, 2018
Message appeared after 2544db1
paulrouget commentedon Jun 25, 2018
@asajeffrey @jdm is away. Maybe you can help.
[-]mozjs_sys + target=android=i686: Rust compilation error [/-][+]mozjs_sys + target=android-i686: Rust compilation error [/+]SimonSapin commentedon Jun 25, 2018
I think there may be a rustc bug causing the error message to show the wrong span of source, and a bindgen bug causing an invalid cast to be emitted. It would help to look at the generated
jsapi.rsfile to see whatu64value is cast to[u32; 2]with theasoperator and why.paulrouget commentedon Jun 25, 2018
Not sure where this is failing. Can't find an obvious culprit: https://gist.github.com/paulrouget/1700b9da726208d4022f1fe2e4ecb610
asajeffrey commentedon Jun 25, 2018
Does mach build --android work?
asajeffrey commentedon Jun 25, 2018
Also, you may be picking up an old jsapi.rs, try removing it and see if that helps.
SimonSapin commentedon Jun 25, 2018
asajeffrey commentedon Jun 25, 2018
Which in my copy of jsapi.rs (generated on and for linux) is:
@emilio any ideas what's going on here?
emilio commentedon Jun 25, 2018
Yeah, this is because uint64_t is 4-byte aligned in that arch. This is a bindgen bug since it's not supposed to care about alignment in this case, but I couldn't repro with:
Which generates the following for
./target/debug/bindgen test.h -- -x c++ --target=android-i686:So a test-case for this would be extremely helpful.
Fix integer_type to actually return integers all the time.
emilio commentedon Jun 25, 2018
https://searchfox.org/mozilla-central/rev/39b790b29543a4718d876d8ca3fd179d82fc24f7/js/public/HashTable.h#1224 is the relevant data structure if I'm not wrong... rust-lang/rust-bindgen#1339 is a potential fix for this, though a repro would be nice.
asajeffrey commentedon Jun 28, 2018
@emilio Hmm, running test.h through bindgen without the
--targetflag produces:which includes the
fooandbarmethods that cause the problem. These methods aren't generated by the command-line bindgen, but apparently are when servo uses bindgen. Is there a flag to bindgen to get it to treat a type as a bitfield rather than an opaque.Also, the opaque type generated is
[u32; 2usize]which looks wrong to me, shouldn't it be[u32; 4usize]?asajeffrey commentedon Jun 28, 2018
Looks like we can work round this, by declaring
js::detail::HashTable.*to be opaque. I'll submit a PR doing this.asajeffrey commentedon Jun 28, 2018
I have a branch with the workaround: https://github.com/asajeffrey/mozjs/tree/opaque-hashtable
@paul: can you check to see if using this fixes your problem?
asajeffrey commentedon Jun 28, 2018
Submitted workaround PR servo/mozjs#141
Auto merge of #141 - asajeffrey:opaque-hashtable, r=nox
paulrouget commentedon Jun 29, 2018
@asajeffrey this fixes it! Thank you.
Auto merge of #21102 - asajeffrey:mozjs-sys-0.51.3, r=SimonSapin
Auto merge of #21102 - asajeffrey:mozjs-sys-0.51.3, r=mbrubeck
Auto merge of #21102 - asajeffrey:mozjs-sys-0.51.3, r=SimonSapin
Fix integer_type to actually return integers all the time.
Auto merge of #1339 - emilio:bitfield-int, r=fitzgen
Auto merge of #141 - asajeffrey:opaque-hashtable, r=nox