aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaibo Huang <hhb@google.com>2020-11-05 04:02:29 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-11-05 04:02:29 +0000
commit08084b88b86ced679cf444e22f59e16c99abbcbb (patch)
treeee41bde9213f8c26094e72cbf46595beceed88ce
parentebed3999bc16ae3e0a050974eef59cd2529bbd34 (diff)
parent54b2d092c96027394f5fecd501fe16db58fdf221 (diff)
downloadanyhow-08084b88b86ced679cf444e22f59e16c99abbcbb.tar.gz
Upgrade rust/crates/anyhow to 1.0.34 am: 738f24df3b am: 54b2d092c9
Original change: https://android-review.googlesource.com/c/platform/external/rust/crates/anyhow/+/1484978 Change-Id: I9e6d309a99a2dd3b1fe79fc8ae850c872b892dbd
-rw-r--r--.cargo_vcs_info.json2
-rw-r--r--Cargo.toml2
-rw-r--r--Cargo.toml.orig2
-rw-r--r--METADATA8
-rw-r--r--README.md6
-rw-r--r--src/error.rs4
-rw-r--r--src/lib.rs14
-rw-r--r--src/macros.rs6
8 files changed, 31 insertions, 13 deletions
diff --git a/.cargo_vcs_info.json b/.cargo_vcs_info.json
index 37e38f8..3a340ff 100644
--- a/.cargo_vcs_info.json
+++ b/.cargo_vcs_info.json
@@ -1,5 +1,5 @@
{
"git": {
- "sha1": "840afd84e9dd91ac5340c05afadeecbe45d0b810"
+ "sha1": "99c982128458fecb8d1d7aff9478dd77dac0ee3b"
}
}
diff --git a/Cargo.toml b/Cargo.toml
index ebb6eab..e60d650 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,7 +13,7 @@
[package]
edition = "2018"
name = "anyhow"
-version = "1.0.33"
+version = "1.0.34"
authors = ["David Tolnay <dtolnay@gmail.com>"]
description = "Flexible concrete Error type built on std::error::Error"
documentation = "https://docs.rs/anyhow"
diff --git a/Cargo.toml.orig b/Cargo.toml.orig
index 42f0491..c6f0bd1 100644
--- a/Cargo.toml.orig
+++ b/Cargo.toml.orig
@@ -1,6 +1,6 @@
[package]
name = "anyhow"
-version = "1.0.33" # remember to update html_root_url
+version = "1.0.34" # remember to update html_root_url
authors = ["David Tolnay <dtolnay@gmail.com>"]
edition = "2018"
license = "MIT OR Apache-2.0"
diff --git a/METADATA b/METADATA
index 1766464..c025753 100644
--- a/METADATA
+++ b/METADATA
@@ -7,13 +7,13 @@ third_party {
}
url {
type: ARCHIVE
- value: "https://static.crates.io/crates/anyhow/anyhow-1.0.33.crate"
+ value: "https://static.crates.io/crates/anyhow/anyhow-1.0.34.crate"
}
- version: "1.0.33"
+ version: "1.0.34"
license_type: NOTICE
last_upgrade_date {
year: 2020
- month: 10
- day: 26
+ month: 11
+ day: 2
}
}
diff --git a/README.md b/README.md
index 87b41d7..336f879 100644
--- a/README.md
+++ b/README.md
@@ -118,6 +118,12 @@ anyhow = "1.0"
return Err(anyhow!("Missing attribute: {}", missing));
```
+ A `bail!` macro is provided as a shorthand for the same early return.
+
+ ```rust
+ bail!("Missing attribute: {}", missing);
+ ```
+
<br>
## No-std support
diff --git a/src/error.rs b/src/error.rs
index 5d48119..5ee9e41 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -193,7 +193,7 @@ impl Error {
_object: error,
});
// Erase the concrete type of E from the compile-time type system. This
- // is equivalent to the safe unsize coersion from Box<ErrorImpl<E>> to
+ // is equivalent to the safe unsize coercion from Box<ErrorImpl<E>> to
// Box<ErrorImpl<dyn StdError + Send + Sync + 'static>> except that the
// result is a thin pointer. The necessary behavior for manipulating the
// underlying ErrorImpl<E> is preserved in the vtable provided by the
@@ -690,7 +690,7 @@ impl<E> ErrorImpl<E> {
fn erase(&self) -> &ErrorImpl<()> {
// Erase the concrete type of E but preserve the vtable in self.vtable
// for manipulating the resulting thin pointer. This is analogous to an
- // unsize coersion.
+ // unsize coercion.
unsafe { &*(self as *const ErrorImpl<E> as *const ErrorImpl<()>) }
}
}
diff --git a/src/lib.rs b/src/lib.rs
index c38d8d7..a6bb634 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -179,6 +179,18 @@
//! # }
//! ```
//!
+//! A `bail!` macro is provided as a shorthand for the same early return.
+//!
+//! ```
+//! # use anyhow::{bail, Result};
+//! #
+//! # fn demo() -> Result<()> {
+//! # let missing = "...";
+//! bail!("Missing attribute: {}", missing);
+//! # Ok(())
+//! # }
+//! ```
+//!
//! <br>
//!
//! # No-std support
@@ -197,7 +209,7 @@
//! will require an explicit `.map_err(Error::msg)` when working with a
//! non-Anyhow error type inside a function that returns Anyhow's error type.
-#![doc(html_root_url = "https://docs.rs/anyhow/1.0.33")]
+#![doc(html_root_url = "https://docs.rs/anyhow/1.0.34")]
#![cfg_attr(backtrace, feature(backtrace))]
#![cfg_attr(doc_cfg, feature(doc_cfg))]
#![cfg_attr(not(feature = "std"), no_std)]
diff --git a/src/macros.rs b/src/macros.rs
index c83dfa5..c4b4c80 100644
--- a/src/macros.rs
+++ b/src/macros.rs
@@ -53,13 +53,13 @@
#[macro_export]
macro_rules! bail {
($msg:literal $(,)?) => {
- return $crate::private::Err($crate::anyhow!($msg));
+ return $crate::private::Err($crate::anyhow!($msg))
};
($err:expr $(,)?) => {
- return $crate::private::Err($crate::anyhow!($err));
+ return $crate::private::Err($crate::anyhow!($err))
};
($fmt:expr, $($arg:tt)*) => {
- return $crate::private::Err($crate::anyhow!($fmt, $($arg)*));
+ return $crate::private::Err($crate::anyhow!($fmt, $($arg)*))
};
}