servo: Merge #16880 - provide more information when bindgen fails (from froydnj:bindgen-informative-failure); r=emilio

Providing the flags we passed into clang can be informative for double-checking that we set everything up correctly.

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

Source-Repo: https://github.com/servo/servo
Source-Revision: 0388e11db2532d41a71e184cb2a1f46e5107b8f5

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 54d3739a0fc67886697020d38fadddb049631b4c
This commit is contained in:
Nathan Froyd 2017-05-16 07:19:53 -05:00
Родитель a38062c7e5
Коммит f13a8dc7cc
1 изменённых файлов: 8 добавлений и 1 удалений

Просмотреть файл

@ -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();