Upgrade rust/crates/derive_arbitrary to 1.1.3

Test: make
Change-Id: I478c3c40b327a16c0e791a7f8899ab858bae703f
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index 0f0db8a..30c0308 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,6 +1,6 @@
 {
   "git": {
-    "sha1": "34be5b6d3d3bb513358e80453984652c88e07b75"
+    "sha1": "8e7b857f4f78b06920a36212ed2f392bc523c1f6"
   },
   "path_in_vcs": "derive"
 }
\ No newline at end of file
diff --git a/Android.bp b/Android.bp
index bd3cd49..e5183a8 100644
--- a/Android.bp
+++ b/Android.bp
@@ -43,7 +43,7 @@
     name: "libderive_arbitrary",
     crate_name: "derive_arbitrary",
     cargo_env_compat: true,
-    cargo_pkg_version: "1.1.2",
+    cargo_pkg_version: "1.1.3",
     srcs: ["src/lib.rs"],
     edition: "2018",
     rustlibs: [
diff --git a/Cargo.toml b/Cargo.toml
index e856a46..68714a1 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,7 +12,7 @@
 [package]
 edition = "2018"
 name = "derive_arbitrary"
-version = "1.1.2"
+version = "1.1.3"
 authors = [
     "The Rust-Fuzz Project Developers",
     "Nick Fitzgerald <fitzgen@gmail.com>",
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index e9b0c31..6896426 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,6 +1,6 @@
 [package]
 name = "derive_arbitrary"
-version = "1.1.2" # Make sure it matches the version of the arbitrary crate itself.
+version = "1.1.3" # Make sure it matches the version of the arbitrary crate itself.
 authors = [
     "The Rust-Fuzz Project Developers",
     "Nick Fitzgerald <fitzgen@gmail.com>",
diff --git a/METADATA b/METADATA
index 6c109ad..5ee0f1e 100644
--- a/METADATA
+++ b/METADATA
@@ -7,13 +7,13 @@
   }
   url {
     type: ARCHIVE
-    value: "https://static.crates.io/crates/derive_arbitrary/derive_arbitrary-1.1.2.crate"
+    value: "https://static.crates.io/crates/derive_arbitrary/derive_arbitrary-1.1.3.crate"
   }
-  version: "1.1.2"
+  version: "1.1.3"
   license_type: NOTICE
   last_upgrade_date {
     year: 2022
     month: 6
-    day: 23
+    day: 27
   }
 }
diff --git a/src/lib.rs b/src/lib.rs
index 6fdbcca..7b16a8d 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -35,15 +35,17 @@
     let (_, ty_generics, where_clause) = generics.split_for_impl();
 
     (quote! {
-        thread_local! {
-            #[allow(non_upper_case_globals)]
-            static #recursive_count: std::cell::Cell<u32> = std::cell::Cell::new(0);
-        }
+        const _: () = {
+            thread_local! {
+                #[allow(non_upper_case_globals)]
+                static #recursive_count: std::cell::Cell<u32> = std::cell::Cell::new(0);
+            }
 
-        impl #impl_generics arbitrary::Arbitrary<#lifetime_without_bounds> for #name #ty_generics #where_clause {
-            #arbitrary_method
-            #size_hint_method
-        }
+            impl #impl_generics arbitrary::Arbitrary<#lifetime_without_bounds> for #name #ty_generics #where_clause {
+                #arbitrary_method
+                #size_hint_method
+            }
+        };
     })
     .into()
 }
@@ -83,17 +85,26 @@
     expr: impl quote::ToTokens,
 ) -> impl quote::ToTokens {
     quote! {
-        #recursive_count.with(|count| {
-            if count.get() > 0 && u.is_empty() {
-                return Err(arbitrary::Error::NotEnoughData);
-            }
+        let guard_against_recursion = u.is_empty();
+        if guard_against_recursion {
+            #recursive_count.with(|count| {
+                if count.get() > 0 {
+                    return Err(arbitrary::Error::NotEnoughData);
+                }
+                count.set(count.get() + 1);
+                Ok(())
+            })?;
+        }
 
-            count.set(count.get() + 1);
-            let result = { #expr };
-            count.set(count.get() - 1);
+        let result = (|| { #expr })();
 
-            result
-        })
+        if guard_against_recursion {
+            #recursive_count.with(|count| {
+                count.set(count.get() - 1);
+            });
+        }
+
+        result
     }
 }