mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
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 -->
This commit is contained in:
commit
eade32ed16
7 changed files with 59 additions and 26 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue