diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2017-01-20 08:59:26 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-20 08:59:26 -0800 |
commit | eade32ed16569806a849e74a395d92a2dbd980a0 (patch) | |
tree | 9100d6ea9892f75700b4a3998cc0252890204139 /components/script/dom/bindings/codegen/CodegenRust.py | |
parent | e6f661c984e4762a91a38d481bd50c0151411079 (diff) | |
parent | 0b9ff576e0ad35c75440ea4953b28fef7f5af4df (diff) | |
download | servo-eade32ed16569806a849e74a395d92a2dbd980a0.tar.gz servo-eade32ed16569806a849e74a395d92a2dbd980a0.zip |
Auto merge of #15099 - servo:phf-no-macros, r=jdm
Remove usage of phf_macros.
It’s a compiler plugin that uses unstable compiler APIs that are not on a path to stabilization.
With this changes, there is one less thing that might break when we update the compiler. For example: https://github.com/sfackler/rust-phf/pull/101
<!-- Please describe your changes on the following line: -->
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [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).
<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15099)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/bindings/codegen/CodegenRust.py')
-rw-r--r-- | components/script/dom/bindings/codegen/CodegenRust.py | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py index 7c084f32400..093f402fa47 100644 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ b/components/script/dom/bindings/codegen/CodegenRust.py @@ -6840,6 +6840,15 @@ class GlobalGenRoots(): ], "\n")), pre="pub flags Globals: u8 {\n", post="\n}") globals_ = CGWrapper(CGIndenter(global_flags), pre="bitflags! {\n", post="\n}") + phf = CGGeneric("include!(concat!(env!(\"OUT_DIR\"), \"/InterfaceObjectMapPhf.rs\"));") + + return CGList([ + CGGeneric(AUTOGENERATED_WARNING_COMMENT), + CGList([imports, globals_, phf], "\n\n") + ]) + + @staticmethod + def InterfaceObjectMapData(config): pairs = [] for d in config.getDescriptors(hasInterfaceObject=True, isInline=False): binding = toBindingNamespace(d.name) @@ -6848,19 +6857,13 @@ class GlobalGenRoots(): pairs.append((ctor.identifier.name, binding, binding)) pairs.sort(key=operator.itemgetter(0)) mappings = [ - CGGeneric('b"%s" => codegen::Bindings::%s::%s::DefineDOMInterface as unsafe fn(_, _),' % pair) + CGGeneric('"%s": "codegen::Bindings::%s::%s::DefineDOMInterface as unsafe fn(_, _)"' % pair) for pair in pairs ] - mapType = "phf::Map<&'static [u8], unsafe fn(*mut JSContext, HandleObject)>" - phf = CGWrapper( - CGIndenter(CGList(mappings, "\n")), - pre="pub static MAP: %s = phf_map! {\n" % mapType, - post="\n};\n") - - return CGList([ - CGGeneric(AUTOGENERATED_WARNING_COMMENT), - CGList([imports, globals_, phf], "\n\n") - ]) + return CGWrapper( + CGList(mappings, ",\n"), + pre="{\n", + post="\n}\n") @staticmethod def PrototypeList(config): |