From b9f974ab334d917b1b79aaa5f1f83e6f727c5bbd Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Thu, 20 Nov 2014 00:02:05 -0400 Subject: [PATCH 1/2] No longer need for local variable in PropertyDeclaration::parse --- components/style/properties/mod.rs.mako | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/components/style/properties/mod.rs.mako b/components/style/properties/mod.rs.mako index 2511f093e32..760dd2040e9 100644 --- a/components/style/properties/mod.rs.mako +++ b/components/style/properties/mod.rs.mako @@ -1615,9 +1615,7 @@ impl PropertyDeclaration { result_list: &mut Vec, base_url: &Url, seen: &mut PropertyBitField) -> PropertyDeclarationParseResult { - // FIXME: local variable to work around Rust #10683 - let name_lower = name.as_slice().to_ascii_lower(); - match name_lower.as_slice() { + match name.to_ascii_lower().as_slice() { % for property in LONGHANDS: % if property.derived_from is None: "${property.name}" => { From 6f2af793e8d0038080f00b3fa161261243e32af8 Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Fri, 21 Nov 2014 10:45:35 -0400 Subject: [PATCH 2/2] Arc::make_unique is now stable --- components/style/properties/mod.rs.mako | 28 +++++++------------------ 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/components/style/properties/mod.rs.mako b/components/style/properties/mod.rs.mako index 760dd2040e9..dabf5452c9b 100644 --- a/components/style/properties/mod.rs.mako +++ b/components/style/properties/mod.rs.mako @@ -1893,20 +1893,6 @@ fn initial_writing_mode_is_empty() { assert_eq!(get_writing_mode(INITIAL_VALUES.get_inheritedbox()), WritingMode::empty()) } - -/// This only exists to limit the scope of #[allow(experimental)] -/// FIXME: remove this when Arc::make_unique() is not experimental anymore. -trait ArcExperimental { - fn make_unique_experimental<'a>(&'a mut self) -> &'a mut T; -} -impl ArcExperimental for Arc { - #[inline] - #[allow(experimental)] - fn make_unique_experimental<'a>(&'a mut self) -> &'a mut T { - self.make_unique() - } -} - /// Fast path for the function below. Only computes new inherited styles. #[allow(unused_mut)] fn cascade_with_cached_declarations(applicable_declarations: &[DeclarationBlock], @@ -1957,7 +1943,7 @@ fn cascade_with_cached_declarations(applicable_declarations: &[DeclarationBlock] .clone() } }; - style_${style_struct.ident}.make_unique_experimental() + style_${style_struct.ident}.make_unique() .${property.ident} = computed_value; % endif @@ -1969,7 +1955,7 @@ fn cascade_with_cached_declarations(applicable_declarations: &[DeclarationBlock] % endif % for derived in DERIVED_LONGHANDS[property.name]: style_${derived.style_struct.ident} - .make_unique_experimental() + .make_unique() .${derived.ident} = longhands::${derived.ident} ::derive_from_${property.ident}( @@ -2163,13 +2149,13 @@ pub fn cascade(applicable_declarations: &[DeclarationBlock], .clone() } }; - style_${style_struct.ident}.make_unique_experimental() + style_${style_struct.ident}.make_unique() .${property.ident} = computed_value; % if property.name in DERIVED_LONGHANDS: % for derived in DERIVED_LONGHANDS[property.name]: style_${derived.style_struct.ident} - .make_unique_experimental() + .make_unique() .${derived.ident} = longhands::${derived.ident} ::derive_from_${property.ident}( @@ -2191,7 +2177,7 @@ pub fn cascade(applicable_declarations: &[DeclarationBlock], // The initial value of border-*-width may be changed at computed value time. { - let border = style_border.make_unique_experimental(); + let border = style_border.make_unique(); % for side in ["top", "right", "bottom", "left"]: // Like calling to_computed_value, which wouldn't type check. if !context.border_${side}_present { @@ -2202,7 +2188,7 @@ pub fn cascade(applicable_declarations: &[DeclarationBlock], // The initial value of display may be changed at computed value time. if !seen.get_display() { - let box_ = style_box_.make_unique_experimental(); + let box_ = style_box_.make_unique(); box_.display = longhands::display::to_computed_value(box_.display, &context); } @@ -2236,7 +2222,7 @@ pub fn cascade_anonymous(parent_style: &ComputedValues) -> ComputedValues { writing_mode: parent_style.writing_mode, }; { - let border = result.border.make_unique_experimental(); + let border = result.border.make_unique(); % for side in ["top", "right", "bottom", "left"]: // Like calling to_computed_value, which wouldn't type check. border.border_${side}_width = Au(0);