From 22db4b482347338faf59ea4cb0aeab57324fd6a4 Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Mon, 15 May 2017 16:45:01 -0400 Subject: [PATCH] provide more information when bindgen fails Providing the flags we passed into clang can be informative for double-checking that we set everything up correctly. --- components/style/build_gecko.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/components/style/build_gecko.rs b/components/style/build_gecko.rs index 8c4b852290a..34502469141 100644 --- a/components/style/build_gecko.rs +++ b/components/style/build_gecko.rs @@ -250,7 +250,14 @@ mod bindings { return; } } - let mut result = builder.generate().expect("Unable to generate bindings").to_string(); + let command_line_opts = builder.command_line_flags(); + let result = builder.generate(); + let mut result = match result { + Ok(bindings) => bindings.to_string(), + Err(_) => { + panic!("Failed to generate bindings, flags: {:?}", command_line_opts); + }, + }; for fixup in fixups.iter() { result = Regex::new(&format!(r"\b{}\b", fixup.pat)).unwrap().replace_all(&result, fixup.rep.as_str()) .into_owned().into();