summary refs log tree commit diff
diff options
context:
space:
mode:
authorDylan Reid <dgreid@chromium.org>2020-01-28 12:31:15 -0800
committerCommit Bot <commit-bot@chromium.org>2020-02-06 05:28:15 +0000
commit672559f91ae54664fc1f76326c0ecc4008da4c09 (patch)
tree05a1d14081aefbc91dcc3a3c4e3988688f1b84ee
parent3eb7927bcd1aeb5578aab3109b9fb90c7a641af5 (diff)
downloadcrosvm-672559f91ae54664fc1f76326c0ecc4008da4c09.tar
crosvm-672559f91ae54664fc1f76326c0ecc4008da4c09.tar.gz
crosvm-672559f91ae54664fc1f76326c0ecc4008da4c09.tar.bz2
crosvm-672559f91ae54664fc1f76326c0ecc4008da4c09.tar.lz
crosvm-672559f91ae54664fc1f76326c0ecc4008da4c09.tar.xz
crosvm-672559f91ae54664fc1f76326c0ecc4008da4c09.tar.zst
crosvm-672559f91ae54664fc1f76326c0ecc4008da4c09.zip
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>
-rw-r--r--Cargo.lock65
-rw-r--r--bit_field/bit_field_derive/Cargo.toml6
-rw-r--r--bit_field/bit_field_derive/bit_field_derive.rs27
-rw-r--r--enumn/Cargo.toml6
-rw-r--r--enumn/src/lib.rs16
-rw-r--r--msg_socket/msg_on_socket_derive/Cargo.toml6
-rw-r--r--p9/wire_format_derive/Cargo.toml6
-rw-r--r--sys_util/poll_token_derive/Cargo.toml6
8 files changed, 84 insertions, 54 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 81abd93..24cfb31 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -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]]
@@ -380,6 +380,14 @@ dependencies = [
 ]
 
 [[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"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -439,6 +447,14 @@ dependencies = [
 ]
 
 [[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"
 
@@ -473,6 +489,16 @@ dependencies = [
 ]
 
 [[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"
 
@@ -525,6 +551,11 @@ 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"
 dependencies = [
@@ -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"
diff --git a/bit_field/bit_field_derive/Cargo.toml b/bit_field/bit_field_derive/Cargo.toml
index df84a2a..4642b93 100644
--- a/bit_field/bit_field_derive/Cargo.toml
+++ b/bit_field/bit_field_derive/Cargo.toml
@@ -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
diff --git a/bit_field/bit_field_derive/bit_field_derive.rs b/bit_field/bit_field_derive/bit_field_derive.rs
index 7084e22..92fea94 100644
--- a/bit_field/bit_field_derive/bit_field_derive.rs
+++ b/bit_field/bit_field_derive/bit_field_derive.rs
@@ -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()?);
         }
     }
 
diff --git a/enumn/Cargo.toml b/enumn/Cargo.toml
index 1708678..381c3d7 100644
--- a/enumn/Cargo.toml
+++ b/enumn/Cargo.toml
@@ -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"
diff --git a/enumn/src/lib.rs b/enumn/src/lib.rs
index 7a04303..1441b4b 100644
--- a/enumn/src/lib.rs
+++ b/enumn/src/lib.rs
@@ -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);
+                            }
+                            _ => {}
                         }
-                        _ => {}
                     }
                 }
             }
diff --git a/msg_socket/msg_on_socket_derive/Cargo.toml b/msg_socket/msg_on_socket_derive/Cargo.toml
index 78e88de..002a3ae 100644
--- a/msg_socket/msg_on_socket_derive/Cargo.toml
+++ b/msg_socket/msg_on_socket_derive/Cargo.toml
@@ -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
diff --git a/p9/wire_format_derive/Cargo.toml b/p9/wire_format_derive/Cargo.toml
index da6cc52..ef6350d 100644
--- a/p9/wire_format_derive/Cargo.toml
+++ b/p9/wire_format_derive/Cargo.toml
@@ -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
diff --git a/sys_util/poll_token_derive/Cargo.toml b/sys_util/poll_token_derive/Cargo.toml
index 45c4552..45290be 100644
--- a/sys_util/poll_token_derive/Cargo.toml
+++ b/sys_util/poll_token_derive/Cargo.toml
@@ -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"