mirror of
https://chromium.googlesource.com/crosvm/crosvm
synced 2025-02-05 10:10:41 +00:00
Update syn, quote, and proc-macro past 1.0
These were pinned at pre-1.0 versions. Update to the stable API to allow new features to be used in the future. Cq-Depend: chromium:2026764 Change-Id: Id2d979525e5210436cbb1cfa61e2b05fafb288f3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2025907 Tested-by: Dylan Reid <dgreid@chromium.org> Tested-by: kokoro <noreply+kokoro@google.com> Commit-Queue: Dylan Reid <dgreid@chromium.org> Reviewed-by: Dylan Reid <dgreid@chromium.org> Reviewed-by: Zach Reizner <zachr@chromium.org>
This commit is contained in:
parent
3eb7927bcd
commit
672559f91a
8 changed files with 84 additions and 54 deletions
65
Cargo.lock
generated
65
Cargo.lock
generated
|
@ -51,9 +51,9 @@ dependencies = [
|
|||
name = "bit_field_derive"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"proc-macro2 0.4.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -189,9 +189,9 @@ dependencies = [
|
|||
name = "enumn"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"proc-macro2 0.4.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -310,9 +310,9 @@ dependencies = [
|
|||
name = "msg_on_socket_derive"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"proc-macro2 0.4.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -366,9 +366,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
name = "poll_token_derive"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"proc-macro2 0.4.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -379,6 +379,14 @@ dependencies = [
|
|||
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "protobuf"
|
||||
version = "2.8.1"
|
||||
|
@ -438,6 +446,14 @@ dependencies = [
|
|||
"proc-macro2 0.4.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rand_ish"
|
||||
version = "0.1.0"
|
||||
|
@ -472,6 +488,16 @@ dependencies = [
|
|||
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sync"
|
||||
version = "0.1.0"
|
||||
|
@ -524,6 +550,11 @@ name = "unicode-xid"
|
|||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "usb_sys"
|
||||
version = "0.1.0"
|
||||
|
@ -584,9 +615,9 @@ dependencies = [
|
|||
name = "wire_format_derive"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"proc-macro2 0.4.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -620,12 +651,16 @@ dependencies = [
|
|||
"checksum num_cpus 1.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5a69d464bdc213aaaff628444e99578ede64e9c854025aa43b9796530afa9238"
|
||||
"checksum pkg-config 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "110d5ee3593dbb73f56294327fe5668bcc997897097cbc76b51e7aed3f52452f"
|
||||
"checksum proc-macro2 0.4.21 (registry+https://github.com/rust-lang/crates.io-index)" = "ab2fc21ba78ac73e4ff6b3818ece00be4e175ffbef4d0a717d978b48b24150c4"
|
||||
"checksum proc-macro2 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3acb317c6ff86a4e579dfa00fc5e6cca91ecbb4e7eb2df0468805b674eb88548"
|
||||
"checksum protobuf 2.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "40361836defdd5871ff7e84096c6f6444af7fc157f8ef1789f54f147687caa20"
|
||||
"checksum protobuf-codegen 2.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "12c6abd78435445fc86898ebbd0521a68438063d4a73e23527b7134e6bf58b4a"
|
||||
"checksum protoc 2.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3998c4bc0af8ccbd3cc68245ee9f72663c5ae2fb78bc48ff7719aef11562edea"
|
||||
"checksum protoc-rust 2.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "234c97039c32bb58a883d0deafa57db37e59428ce536f3bdfe1c46cffec04113"
|
||||
"checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c"
|
||||
"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
|
||||
"checksum remain 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3bec2543b50be4539fdc27fde082e218cf4c3895358ca77f5c52fe930589e209"
|
||||
"checksum syn 0.15.26 (registry+https://github.com/rust-lang/crates.io-index)" = "f92e629aa1d9c827b2bb8297046c1ccffc57c99b947a680d3ccff1f136a3bee9"
|
||||
"checksum syn 1.0.14 (registry+https://github.com/rust-lang/crates.io-index)" = "af6f3550d8dff9ef7dc34d384ac6f107e5d31c8f57d9f28e0081503f547ac8f5"
|
||||
"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526"
|
||||
"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
|
||||
"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
|
||||
|
|
|
@ -5,9 +5,9 @@ authors = ["The Chromium OS Authors"]
|
|||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
proc-macro2 = "=0.4"
|
||||
quote = "=0.6"
|
||||
syn = "=0.15"
|
||||
proc-macro2 = "^1"
|
||||
quote = "^1"
|
||||
syn = "^1"
|
||||
|
||||
[lib]
|
||||
proc-macro = true
|
||||
|
|
|
@ -75,14 +75,14 @@ fn bitfield_tuple_struct_impl(ast: &DeriveInput, fields: &FieldsUnnamed) -> Resu
|
|||
|
||||
let ident = &ast.ident;
|
||||
|
||||
if width.value() > 64 {
|
||||
if width > 64 {
|
||||
return Err(Error::new(
|
||||
Span::call_site(),
|
||||
"max width of bitfield field is 64",
|
||||
));
|
||||
}
|
||||
|
||||
let bits = width.value() as u8;
|
||||
let bits = width as u8;
|
||||
|
||||
if fields.unnamed.len() != 1 {
|
||||
return Err(Error::new(
|
||||
|
@ -91,7 +91,7 @@ fn bitfield_tuple_struct_impl(ast: &DeriveInput, fields: &FieldsUnnamed) -> Resu
|
|||
));
|
||||
}
|
||||
|
||||
let field_type = match &fields.unnamed.first().unwrap().value().ty {
|
||||
let field_type = match &fields.unnamed.first().unwrap().ty {
|
||||
Type::Path(t) => t,
|
||||
_ => {
|
||||
return Err(Error::new(
|
||||
|
@ -100,14 +100,7 @@ fn bitfield_tuple_struct_impl(ast: &DeriveInput, fields: &FieldsUnnamed) -> Resu
|
|||
));
|
||||
}
|
||||
};
|
||||
let span = field_type
|
||||
.path
|
||||
.segments
|
||||
.first()
|
||||
.unwrap()
|
||||
.value()
|
||||
.ident
|
||||
.span();
|
||||
let span = field_type.path.segments.first().unwrap().ident.span();
|
||||
|
||||
let from_u64 = quote_spanned! {
|
||||
span => val as #field_type
|
||||
|
@ -145,22 +138,22 @@ fn bitfield_enum_impl(ast: &DeriveInput, data: &DataEnum) -> Result<TokenStream>
|
|||
let width = parse_remove_bits_attr(&mut ast)?;
|
||||
match width {
|
||||
None => bitfield_enum_without_width_impl(&ast, data),
|
||||
Some(width) => bitfield_enum_with_width_impl(&ast, data, &width),
|
||||
Some(width) => bitfield_enum_with_width_impl(&ast, data, width),
|
||||
}
|
||||
}
|
||||
|
||||
fn bitfield_enum_with_width_impl(
|
||||
ast: &DeriveInput,
|
||||
data: &DataEnum,
|
||||
width: &LitInt,
|
||||
width: u64,
|
||||
) -> Result<TokenStream> {
|
||||
if width.value() > 64 {
|
||||
if width > 64 {
|
||||
return Err(Error::new(
|
||||
Span::call_site(),
|
||||
"max width of bitfield enum is 64",
|
||||
));
|
||||
}
|
||||
let bits = width.value() as u8;
|
||||
let bits = width as u8;
|
||||
let declare_discriminants = get_declare_discriminants_for_enum(bits, ast, data);
|
||||
|
||||
let ident = &ast.ident;
|
||||
|
@ -409,14 +402,14 @@ fn try_parse_bits_attr(attr: &Attribute) -> Result<Option<LitInt>> {
|
|||
Ok(None)
|
||||
}
|
||||
|
||||
fn parse_remove_bits_attr(ast: &mut DeriveInput) -> Result<Option<LitInt>> {
|
||||
fn parse_remove_bits_attr(ast: &mut DeriveInput) -> Result<Option<u64>> {
|
||||
let mut width = None;
|
||||
let mut bits_idx = 0;
|
||||
|
||||
for (i, attr) in ast.attrs.iter().enumerate() {
|
||||
if let Some(w) = try_parse_bits_attr(attr)? {
|
||||
bits_idx = i;
|
||||
width = Some(w);
|
||||
width = Some(w.base10_parse()?);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,6 @@ edition = "2018"
|
|||
proc-macro = true
|
||||
|
||||
[dependencies]
|
||||
proc-macro2 = "0.4"
|
||||
quote = "0.6"
|
||||
syn = "0.15"
|
||||
proc-macro2 = "^1"
|
||||
quote = "^1"
|
||||
syn = "^1"
|
||||
|
|
|
@ -134,14 +134,16 @@ fn testable_derive(input: DeriveInput) -> proc_macro2::TokenStream {
|
|||
let mut repr = None;
|
||||
for attr in input.attrs {
|
||||
if let Ok(Meta::List(list)) = attr.parse_meta() {
|
||||
if list.ident == "repr" {
|
||||
if let Some(NestedMeta::Meta(Meta::Word(word))) = list.nested.into_iter().next() {
|
||||
match word.to_string().as_str() {
|
||||
"u8" | "u16" | "u32" | "u64" | "u128" | "usize" | "i8" | "i16" | "i32"
|
||||
| "i64" | "i128" | "isize" => {
|
||||
repr = Some(word);
|
||||
if list.path.is_ident("repr") {
|
||||
if let Some(NestedMeta::Meta(Meta::Path(word))) = list.nested.into_iter().next() {
|
||||
if let Some(s) = word.get_ident() {
|
||||
match s.to_string().as_str() {
|
||||
"u8" | "u16" | "u32" | "u64" | "u128" | "usize" | "i8" | "i16"
|
||||
| "i32" | "i64" | "i128" | "isize" => {
|
||||
repr = Some(word);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,9 +5,9 @@ authors = ["The Chromium OS Authors"]
|
|||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
proc-macro2 = "=0.4"
|
||||
quote = "=0.6"
|
||||
syn = "=0.15"
|
||||
proc-macro2 = "^1"
|
||||
quote = "^1"
|
||||
syn = "^1"
|
||||
|
||||
[lib]
|
||||
proc-macro = true
|
||||
|
|
|
@ -5,9 +5,9 @@ authors = ["The Chromium OS Authors"]
|
|||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
proc-macro2 = "=0.4"
|
||||
quote = "=0.6"
|
||||
syn = "=0.15"
|
||||
proc-macro2 = "^1"
|
||||
quote = "^1"
|
||||
syn = "^1"
|
||||
|
||||
[lib]
|
||||
proc-macro = true
|
||||
|
|
|
@ -10,6 +10,6 @@ proc-macro = true
|
|||
path = "poll_token_derive.rs"
|
||||
|
||||
[dependencies]
|
||||
proc-macro2 = "0.4"
|
||||
quote = "0.6"
|
||||
syn = "0.15"
|
||||
proc-macro2 = "^1"
|
||||
quote = "^1"
|
||||
syn = "^1"
|
||||
|
|
Loading…
Reference in a new issue