forked from mirrors/gecko-dev
This aligns us with Servo. It pulls a new `rand` crate version, but I'm removing one in https://phabricator.services.mozilla.com/D55351, so hopefully adds up :) Differential Revision: https://phabricator.services.mozilla.com/D55359 --HG-- rename : third_party/rust/cssparser-macros/Cargo.toml => third_party/rust/phf_macros/Cargo.toml rename : third_party/rust/cssparser-macros/Cargo.toml => third_party/rust/proc-macro-hack/Cargo.toml rename : third_party/rust/rand/.cargo-checksum.json => third_party/rust/rand-0.6.5/.cargo-checksum.json rename : third_party/rust/rand/CHANGELOG.md => third_party/rust/rand-0.6.5/CHANGELOG.md rename : third_party/rust/rand/Cargo.toml => third_party/rust/rand-0.6.5/Cargo.toml rename : third_party/rust/rand/README.md => third_party/rust/rand-0.6.5/README.md rename : third_party/rust/rand/benches/distributions.rs => third_party/rust/rand-0.6.5/benches/distributions.rs rename : third_party/rust/rand/benches/generators.rs => third_party/rust/rand-0.6.5/benches/generators.rs rename : third_party/rust/rand/benches/misc.rs => third_party/rust/rand-0.6.5/benches/misc.rs rename : third_party/rust/rand/benches/seq.rs => third_party/rust/rand-0.6.5/benches/seq.rs rename : third_party/rust/rand/build.rs => third_party/rust/rand-0.6.5/build.rs rename : third_party/rust/rand/examples/monte-carlo.rs => third_party/rust/rand-0.6.5/examples/monte-carlo.rs rename : third_party/rust/rand/examples/monty-hall.rs => third_party/rust/rand-0.6.5/examples/monty-hall.rs rename : third_party/rust/rand/src/deprecated.rs => third_party/rust/rand-0.6.5/src/deprecated.rs rename : third_party/rust/rand/src/distributions/bernoulli.rs => third_party/rust/rand-0.6.5/src/distributions/bernoulli.rs rename : third_party/rust/rand/src/distributions/binomial.rs => third_party/rust/rand-0.6.5/src/distributions/binomial.rs rename : third_party/rust/rand/src/distributions/cauchy.rs => third_party/rust/rand-0.6.5/src/distributions/cauchy.rs rename : third_party/rust/rand/src/distributions/dirichlet.rs => third_party/rust/rand-0.6.5/src/distributions/dirichlet.rs rename : third_party/rust/rand/src/distributions/exponential.rs => third_party/rust/rand-0.6.5/src/distributions/exponential.rs rename : third_party/rust/rand/src/distributions/float.rs => third_party/rust/rand-0.6.5/src/distributions/float.rs rename : third_party/rust/rand/src/distributions/gamma.rs => third_party/rust/rand-0.6.5/src/distributions/gamma.rs rename : third_party/rust/rand/src/distributions/integer.rs => third_party/rust/rand-0.6.5/src/distributions/integer.rs rename : third_party/rust/rand/src/distributions/mod.rs => third_party/rust/rand-0.6.5/src/distributions/mod.rs rename : third_party/rust/rand/src/distributions/normal.rs => third_party/rust/rand-0.6.5/src/distributions/normal.rs rename : third_party/rust/rand/src/distributions/other.rs => third_party/rust/rand-0.6.5/src/distributions/other.rs rename : third_party/rust/rand/src/distributions/pareto.rs => third_party/rust/rand-0.6.5/src/distributions/pareto.rs rename : third_party/rust/rand/src/distributions/poisson.rs => third_party/rust/rand-0.6.5/src/distributions/poisson.rs rename : third_party/rust/rand/src/distributions/triangular.rs => third_party/rust/rand-0.6.5/src/distributions/triangular.rs rename : third_party/rust/rand/src/distributions/uniform.rs => third_party/rust/rand-0.6.5/src/distributions/uniform.rs rename : third_party/rust/rand/src/distributions/unit_circle.rs => third_party/rust/rand-0.6.5/src/distributions/unit_circle.rs rename : third_party/rust/rand/src/distributions/unit_sphere.rs => third_party/rust/rand-0.6.5/src/distributions/unit_sphere.rs rename : third_party/rust/rand/src/distributions/utils.rs => third_party/rust/rand-0.6.5/src/distributions/utils.rs rename : third_party/rust/rand/src/distributions/weibull.rs => third_party/rust/rand-0.6.5/src/distributions/weibull.rs rename : third_party/rust/rand/src/distributions/weighted.rs => third_party/rust/rand-0.6.5/src/distributions/weighted.rs rename : third_party/rust/rand/src/lib.rs => third_party/rust/rand-0.6.5/src/lib.rs rename : third_party/rust/rand/src/prelude.rs => third_party/rust/rand-0.6.5/src/prelude.rs rename : third_party/rust/rand/src/prng/mod.rs => third_party/rust/rand-0.6.5/src/prng/mod.rs rename : third_party/rust/rand/src/rngs/adapter/mod.rs => third_party/rust/rand-0.6.5/src/rngs/adapter/mod.rs rename : third_party/rust/rand/src/rngs/adapter/read.rs => third_party/rust/rand-0.6.5/src/rngs/adapter/read.rs rename : third_party/rust/rand/src/rngs/adapter/reseeding.rs => third_party/rust/rand-0.6.5/src/rngs/adapter/reseeding.rs rename : third_party/rust/rand/src/rngs/entropy.rs => third_party/rust/rand-0.6.5/src/rngs/entropy.rs rename : third_party/rust/rand/src/rngs/mock.rs => third_party/rust/rand-0.6.5/src/rngs/mock.rs rename : third_party/rust/rand/src/rngs/mod.rs => third_party/rust/rand-0.6.5/src/rngs/mod.rs rename : third_party/rust/rand/src/rngs/small.rs => third_party/rust/rand-0.6.5/src/rngs/small.rs rename : third_party/rust/rand/src/rngs/std.rs => third_party/rust/rand-0.6.5/src/rngs/std.rs rename : third_party/rust/rand/src/rngs/thread.rs => third_party/rust/rand-0.6.5/src/rngs/thread.rs rename : third_party/rust/rand/src/seq/index.rs => third_party/rust/rand-0.6.5/src/seq/index.rs rename : third_party/rust/rand/src/seq/mod.rs => third_party/rust/rand-0.6.5/src/seq/mod.rs rename : third_party/rust/rand/tests/uniformity.rs => third_party/rust/rand-0.6.5/tests/uniformity.rs rename : third_party/rust/rand/src/distributions/weighted.rs => third_party/rust/rand/src/distributions/weighted/mod.rs rename : third_party/rust/rand_chacha/.cargo-checksum.json => third_party/rust/rand_chacha-0.1.1/.cargo-checksum.json rename : third_party/rust/rand_chacha/CHANGELOG.md => third_party/rust/rand_chacha-0.1.1/CHANGELOG.md rename : third_party/rust/rand_chacha/Cargo.toml => third_party/rust/rand_chacha-0.1.1/Cargo.toml rename : third_party/rust/rand_chacha/README.md => third_party/rust/rand_chacha-0.1.1/README.md rename : third_party/rust/rand_chacha/build.rs => third_party/rust/rand_chacha-0.1.1/build.rs rename : third_party/rust/rand_chacha/src/chacha.rs => third_party/rust/rand_chacha-0.1.1/src/chacha.rs rename : third_party/rust/rand_chacha/src/lib.rs => third_party/rust/rand_chacha-0.1.1/src/lib.rs rename : third_party/rust/rand_core/.cargo-checksum.json => third_party/rust/rand_core-0.4.0/.cargo-checksum.json rename : third_party/rust/rand_core/CHANGELOG.md => third_party/rust/rand_core-0.4.0/CHANGELOG.md rename : third_party/rust/rand_core/Cargo.toml => third_party/rust/rand_core-0.4.0/Cargo.toml rename : third_party/rust/rand_core/README.md => third_party/rust/rand_core-0.4.0/README.md rename : third_party/rust/rand_core/src/block.rs => third_party/rust/rand_core-0.4.0/src/block.rs rename : third_party/rust/rand_core/src/error.rs => third_party/rust/rand_core-0.4.0/src/error.rs rename : third_party/rust/rand_core/src/impls.rs => third_party/rust/rand_core-0.4.0/src/impls.rs rename : third_party/rust/rand_core/src/lib.rs => third_party/rust/rand_core-0.4.0/src/lib.rs rename : third_party/rust/rand_hc/.cargo-checksum.json => third_party/rust/rand_hc-0.1.0/.cargo-checksum.json rename : third_party/rust/rand_hc/CHANGELOG.md => third_party/rust/rand_hc-0.1.0/CHANGELOG.md rename : third_party/rust/rand_hc/Cargo.toml => third_party/rust/rand_hc-0.1.0/Cargo.toml rename : third_party/rust/rand_hc/README.md => third_party/rust/rand_hc-0.1.0/README.md rename : third_party/rust/rand_hc/src/hc128.rs => third_party/rust/rand_hc-0.1.0/src/hc128.rs rename : third_party/rust/rand_hc/src/lib.rs => third_party/rust/rand_hc-0.1.0/src/lib.rs rename : third_party/rust/rand_pcg/.cargo-checksum.json => third_party/rust/rand_pcg-0.1.2/.cargo-checksum.json rename : third_party/rust/rand_pcg/CHANGELOG.md => third_party/rust/rand_pcg-0.1.2/CHANGELOG.md rename : third_party/rust/rand_pcg/Cargo.toml => third_party/rust/rand_pcg-0.1.2/Cargo.toml rename : third_party/rust/rand_pcg/README.md => third_party/rust/rand_pcg-0.1.2/README.md rename : third_party/rust/rand_chacha/build.rs => third_party/rust/rand_pcg-0.1.2/build.rs rename : third_party/rust/rand_pcg/src/lib.rs => third_party/rust/rand_pcg-0.1.2/src/lib.rs rename : third_party/rust/rand_pcg/src/pcg128.rs => third_party/rust/rand_pcg-0.1.2/src/pcg128.rs rename : third_party/rust/rand_pcg/src/pcg64.rs => third_party/rust/rand_pcg-0.1.2/src/pcg64.rs rename : third_party/rust/rand_pcg/tests/lcg64xsh32.rs => third_party/rust/rand_pcg-0.1.2/tests/lcg64xsh32.rs rename : third_party/rust/rand_pcg/tests/mcg128xsl64.rs => third_party/rust/rand_pcg-0.1.2/tests/mcg128xsl64.rs extra : moz-landing-system : lando
39 lines
1.3 KiB
Rust
39 lines
1.3 KiB
Rust
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
extern crate proc_macro;
|
|
|
|
use proc_macro::TokenStream;
|
|
|
|
#[proc_macro]
|
|
pub fn _cssparser_internal_max_len(input: TokenStream) -> TokenStream {
|
|
struct Input {
|
|
max_length: usize,
|
|
}
|
|
|
|
impl syn::parse::Parse for Input {
|
|
fn parse(input: syn::parse::ParseStream) -> syn::parse::Result<Self> {
|
|
let mut max_length = 0;
|
|
while !input.is_empty() {
|
|
if input.peek(syn::Token![_]) {
|
|
input.parse::<syn::Token![_]>().unwrap();
|
|
continue;
|
|
}
|
|
let lit: syn::LitStr = input.parse()?;
|
|
let value = lit.value();
|
|
if value.to_ascii_lowercase() != value {
|
|
return Err(syn::Error::new(lit.span(), "must be ASCII-lowercase"));
|
|
}
|
|
max_length = max_length.max(value.len());
|
|
}
|
|
Ok(Input { max_length })
|
|
}
|
|
}
|
|
|
|
let Input { max_length } = syn::parse_macro_input!(input);
|
|
quote::quote!(
|
|
pub(super) const MAX_LENGTH: usize = #max_length;
|
|
)
|
|
.into()
|
|
}
|