# HG changeset patch # User Simon Sapin # Date 1547211824 -3600 # Node ID f63ebd7e9e281f22e71c268151337178de2c246a # Parent 4f2e84dc490dbbac2a35799b6b9230c105f2cd35 Bug 1519729 - Document public macros. r=emilio Undocumented public macros emit warnings in nightly-2019-01-11, and we #![deny] that warning. Cherry-picks a commit from https://github.com/servo/servo/pull/22674 diff --git a/servo/components/style/properties/properties.mako.rs b/servo/components/style/properties/properties.mako.rs --- a/servo/components/style/properties/properties.mako.rs +++ b/servo/components/style/properties/properties.mako.rs @@ -3816,17 +3816,24 @@ impl AliasId { % for property in data.all_aliases(): AliasId::${property.camel_case} => "${property.camel_case}", % endfor }; formatter.write_str(name) } } -// NOTE(emilio): Callers are responsible to deal with prefs. +/// Call the given macro with tokens like this for each longhand and shorthand properties +/// that is enabled in content: +/// +/// ``` +/// [CamelCaseName, SetCamelCaseName, PropertyId::Longhand(LonghandId::CamelCaseName)], +/// ``` +/// +/// NOTE(emilio): Callers are responsible to deal with prefs. #[macro_export] macro_rules! css_properties_accessors { ($macro_name: ident) => { $macro_name! { % for kind, props in [("Longhand", data.longhands), ("Shorthand", data.shorthands)]: % for property in props: % if property.enabled_in_content(): % for name in [property.name] + property.alias: @@ -3839,16 +3846,24 @@ macro_rules! css_properties_accessors { % endfor % endif % endfor % endfor } } } +/// Call the given macro with tokens like this for each longhand properties: +/// +/// ``` +/// { snake_case_ident, true } +/// ``` +/// +/// … where the boolean indicates whether the property value type +/// is wrapped in a `Box<_>` in the corresponding `PropertyDeclaration` variant. #[macro_export] macro_rules! longhand_properties_idents { ($macro_name: ident) => { $macro_name! { % for property in data.longhands: { ${property.ident}, ${"true" if property.boxed else "false"} } % endfor } # HG changeset patch # User Emilio Cobos Álvarez # Date 1547412158 -3600 # Node ID 1a1d8b9f1a3ab704ab277407823f6f42dd63a3d4 # Parent a2f691714d70fa6a9119503270809fa0eb8df6c6 Bug 1519629 - Document a few more macros. --- firefox-60.6.1/servo/components/style/properties/properties.mako.rs.orig 2019-03-22 06:01:07.000000000 +0100 +++ firefox-60.6.1/servo/components/style/properties/properties.mako.rs 2019-04-14 12:19:55.687706977 +0200 @@ -55,6 +55,7 @@ pub use self::declaration_block::*; +/// doc stub #[cfg(feature = "gecko")] #[macro_export] macro_rules! property_name { --- firefox-60.8.0/servo/components/style_traits/values.rs.orig 2019-07-09 22:38:09.837119875 +0200 +++ firefox-60.8.0/servo/components/style_traits/values.rs 2019-07-09 22:40:59.863527104 +0200 @@ -135,6 +135,7 @@ } } +/// dummy #[macro_export] macro_rules! serialize_function { ($dest: expr, $name: ident($( $arg: expr, )+)) => { @@ -404,6 +405,7 @@ impl_to_css_for_predefined_type!(::cssparser::Color); impl_to_css_for_predefined_type!(::cssparser::UnicodeRange); +/// dummy #[macro_export] macro_rules! define_css_keyword_enum { (pub enum $name:ident { $($variant:ident = $css:expr,)+ }) => {