Skip to content

Commit

Permalink
style: Add a special list for cbindgen types to avoid generating redu…
Browse files Browse the repository at this point in the history
…ndant rust types.

We will blacklist this type and add a module raw line to map the gecko
type to its rust type (as an alias).

Differential Revision: https://phabricator.services.mozilla.com/D10303
  • Loading branch information
BorisChiou authored and emilio committed Nov 5, 2018
1 parent 8bc8a0b commit b00bbb3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions components/style/build_gecko.rs
Expand Up @@ -392,6 +392,12 @@ mod bindings {
.handle_str_items("whitelist-vars", |b, item| b.whitelist_var(item))
.handle_str_items("whitelist-types", |b, item| b.whitelist_type(item))
.handle_str_items("opaque-types", |b, item| b.opaque_type(item))
.handle_table_items("cbindgen-types", |b, item| {
let gecko = item["gecko"].as_str().unwrap();
let servo = item["servo"].as_str().unwrap();
let line = format!("pub use {} as {};", servo, gecko.rsplit("::").next().unwrap());
b.blacklist_type(gecko).module_raw_line("root::mozilla", line)
})
.handle_table_items("mapped-generic-types", |builder, item| {
let generic = item["generic"].as_bool().unwrap();
let gecko = item["gecko"].as_str().unwrap();
Expand Down

0 comments on commit b00bbb3

Please sign in to comment.