Upgrade thiserror to 1.0.40

This project was upgraded with external_updater.
Usage: tools/external_updater/updater.sh update rust/crates/thiserror
For more info, check https://cs.android.com/android/platform/superproject/+/master:tools/external_updater/README.md

Test: TreeHugger
Bug: 276463929
Change-Id: Ibc5473cc44e1c2c1ff9b48f0e2a612c637dc8ef1
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index 302d141..06b904a 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,6 +1,6 @@
 {
   "git": {
-    "sha1": "74bfe75eb25ba9d39b0ae5b570d611855cbc5086"
+    "sha1": "3cec8c487953298acd00c61ef9a81d0461517974"
   },
   "path_in_vcs": ""
 }
\ No newline at end of file
diff --git a/.clippy.toml b/.clippy.toml
index 3d30690..0d369b5 100644
--- a/.clippy.toml
+++ b/.clippy.toml
@@ -1 +1 @@
-msrv = "1.31.0"
+msrv = "1.56.0"
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index e1db2ed..2c00fde 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -3,6 +3,7 @@
 on:
   push:
   pull_request:
+  workflow_dispatch:
   schedule: [cron: "40 1 * * *"]
 
 permissions:
@@ -12,16 +13,18 @@
   RUSTFLAGS: -Dwarnings
 
 jobs:
+  pre_ci:
+    uses: dtolnay/.github/.github/workflows/pre_ci.yml@master
+
   test:
     name: Rust ${{matrix.rust}}
+    needs: pre_ci
+    if: needs.pre_ci.outputs.continue
     runs-on: ubuntu-latest
     strategy:
       fail-fast: false
       matrix:
-        rust: [beta, stable, 1.56.0]
-        include:
-          - rust: nightly
-            rustflags: --cfg thiserror_nightly_testing
+        rust: [nightly, beta, stable, 1.56.0]
     timeout-minutes: 45
     steps:
       - uses: actions/checkout@v3
@@ -29,20 +32,13 @@
         with:
           toolchain: ${{matrix.rust}}
           components: rust-src
+      - name: Enable type layout randomization
+        run: echo RUSTFLAGS=${RUSTFLAGS}\ -Zrandomize-layout >> $GITHUB_ENV
+        if: matrix.rust == 'nightly'
+      - name: Enable nightly-only tests
+        run: echo RUSTFLAGS=${RUSTFLAGS}\ --cfg=thiserror_nightly_testing >> $GITHUB_ENV
+        if: matrix.rust == 'nightly'
       - run: cargo test --all
-        env:
-          RUSTFLAGS: ${{matrix.rustflags}} ${{env.RUSTFLAGS}}
-
-  msrv:
-    name: Rust 1.31.0
-    runs-on: ubuntu-latest
-    timeout-minutes: 45
-    steps:
-      - uses: actions/checkout@v3
-      - uses: dtolnay/rust-toolchain@1.31.0
-        with:
-          components: rust-src
-      - run: cargo check
 
   clippy:
     name: Clippy
@@ -58,6 +54,8 @@
 
   miri:
     name: Miri
+    needs: pre_ci
+    if: needs.pre_ci.outputs.continue
     runs-on: ubuntu-latest
     timeout-minutes: 45
     steps:
diff --git a/Android.bp b/Android.bp
index 8081558..6db8d4d 100644
--- a/Android.bp
+++ b/Android.bp
@@ -42,7 +42,7 @@
     host_supported: true,
     crate_name: "thiserror",
     cargo_env_compat: true,
-    cargo_pkg_version: "1.0.38",
+    cargo_pkg_version: "1.0.40",
     srcs: ["src/lib.rs"],
     edition: "2018",
     cfgs: ["provide_any"],
diff --git a/Cargo.toml b/Cargo.toml
index e235408..4d3905b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,9 +11,9 @@
 
 [package]
 edition = "2018"
-rust-version = "1.31"
+rust-version = "1.56"
 name = "thiserror"
-version = "1.0.38"
+version = "1.0.40"
 authors = ["David Tolnay <dtolnay@gmail.com>"]
 description = "derive(Error)"
 documentation = "https://docs.rs/thiserror"
@@ -31,7 +31,7 @@
 targets = ["x86_64-unknown-linux-gnu"]
 
 [dependencies.thiserror-impl]
-version = "=1.0.38"
+version = "=1.0.40"
 
 [dev-dependencies.anyhow]
 version = "1.0.65"
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index 82ef03d..355f48d 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,6 +1,6 @@
 [package]
 name = "thiserror"
-version = "1.0.38"
+version = "1.0.40"
 authors = ["David Tolnay <dtolnay@gmail.com>"]
 categories = ["rust-patterns"]
 description = "derive(Error)"
@@ -9,10 +9,10 @@
 keywords = ["error", "error-handling", "derive"]
 license = "MIT OR Apache-2.0"
 repository = "https://github.com/dtolnay/thiserror"
-rust-version = "1.31"
+rust-version = "1.56"
 
 [dependencies]
-thiserror-impl = { version = "=1.0.38", path = "impl" }
+thiserror-impl = { version = "=1.0.40", path = "impl" }
 
 [dev-dependencies]
 anyhow = "1.0.65"
diff --git a/LICENSE-APACHE b/LICENSE-APACHE
index 16fe87b..1b5ec8b 100644
--- a/LICENSE-APACHE
+++ b/LICENSE-APACHE
@@ -174,28 +174,3 @@
    of your accepting any such warranty or additional liability.
 
 END OF TERMS AND CONDITIONS
-
-APPENDIX: How to apply the Apache License to your work.
-
-   To apply the Apache License to your work, attach the following
-   boilerplate notice, with the fields enclosed by brackets "[]"
-   replaced with your own identifying information. (Don't include
-   the brackets!)  The text should be enclosed in the appropriate
-   comment syntax for the file format. We also recommend that a
-   file or class name and description of purpose be included on the
-   same "printed page" as the copyright notice for easier
-   identification within third-party archives.
-
-Copyright [yyyy] [name of copyright owner]
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-	http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
diff --git a/METADATA b/METADATA
index db2395f..77a19a5 100644
--- a/METADATA
+++ b/METADATA
@@ -11,13 +11,13 @@
   }
   url {
     type: ARCHIVE
-    value: "https://static.crates.io/crates/thiserror/thiserror-1.0.38.crate"
+    value: "https://static.crates.io/crates/thiserror/thiserror-1.0.40.crate"
   }
-  version: "1.0.38"
+  version: "1.0.40"
   license_type: NOTICE
   last_upgrade_date {
-    year: 2022
-    month: 12
-    day: 19
+    year: 2023
+    month: 3
+    day: 23
   }
 }
diff --git a/README.md b/README.md
index 3ba375f..9de063c 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@
 thiserror = "1.0"
 ```
 
-*Compiler support: requires rustc 1.31+*
+*Compiler support: requires rustc 1.56+*
 
 <br>
 
diff --git a/src/lib.rs b/src/lib.rs
index aae6552..94bd860 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -228,6 +228,7 @@
 //!
 //!   [`anyhow`]: https://github.com/dtolnay/anyhow
 
+#![doc(html_root_url = "https://docs.rs/thiserror/1.0.40")]
 #![allow(
     // Clippy bug: https://github.com/rust-lang/rust-clippy/issues/7421
     clippy::doc_markdown,
diff --git a/tests/test_from.rs b/tests/test_from.rs
index 1f38705..51af40b 100644
--- a/tests/test_from.rs
+++ b/tests/test_from.rs
@@ -1,3 +1,5 @@
+#![allow(clippy::extra_unused_type_parameters)]
+
 use std::io;
 use thiserror::Error;