"error: unexpected close delimiter: `]`" in baldrdash's binding.rs when building for x86 Android
Categories
(Core :: JavaScript: WebAssembly, defect)
Tracking
()
People
(Reporter: botond, Unassigned)
Details
I'm trying to build today's m-c for x86 Android, and getting the following error:
19:16.46 error: unexpected close delimiter: `]`
19:16.46 --> /home/botond/dev/projects/mozilla/out-of-tree-objdirs/central-android-x86/i686-linux-android/debug/build/baldrdash-ffff98d0f670c45d/out/bindings.rs:553:32
19:16.46 |
19:16.46 553 | #[derive(Copy, Clone)]; 2usize ] , }#[test]
19:16.46 | ^ unexpected close delimiter
The error persists after a clobber.
| Reporter | ||
Comment 1•7 years ago
|
||
Benjamin, do you know what's going on here? Is this a bug in bindgen where it generates malformed Rust code?
Comment 2•7 years ago
|
||
Hi, sorry I can't investigate as of now; will redirect to other Cranelift/build people, if they get a chance to look at this. Otherwise happy to give a look when I'm back (should be around Jan 24th).
That being said, if there's no errors on other platforms, my gut feelings would indeed lean to a bug in bindgen, but this claim bares no proofs.
Comment 3•7 years ago
|
||
(In reply to Benjamin Bouvier [:bbouvier] (away until Jan 24th) from comment #2)
That being said, if there's no errors on other platforms, my gut feelings would indeed lean to a bug in bindgen, but this claim bares no proofs.
That seems like really bizarre Rust code to generate. I'm inclined to agree with bbouvier, though I'm curious why automation m-c builds aren't seeing this. What version of Rust/LLVM/clang are you using?
Comment 4•7 years ago
|
||
This is a (very old and fixed long-ago) bug in rustfmt. See https://github.com/rust-lang/rust-bindgen/issues/1120.
I don't know which rustfmt version you have in your $PATH, but if it's not failing on the style system then the baldrslash script should probably do something like this:
Which allows you to disable it and such.
Comment 5•7 years ago
|
||
Can you confirm that a patch like:
diff --git a/js/src/wasm/cranelift/build.rs b/js/src/wasm/cranelift/build.rs
index c100aca39c04..d492d0711a0a 100644
--- a/js/src/wasm/cranelift/build.rs
+++ b/js/src/wasm/cranelift/build.rs
@@ -32,6 +32,7 @@ fn main() {
let mut bindings = bindgen::builder()
.disable_name_namespacing()
+ .rustfmt_bindings(false)
// We whitelist the Baldr C functions and get the associated types for free.
.whitelist_function("env_.*")
.whitelist_function("global_.*")
Allows you to build?
Comment 6•7 years ago
|
||
Oh I guess the style system is not generating unions so it just works...
Comment 7•7 years ago
|
||
So my guess is that what's happening is:
- You have a very old rustfmt in $PATH.
- You have rustfmt installed via rustup for the default toolchain, but not for the android one, so when you build for desktop that one's picked and it works.
- But when building for android there's no
~/.cargo/bin/rustfmt, and we use the otherrustfmt, which causes the havoc.
| Reporter | ||
Comment 8•7 years ago
•
|
||
Indeed, a while ago I had played around with rustfmt and had a locally patched version in ~/.cargo/bin.
rustup would tell me things like:
warning: tool rustfmt is already installed, remove it from /home/botond/.cargo/bin, then run rustup update to have rustup manage this tool.
but I didn't pay it much heed, not realizing that it could have side effects like breaking Firefox builds.
Emilio, thanks for the diagnosis! I'm going to close this as invalid.
Description
•