Update thiserror to 1.0.30 am: 63585e47ca

Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/thiserror/+/2004740

Change-Id: If9645385e68ae9908378877e5c740d7a405665cc
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index d146052..cafa20e 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,5 +1,6 @@
 {
   "git": {
-    "sha1": "c7dd271dcd92af17168746a809503ee392d6f6ad"
-  }
-}
+    "sha1": "672e9525bbc2e5682c380d36974f34716b963591"
+  },
+  "path_in_vcs": ""
+}
\ No newline at end of file
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 263e04c..61714b6 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -21,6 +21,7 @@
       - uses: dtolnay/rust-toolchain@master
         with:
           toolchain: ${{matrix.rust}}
+          components: rust-src
       - run: cargo test --all
         env:
           RUSTFLAGS: ${{matrix.rustflags}}
@@ -36,7 +37,16 @@
   clippy:
     name: Clippy
     runs-on: ubuntu-latest
+    if: github.event_name != 'pull_request'
     steps:
       - uses: actions/checkout@v2
       - uses: dtolnay/rust-toolchain@clippy
       - run: cargo clippy --tests -- -Dclippy::all -Dclippy::pedantic
+
+  outdated:
+    name: Outdated
+    runs-on: ubuntu-latest
+    if: github.event_name != 'pull_request'
+    steps:
+      - uses: actions/checkout@v2
+      - run: cargo outdated --exit-code 1
diff --git a/Android.bp b/Android.bp
index 9db6ce8..b1dc159 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.29",
+    cargo_pkg_version: "1.0.30",
     srcs: ["src/lib.rs"],
     edition: "2018",
     proc_macros: ["libthiserror_impl"],
diff --git a/Cargo.toml b/Cargo.toml
index ea80376..78c99d6 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,8 +11,9 @@
 
 [package]
 edition = "2018"
+rust-version = "1.31"
 name = "thiserror"
-version = "1.0.29"
+version = "1.0.30"
 authors = ["David Tolnay <dtolnay@gmail.com>"]
 description = "derive(Error)"
 documentation = "https://docs.rs/thiserror"
@@ -23,7 +24,7 @@
 [package.metadata.docs.rs]
 targets = ["x86_64-unknown-linux-gnu"]
 [dependencies.thiserror-impl]
-version = "=1.0.29"
+version = "=1.0.30"
 [dev-dependencies.anyhow]
 version = "1.0"
 
@@ -34,5 +35,5 @@
 version = "1.0"
 
 [dev-dependencies.trybuild]
-version = "1.0.19"
+version = "1.0.49"
 features = ["diff"]
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index f619245..efa9af1 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,8 +1,9 @@
 [package]
 name = "thiserror"
-version = "1.0.29"
+version = "1.0.30"
 authors = ["David Tolnay <dtolnay@gmail.com>"]
 edition = "2018"
+rust-version = "1.31"
 license = "MIT OR Apache-2.0"
 description = "derive(Error)"
 repository = "https://github.com/dtolnay/thiserror"
@@ -11,13 +12,13 @@
 readme = "README.md"
 
 [dependencies]
-thiserror-impl = { version = "=1.0.29", path = "impl" }
+thiserror-impl = { version = "=1.0.30", path = "impl" }
 
 [dev-dependencies]
 anyhow = "1.0"
 ref-cast = "1.0"
 rustversion = "1.0"
-trybuild = { version = "1.0.19", features = ["diff"] }
+trybuild = { version = "1.0.49", features = ["diff"] }
 
 [workspace]
 members = ["impl"]
diff --git a/METADATA b/METADATA
index 6f9cb40..e961418 100644
--- a/METADATA
+++ b/METADATA
@@ -7,13 +7,13 @@
   }
   url {
     type: ARCHIVE
-    value: "https://static.crates.io/crates/thiserror/thiserror-1.0.29.crate"
+    value: "https://static.crates.io/crates/thiserror/thiserror-1.0.30.crate"
   }
-  version: "1.0.29"
+  version: "1.0.30"
   license_type: NOTICE
   last_upgrade_date {
-    year: 2021
-    month: 9
-    day: 22
+    year: 2022
+    month: 3
+    day: 1
   }
 }
diff --git a/rust-toolchain.toml b/rust-toolchain.toml
new file mode 100644
index 0000000..20fe888
--- /dev/null
+++ b/rust-toolchain.toml
@@ -0,0 +1,2 @@
+[toolchain]
+components = ["rust-src"]
diff --git a/src/aserror.rs b/src/aserror.rs
index f440034..c036b7b 100644
--- a/src/aserror.rs
+++ b/src/aserror.rs
@@ -1,4 +1,5 @@
 use std::error::Error;
+use std::panic::UnwindSafe;
 
 pub trait AsDynError<'a> {
     fn as_dyn_error(&self) -> &(dyn Error + 'a);
@@ -31,3 +32,10 @@
         self
     }
 }
+
+impl<'a> AsDynError<'a> for dyn Error + Send + Sync + UnwindSafe + 'a {
+    #[inline]
+    fn as_dyn_error(&self) -> &(dyn Error + 'a) {
+        self
+    }
+}
diff --git a/tests/ui/bad-field-attr.stderr b/tests/ui/bad-field-attr.stderr
index ecc4702..5fb5744 100644
--- a/tests/ui/bad-field-attr.stderr
+++ b/tests/ui/bad-field-attr.stderr
@@ -1,5 +1,5 @@
 error: #[error(transparent)] needs to go outside the enum or struct, not on an individual field
- --> $DIR/bad-field-attr.rs:5:18
+ --> tests/ui/bad-field-attr.rs:5:18
   |
 5 | pub struct Error(#[error(transparent)] std::io::Error);
   |                  ^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/concat-display.stderr b/tests/ui/concat-display.stderr
index a009145..6ab4048 100644
--- a/tests/ui/concat-display.stderr
+++ b/tests/ui/concat-display.stderr
@@ -1,5 +1,5 @@
 error: expected string literal
-  --> $DIR/concat-display.rs:8:17
+  --> tests/ui/concat-display.rs:8:17
    |
 8  |         #[error(concat!("invalid ", $what))]
    |                 ^^^^^^
diff --git a/tests/ui/duplicate-enum-source.stderr b/tests/ui/duplicate-enum-source.stderr
index 55d81be..4a4b2d3 100644
--- a/tests/ui/duplicate-enum-source.stderr
+++ b/tests/ui/duplicate-enum-source.stderr
@@ -1,5 +1,5 @@
 error: duplicate #[source] attribute
- --> $DIR/duplicate-enum-source.rs:8:9
+ --> tests/ui/duplicate-enum-source.rs:8:9
   |
 8 |         #[source]
   |         ^^^^^^^^^
diff --git a/tests/ui/duplicate-fmt.stderr b/tests/ui/duplicate-fmt.stderr
index 3206640..532b16b 100644
--- a/tests/ui/duplicate-fmt.stderr
+++ b/tests/ui/duplicate-fmt.stderr
@@ -1,5 +1,5 @@
 error: only one #[error(...)] attribute is allowed
- --> $DIR/duplicate-fmt.rs:5:1
+ --> tests/ui/duplicate-fmt.rs:5:1
   |
 5 | #[error("...")]
   | ^^^^^^^^^^^^^^^
diff --git a/tests/ui/duplicate-struct-source.stderr b/tests/ui/duplicate-struct-source.stderr
index 76fc6f5..c8de574 100644
--- a/tests/ui/duplicate-struct-source.stderr
+++ b/tests/ui/duplicate-struct-source.stderr
@@ -1,5 +1,5 @@
 error: duplicate #[source] attribute
- --> $DIR/duplicate-struct-source.rs:7:5
+ --> tests/ui/duplicate-struct-source.rs:7:5
   |
 7 |     #[source]
   |     ^^^^^^^^^
diff --git a/tests/ui/duplicate-transparent.stderr b/tests/ui/duplicate-transparent.stderr
index c963475..a830879 100644
--- a/tests/ui/duplicate-transparent.stderr
+++ b/tests/ui/duplicate-transparent.stderr
@@ -1,5 +1,5 @@
 error: duplicate #[error(transparent)] attribute
- --> $DIR/duplicate-transparent.rs:5:1
+ --> tests/ui/duplicate-transparent.rs:5:1
   |
 5 | #[error(transparent)]
   | ^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/from-not-source.stderr b/tests/ui/from-not-source.stderr
index b656c8e..9713601 100644
--- a/tests/ui/from-not-source.stderr
+++ b/tests/ui/from-not-source.stderr
@@ -1,5 +1,5 @@
 error: #[from] is only supported on the source field, not any other field
- --> $DIR/from-not-source.rs:7:5
+ --> tests/ui/from-not-source.rs:7:5
   |
 7 |     #[from]
   |     ^^^^^^^
diff --git a/tests/ui/lifetime.stderr b/tests/ui/lifetime.stderr
index 5f86fa0..8b58136 100644
--- a/tests/ui/lifetime.stderr
+++ b/tests/ui/lifetime.stderr
@@ -1,11 +1,11 @@
 error: non-static lifetimes are not allowed in the source of an error, because std::error::Error requires the source is dyn Error + 'static
- --> $DIR/lifetime.rs:6:26
+ --> tests/ui/lifetime.rs:6:26
   |
 6 | struct Error<'a>(#[from] Inner<'a>);
   |                          ^^^^^^^^^
 
 error: non-static lifetimes are not allowed in the source of an error, because std::error::Error requires the source is dyn Error + 'static
-  --> $DIR/lifetime.rs:15:17
+  --> tests/ui/lifetime.rs:15:17
    |
 15 |     Foo(#[from] Generic<&'a str>),
    |                 ^^^^^^^^^^^^^^^^
diff --git a/tests/ui/missing-fmt.stderr b/tests/ui/missing-fmt.stderr
index 1d21b1b..c0be373 100644
--- a/tests/ui/missing-fmt.stderr
+++ b/tests/ui/missing-fmt.stderr
@@ -1,5 +1,5 @@
 error: missing #[error("...")] display attribute
- --> $DIR/missing-fmt.rs:7:5
+ --> tests/ui/missing-fmt.rs:7:5
   |
 7 |     B(usize),
   |     ^^^^^^^^
diff --git a/tests/ui/no-display.stderr b/tests/ui/no-display.stderr
index 8af2452..e6a52f5 100644
--- a/tests/ui/no-display.stderr
+++ b/tests/ui/no-display.stderr
@@ -1,12 +1,23 @@
 error[E0599]: the method `as_display` exists for reference `&NoDisplay`, but its trait bounds were not satisfied
- --> $DIR/no-display.rs:7:9
-  |
-4 | struct NoDisplay;
-  | ----------------- doesn't satisfy `NoDisplay: std::fmt::Display`
+   --> tests/ui/no-display.rs:7:9
+    |
+4   | struct NoDisplay;
+    | ----------------- doesn't satisfy `NoDisplay: std::fmt::Display`
 ...
-7 | #[error("thread: {thread}")]
-  |         ^^^^^^^^^^^^^^^^^^ method cannot be called on `&NoDisplay` due to unsatisfied trait bounds
-  |
-  = note: the following trait bounds were not satisfied:
-          `NoDisplay: std::fmt::Display`
-          which is required by `&NoDisplay: DisplayAsDisplay`
+7   | #[error("thread: {thread}")]
+    |         ^^^^^^^^^^^^^^^^^^ method cannot be called on `&NoDisplay` due to unsatisfied trait bounds
+    |
+    = note: the following trait bounds were not satisfied:
+            `NoDisplay: std::fmt::Display`
+            which is required by `&NoDisplay: DisplayAsDisplay`
+note: the following trait must be implemented
+   --> $RUST/core/src/fmt/mod.rs
+    |
+    | / pub trait Display {
+    | |     /// Formats the value using the given formatter.
+    | |     ///
+    | |     /// # Examples
+...   |
+    | |     fn fmt(&self, f: &mut Formatter<'_>) -> Result;
+    | | }
+    | |_^
diff --git a/tests/ui/source-enum-not-error.stderr b/tests/ui/source-enum-not-error.stderr
index 2bf7aea..d01cba5 100644
--- a/tests/ui/source-enum-not-error.stderr
+++ b/tests/ui/source-enum-not-error.stderr
@@ -1,17 +1,28 @@
 error[E0599]: the method `as_dyn_error` exists for reference `&NotError`, but its trait bounds were not satisfied
-  --> $DIR/source-enum-not-error.rs:10:9
-   |
-4  | pub struct NotError;
-   | --------------------
-   | |
-   | doesn't satisfy `NotError: AsDynError`
-   | doesn't satisfy `NotError: std::error::Error`
+   --> tests/ui/source-enum-not-error.rs:10:9
+    |
+4   | pub struct NotError;
+    | --------------------
+    | |
+    | doesn't satisfy `NotError: AsDynError`
+    | doesn't satisfy `NotError: std::error::Error`
 ...
-10 |         source: NotError,
-   |         ^^^^^^ method cannot be called on `&NotError` due to unsatisfied trait bounds
-   |
-   = note: the following trait bounds were not satisfied:
-           `NotError: std::error::Error`
-           which is required by `NotError: AsDynError`
-           `&NotError: std::error::Error`
-           which is required by `&NotError: AsDynError`
+10  |         source: NotError,
+    |         ^^^^^^ method cannot be called on `&NotError` due to unsatisfied trait bounds
+    |
+    = note: the following trait bounds were not satisfied:
+            `NotError: std::error::Error`
+            which is required by `NotError: AsDynError`
+            `&NotError: std::error::Error`
+            which is required by `&NotError: AsDynError`
+note: the following trait must be implemented
+   --> $RUST/std/src/error.rs
+    |
+    | / pub trait Error: Debug + Display {
+    | |     /// The lower-level source of this error, if any.
+    | |     ///
+    | |     /// # Examples
+...   |
+    | |     }
+    | | }
+    | |_^
diff --git a/tests/ui/source-struct-not-error.stderr b/tests/ui/source-struct-not-error.stderr
index 7a2c0fe..be1331a 100644
--- a/tests/ui/source-struct-not-error.stderr
+++ b/tests/ui/source-struct-not-error.stderr
@@ -1,16 +1,27 @@
 error[E0599]: the method `as_dyn_error` exists for struct `NotError`, but its trait bounds were not satisfied
- --> $DIR/source-struct-not-error.rs:9:5
-  |
-4 | struct NotError;
-  | ----------------
-  | |
-  | method `as_dyn_error` not found for this
-  | doesn't satisfy `NotError: AsDynError`
-  | doesn't satisfy `NotError: std::error::Error`
+   --> tests/ui/source-struct-not-error.rs:9:5
+    |
+4   | struct NotError;
+    | ----------------
+    | |
+    | method `as_dyn_error` not found for this
+    | doesn't satisfy `NotError: AsDynError`
+    | doesn't satisfy `NotError: std::error::Error`
 ...
-9 |     source: NotError,
-  |     ^^^^^^ method cannot be called on `NotError` due to unsatisfied trait bounds
-  |
-  = note: the following trait bounds were not satisfied:
-          `NotError: std::error::Error`
-          which is required by `NotError: AsDynError`
+9   |     source: NotError,
+    |     ^^^^^^ method cannot be called on `NotError` due to unsatisfied trait bounds
+    |
+    = note: the following trait bounds were not satisfied:
+            `NotError: std::error::Error`
+            which is required by `NotError: AsDynError`
+note: the following trait must be implemented
+   --> $RUST/std/src/error.rs
+    |
+    | / pub trait Error: Debug + Display {
+    | |     /// The lower-level source of this error, if any.
+    | |     ///
+    | |     /// # Examples
+...   |
+    | |     }
+    | | }
+    | |_^
diff --git a/tests/ui/transparent-display.stderr b/tests/ui/transparent-display.stderr
index 0148830..54d958b 100644
--- a/tests/ui/transparent-display.stderr
+++ b/tests/ui/transparent-display.stderr
@@ -1,5 +1,5 @@
 error: cannot have both #[error(transparent)] and a display attribute
- --> $DIR/transparent-display.rs:5:1
+ --> tests/ui/transparent-display.rs:5:1
   |
 5 | #[error("...")]
   | ^^^^^^^^^^^^^^^
diff --git a/tests/ui/transparent-enum-many.stderr b/tests/ui/transparent-enum-many.stderr
index 0c409ef..a9adfa5 100644
--- a/tests/ui/transparent-enum-many.stderr
+++ b/tests/ui/transparent-enum-many.stderr
@@ -1,5 +1,5 @@
 error: #[error(transparent)] requires exactly one field
- --> $DIR/transparent-enum-many.rs:5:5
+ --> tests/ui/transparent-enum-many.rs:5:5
   |
 5 | /     #[error(transparent)]
 6 | |     Other(anyhow::Error, String),
diff --git a/tests/ui/transparent-enum-source.stderr b/tests/ui/transparent-enum-source.stderr
index a4e6985..ccb9067 100644
--- a/tests/ui/transparent-enum-source.stderr
+++ b/tests/ui/transparent-enum-source.stderr
@@ -1,5 +1,5 @@
 error: transparent variant can't contain #[source]
- --> $DIR/transparent-enum-source.rs:6:11
+ --> tests/ui/transparent-enum-source.rs:6:11
   |
 6 |     Other(#[source] anyhow::Error),
   |           ^^^^^^^^^
diff --git a/tests/ui/transparent-struct-many.stderr b/tests/ui/transparent-struct-many.stderr
index 102f0b3..c0e3806 100644
--- a/tests/ui/transparent-struct-many.stderr
+++ b/tests/ui/transparent-struct-many.stderr
@@ -1,5 +1,5 @@
 error: #[error(transparent)] requires exactly one field
- --> $DIR/transparent-struct-many.rs:4:1
+ --> tests/ui/transparent-struct-many.rs:4:1
   |
 4 | #[error(transparent)]
   | ^^^^^^^^^^^^^^^^^^^^^
diff --git a/tests/ui/transparent-struct-source.stderr b/tests/ui/transparent-struct-source.stderr
index 16ea50b..3012ca3 100644
--- a/tests/ui/transparent-struct-source.stderr
+++ b/tests/ui/transparent-struct-source.stderr
@@ -1,5 +1,5 @@
 error: transparent error struct can't contain #[source]
- --> $DIR/transparent-struct-source.rs:5:18
+ --> tests/ui/transparent-struct-source.rs:5:18
   |
 5 | pub struct Error(#[source] anyhow::Error);
   |                  ^^^^^^^^^
diff --git a/tests/ui/unexpected-field-fmt.stderr b/tests/ui/unexpected-field-fmt.stderr
index 42d80db..bf3c24d 100644
--- a/tests/ui/unexpected-field-fmt.stderr
+++ b/tests/ui/unexpected-field-fmt.stderr
@@ -1,5 +1,5 @@
 error: not expected here; the #[error(...)] attribute belongs on top of a struct or an enum variant
- --> $DIR/unexpected-field-fmt.rs:6:9
+ --> tests/ui/unexpected-field-fmt.rs:6:9
   |
 6 |         #[error("...")]
   |         ^^^^^^^^^^^^^^^
diff --git a/tests/ui/unexpected-struct-source.stderr b/tests/ui/unexpected-struct-source.stderr
index f48d554..6f15841 100644
--- a/tests/ui/unexpected-struct-source.stderr
+++ b/tests/ui/unexpected-struct-source.stderr
@@ -1,5 +1,5 @@
 error: not expected here; the #[source] attribute belongs on a specific field
- --> $DIR/unexpected-struct-source.rs:4:1
+ --> tests/ui/unexpected-struct-source.rs:4:1
   |
 4 | #[source]
   | ^^^^^^^^^
diff --git a/tests/ui/union.stderr b/tests/ui/union.stderr
index a378011..3ec4d71 100644
--- a/tests/ui/union.stderr
+++ b/tests/ui/union.stderr
@@ -1,5 +1,5 @@
 error: union as errors are not supported
- --> $DIR/union.rs:4:1
+ --> tests/ui/union.rs:4:1
   |
 4 | / pub union U {
 5 | |     msg: &'static str,