Merge "Upgrade rust/crates/tokio-macros to 1.4.1"
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index 65c26b2..1131041 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,5 +1,5 @@
 {
   "git": {
-    "sha1": "c505a2f81aa7a73d95bd2b0c56a5a5205054656e"
+    "sha1": "d39c9ed9dc29627ce3f2e134502ee24b4b537a04"
   }
 }
diff --git a/Android.bp b/Android.bp
index 8db1197..bf2ead9 100644
--- a/Android.bp
+++ b/Android.bp
@@ -21,6 +21,8 @@
 rust_proc_macro {
     name: "libtokio_macros",
     crate_name: "tokio_macros",
+    cargo_env_compat: true,
+    cargo_pkg_version: "1.4.1",
     srcs: ["src/lib.rs"],
     edition: "2018",
     rustlibs: [
@@ -33,6 +35,8 @@
 rust_test_host {
     name: "tokio-macros_host_test_src_lib",
     crate_name: "tokio_macros",
+    cargo_env_compat: true,
+    cargo_pkg_version: "1.4.1",
     srcs: ["src/lib.rs"],
     test_suites: ["general-tests"],
     auto_gen_config: true,
@@ -47,28 +51,3 @@
         "libtokio",
     ],
 }
-
-// dependent_library ["feature_list"]
-//   autocfg-1.0.1
-//   bytes-1.0.1 "default,std"
-//   cfg-if-1.0.0
-//   instant-0.1.10
-//   libc-0.2.98 "default,std"
-//   lock_api-0.4.4
-//   log-0.4.14
-//   memchr-2.4.0 "default,std"
-//   mio-0.7.13 "default,net,os-ext,os-poll,os-util,tcp,udp,uds"
-//   num_cpus-1.13.0
-//   once_cell-1.8.0 "alloc,default,race,std"
-//   parking_lot-0.11.1 "default"
-//   parking_lot_core-0.8.3
-//   pin-project-lite-0.2.7
-//   proc-macro2-1.0.28 "default,proc-macro"
-//   quote-1.0.9 "default,proc-macro"
-//   scopeguard-1.1.0
-//   signal-hook-registry-1.4.0
-//   smallvec-1.6.1
-//   syn-1.0.74 "clone-impls,default,derive,full,parsing,printing,proc-macro,quote"
-//   tokio-1.9.0 "bytes,default,fs,full,io-std,io-util,libc,macros,memchr,mio,net,num_cpus,once_cell,parking_lot,process,rt,rt-multi-thread,signal,signal-hook-registry,sync,time,tokio-macros,winapi"
-//   tokio-macros-1.3.0
-//   unicode-xid-0.2.2 "default"
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0d58f97..de94e3d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,24 @@
+# 1.4.1 (September 30th, 2021)
+
+Reverted: run `current_thread` inside `LocalSet` ([#4027])
+
+# 1.4.0 (September 29th, 2021)
+
+(yanked)
+
+### Changed
+
+- macros: run `current_thread` inside `LocalSet` ([#4027])
+- macros: explicitly relaxed clippy lint for `.expect()` in runtime entry macro ([#4030])
+
+### Fixed
+
+- macros: fix invalid error messages in functions wrapped with `#[main]` or `#[test]` ([#4067])
+
+[#4027]: https://github.com/tokio-rs/tokio/pull/4027
+[#4030]: https://github.com/tokio-rs/tokio/pull/4030
+[#4067]: https://github.com/tokio-rs/tokio/pull/4067
+
 # 1.3.0 (July 7, 2021)
 
 - macros: don't trigger `clippy::unwrap_used` ([#3926])
diff --git a/Cargo.toml b/Cargo.toml
index 5f6fdce..051c274 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -3,21 +3,20 @@
 # 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
+# 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)
+# If you are reading this file be aware that the original Cargo.toml
+# will likely look very different (and much more reasonable).
+# See Cargo.toml.orig for the original contents.
 
 [package]
 edition = "2018"
 name = "tokio-macros"
-version = "1.3.0"
+version = "1.4.1"
 authors = ["Tokio Contributors <team@tokio.rs>"]
 description = "Tokio's proc macros.\n"
 homepage = "https://tokio.rs"
-documentation = "https://docs.rs/tokio-macros/1.3.0/tokio_macros"
+documentation = "https://docs.rs/tokio-macros/1.4.1/tokio_macros"
 categories = ["asynchronous"]
 license = "MIT"
 repository = "https://github.com/tokio-rs/tokio"
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index 5399bc6..c394735 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -6,13 +6,13 @@
 #   - Cargo.toml
 # - Update CHANGELOG.md.
 # - Create "tokio-macros-1.0.x" git tag.
-version = "1.3.0"
+version = "1.4.1"
 edition = "2018"
 authors = ["Tokio Contributors <team@tokio.rs>"]
 license = "MIT"
 repository = "https://github.com/tokio-rs/tokio"
 homepage = "https://tokio.rs"
-documentation = "https://docs.rs/tokio-macros/1.3.0/tokio_macros"
+documentation = "https://docs.rs/tokio-macros/1.4.1/tokio_macros"
 description = """
 Tokio's proc macros.
 """
diff --git a/METADATA b/METADATA
index c8996e2..0bae6e6 100644
--- a/METADATA
+++ b/METADATA
@@ -7,13 +7,13 @@
   }
   url {
     type: ARCHIVE
-    value: "https://static.crates.io/crates/tokio-macros/tokio-macros-1.3.0.crate"
+    value: "https://static.crates.io/crates/tokio-macros/tokio-macros-1.4.1.crate"
   }
-  version: "1.3.0"
+  version: "1.4.1"
   license_type: NOTICE
   last_upgrade_date {
     year: 2021
-    month: 8
-    day: 9
+    month: 9
+    day: 30
   }
 }
diff --git a/src/entry.rs b/src/entry.rs
index c5db13c..9da0d61 100644
--- a/src/entry.rs
+++ b/src/entry.rs
@@ -323,13 +323,27 @@
 
     let body = &input.block;
     let brace_token = input.block.brace_token;
+    let (tail_return, tail_semicolon) = match body.stmts.last() {
+        Some(syn::Stmt::Semi(expr, _)) => (
+            match expr {
+                syn::Expr::Return(_) => quote! { return },
+                _ => quote! {},
+            },
+            quote! {
+                ;
+            },
+        ),
+        _ => (quote! {}, quote! {}),
+    };
     input.block = syn::parse2(quote_spanned! {last_stmt_end_span=>
         {
-            #rt
+            let body = async #body;
+            #[allow(clippy::expect_used)]
+            #tail_return #rt
                 .enable_all()
                 .build()
                 .expect("Failed building the Runtime")
-                .block_on(async #body)
+                .block_on(body)#tail_semicolon
         }
     })
     .expect("Parsing failure");