Commit f81233ea authored by Emilio Cobos Álvarez's avatar Emilio Cobos Álvarez
Browse files

Bug 1585099 - Update cssparser on ESR68 to 0.25.5 to avoid warning that became...

Bug 1585099 - Update cssparser on ESR68 to 0.25.5 to avoid warning that became a hard error. r=heycam, a=RyanVM

The changes look big because of the reformatting, but this should be ok, I'd
think.

I could've manually cherry-picked the particular fix and used [patch] or
something, but the particular commit didn't apply cleanly and I think it's
better to just update to a published version.

Differential Revision: https://phabricator.services.mozilla.com/D47796
parent d74b297d
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -736,7 +736,7 @@ dependencies = [

[[package]]
name = "cssparser"
version = "0.25.3"
version = "0.25.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
 "cssparser-macros 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1204,7 +1204,7 @@ name = "geckoservo"
version = "0.0.1"
dependencies = [
 "atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "cssparser 0.25.3 (registry+https://github.com/rust-lang/crates.io-index)",
 "cssparser 0.25.5 (registry+https://github.com/rust-lang/crates.io-index)",
 "cstr 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
 "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)",
 "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1681,7 +1681,7 @@ name = "malloc_size_of"
version = "0.0.1"
dependencies = [
 "app_units 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "cssparser 0.25.3 (registry+https://github.com/rust-lang/crates.io-index)",
 "cssparser 0.25.5 (registry+https://github.com/rust-lang/crates.io-index)",
 "euclid 0.19.5 (registry+https://github.com/rust-lang/crates.io-index)",
 "hashglobe 0.1.0",
 "selectors 0.21.0",
@@ -2667,7 +2667,7 @@ name = "selectors"
version = "0.21.0"
dependencies = [
 "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
 "cssparser 0.25.3 (registry+https://github.com/rust-lang/crates.io-index)",
 "cssparser 0.25.5 (registry+https://github.com/rust-lang/crates.io-index)",
 "derive_more 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
 "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2884,7 +2884,7 @@ dependencies = [
 "bindgen 0.49.1 (registry+https://github.com/rust-lang/crates.io-index)",
 "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
 "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
 "cssparser 0.25.3 (registry+https://github.com/rust-lang/crates.io-index)",
 "cssparser 0.25.5 (registry+https://github.com/rust-lang/crates.io-index)",
 "derive_more 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "euclid 0.19.5 (registry+https://github.com/rust-lang/crates.io-index)",
 "fallible 0.0.1",
@@ -2946,7 +2946,7 @@ version = "0.0.1"
dependencies = [
 "app_units 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
 "cssparser 0.25.3 (registry+https://github.com/rust-lang/crates.io-index)",
 "cssparser 0.25.5 (registry+https://github.com/rust-lang/crates.io-index)",
 "euclid 0.19.5 (registry+https://github.com/rust-lang/crates.io-index)",
 "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "malloc_size_of 0.0.1",
@@ -2962,7 +2962,7 @@ name = "stylo_tests"
version = "0.0.1"
dependencies = [
 "atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "cssparser 0.25.3 (registry+https://github.com/rust-lang/crates.io-index)",
 "cssparser 0.25.5 (registry+https://github.com/rust-lang/crates.io-index)",
 "cstr 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
 "env_logger 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
 "geckoservo 0.0.1",
@@ -3137,7 +3137,7 @@ dependencies = [
name = "to_shmem"
version = "0.0.1"
dependencies = [
 "cssparser 0.25.3 (registry+https://github.com/rust-lang/crates.io-index)",
 "cssparser 0.25.5 (registry+https://github.com/rust-lang/crates.io-index)",
 "servo_arc 0.1.1",
 "smallbitvec 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
 "smallvec 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -3807,7 +3807,7 @@ dependencies = [
"checksum crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2760899e32a1d58d5abb31129f8fae5de75220bc2176e77ff7c627ae45c918d9"
"checksum crossbeam-utils 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d636a8b3bcc1b409d7ffd3facef8f21dcb4009626adbd0c5e6c4305c07253c7b"
"checksum crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "41ee4864f4797060e52044376f7d107429ce1fb43460021b126424b7180ee21a"
"checksum cssparser 0.25.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ba1ab4e1814be64bf6b6064ff532db0e34087f11b37706d6c96a21d32478761d"
"checksum cssparser 0.25.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e06795910fc2f585a75bdc9690fbcc51e83519f07b6eb981db43944643c04933"
"checksum cssparser-macros 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f3a5383ae18dbfdeb569ed62019f5bddb2a95cd2d3833313c475a0d014777805"
"checksum cstr 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b6557bdb1dc9647eae1cf7f5601b14cd45fc3c7ccf2df618387416fe542da6ea"
"checksum cstr-macros 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0472c17c83d3ec1af32fb6ee2b3ad56ae0b6e69355d63d1d30602055c34324a8"
+1 −1
Original line number Diff line number Diff line
{"files":{"Cargo.toml":"150d450e43bcb9e523941408be883997ecffce7ff5f224329372edfe56334a55","LICENSE":"fab3dd6bdab226f1c08630b1dd917e11fcb4ec5e1e020e2c16f83a0a13863e85","README.md":"b9d6c5dc56ccc267db9e0e2389061dc2524daefa4baed88b36c98efc7a51c2a9","build.rs":"310d6d7b1931ff783a8aa1a4c6baee87b4c9130c858e4694ef69cc96df5e38dc","build/match_byte.rs":"6f7ec4235c9f2da403ea0be9339661ecd8e1f5e1c788cf88a41448b1080c59b8","docs/404.html":"025861f76f8d1f6d67c20ab624c6e418f4f824385e2dd8ad8732c4ea563c6a2e","docs/index.html":"025861f76f8d1f6d67c20ab624c6e418f4f824385e2dd8ad8732c4ea563c6a2e","src/color.rs":"43f996fbd8da54bd8ffa870f5e3610e5ba6e61543f92a129fa6c850e9b10db7e","src/cow_rc_str.rs":"541216f8ef74ee3cc5cbbc1347e5f32ed66588c401851c9a7d68b867aede1de0","src/from_bytes.rs":"331fe63af2123ae3675b61928a69461b5ac77799fff3ce9978c55cf2c558f4ff","src/lib.rs":"a474ee88ef8f73fcb7b7272d426e5eafb4ad10d104797a5a188d1676c8180972","src/macros.rs":"adb9773c157890381556ea83d7942dcc676f99eea71abbb6afeffee1e3f28960","src/nth.rs":"5c70fb542d1376cddab69922eeb4c05e4fcf8f413f27563a2af50f72a47c8f8c","src/parser.rs":"22067562160a1294fa92779b66c25cbccf259a2ef7dcf687c791fecdd020ce7f","src/rules_and_declarations.rs":"622ce07c117a511d40ce595602d4f4730659a59273388f28553d1a2b0fac92ce","src/serializer.rs":"3e2dfc60613f885cb6f99abfc854fde2a1e00de507431bd2e51178b61abfd69b","src/size_of_tests.rs":"385a0d77fbd6f86cb8013fd8d7541886980876a9da1da714bf175954c0e726cf","src/tests.rs":"9d08b3943d453664e01d58e307f79345e240f9f9ce6f8d36a842eff37155563e","src/tokenizer.rs":"adcf5811955e8df57a519e3d1e44fe3afeb5afeb1076daeb8d36fed1abcf1327","src/unicode_range.rs":"ae159d2ebe4123a6666e18dc0362f89b475240a6b7ed5fb6fe21b9e7a4139da8"},"package":"ba1ab4e1814be64bf6b6064ff532db0e34087f11b37706d6c96a21d32478761d"}
 No newline at end of file
{"files":{"Cargo.toml":"26e11f3e55baf0de8784dc3ec88771411ceae587c64e162fed3939b87c3cc591","LICENSE":"fab3dd6bdab226f1c08630b1dd917e11fcb4ec5e1e020e2c16f83a0a13863e85","README.md":"b9d6c5dc56ccc267db9e0e2389061dc2524daefa4baed88b36c98efc7a51c2a9","build.rs":"08e4a99d5184b2f22ab93bc0a024fec18dbd8fd38b9db638f19d4defede858ee","build/match_byte.rs":"e8537833ff1599a1bdbd0167f6295af7bd21e42024f32b982af32d58c156685c","docs/404.html":"025861f76f8d1f6d67c20ab624c6e418f4f824385e2dd8ad8732c4ea563c6a2e","docs/index.html":"025861f76f8d1f6d67c20ab624c6e418f4f824385e2dd8ad8732c4ea563c6a2e","src/color.rs":"8d3017ba8d644172908bd80d35e9be1081db477d2e0b0ea13971e29a466d451f","src/cow_rc_str.rs":"89b5dff5cf80eef3fcff0c11799e54a978d02d8b8963a621fbb999d35e7c03a3","src/from_bytes.rs":"b1cf15c4e975523fef46b575598737a39f3c63e5ce0b2bfd6ec627c69c6ea54a","src/lib.rs":"98b28ca7c72b8d20b3d76ae5b841be87bcadfc89e433ecc95fcf37aa15731442","src/macros.rs":"a50a0a7afa43e099dc008e54956e4c1fdfba2e9795d006b22e9eb45065fed61e","src/nth.rs":"a9d5fa0bd2c3ae7c48c851b9f5508ebdb07affdf5d0737bb8d85a7befab2ef9c","src/parser.rs":"fe2eb2be084923bf362de4b95c029beb21f172ad972a6452c400f640b43a583e","src/rules_and_declarations.rs":"712a5e893169e715bbcd18aac87a18ae728dc6bb922e79b237d34ce7a4548fcf","src/serializer.rs":"151305364cb1f20ea2dc0b3ebfbb77937e616ef4441d5dd3c9abda232f79a7af","src/size_of_tests.rs":"a628cacc876f240ac1bb9e287cdae293bffc4b86d45d9307e4fc2f822e8f3e84","src/tests.rs":"bf97071b691c0b0c932af5813e876142ce707ba57774742dbe60889b1dc54069","src/tokenizer.rs":"0450c38d140382161408a8fca5aac343f5a9405603234095dccd93f680831cb7","src/unicode_range.rs":"c4655c817db0dabb1d55669ac61a56ecf7f6a6c4353cf5b539b13bea6511c3dd"},"package":"e06795910fc2f585a75bdc9690fbcc51e83519f07b6eb981db43944643c04933"}
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@

[package]
name = "cssparser"
version = "0.25.3"
version = "0.25.5"
authors = ["Simon Sapin <simon.sapin@exyr.org>"]
build = "build.rs"
exclude = ["src/css-parsing-tests/**", "src/big-data-url.css"]
+6 −3
Original line number Diff line number Diff line
@@ -33,9 +33,12 @@ mod codegen {
        println!("cargo:rerun-if-changed={}", input.display());

        // We have stack overflows on Servo's CI.
        let handle = Builder::new().stack_size(128 * 1024 * 1024).spawn(move || {
        let handle = Builder::new()
            .stack_size(128 * 1024 * 1024)
            .spawn(move || {
                match_byte::expand(&input, &output);
        }).unwrap();
            })
            .unwrap();

        handle.join().unwrap();
    }
+31 −21
Original line number Diff line number Diff line
@@ -12,18 +12,27 @@ use syn::parse::{Parse, ParseStream, Result};

use proc_macro2::{Span, TokenStream};

struct MatchByteParser {
}
struct MatchByteParser {}

pub fn expand(from: &Path, to: &Path) {
    let mut source = String::new();
    File::open(from).unwrap().read_to_string(&mut source).unwrap();
    File::open(from)
        .unwrap()
        .read_to_string(&mut source)
        .unwrap();
    let ast = syn::parse_file(&source).expect("Parsing rules.rs module");
    let mut m = MatchByteParser {};
    let ast = m.fold_file(ast);

    let code = ast.into_token_stream().to_string().replace("{ ", "{\n").replace(" }", "\n}");
    File::create(to).unwrap().write_all(code.as_bytes()).unwrap();
    let code = ast
        .into_token_stream()
        .to_string()
        .replace("{ ", "{\n")
        .replace(" }", "\n}");
    File::create(to)
        .unwrap()
        .write_all(code.as_bytes())
        .unwrap();
}

struct MatchByte {
@@ -45,7 +54,7 @@ impl Parse for MatchByte {
                    arms.push(input.call(syn::Arm::parse)?);
                }
                arms
            }
            },
        })
    }
}
@@ -55,16 +64,14 @@ fn get_byte_from_expr_lit(expr: &Box<syn::Expr>) -> u8 {
        syn::Expr::Lit(syn::ExprLit { ref lit, .. }) => {
            if let syn::Lit::Byte(ref byte) = *lit {
                byte.value()
            }
            else {
            } else {
                panic!("Found a pattern that wasn't a byte")
            }
        },
        }
        _ => unreachable!(),
    }
}


/// Expand a TokenStream corresponding to the `match_byte` macro.
///
/// ## Example
@@ -98,7 +105,7 @@ fn expand_match_byte(body: &TokenStream) -> syn::Expr {
                    if table[value as usize] == 0 {
                        table[value as usize] = case_id as u8;
                    }
                },
                }
                &syn::Pat::Range(syn::PatRange { ref lo, ref hi, .. }) => {
                    let lo = get_byte_from_expr_lit(lo);
                    let hi = get_byte_from_expr_lit(hi);
@@ -110,14 +117,14 @@ fn expand_match_byte(body: &TokenStream) -> syn::Expr {
                    if table[hi as usize] == 0 {
                        table[hi as usize] = case_id as u8;
                    }
                },
                }
                &syn::Pat::Wild(_) => {
                    for byte in table.iter_mut() {
                        if *byte == 0 {
                            *byte = case_id as u8;
                        }
                    }
                },
                }
                &syn::Pat::Ident(syn::PatIdent { ref ident, .. }) => {
                    assert_eq!(wildcard, None);
                    wildcard = Some(ident);
@@ -126,7 +133,7 @@ fn expand_match_byte(body: &TokenStream) -> syn::Expr {
                            *byte = case_id as u8;
                        }
                    }
                },
                }
                _ => {
                    panic!("Unexpected pattern: {:?}. Buggy code ?", pat);
                }
@@ -161,9 +168,12 @@ impl Fold for MatchByteParser {
        match stmt {
            syn::Stmt::Item(syn::Item::Macro(syn::ItemMacro { ref mac, .. })) => {
                if mac.path == parse_quote!(match_byte) {
                    return syn::fold::fold_stmt(self, syn::Stmt::Expr(expand_match_byte(&mac.tts)))
                    return syn::fold::fold_stmt(
                        self,
                        syn::Stmt::Expr(expand_match_byte(&mac.tts)),
                    );
                }
            }
            },
            _ => {}
        }

@@ -174,9 +184,9 @@ impl Fold for MatchByteParser {
        match expr {
            syn::Expr::Macro(syn::ExprMacro { ref mac, .. }) => {
                if mac.path == parse_quote!(match_byte) {
                    return syn::fold::fold_expr(self, expand_match_byte(&mac.tts))
                    return syn::fold::fold_expr(self, expand_match_byte(&mac.tts));
                }
            }
            },
            _ => {}
        }

Loading