No bug - Revendor rust dependencies

This commit is contained in:
Servo VCS Sync 2018-02-14 17:42:57 +00:00
Родитель 5e807fd261
Коммит 67d1d60ad7
10 изменённых файлов: 263 добавлений и 0 удалений

1
third_party/rust/cstr-macros/.cargo-checksum.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1 @@
{"files":{"Cargo.toml":"e173ef38709c8afee2488a6b0acf94c7695c3cebe89b3fe444253808bede8405","LICENSE":"2c6fc9268c3b765da5bf34fe4909425437f61be05674c2516c7f8cf1251c20aa","src/lib.rs":"71e7248b21b5e603e31060ecf241cf204efdfea5a0b400d084601f6c8bdfe11c"},"package":"f9f316203d1ea36f4f18316822806f6999aa3dc5ed1adf51e35b77e3b3933d78"}

31
third_party/rust/cstr-macros/Cargo.toml поставляемый Normal file
Просмотреть файл

@ -0,0 +1,31 @@
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
#
# When uploading crates to the registry Cargo will automatically
# "normalize" Cargo.toml files for maximal compatibility
# with all versions of Cargo and also rewrite `path` dependencies
# to registry (e.g. crates.io) dependencies
#
# If you believe there's an error in this file please file an
# issue against the rust-lang/cargo repository. If you're
# editing this file be aware that the upstream Cargo.toml
# will likely look very different (and much more reasonable)
[package]
name = "cstr-macros"
version = "0.1.2"
authors = ["Xidorn Quan <me@upsuper.org>"]
description = "Procedural macros for cstr"
license = "MIT"
repository = "https://github.com/upsuper/cstr"
[lib]
proc-macro = true
[dependencies.procedural-masquerade]
version = "0.1"
[dependencies.syn]
version = "0.12"
features = ["derive", "parsing"]
default-features = false
[dev-dependencies.quote]
version = "0.4"

25
third_party/rust/cstr-macros/LICENSE поставляемый Normal file
Просмотреть файл

@ -0,0 +1,25 @@
Copyright (c) 2018 Xidorn Quan
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

64
third_party/rust/cstr-macros/src/lib.rs поставляемый Normal file
Просмотреть файл

@ -0,0 +1,64 @@
#[macro_use]
extern crate procedural_masquerade;
extern crate proc_macro;
#[cfg(test)]
#[macro_use]
extern crate quote;
extern crate syn;
use std::ascii::escape_default;
use std::ffi::CString;
define_proc_macros! {
#[allow(non_snake_case)]
pub fn cstr_internal__build_bytes(input: &str) -> String {
let bytes = build_bytes(input);
format!("const BYTES: &'static [u8] = {};", bytes)
}
}
fn build_bytes(input: &str) -> String {
let s = match syn::parse_str::<syn::LitStr>(input) {
Ok(s) => s,
_ => panic!("expected a string literal, got {}", input)
};
let cstr = match CString::new(s.value()) {
Ok(s) => s,
_ => panic!("literal must not contain NUL byte")
};
let mut bytes = Vec::new();
bytes.extend(br#"b""#);
bytes.extend(cstr.as_bytes().iter().flat_map(|&b| escape_default(b)));
bytes.extend(br#"\0""#);
String::from_utf8(bytes).unwrap()
}
#[cfg(test)]
mod tests {
use super::build_bytes;
macro_rules! build_bytes {
($($t:tt)*) => {
build_bytes(&quote!($($t)*).to_string())
}
}
macro_rules! result {
($($t:tt)*) => {
quote!($($t)*).to_string()
}
}
#[test]
fn test_build_bytes() {
assert_eq!(build_bytes!("aaa"), result!(b"aaa\0"));
assert_eq!(build_bytes!("\t\n\r\"\\'"), result!(b"\t\n\r\"\\\'\0"));
assert_eq!(build_bytes!("\x01\x02 \x7f"), result!(b"\x01\x02 \x7f\0"));
assert_eq!(build_bytes!("你好"), result!(b"\xe4\xbd\xa0\xe5\xa5\xbd\0"));
}
#[test]
#[should_panic]
fn test_build_bytes_nul_inside() {
build_bytes!("a\x00a");
}
}

1
third_party/rust/cstr/.cargo-checksum.json поставляемый Normal file
Просмотреть файл

@ -0,0 +1 @@
{"files":{"Cargo.toml":"6906aff00530782954ae2e4ef4a64cf7fc0b6ddbe4557464815921bd4b966d17","LICENSE":"2c6fc9268c3b765da5bf34fe4909425437f61be05674c2516c7f8cf1251c20aa","src/lib.rs":"01e21fd1789ccbaab8d4d46cfcfc4b1997ffae3598cb83db0852f613b93f17b1"},"package":"b6557bdb1dc9647eae1cf7f5601b14cd45fc3c7ccf2df618387416fe542da6ea"}

25
third_party/rust/cstr/Cargo.toml поставляемый Normal file
Просмотреть файл

@ -0,0 +1,25 @@
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
#
# When uploading crates to the registry Cargo will automatically
# "normalize" Cargo.toml files for maximal compatibility
# with all versions of Cargo and also rewrite `path` dependencies
# to registry (e.g. crates.io) dependencies
#
# If you believe there's an error in this file please file an
# issue against the rust-lang/cargo repository. If you're
# editing this file be aware that the upstream Cargo.toml
# will likely look very different (and much more reasonable)
[package]
name = "cstr"
version = "0.1.3"
authors = ["Xidorn Quan <me@upsuper.org>"]
description = "Macro for building static CStr reference"
keywords = ["macro", "cstr"]
license = "MIT"
repository = "https://github.com/upsuper/cstr"
[dependencies.cstr-macros]
version = "0.1.2"
[dependencies.procedural-masquerade]
version = "0.1"

25
third_party/rust/cstr/LICENSE поставляемый Normal file
Просмотреть файл

@ -0,0 +1,25 @@
Copyright (c) 2018 Xidorn Quan
Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

48
third_party/rust/cstr/src/lib.rs поставляемый Normal file
Просмотреть файл

@ -0,0 +1,48 @@
//! A macro for getting `&'static CStr` from literal.
//!
//! This macro checks whether the given literal is valid for `CStr`
//! at compile time, and returns a static reference of `CStr`.
//!
//! Note that it currently cannot be used to initialize constants due
//! to restriction of Rust.
//!
//! Also, it currently only supports a UTF-8 string as input because
//! Rust's tokenizer only accepts that without the `b` prefix. This
//! may be expanded in the future if necessary.
//!
//! # Example
//!
//! ```
//! #[macro_use] extern crate cstr;
//! use std::ffi::CStr;
//!
//! # fn main() {
//! let test = cstr!("hello");
//! assert_eq!(test, CStr::from_bytes_with_nul(b"hello\0").unwrap());
//! # }
//! ```
#[allow(unused_imports)]
#[macro_use]
extern crate cstr_macros;
#[macro_use]
extern crate procedural_masquerade;
#[doc(hidden)]
pub use cstr_macros::*;
define_invoke_proc_macro!(cstr__invoke_build_bytes);
#[macro_export]
macro_rules! cstr {
($t: tt) => {
{
cstr__invoke_build_bytes! {
cstr_internal__build_bytes!($t)
}
unsafe {
::std::ffi::CStr::from_bytes_with_nul_unchecked(BYTES)
}
}
}
}

21
toolkit/library/gtest/rust/Cargo.lock сгенерированный
Просмотреть файл

@ -314,6 +314,24 @@ dependencies = [
"syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cstr"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cstr-macros 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"procedural-masquerade 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cstr-macros"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"procedural-masquerade 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.12.12 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cubeb"
version = "0.3.2"
@ -561,6 +579,7 @@ version = "0.0.1"
dependencies = [
"atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.23.2 (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.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1750,6 +1769,8 @@ dependencies = [
"checksum cose-c 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "49726015ab0ca765144fcca61e4a7a543a16b795a777fa53f554da2fffff9a94"
"checksum cssparser 0.23.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8a807ac3ab7a217829c2a3b65732b926b2befe6a35f33b4bf8b503692430f223"
"checksum cssparser-macros 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "079adec4af52bb5275eadd004292028c79eb3c5f5b4ee8086a36d4197032f6df"
"checksum cstr 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b6557bdb1dc9647eae1cf7f5601b14cd45fc3c7ccf2df618387416fe542da6ea"
"checksum cstr-macros 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f9f316203d1ea36f4f18316822806f6999aa3dc5ed1adf51e35b77e3b3933d78"
"checksum darling 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d3effd06d4057f275cb7858889f4952920bab78dd8ff0f6e7dfe0c8d2e67ed89"
"checksum darling_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "167dd3e235c2f1da16a635c282630452cdf49191eb05711de1bcd1d3d5068c00"
"checksum darling_macro 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c53edaba455f6073a10c27c72440860eb3f60444f8c8660a391032eeae744d82"

22
toolkit/library/rust/Cargo.lock сгенерированный
Просмотреть файл

@ -314,6 +314,24 @@ dependencies = [
"syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cstr"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cstr-macros 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"procedural-masquerade 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cstr-macros"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"procedural-masquerade 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.12.12 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cubeb"
version = "0.3.2"
@ -561,6 +579,7 @@ version = "0.0.1"
dependencies = [
"atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.23.2 (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.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1362,6 +1381,7 @@ version = "0.0.1"
dependencies = [
"atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"cssparser 0.23.2 (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.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.16.0 (registry+https://github.com/rust-lang/crates.io-index)",
"geckoservo 0.0.1",
@ -1752,6 +1772,8 @@ dependencies = [
"checksum cose-c 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "49726015ab0ca765144fcca61e4a7a543a16b795a777fa53f554da2fffff9a94"
"checksum cssparser 0.23.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8a807ac3ab7a217829c2a3b65732b926b2befe6a35f33b4bf8b503692430f223"
"checksum cssparser-macros 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "079adec4af52bb5275eadd004292028c79eb3c5f5b4ee8086a36d4197032f6df"
"checksum cstr 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b6557bdb1dc9647eae1cf7f5601b14cd45fc3c7ccf2df618387416fe542da6ea"
"checksum cstr-macros 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f9f316203d1ea36f4f18316822806f6999aa3dc5ed1adf51e35b77e3b3933d78"
"checksum darling 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d3effd06d4057f275cb7858889f4952920bab78dd8ff0f6e7dfe0c8d2e67ed89"
"checksum darling_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "167dd3e235c2f1da16a635c282630452cdf49191eb05711de1bcd1d3d5068c00"
"checksum darling_macro 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c53edaba455f6073a10c27c72440860eb3f60444f8c8660a391032eeae744d82"