Merge branch 'master' into fix-nightly-backtraces

This commit is contained in:
Freja Roberts 2024-05-13 18:47:47 +02:00 committed by GitHub
commit dacfb5566e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 1133 additions and 17 deletions

1
.gitignore vendored
View File

@ -1,4 +1,3 @@
/target
**/*.rs.bk
Cargo.lock
tags

1120
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -16,7 +16,7 @@ rust-version = "1.65.0"
[workspace.dependencies]
indenter = "0.3.0"
once_cell = "1.18.0"
owo-colors = "3.2.0"
owo-colors = "4.0"
autocfg = "1.0"
[profile.dev.package.backtrace]

View File

@ -23,7 +23,7 @@ tracing-error = { version = "0.2.0", optional = true }
backtrace = { version = "0.3.48", features = ["gimli-symbolize"] }
indenter = { workspace = true }
owo-colors = { workspace = true }
color-spantrace = { version = "0.2", optional = true }
color-spantrace = { version = "0.2", path = "../color-spantrace", optional = true }
once_cell = { workspace = true }
url = { version = "2.1.1", optional = true }

View File

@ -14,7 +14,7 @@ rust-version = { workspace = true }
[dependencies]
tracing-error = "0.2.0"
tracing-core = "0.1.21"
owo-colors = "4.0"
owo-colors = { workspace = true }
once_cell = { workspace = true }
[dev-dependencies]

View File

@ -30,8 +30,7 @@ autocfg = { workspace = true }
futures = { version = "0.3", default-features = false }
rustversion = "1.0"
thiserror = "1.0"
# TODO: 1.0.90 uses rustc-1.70
trybuild = { version = "=1.0.83", features = ["diff"] }
trybuild = { version = "=1.0.89", features = ["diff"] } # pinned due to MSRV
backtrace = "0.3.46"
anyhow = "1.0.28"
syn = { version = "2.0", features = ["full"] }

View File

@ -27,7 +27,7 @@ impl Report {
/// Create a new error object from a printable error message.
///
/// If the argument implements std::error::Error, prefer `Report::new`
/// If the argument implements `std::error::Error`, prefer [`Report::new`]
/// instead which preserves the underlying error's cause chain and
/// backtrace. If the argument may or may not implement std::error::Error
/// now or in the future, use `eyre!(err)` which handles either way

View File

@ -417,22 +417,22 @@ pub use WrapErr as Context;
///
/// # Display representations
///
/// When you print an error object using "{}" or to_string(), only the outermost underlying error
/// is printed, not any of the lower level causes. This is exactly as if you had called the Display
/// impl of the error from which you constructed your eyre::Report.
/// When you print an error object using `"{}"` or `to_string()`, only the outermost underlying error
/// is printed, not any of the lower level causes. This is exactly as if you had called the `Display`
/// implementation of the error from which you constructed your `eyre::Report`.
///
/// ```console
/// Failed to read instrs from ./path/to/instrs.json
/// ```
///
/// To print causes as well using eyre's default formatting of causes, use the
/// alternate selector "{:#}".
/// alternate selector `"{:#}"`.
///
/// ```console
/// Failed to read instrs from ./path/to/instrs.json: No such file or directory (os error 2)
/// ```
///
/// The Debug format "{:?}" includes your backtrace if one was captured. Note
/// The Debug format `"{:?}"` includes your backtrace if one was captured. Note
/// that this is the representation you get by default if you return an error
/// from `fn main` instead of printing it explicitly yourself.
///
@ -458,7 +458,7 @@ pub use WrapErr as Context;
/// 7: _start
/// ```
///
/// To see a conventional struct-style Debug representation, use "{:#?}".
/// To see a conventional struct-style Debug representation, use `"{:#?}"`.
///
/// ```console
/// Error {
@ -1276,7 +1276,7 @@ pub trait ContextCompat<T>: context::private::Sealed {
F: FnOnce() -> D;
}
/// Equivalent to Ok::<_, eyre::Error>(value).
/// Equivalent to `Ok::<_, eyre::Error>(value)`.
///
/// This simplifies creation of an eyre::Result in places where type inference
/// cannot deduce the `E` type of the result &mdash; without needing to write

View File

@ -108,9 +108,7 @@ macro_rules! bail {
#[macro_export]
macro_rules! ensure {
($cond:expr $(,)?) => {
if !$cond {
$crate::ensure!($cond, concat!("Condition failed: `", stringify!($cond), "`"))
}
$crate::ensure!($cond, concat!("Condition failed: `", stringify!($cond), "`"))
};
($cond:expr, $msg:literal $(,)?) => {
if !$cond {