aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Vander Stoep <jeffv@google.com>2024-02-05 13:31:11 +0100
committerJeff Vander Stoep <jeffv@google.com>2024-02-05 13:31:12 +0100
commit2ca044f36c29ea902095611a01e919d06492f881 (patch)
tree71185c1e5b22e98a7b0c0707fd0429ca0612ea53
parente1eb798b6fc3e822f80b7e226ffbb6bd86fa9fc5 (diff)
downloadtokio-macros-2ca044f36c29ea902095611a01e919d06492f881.tar.gz
Upgrade tokio-macros to 2.2.0
This project was upgraded with external_updater. Usage: tools/external_updater/updater.sh update external/rust/crates/tokio-macros For more info, check https://cs.android.com/android/platform/superproject/+/main:tools/external_updater/README.md Test: TreeHugger Change-Id: Ida295d0798c804e98aba51f6432f1aac591fd7be
-rw-r--r--.cargo_vcs_info.json2
-rw-r--r--Android.bp4
-rw-r--r--CHANGELOG.md8
-rw-r--r--Cargo.toml8
-rw-r--r--Cargo.toml.orig8
-rw-r--r--METADATA25
-rw-r--r--src/entry.rs24
-rw-r--r--src/lib.rs2
-rw-r--r--src/select.rs10
9 files changed, 48 insertions, 43 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index da31265..cd314c7 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,6 +1,6 @@
{
"git": {
- "sha1": "66c62a4b74f9da7be3198bb7ac77d8d18967d51e"
+ "sha1": "49eb26f159c839fb34f4ce964759692443ca1302"
},
"path_in_vcs": "tokio-macros"
} \ No newline at end of file
diff --git a/Android.bp b/Android.bp
index 666092e..85947a8 100644
--- a/Android.bp
+++ b/Android.bp
@@ -22,9 +22,9 @@ rust_proc_macro {
name: "libtokio_macros",
crate_name: "tokio_macros",
cargo_env_compat: true,
- cargo_pkg_version: "2.1.0",
+ cargo_pkg_version: "2.2.0",
srcs: ["src/lib.rs"],
- edition: "2018",
+ edition: "2021",
rustlibs: [
"libproc_macro2",
"libquote",
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e9d58db..3296139 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,11 @@
+# 2.2.0 (November 19th, 2023)
+
+### Changed
+
+- use `::core` qualified imports instead of `::std` inside `tokio::test` macro ([#5973])
+
+[#5973]: https://github.com/tokio-rs/tokio/pull/5973
+
# 2.1.0 (April 25th, 2023)
- macros: fix typo in `#[tokio::test]` docs ([#5636])
diff --git a/Cargo.toml b/Cargo.toml
index 6bd8b81..9dc09b6 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -10,10 +10,10 @@
# See Cargo.toml.orig for the original contents.
[package]
-edition = "2018"
-rust-version = "1.56"
+edition = "2021"
+rust-version = "1.63"
name = "tokio-macros"
-version = "2.1.0"
+version = "2.2.0"
authors = ["Tokio Contributors <team@tokio.rs>"]
description = """
Tokio's proc macros.
@@ -31,7 +31,7 @@ all-features = true
proc-macro = true
[dependencies.proc-macro2]
-version = "1.0.7"
+version = "1.0.60"
[dependencies.quote]
version = "1"
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index 4ca789d..ea9839c 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -4,9 +4,9 @@ name = "tokio-macros"
# - Remove path dependencies
# - Update CHANGELOG.md.
# - Create "tokio-macros-1.x.y" git tag.
-version = "2.1.0"
-edition = "2018"
-rust-version = "1.56"
+version = "2.2.0"
+edition = "2021"
+rust-version = "1.63"
authors = ["Tokio Contributors <team@tokio.rs>"]
license = "MIT"
repository = "https://github.com/tokio-rs/tokio"
@@ -22,7 +22,7 @@ proc-macro = true
[features]
[dependencies]
-proc-macro2 = "1.0.7"
+proc-macro2 = "1.0.60"
quote = "1"
syn = { version = "2.0", features = ["full"] }
diff --git a/METADATA b/METADATA
index d71aedd..3f4d7cf 100644
--- a/METADATA
+++ b/METADATA
@@ -1,23 +1,20 @@
# This project was upgraded with external_updater.
-# Usage: tools/external_updater/updater.sh update rust/crates/tokio-macros
-# For more info, check https://cs.android.com/android/platform/superproject/+/master:tools/external_updater/README.md
+# Usage: tools/external_updater/updater.sh update external/rust/crates/tokio-macros
+# For more info, check https://cs.android.com/android/platform/superproject/+/main:tools/external_updater/README.md
name: "tokio-macros"
description: "Tokio\'s proc macros."
third_party {
- url {
- type: HOMEPAGE
- value: "https://crates.io/crates/tokio-macros"
- }
- url {
- type: ARCHIVE
- value: "https://static.crates.io/crates/tokio-macros/tokio-macros-2.1.0.crate"
- }
- version: "2.1.0"
license_type: NOTICE
last_upgrade_date {
- year: 2023
- month: 11
- day: 1
+ year: 2024
+ month: 2
+ day: 5
+ }
+ homepage: "https://crates.io/crates/tokio-macros"
+ identifier {
+ type: "Archive"
+ value: "https://static.crates.io/crates/tokio-macros/tokio-macros-2.2.0.crate"
+ version: "2.2.0"
}
}
diff --git a/src/entry.rs b/src/entry.rs
index edac530..3706026 100644
--- a/src/entry.rs
+++ b/src/entry.rs
@@ -126,22 +126,22 @@ impl Configuration {
}
fn build(&self) -> Result<FinalConfig, syn::Error> {
- let flavor = self.flavor.unwrap_or(self.default_flavor);
- use RuntimeFlavor::*;
+ use RuntimeFlavor as F;
+ let flavor = self.flavor.unwrap_or(self.default_flavor);
let worker_threads = match (flavor, self.worker_threads) {
- (CurrentThread, Some((_, worker_threads_span))) => {
+ (F::CurrentThread, Some((_, worker_threads_span))) => {
let msg = format!(
"The `worker_threads` option requires the `multi_thread` runtime flavor. Use `#[{}(flavor = \"multi_thread\")]`",
self.macro_name(),
);
return Err(syn::Error::new(worker_threads_span, msg));
}
- (CurrentThread, None) => None,
- (Threaded, worker_threads) if self.rt_multi_thread_available => {
+ (F::CurrentThread, None) => None,
+ (F::Threaded, worker_threads) if self.rt_multi_thread_available => {
worker_threads.map(|(val, _span)| val)
}
- (Threaded, _) => {
+ (F::Threaded, _) => {
let msg = if self.flavor.is_none() {
"The default runtime flavor is `multi_thread`, but the `rt-multi-thread` feature is disabled."
} else {
@@ -152,14 +152,14 @@ impl Configuration {
};
let start_paused = match (flavor, self.start_paused) {
- (Threaded, Some((_, start_paused_span))) => {
+ (F::Threaded, Some((_, start_paused_span))) => {
let msg = format!(
"The `start_paused` option requires the `current_thread` runtime flavor. Use `#[{}(flavor = \"current_thread\")]`",
self.macro_name(),
);
return Err(syn::Error::new(start_paused_span, msg));
}
- (CurrentThread, Some((start_paused, _))) => Some(start_paused),
+ (F::CurrentThread, Some((start_paused, _))) => Some(start_paused),
(_, None) => None,
};
@@ -354,10 +354,10 @@ fn parse_knobs(mut input: ItemFn, is_test: bool, config: FinalConfig) -> TokenSt
},
};
if let Some(v) = config.worker_threads {
- rt = quote! { #rt.worker_threads(#v) };
+ rt = quote_spanned! {last_stmt_start_span=> #rt.worker_threads(#v) };
}
if let Some(v) = config.start_paused {
- rt = quote! { #rt.start_paused(#v) };
+ rt = quote_spanned! {last_stmt_start_span=> #rt.start_paused(#v) };
}
let header = if is_test {
@@ -402,7 +402,7 @@ fn parse_knobs(mut input: ItemFn, is_test: bool, config: FinalConfig) -> TokenSt
quote! {
let body = async #body;
#crate_path::pin!(body);
- let body: ::std::pin::Pin<&mut dyn ::std::future::Future<Output = #output_type>> = body;
+ let body: ::core::pin::Pin<&mut dyn ::core::future::Future<Output = #output_type>> = body;
}
} else {
quote! {
@@ -586,6 +586,6 @@ impl ToTokens for Body<'_> {
for stmt in self.stmts {
stmt.to_tokens(tokens);
}
- })
+ });
}
}
diff --git a/src/lib.rs b/src/lib.rs
index 1d024f5..919c4ac 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -209,7 +209,7 @@ pub fn main(args: TokenStream, item: TokenStream) -> TokenStream {
/// Marks async function to be executed by selected runtime. This macro helps set up a `Runtime`
/// without requiring the user to use [Runtime](../tokio/runtime/struct.Runtime.html) or
-/// [Builder](../tokio/runtime/struct.builder.html) directly.
+/// [Builder](../tokio/runtime/struct.Builder.html) directly.
///
/// ## Function arguments:
///
diff --git a/src/select.rs b/src/select.rs
index dd491f8..324b8f9 100644
--- a/src/select.rs
+++ b/src/select.rs
@@ -73,27 +73,27 @@ fn clean_pattern(pat: &mut syn::Pat) {
}
}
syn::Pat::Or(or) => {
- for case in or.cases.iter_mut() {
+ for case in &mut or.cases {
clean_pattern(case);
}
}
syn::Pat::Slice(slice) => {
- for elem in slice.elems.iter_mut() {
+ for elem in &mut slice.elems {
clean_pattern(elem);
}
}
syn::Pat::Struct(struct_pat) => {
- for field in struct_pat.fields.iter_mut() {
+ for field in &mut struct_pat.fields {
clean_pattern(&mut field.pat);
}
}
syn::Pat::Tuple(tuple) => {
- for elem in tuple.elems.iter_mut() {
+ for elem in &mut tuple.elems {
clean_pattern(elem);
}
}
syn::Pat::TupleStruct(tuple) => {
- for elem in tuple.elems.iter_mut() {
+ for elem in &mut tuple.elems {
clean_pattern(elem);
}
}