import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo

This commit is contained in:
Roy Tam 2018-01-19 03:59:58 +08:00
commit dcd9973243
150858 changed files with 23884658 additions and 0 deletions

View file

@ -0,0 +1 @@
{"files":{".cargo-ok":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","Cargo.toml":"a55cb9efcb3820aa9fcdff157bffaa287988ea9d4cec33e638fa7fdd978c7742","lib.rs":"d927e99fc4fd88b0e30b44580384b411e63bc504e9953ac7cc85029437372266"},"package":"bcc3ad8109fa4b522f9b0cd81440422781f564aaf8c195de6b9d6642177ad0dd"}

0
third_party/rust/matches/.cargo-ok vendored Normal file
View file

12
third_party/rust/matches/Cargo.toml vendored Normal file
View file

@ -0,0 +1,12 @@
[package]
name = "matches"
version = "0.1.3"
authors = ["Simon Sapin <simon.sapin@exyr.org>"]
license = "MIT"
repository = "https://github.com/SimonSapin/rust-std-candidates"
description = "A macro to evaluate, as a boolean, whether an expression matches a pattern."
[lib]
name = "matches"
path = "lib.rs"
doctest = false

62
third_party/rust/matches/lib.rs vendored Normal file
View file

@ -0,0 +1,62 @@
#[macro_export]
macro_rules! matches {
($expression:expr, $($pattern:tt)+) => {
_matches_tt_as_expr_hack! {
match $expression {
$($pattern)+ => true,
_ => false
}
}
}
}
/// Work around "error: unexpected token: `an interpolated tt`", whatever that means.
#[macro_export]
macro_rules! _matches_tt_as_expr_hack {
($value:expr) => ($value)
}
#[macro_export]
macro_rules! assert_matches {
($expression:expr, $($pattern:tt)+) => {
_matches_tt_as_expr_hack! {
match $expression {
$($pattern)+ => (),
ref e => panic!("assertion failed: `{:?}` does not match `{}`", e, stringify!($($pattern)+)),
}
}
}
}
#[macro_export]
macro_rules! debug_assert_matches {
($($arg:tt)*) => (if cfg!(debug_assertions) { assert_matches!($($arg)*); })
}
#[test]
fn matches_works() {
let foo = Some("-12");
assert!(matches!(foo, Some(bar) if
matches!(bar.as_bytes()[0], b'+' | b'-') &&
matches!(bar.as_bytes()[1], b'0'...b'9')
));
}
#[test]
fn assert_matches_works() {
let foo = Some("-12");
assert_matches!(foo, Some(bar) if
matches!(bar.as_bytes()[0], b'+' | b'-') &&
matches!(bar.as_bytes()[1], b'0'...b'9')
);
}
#[test]
#[should_panic(expected = "assertion failed: `Some(\"-AB\")` does not match ")]
fn assert_matches_panics() {
let foo = Some("-AB");
assert_matches!(foo, Some(bar) if
matches!(bar.as_bytes()[0], b'+' | b'-') &&
matches!(bar.as_bytes()[1], b'0'...b'9')
);
}