From 3ae04d4d4b7d5b09fbfc7ea341741eed88862a1c Mon Sep 17 00:00:00 2001
From: Tim Diekmann
Date: Tue, 15 Aug 2023 20:22:37 +0200
Subject: [PATCH 1/2] Upgrade `error-stack` toolchain and use `Error::provide`
---
.github/renovate.json | 5 ++
libs/error-stack/Cargo.toml | 2 +-
libs/error-stack/README.md | 2 +-
libs/error-stack/macros/Cargo.toml | 2 +-
libs/error-stack/macros/README.md | 2 +-
libs/error-stack/rust-toolchain.toml | 2 +-
libs/error-stack/src/context.rs | 10 ++--
libs/error-stack/src/error.rs | 13 +++--
libs/error-stack/src/fmt.rs | 4 +-
libs/error-stack/src/frame.rs | 14 +++--
libs/error-stack/src/frame/frame_impl.rs | 54 +++++++++++++------
libs/error-stack/src/hook.rs | 9 ++--
libs/error-stack/src/lib.rs | 7 +--
libs/error-stack/src/report.rs | 12 ++---
libs/error-stack/tests/common.rs | 20 +++----
.../doc/hook__debug_hook_provide.snap | 2 +-
.../snapshots/test_debug__full__complex.snap | 2 +-
.../test_debug__full__hook_provider.snap | 2 +-
.../snapshots/test_debug__full__linear.snap | 4 +-
.../test_debug__full__linear_ext.snap | 4 +-
.../test_debug__full__multiline_context.snap | 6 +--
.../snapshots/test_debug__full__sources.snap | 2 +-
...test_debug__full__sources_transparent.snap | 2 +-
.../snapshots/test_debug__sources_nested.snap | 20 +++----
.../test_debug__sources_nested@backtrace.snap | 20 +++----
...g__sources_nested@spantrace-backtrace.snap | 20 +++----
.../test_debug__sources_nested_alternate.snap | 20 +++----
...g__sources_nested_alternate@backtrace.snap | 20 +++----
..._nested_alternate@spantrace-backtrace.snap | 20 +++----
libs/error-stack/tests/test_attach.rs | 3 +-
.../tests/test_attach_printable.rs | 3 +-
libs/error-stack/tests/test_backtrace.rs | 2 +-
libs/error-stack/tests/test_change_context.rs | 3 +-
libs/error-stack/tests/test_compatibility.rs | 24 +++++----
libs/error-stack/tests/test_conversion.rs | 4 +-
libs/error-stack/tests/test_debug.rs | 7 ++-
libs/error-stack/tests/test_display.rs | 3 +-
libs/error-stack/tests/test_downcast.rs | 3 +-
libs/error-stack/tests/test_extend.rs | 3 +-
libs/error-stack/tests/test_frame.rs | 3 +-
libs/error-stack/tests/test_iter.rs | 4 +-
libs/error-stack/tests/test_macros.rs | 3 +-
libs/error-stack/tests/test_provision.rs | 3 +-
libs/error-stack/tests/test_serialize.rs | 3 +-
libs/error-stack/tests/test_span_trace.rs | 3 +-
45 files changed, 191 insertions(+), 185 deletions(-)
diff --git a/.github/renovate.json b/.github/renovate.json
index 9f073c791fb..ead9071a958 100644
--- a/.github/renovate.json
+++ b/.github/renovate.json
@@ -205,6 +205,11 @@
"matchPackagePatterns": ["^tracing[-_]?"],
"excludePackageNames": ["tracing-opentelemetry"],
"groupName": "`tracing` crates"
+ },
+ {
+ "matchManagers": ["cargo"],
+ "matchFileNames": ["libs/error-stack/Cargo.toml"],
+ "excludeDepNames": ["anyhow"]
}
],
"regexManagers": [
diff --git a/libs/error-stack/Cargo.toml b/libs/error-stack/Cargo.toml
index adc713860b0..3cc1cdc43b4 100644
--- a/libs/error-stack/Cargo.toml
+++ b/libs/error-stack/Cargo.toml
@@ -19,7 +19,7 @@ categories = ["rust-patterns", "no-std"]
[dependencies]
tracing-error = { version = "0.2", optional = true, default_features = false }
-anyhow = { version = ">=1.0.65, <=1.0.72", default-features = false, optional = true }
+anyhow = { version = ">=1.0.73", default-features = false, optional = true }
eyre = { version = "0.6", default-features = false, optional = true }
serde = { version = "1", default-features = false, optional = true }
spin = { version = "0.9", default-features = false, optional = true, features = ['rwlock', 'once'] }
diff --git a/libs/error-stack/README.md b/libs/error-stack/README.md
index 7e1197db4fd..ec14b1d313c 100644
--- a/libs/error-stack/README.md
+++ b/libs/error-stack/README.md
@@ -8,7 +8,7 @@
[][crates.io]
[][libs.rs]
-[][rust-version]
+[][rust-version]
[][documentation]
[][license]
[][discord]
diff --git a/libs/error-stack/macros/Cargo.toml b/libs/error-stack/macros/Cargo.toml
index f93e4349429..ed2693cd8ce 100644
--- a/libs/error-stack/macros/Cargo.toml
+++ b/libs/error-stack/macros/Cargo.toml
@@ -18,4 +18,4 @@ proc-macro = true
[dependencies]
[dev-dependencies]
-error-stack = { version = "0.3.1", default-features = false }
+error-stack = { path = "..", default-features = false }
diff --git a/libs/error-stack/macros/README.md b/libs/error-stack/macros/README.md
index 2ce7fa6a920..d5b97842791 100644
--- a/libs/error-stack/macros/README.md
+++ b/libs/error-stack/macros/README.md
@@ -7,7 +7,7 @@
[][crates.io]
[][libs.rs]
-[][rust-version]
+[][rust-version]
[][documentation]
[][license]
[][discord]
diff --git a/libs/error-stack/rust-toolchain.toml b/libs/error-stack/rust-toolchain.toml
index b3820399d02..d400dca07a8 100644
--- a/libs/error-stack/rust-toolchain.toml
+++ b/libs/error-stack/rust-toolchain.toml
@@ -1,4 +1,4 @@
[toolchain]
# Please also update the badges in `README.md`s (`error-stack` and `error-stack-macros`), and `src/lib.rs`
-channel = "nightly-2023-08-14"
+channel = "nightly-2023-08-15"
components = ['rustfmt', 'clippy', 'llvm-tools-preview', 'miri', 'rust-src']
diff --git a/libs/error-stack/src/context.rs b/libs/error-stack/src/context.rs
index af0b0c7ea18..8cce96947cf 100644
--- a/libs/error-stack/src/context.rs
+++ b/libs/error-stack/src/context.rs
@@ -1,6 +1,6 @@
-use core::fmt;
#[cfg(nightly)]
-use core::{any::Demand, error::Error};
+use core::error::{Error, Request};
+use core::fmt;
#[cfg(all(not(nightly), feature = "std"))]
use std::error::Error;
@@ -61,7 +61,7 @@ pub trait Context: fmt::Display + fmt::Debug + Send + Sync + 'static {
/// Provide values which can then be requested by [`Report`].
#[cfg(nightly)]
#[allow(unused_variables)]
- fn provide<'a>(&'a self, demand: &mut Demand<'a>) {}
+ fn provide<'a>(&'a self, request: &mut Request<'a>) {}
}
impl From for Report
@@ -78,7 +78,7 @@ where
#[cfg(any(nightly, feature = "std"))]
impl Context for C {
#[cfg(nightly)]
- fn provide<'a>(&'a self, demand: &mut Demand<'a>) {
- Error::provide(self, demand);
+ fn provide<'a>(&'a self, request: &mut Request<'a>) {
+ Error::provide(self, request);
}
}
diff --git a/libs/error-stack/src/error.rs b/libs/error-stack/src/error.rs
index 19c03cd9274..83ec755b874 100644
--- a/libs/error-stack/src/error.rs
+++ b/libs/error-stack/src/error.rs
@@ -1,9 +1,6 @@
-use core::fmt;
#[cfg(nightly)]
-use core::{
- any::{Demand, Provider},
- error::Error,
-};
+use core::error::{Error, Request};
+use core::fmt;
#[cfg(not(nightly))]
use std::error::Error;
@@ -37,7 +34,9 @@ impl fmt::Display for ReportError {
impl Error for ReportError {
#[cfg(nightly)]
- fn provide<'a>(&'a self, demand: &mut Demand<'a>) {
- self.0.frames().for_each(|frame| frame.provide(demand));
+ fn provide<'a>(&'a self, request: &mut Request<'a>) {
+ self.0
+ .frames()
+ .for_each(|frame| frame.as_error().provide(request));
}
}
diff --git a/libs/error-stack/src/fmt.rs b/libs/error-stack/src/fmt.rs
index 5978b0fa1e9..9e838f62bc0 100644
--- a/libs/error-stack/src/fmt.rs
+++ b/libs/error-stack/src/fmt.rs
@@ -18,10 +18,10 @@
//! [`Report::install_debug_hook`] calls determines the order of the rendered output. Note, that
//! Hooks get called on all values provided by [`Context::provide`], but not on the [`Context`]
//! object itself. Therefore if you want to call a hook on a [`Context`] to print in addition to its
-//! [`Display`] implementation, you may want to call [`demand.provide_ref(self)`] inside of
+//! [`Display`] implementation, you may want to call [`request.provide_ref(self)`] inside of
//! [`Context::provide`].
//!
-//! [`demand.provide_ref(self)`]: core::any::Demand::provide_ref
+//! [`request.provide_ref(self)`]: core::error::Request::provide_ref
//!
//! Hook functions need to be [`Fn`] and **not** [`FnMut`], which means they are unable to directly
//! mutate state outside of the closure.
diff --git a/libs/error-stack/src/frame.rs b/libs/error-stack/src/frame.rs
index 6a6b4b7c9ef..d710ec05017 100644
--- a/libs/error-stack/src/frame.rs
+++ b/libs/error-stack/src/frame.rs
@@ -3,7 +3,7 @@ mod kind;
use alloc::boxed::Box;
#[cfg(nightly)]
-use core::any::{self, Demand, Provider};
+use core::error::{self, Error};
use core::{any::TypeId, fmt};
use self::frame_impl::FrameImpl;
@@ -59,7 +59,7 @@ impl Frame {
where
T: ?Sized + 'static,
{
- any::request_ref(self)
+ error::request_ref(self.as_error())
}
/// Requests the value of `T` from the `Frame` if provided.
@@ -69,7 +69,7 @@ impl Frame {
where
T: 'static,
{
- any::request_value(self)
+ error::request_value(self.as_error())
}
/// Returns if `T` is the held context or attachment by this frame.
@@ -95,12 +95,10 @@ impl Frame {
pub fn type_id(&self) -> TypeId {
self.frame.as_any().type_id()
}
-}
-#[cfg(nightly)]
-impl Provider for Frame {
- fn provide<'a>(&'a self, demand: &mut Demand<'a>) {
- self.frame.provide(demand);
+ #[cfg(nightly)]
+ pub(crate) fn as_error(&self) -> &impl Error {
+ &self.frame
}
}
diff --git a/libs/error-stack/src/frame/frame_impl.rs b/libs/error-stack/src/frame/frame_impl.rs
index 9ea0a8a85bc..4b7459d4d75 100644
--- a/libs/error-stack/src/frame/frame_impl.rs
+++ b/libs/error-stack/src/frame/frame_impl.rs
@@ -1,6 +1,6 @@
use alloc::boxed::Box;
#[cfg(nightly)]
-use core::any::Demand;
+use core::error::{Error, Request};
use core::{any::Any, fmt};
use crate::{AttachmentKind, Context, Frame, FrameKind};
@@ -15,7 +15,28 @@ pub(super) trait FrameImpl: Send + Sync + 'static {
/// Provide values which can then be requested.
#[cfg(nightly)]
- fn provide<'a>(&'a self, demand: &mut Demand<'a>);
+ fn provide<'a>(&'a self, request: &mut Request<'a>);
+}
+
+#[cfg(nightly)]
+impl fmt::Debug for Box {
+ fn fmt(&self, _: &mut fmt::Formatter<'_>) -> fmt::Result {
+ unreachable!()
+ }
+}
+
+#[cfg(nightly)]
+impl fmt::Display for Box {
+ fn fmt(&self, _: &mut fmt::Formatter<'_>) -> fmt::Result {
+ unreachable!()
+ }
+}
+
+#[cfg(nightly)]
+impl Error for Box {
+ fn provide<'a>(&'a self, request: &mut Request<'a>) {
+ (**self).provide(request);
+ }
}
struct ContextFrame {
@@ -36,8 +57,8 @@ impl FrameImpl for ContextFrame {
}
#[cfg(nightly)]
- fn provide<'a>(&'a self, demand: &mut Demand<'a>) {
- Context::provide(&self.context, demand);
+ fn provide<'a>(&'a self, request: &mut Request<'a>) {
+ Context::provide(&self.context, request);
}
}
@@ -59,8 +80,8 @@ impl FrameImpl for AttachmentFrame {
}
#[cfg(nightly)]
- fn provide<'a>(&'a self, demand: &mut Demand<'a>) {
- demand.provide_ref(&self.attachment);
+ fn provide<'a>(&'a self, request: &mut Request<'a>) {
+ request.provide_ref(&self.attachment);
}
}
@@ -84,8 +105,8 @@ impl FrameImpl
}
#[cfg(nightly)]
- fn provide<'a>(&'a self, demand: &mut Demand<'a>) {
- demand.provide_ref(&self.attachment);
+ fn provide<'a>(&'a self, request: &mut Request<'a>) {
+ request.provide_ref(&self.attachment);
}
}
@@ -108,11 +129,10 @@ impl fmt::Display for AnyhowContext {
#[cfg(feature = "anyhow")]
impl Context for AnyhowContext {
- // `Provider` is only implemented for `anyhow::Error` on `std`
#[cfg(all(nightly, feature = "std"))]
#[inline]
- fn provide<'a>(&'a self, demand: &mut Demand<'a>) {
- core::any::Provider::provide(&self.0, demand);
+ fn provide<'a>(&'a self, request: &mut Request<'a>) {
+ request.provide_ref(self.0.backtrace());
}
}
@@ -132,8 +152,8 @@ impl FrameImpl for AnyhowContext {
#[cfg(nightly)]
#[inline]
- fn provide<'a>(&'a self, demand: &mut Demand<'a>) {
- Context::provide(self, demand);
+ fn provide<'a>(&'a self, request: &mut Request<'a>) {
+ Context::provide(self, request);
}
}
@@ -158,8 +178,8 @@ impl fmt::Display for EyreContext {
impl Context for EyreContext {
#[cfg(nightly)]
#[inline]
- fn provide<'a>(&'a self, _demand: &mut Demand<'a>) {
- // `eyre::Report` does not implement `Provider`
+ fn provide<'a>(&'a self, request: &mut Request<'a>) {
+ Error::provide(self.0.as_ref() as &dyn Error, request);
}
}
@@ -179,8 +199,8 @@ impl FrameImpl for EyreContext {
#[cfg(nightly)]
#[inline]
- fn provide<'a>(&'a self, demand: &mut Demand<'a>) {
- Context::provide(self, demand);
+ fn provide<'a>(&'a self, request: &mut Request<'a>) {
+ Context::provide(self, request);
}
}
diff --git a/libs/error-stack/src/hook.rs b/libs/error-stack/src/hook.rs
index 823d58a7510..e05ebd40e6b 100644
--- a/libs/error-stack/src/hook.rs
+++ b/libs/error-stack/src/hook.rs
@@ -74,15 +74,14 @@ impl Report<()> {
/// ```rust
/// # // this is a lot of boilerplate, if you find a better way, please change this!
/// # // with #![cfg(nightly)] docsrs will complain that there's no main in non-nightly
- /// # #![cfg_attr(nightly, feature(error_generic_member_access, provide_any))]
+ /// # #![cfg_attr(nightly, feature(error_in_core, error_generic_member_access))]
/// # const _: &'static str = r#"
- /// #![feature(error_generic_member_access, provide_any)]
+ /// #![feature(error_generic_member_access)]
/// # "#;
///
/// # #[cfg(nightly)]
/// # mod nightly {
- /// use std::any::Demand;
- /// use std::error::Error;
+ /// use std::error::{Request, Error};
/// use std::fmt::{Display, Formatter};
/// use error_stack::{Report, report};
///
@@ -104,7 +103,7 @@ impl Report<()> {
/// }
///
/// impl Error for UserError {
- /// fn provide<'a>(&'a self, req: &mut Demand<'a>) {
+ /// fn provide<'a>(&'a self, req: &mut Request<'a>) {
/// req.provide_value(Suggestion("try better next time!"));
/// req.provide_ref(&self.code);
/// }
diff --git a/libs/error-stack/src/lib.rs b/libs/error-stack/src/lib.rs
index 6318177de53..a74dbae8279 100644
--- a/libs/error-stack/src/lib.rs
+++ b/libs/error-stack/src/lib.rs
@@ -2,7 +2,7 @@
//!
//! [][crates.io]
//! [][libs.rs]
-//! [][rust-version]
+//! [][rust-version]
//! [][discord]
//!
//! [crates.io]: https://crates.io/crates/error-stack
@@ -428,10 +428,7 @@
//! [`Debug`]: core::fmt::Debug
//! [`SpanTrace`]: tracing_error::SpanTrace
#![cfg_attr(not(feature = "std"), no_std)]
-#![cfg_attr(
- nightly,
- feature(provide_any, error_in_core, error_generic_member_access)
-)]
+#![cfg_attr(nightly, feature(error_in_core, error_generic_member_access))]
#![cfg_attr(all(doc, nightly), feature(doc_auto_cfg))]
#![cfg_attr(all(nightly, feature = "std"), feature(backtrace_frames))]
#![cfg_attr(
diff --git a/libs/error-stack/src/report.rs b/libs/error-stack/src/report.rs
index d82a5845ece..f96482295aa 100644
--- a/libs/error-stack/src/report.rs
+++ b/libs/error-stack/src/report.rs
@@ -63,7 +63,7 @@ use crate::{
/// consists of. Therefore it isn't guaranteed that [`request_ref()`] will only ever return a single
/// [`Backtrace`] or [`SpanTrace`].
///
-/// [`provide`]: core::any::Provider::provide
+/// [`provide`]: core::error::Error::provide
/// [`ErrorLayer`]: tracing_error::ErrorLayer
/// [`attach()`]: Self::attach
/// [`extend_one()`]: Self::extend_one
@@ -269,7 +269,7 @@ impl Report {
#[track_caller]
pub(crate) fn from_frame(frame: Frame) -> Self {
#[cfg(nightly)]
- let location = core::any::request_ref::(&frame)
+ let location = core::error::request_ref::(&frame.as_error())
.is_none()
.then_some(Location::caller());
@@ -277,7 +277,7 @@ impl Report {
let location = Some(Location::caller());
#[cfg(all(nightly, feature = "std"))]
- let backtrace = core::any::request_ref::(&frame)
+ let backtrace = core::error::request_ref::(&frame.as_error())
.filter(|backtrace| backtrace.status() == BacktraceStatus::Captured)
.is_none()
.then(Backtrace::capture);
@@ -286,7 +286,7 @@ impl Report {
let backtrace = Some(Backtrace::capture());
#[cfg(all(nightly, feature = "spantrace"))]
- let span_trace = core::any::request_ref::(&frame)
+ let span_trace = core::error::request_ref::(&frame.as_error())
.filter(|span_trace| span_trace.status() == SpanTraceStatus::CAPTURED)
.is_none()
.then(SpanTrace::capture);
@@ -509,14 +509,14 @@ impl Report {
}
/// Creates an iterator of references of type `T` that have been [`attached`](Self::attach) or
- /// that are [`provide`](core::any::Provider::provide)d by [`Context`] objects.
+ /// that are [`provide`](Error::provide)d by [`Context`] objects.
#[cfg(nightly)]
pub fn request_ref(&self) -> RequestRef<'_, T> {
RequestRef::new(&self.frames)
}
/// Creates an iterator of values of type `T` that have been [`attached`](Self::attach) or
- /// that are [`provide`](core::any::Provider::provide)d by [`Context`] objects.
+ /// that are [`provide`](Error::provide)d by [`Context`] objects.
#[cfg(nightly)]
pub fn request_value(&self) -> RequestValue<'_, T> {
RequestValue::new(&self.frames)
diff --git a/libs/error-stack/tests/common.rs b/libs/error-stack/tests/common.rs
index a53afbd28c8..2766f82a381 100644
--- a/libs/error-stack/tests/common.rs
+++ b/libs/error-stack/tests/common.rs
@@ -49,9 +49,9 @@ impl fmt::Display for ContextA {
impl Context for ContextA {
#[cfg(nightly)]
- fn provide<'a>(&'a self, demand: &mut core::any::Demand<'a>) {
- demand.provide_ref(&self.0);
- demand.provide_value(u64::from(self.0));
+ fn provide<'a>(&'a self, request: &mut core::error::Request<'a>) {
+ request.provide_ref(&self.0);
+ request.provide_value(u64::from(self.0));
}
}
@@ -66,9 +66,9 @@ impl fmt::Display for ContextB {
impl Context for ContextB {
#[cfg(nightly)]
- fn provide<'a>(&'a self, demand: &mut core::any::Demand<'a>) {
- demand.provide_ref(&self.0);
- demand.provide_value(i64::from(self.0));
+ fn provide<'a>(&'a self, request: &mut core::error::Request<'a>) {
+ request.provide_ref(&self.0);
+ request.provide_value(i64::from(self.0));
}
}
@@ -93,8 +93,8 @@ impl fmt::Display for ErrorA {
#[cfg(feature = "spantrace")]
impl Context for ErrorA {
#[cfg(nightly)]
- fn provide<'a>(&'a self, demand: &mut core::any::Demand<'a>) {
- demand.provide_ref(&self.1);
+ fn provide<'a>(&'a self, request: &mut core::error::Request<'a>) {
+ request.provide_ref(&self.1);
}
}
@@ -118,8 +118,8 @@ impl fmt::Display for ErrorB {
#[cfg(all(nightly, feature = "std"))]
impl std::error::Error for ErrorB {
- fn provide<'a>(&'a self, demand: &mut core::any::Demand<'a>) {
- demand.provide_ref(&self.1);
+ fn provide<'a>(&'a self, request: &mut core::error::Request<'a>) {
+ request.provide_ref(&self.1);
}
}
diff --git a/libs/error-stack/tests/snapshots/doc/hook__debug_hook_provide.snap b/libs/error-stack/tests/snapshots/doc/hook__debug_hook_provide.snap
index a295221677b..cd574c02a7b 100644
--- a/libs/error-stack/tests/snapshots/doc/hook__debug_hook_provide.snap
+++ b/libs/error-stack/tests/snapshots/doc/hook__debug_hook_provide.snap
@@ -1,7 +1,7 @@
invalid user input
├╴suggestion: try better next time!
├╴error code: 420
-├╴at src/hook.rs:50:14
+├╴at src/hook.rs:49:14
╰╴backtrace (1)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
diff --git a/libs/error-stack/tests/snapshots/test_debug__full__complex.snap b/libs/error-stack/tests/snapshots/test_debug__full__complex.snap
index 2f719afbc3b..ca19254b0c0 100644
--- a/libs/error-stack/tests/snapshots/test_debug__full__complex.snap
+++ b/libs/error-stack/tests/snapshots/test_debug__full__complex.snap
@@ -3,7 +3,7 @@ source: tests/test_debug.rs
expression: "format!(\"{report:?}\")"
---
context A
-├╴at tests/test_debug.rs:434:14
+├╴at tests/test_debug.rs:433:14
├╴printable A
│
╰┬▶ root error
diff --git a/libs/error-stack/tests/snapshots/test_debug__full__hook_provider.snap b/libs/error-stack/tests/snapshots/test_debug__full__hook_provider.snap
index 456ded5f252..96f95d549b6 100644
--- a/libs/error-stack/tests/snapshots/test_debug__full__hook_provider.snap
+++ b/libs/error-stack/tests/snapshots/test_debug__full__hook_provider.snap
@@ -5,7 +5,7 @@ expression: "format!(\"{report:?}\")"
context D
├╴usize: 420
├╴&'static str: Invalid User Input
-├╴at tests/test_debug.rs:589:38
+├╴at tests/test_debug.rs:588:38
│
╰─▶ root error
├╴at tests/common.rs:4:5
diff --git a/libs/error-stack/tests/snapshots/test_debug__full__linear.snap b/libs/error-stack/tests/snapshots/test_debug__full__linear.snap
index ac06b1be2f2..8de0814b710 100644
--- a/libs/error-stack/tests/snapshots/test_debug__full__linear.snap
+++ b/libs/error-stack/tests/snapshots/test_debug__full__linear.snap
@@ -3,11 +3,11 @@ source: tests/test_debug.rs
expression: "format!(\"{report:?}\")"
---
context B
-├╴at tests/test_debug.rs:279:14
+├╴at tests/test_debug.rs:278:14
├╴printable C
│
├─▶ context A
-│ ├╴at tests/test_debug.rs:276:14
+│ ├╴at tests/test_debug.rs:275:14
│ ├╴printable B
│ ╰╴1 additional opaque attachment
│
diff --git a/libs/error-stack/tests/snapshots/test_debug__full__linear_ext.snap b/libs/error-stack/tests/snapshots/test_debug__full__linear_ext.snap
index f54d5134d3f..2c87b68589b 100644
--- a/libs/error-stack/tests/snapshots/test_debug__full__linear_ext.snap
+++ b/libs/error-stack/tests/snapshots/test_debug__full__linear_ext.snap
@@ -3,11 +3,11 @@ source: tests/test_debug.rs
expression: "format!(\"{report:#?}\")"
---
context B
-├╴at tests/test_debug.rs:296:14
+├╴at tests/test_debug.rs:295:14
├╴printable C
│
├─▶ context A
-│ ├╴at tests/test_debug.rs:293:14
+│ ├╴at tests/test_debug.rs:292:14
│ ├╴printable B
│ ╰╴1 additional opaque attachment
│
diff --git a/libs/error-stack/tests/snapshots/test_debug__full__multiline_context.snap b/libs/error-stack/tests/snapshots/test_debug__full__multiline_context.snap
index 5332a61ac4d..5d9a4d75576 100644
--- a/libs/error-stack/tests/snapshots/test_debug__full__multiline_context.snap
+++ b/libs/error-stack/tests/snapshots/test_debug__full__multiline_context.snap
@@ -3,20 +3,20 @@ source: tests/test_debug.rs
expression: "format!(\"{report:#?}\")"
---
context B
-├╴at tests/test_debug.rs:321:14
+├╴at tests/test_debug.rs:320:14
├╴printable C
│
├─▶ A multiline
│ context that might have
│ a bit more info
-│ ├╴at tests/test_debug.rs:318:14
+│ ├╴at tests/test_debug.rs:317:14
│ ├╴printable B
│ ╰╴1 additional opaque attachment
│
╰─▶ A multiline
context that might have
a bit more info
- ├╴at tests/test_debug.rs:317:22
+ ├╴at tests/test_debug.rs:316:22
╰╴backtrace (1)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
diff --git a/libs/error-stack/tests/snapshots/test_debug__full__sources.snap b/libs/error-stack/tests/snapshots/test_debug__full__sources.snap
index 1b0ef1e9194..31b5a6c9b28 100644
--- a/libs/error-stack/tests/snapshots/test_debug__full__sources.snap
+++ b/libs/error-stack/tests/snapshots/test_debug__full__sources.snap
@@ -3,7 +3,7 @@ source: tests/test_debug.rs
expression: "format!(\"{report:?}\")"
---
context A
-├╴at tests/test_debug.rs:366:14
+├╴at tests/test_debug.rs:365:14
├╴1 additional opaque attachment
│
╰┬▶ root error
diff --git a/libs/error-stack/tests/snapshots/test_debug__full__sources_transparent.snap b/libs/error-stack/tests/snapshots/test_debug__full__sources_transparent.snap
index f48eac4c7a1..a7126c413fe 100644
--- a/libs/error-stack/tests/snapshots/test_debug__full__sources_transparent.snap
+++ b/libs/error-stack/tests/snapshots/test_debug__full__sources_transparent.snap
@@ -3,7 +3,7 @@ source: tests/test_debug.rs
expression: "format!(\"{report:?}\")"
---
context A
-├╴at tests/test_debug.rs:407:18
+├╴at tests/test_debug.rs:406:18
├╴1 additional opaque attachment
│
╰┬▶ root error
diff --git a/libs/error-stack/tests/snapshots/test_debug__sources_nested.snap b/libs/error-stack/tests/snapshots/test_debug__sources_nested.snap
index 3940fe44588..1dfa43959bd 100644
--- a/libs/error-stack/tests/snapshots/test_debug__sources_nested.snap
+++ b/libs/error-stack/tests/snapshots/test_debug__sources_nested.snap
@@ -3,12 +3,12 @@ source: tests/test_debug.rs
expression: "format!(\"{report:?}\")"
---
context A
-├╴at tests/test_debug.rs:207:10
+├╴at tests/test_debug.rs:206:10
├╴2
├╴1
│
╰┬▶ context A
- │ ├╴at tests/test_debug.rs:201:10
+ │ ├╴at tests/test_debug.rs:200:10
│ ├╴4
│ ├╴3
│ │
@@ -17,16 +17,16 @@ context A
│ ╰╴6
│
╰▶ context A
- ├╴at tests/test_debug.rs:196:10
+ ├╴at tests/test_debug.rs:195:10
├╴5
├╴3
│
├─▶ context A
- │ ├╴at tests/test_debug.rs:194:10
+ │ ├╴at tests/test_debug.rs:193:10
│ ╰╴7
│
╰┬▶ context A
- │ ├╴at tests/test_debug.rs:185:34
+ │ ├╴at tests/test_debug.rs:184:34
│ ├╴9
│ ├╴8
│ │
@@ -34,7 +34,7 @@ context A
│ ╰╴at tests/common.rs:4:5
│
├▶ context A
- │ ├╴at tests/test_debug.rs:179:10
+ │ ├╴at tests/test_debug.rs:178:10
│ ├╴13
│ ├╴10
│ ├╴16
@@ -45,7 +45,7 @@ context A
│ ╰╴at tests/common.rs:4:5
│
├▶ context A
- │ ├╴at tests/test_debug.rs:165:10
+ │ ├╴at tests/test_debug.rs:164:10
│ ├╴15
│ ├╴14
│ ├╴10
@@ -57,7 +57,7 @@ context A
│ ╰╴at tests/common.rs:4:5
│
├▶ context A
- │ ├╴at tests/test_debug.rs:175:10
+ │ ├╴at tests/test_debug.rs:174:10
│ ├╴11
│ ├╴9
│ ├╴8
@@ -66,13 +66,13 @@ context A
│ ╰╴at tests/common.rs:4:5
│
╰▶ context A
- ├╴at tests/test_debug.rs:171:10
+ ├╴at tests/test_debug.rs:170:10
├╴12
├╴9
├╴8
│
├─▶ context A
- │ ╰╴at tests/test_debug.rs:170:10
+ │ ╰╴at tests/test_debug.rs:169:10
│
╰─▶ root error
╰╴at tests/common.rs:4:5
diff --git a/libs/error-stack/tests/snapshots/test_debug__sources_nested@backtrace.snap b/libs/error-stack/tests/snapshots/test_debug__sources_nested@backtrace.snap
index 7ccb5b975c8..6ad45d2e1c4 100644
--- a/libs/error-stack/tests/snapshots/test_debug__sources_nested@backtrace.snap
+++ b/libs/error-stack/tests/snapshots/test_debug__sources_nested@backtrace.snap
@@ -3,12 +3,12 @@ source: tests/test_debug.rs
expression: "format!(\"{report:?}\")"
---
context A
-├╴at tests/test_debug.rs:207:10
+├╴at tests/test_debug.rs:206:10
├╴2
├╴1
│
╰┬▶ context A
- │ ├╴at tests/test_debug.rs:201:10
+ │ ├╴at tests/test_debug.rs:200:10
│ ├╴4
│ ├╴3
│ │
@@ -18,16 +18,16 @@ context A
│ ╰╴6
│
╰▶ context A
- ├╴at tests/test_debug.rs:196:10
+ ├╴at tests/test_debug.rs:195:10
├╴5
├╴3
│
├─▶ context A
- │ ├╴at tests/test_debug.rs:194:10
+ │ ├╴at tests/test_debug.rs:193:10
│ ╰╴7
│
╰┬▶ context A
- │ ├╴at tests/test_debug.rs:185:34
+ │ ├╴at tests/test_debug.rs:184:34
│ ├╴9
│ ├╴8
│ │
@@ -36,7 +36,7 @@ context A
│ ╰╴backtrace (2)
│
├▶ context A
- │ ├╴at tests/test_debug.rs:179:10
+ │ ├╴at tests/test_debug.rs:178:10
│ ├╴13
│ ├╴10
│ ├╴16
@@ -48,7 +48,7 @@ context A
│ ╰╴backtrace (3)
│
├▶ context A
- │ ├╴at tests/test_debug.rs:165:10
+ │ ├╴at tests/test_debug.rs:164:10
│ ├╴15
│ ├╴14
│ ├╴10
@@ -61,7 +61,7 @@ context A
│ ╰╴backtrace (4)
│
├▶ context A
- │ ├╴at tests/test_debug.rs:175:10
+ │ ├╴at tests/test_debug.rs:174:10
│ ├╴11
│ ├╴9
│ ├╴8
@@ -71,13 +71,13 @@ context A
│ ╰╴backtrace (5)
│
╰▶ context A
- ├╴at tests/test_debug.rs:171:10
+ ├╴at tests/test_debug.rs:170:10
├╴12
├╴9
├╴8
│
├─▶ context A
- │ ╰╴at tests/test_debug.rs:170:10
+ │ ╰╴at tests/test_debug.rs:169:10
│
╰─▶ root error
├╴at tests/common.rs:4:5
diff --git a/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace-backtrace.snap b/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace-backtrace.snap
index ab49105f424..926d06260e8 100644
--- a/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace-backtrace.snap
+++ b/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace-backtrace.snap
@@ -3,12 +3,12 @@ source: tests/test_debug.rs
expression: "format!(\"{report:?}\")"
---
context A
-├╴at tests/test_debug.rs:207:10
+├╴at tests/test_debug.rs:206:10
├╴2
├╴1
│
╰┬▶ context A
- │ ├╴at tests/test_debug.rs:201:10
+ │ ├╴at tests/test_debug.rs:200:10
│ ├╴4
│ ├╴3
│ │
@@ -19,16 +19,16 @@ context A
│ ╰╴6
│
╰▶ context A
- ├╴at tests/test_debug.rs:196:10
+ ├╴at tests/test_debug.rs:195:10
├╴5
├╴3
│
├─▶ context A
- │ ├╴at tests/test_debug.rs:194:10
+ │ ├╴at tests/test_debug.rs:193:10
│ ╰╴7
│
╰┬▶ context A
- │ ├╴at tests/test_debug.rs:185:34
+ │ ├╴at tests/test_debug.rs:184:34
│ ├╴9
│ ├╴8
│ │
@@ -38,7 +38,7 @@ context A
│ ╰╴span trace with 2 frames (2)
│
├▶ context A
- │ ├╴at tests/test_debug.rs:179:10
+ │ ├╴at tests/test_debug.rs:178:10
│ ├╴13
│ ├╴10
│ ├╴16
@@ -51,7 +51,7 @@ context A
│ ╰╴span trace with 2 frames (3)
│
├▶ context A
- │ ├╴at tests/test_debug.rs:165:10
+ │ ├╴at tests/test_debug.rs:164:10
│ ├╴15
│ ├╴14
│ ├╴10
@@ -65,7 +65,7 @@ context A
│ ╰╴span trace with 2 frames (4)
│
├▶ context A
- │ ├╴at tests/test_debug.rs:175:10
+ │ ├╴at tests/test_debug.rs:174:10
│ ├╴11
│ ├╴9
│ ├╴8
@@ -76,13 +76,13 @@ context A
│ ╰╴span trace with 2 frames (5)
│
╰▶ context A
- ├╴at tests/test_debug.rs:171:10
+ ├╴at tests/test_debug.rs:170:10
├╴12
├╴9
├╴8
│
├─▶ context A
- │ ╰╴at tests/test_debug.rs:170:10
+ │ ╰╴at tests/test_debug.rs:169:10
│
╰─▶ root error
├╴at tests/common.rs:4:5
diff --git a/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate.snap b/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate.snap
index 1c193ae24c6..f9e2f3f9cbb 100644
--- a/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate.snap
+++ b/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate.snap
@@ -3,12 +3,12 @@ source: tests/test_debug.rs
expression: "format!(\"{report:#?}\")"
---
context A
-├╴at tests/test_debug.rs:207:10
+├╴at tests/test_debug.rs:206:10
├╴2
├╴1
│
╰┬▶ context A
- │ ├╴at tests/test_debug.rs:201:10
+ │ ├╴at tests/test_debug.rs:200:10
│ ├╴4
│ ├╴3
│ │
@@ -17,16 +17,16 @@ context A
│ ╰╴6
│
╰▶ context A
- ├╴at tests/test_debug.rs:196:10
+ ├╴at tests/test_debug.rs:195:10
├╴5
├╴3
│
├─▶ context A
- │ ├╴at tests/test_debug.rs:194:10
+ │ ├╴at tests/test_debug.rs:193:10
│ ╰╴7
│
╰┬▶ context A
- │ ├╴at tests/test_debug.rs:185:34
+ │ ├╴at tests/test_debug.rs:184:34
│ ├╴9
│ ├╴8
│ │
@@ -34,7 +34,7 @@ context A
│ ╰╴at tests/common.rs:4:5
│
├▶ context A
- │ ├╴at tests/test_debug.rs:179:10
+ │ ├╴at tests/test_debug.rs:178:10
│ ├╴13
│ ├╴10
│ ├╴16
@@ -45,7 +45,7 @@ context A
│ ╰╴at tests/common.rs:4:5
│
├▶ context A
- │ ├╴at tests/test_debug.rs:165:10
+ │ ├╴at tests/test_debug.rs:164:10
│ ├╴15
│ ├╴14
│ ├╴10
@@ -57,7 +57,7 @@ context A
│ ╰╴at tests/common.rs:4:5
│
├▶ context A
- │ ├╴at tests/test_debug.rs:175:10
+ │ ├╴at tests/test_debug.rs:174:10
│ ├╴11
│ ├╴9
│ ├╴8
@@ -66,13 +66,13 @@ context A
│ ╰╴at tests/common.rs:4:5
│
╰▶ context A
- ├╴at tests/test_debug.rs:171:10
+ ├╴at tests/test_debug.rs:170:10
├╴12
├╴9
├╴8
│
├─▶ context A
- │ ╰╴at tests/test_debug.rs:170:10
+ │ ╰╴at tests/test_debug.rs:169:10
│
╰─▶ root error
╰╴at tests/common.rs:4:5
diff --git a/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@backtrace.snap b/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@backtrace.snap
index 225e4e7df00..99f4476b6b5 100644
--- a/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@backtrace.snap
+++ b/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@backtrace.snap
@@ -3,12 +3,12 @@ source: tests/test_debug.rs
expression: "format!(\"{report:#?}\")"
---
context A
-├╴at tests/test_debug.rs:207:10
+├╴at tests/test_debug.rs:206:10
├╴2
├╴1
│
╰┬▶ context A
- │ ├╴at tests/test_debug.rs:201:10
+ │ ├╴at tests/test_debug.rs:200:10
│ ├╴4
│ ├╴3
│ │
@@ -18,16 +18,16 @@ context A
│ ╰╴6
│
╰▶ context A
- ├╴at tests/test_debug.rs:196:10
+ ├╴at tests/test_debug.rs:195:10
├╴5
├╴3
│
├─▶ context A
- │ ├╴at tests/test_debug.rs:194:10
+ │ ├╴at tests/test_debug.rs:193:10
│ ╰╴7
│
╰┬▶ context A
- │ ├╴at tests/test_debug.rs:185:34
+ │ ├╴at tests/test_debug.rs:184:34
│ ├╴9
│ ├╴8
│ │
@@ -36,7 +36,7 @@ context A
│ ╰╴backtrace (2)
│
├▶ context A
- │ ├╴at tests/test_debug.rs:179:10
+ │ ├╴at tests/test_debug.rs:178:10
│ ├╴13
│ ├╴10
│ ├╴16
@@ -48,7 +48,7 @@ context A
│ ╰╴backtrace (3)
│
├▶ context A
- │ ├╴at tests/test_debug.rs:165:10
+ │ ├╴at tests/test_debug.rs:164:10
│ ├╴15
│ ├╴14
│ ├╴10
@@ -61,7 +61,7 @@ context A
│ ╰╴backtrace (4)
│
├▶ context A
- │ ├╴at tests/test_debug.rs:175:10
+ │ ├╴at tests/test_debug.rs:174:10
│ ├╴11
│ ├╴9
│ ├╴8
@@ -71,13 +71,13 @@ context A
│ ╰╴backtrace (5)
│
╰▶ context A
- ├╴at tests/test_debug.rs:171:10
+ ├╴at tests/test_debug.rs:170:10
├╴12
├╴9
├╴8
│
├─▶ context A
- │ ╰╴at tests/test_debug.rs:170:10
+ │ ╰╴at tests/test_debug.rs:169:10
│
╰─▶ root error
├╴at tests/common.rs:4:5
diff --git a/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace-backtrace.snap b/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace-backtrace.snap
index 536c4c75657..abae421bfc6 100644
--- a/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace-backtrace.snap
+++ b/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace-backtrace.snap
@@ -3,12 +3,12 @@ source: tests/test_debug.rs
expression: "format!(\"{report:#?}\")"
---
context A
-├╴at tests/test_debug.rs:207:10
+├╴at tests/test_debug.rs:206:10
├╴2
├╴1
│
╰┬▶ context A
- │ ├╴at tests/test_debug.rs:201:10
+ │ ├╴at tests/test_debug.rs:200:10
│ ├╴4
│ ├╴3
│ │
@@ -19,16 +19,16 @@ context A
│ ╰╴6
│
╰▶ context A
- ├╴at tests/test_debug.rs:196:10
+ ├╴at tests/test_debug.rs:195:10
├╴5
├╴3
│
├─▶ context A
- │ ├╴at tests/test_debug.rs:194:10
+ │ ├╴at tests/test_debug.rs:193:10
│ ╰╴7
│
╰┬▶ context A
- │ ├╴at tests/test_debug.rs:185:34
+ │ ├╴at tests/test_debug.rs:184:34
│ ├╴9
│ ├╴8
│ │
@@ -38,7 +38,7 @@ context A
│ ╰╴span trace with 2 frames (2)
│
├▶ context A
- │ ├╴at tests/test_debug.rs:179:10
+ │ ├╴at tests/test_debug.rs:178:10
│ ├╴13
│ ├╴10
│ ├╴16
@@ -51,7 +51,7 @@ context A
│ ╰╴span trace with 2 frames (3)
│
├▶ context A
- │ ├╴at tests/test_debug.rs:165:10
+ │ ├╴at tests/test_debug.rs:164:10
│ ├╴15
│ ├╴14
│ ├╴10
@@ -65,7 +65,7 @@ context A
│ ╰╴span trace with 2 frames (4)
│
├▶ context A
- │ ├╴at tests/test_debug.rs:175:10
+ │ ├╴at tests/test_debug.rs:174:10
│ ├╴11
│ ├╴9
│ ├╴8
@@ -76,13 +76,13 @@ context A
│ ╰╴span trace with 2 frames (5)
│
╰▶ context A
- ├╴at tests/test_debug.rs:171:10
+ ├╴at tests/test_debug.rs:170:10
├╴12
├╴9
├╴8
│
├─▶ context A
- │ ╰╴at tests/test_debug.rs:170:10
+ │ ╰╴at tests/test_debug.rs:169:10
│
╰─▶ root error
├╴at tests/common.rs:4:5
diff --git a/libs/error-stack/tests/test_attach.rs b/libs/error-stack/tests/test_attach.rs
index de3f8c9e041..878603f1e04 100644
--- a/libs/error-stack/tests/test_attach.rs
+++ b/libs/error-stack/tests/test_attach.rs
@@ -1,5 +1,4 @@
-#![cfg_attr(nightly, feature(provide_any))]
-#![cfg_attr(all(nightly, feature = "std"), feature(error_generic_member_access))]
+#![cfg_attr(nightly, feature(error_in_core, error_generic_member_access))]
#[macro_use]
mod common;
diff --git a/libs/error-stack/tests/test_attach_printable.rs b/libs/error-stack/tests/test_attach_printable.rs
index 07fa39c66a4..30a72fe1bae 100644
--- a/libs/error-stack/tests/test_attach_printable.rs
+++ b/libs/error-stack/tests/test_attach_printable.rs
@@ -1,5 +1,4 @@
-#![cfg_attr(nightly, feature(provide_any))]
-#![cfg_attr(all(nightly, feature = "std"), feature(error_generic_member_access))]
+#![cfg_attr(nightly, feature(error_in_core, error_generic_member_access))]
#[macro_use]
mod common;
diff --git a/libs/error-stack/tests/test_backtrace.rs b/libs/error-stack/tests/test_backtrace.rs
index 9c9511bed6e..8fb5619a6e2 100644
--- a/libs/error-stack/tests/test_backtrace.rs
+++ b/libs/error-stack/tests/test_backtrace.rs
@@ -1,7 +1,7 @@
#![cfg(all(rust_1_65, feature = "std"))]
#![cfg_attr(
nightly,
- feature(provide_any, backtrace_frames, error_generic_member_access)
+ feature(error_in_core, backtrace_frames, error_generic_member_access)
)]
mod common;
diff --git a/libs/error-stack/tests/test_change_context.rs b/libs/error-stack/tests/test_change_context.rs
index 27342bfc582..249cb3c0f2c 100644
--- a/libs/error-stack/tests/test_change_context.rs
+++ b/libs/error-stack/tests/test_change_context.rs
@@ -1,5 +1,4 @@
-#![cfg_attr(nightly, feature(provide_any))]
-#![cfg_attr(all(nightly, feature = "std"), feature(error_generic_member_access))]
+#![cfg_attr(nightly, feature(error_in_core, error_generic_member_access))]
#[macro_use]
mod common;
diff --git a/libs/error-stack/tests/test_compatibility.rs b/libs/error-stack/tests/test_compatibility.rs
index cd561efbd29..0992a75afe4 100644
--- a/libs/error-stack/tests/test_compatibility.rs
+++ b/libs/error-stack/tests/test_compatibility.rs
@@ -1,12 +1,12 @@
#![cfg(any(feature = "eyre", feature = "anyhow"))]
-#![cfg_attr(nightly, feature(provide_any))]
-#![cfg_attr(
- all(nightly, feature = "std"),
- feature(backtrace_frames, error_generic_member_access)
-)]
+#![cfg_attr(nightly, feature(error_in_core, error_generic_member_access))]
+#![cfg_attr(all(nightly, feature = "std"), feature(backtrace_frames))]
mod common;
+#[cfg(nightly)]
+use core::error;
+
#[allow(clippy::wildcard_imports)]
use common::*;
use error_stack::IntoReportCompat;
@@ -21,7 +21,7 @@ fn error() {
assert_eq!(error_ref.to_string(), "context A");
#[cfg(nightly)]
assert_eq!(
- *core::any::request_ref::(error_ref).expect("requested value not found"),
+ *error::request_ref::(error_ref).expect("requested value not found"),
10
);
@@ -29,7 +29,7 @@ fn error() {
assert_eq!(error.to_string(), "context A");
#[cfg(nightly)]
assert_eq!(
- *core::any::request_ref::(&error).expect("requested value not found"),
+ *error::request_ref::(&error).expect("requested value not found"),
10
);
}
@@ -171,13 +171,15 @@ fn eyre() {
}
#[test]
-#[cfg(all(nightly, feature = "eyre"))]
+#[cfg(all(nightly, feature = "eyre", feature = "std"))]
#[ignore = "bug: `eyre` currently does not provide a backtrace`"]
fn eyre_backtrace() {
+ install_eyre_hook();
+
let error = eyre::eyre!("test error");
- let error_backtrace = error
- .request_ref::()
- .expect("no backtrace captured");
+ let error_backtrace =
+ error::request_ref::(error.as_ref() as &dyn error::Error)
+ .expect("no backtrace captured");
let error_backtrace_len = error_backtrace.frames().len();
let error_backtrace_string = error_backtrace.to_string();
diff --git a/libs/error-stack/tests/test_conversion.rs b/libs/error-stack/tests/test_conversion.rs
index 217647c85a6..f1f6a73c264 100644
--- a/libs/error-stack/tests/test_conversion.rs
+++ b/libs/error-stack/tests/test_conversion.rs
@@ -1,5 +1,5 @@
#![cfg(feature = "std")]
-#![cfg_attr(nightly, feature(provide_any, error_generic_member_access))]
+#![cfg_attr(nightly, feature(error_in_core, error_generic_member_access))]
use std::io;
@@ -38,7 +38,7 @@ fn boxed_error() {
#[cfg(nightly)]
assert_eq!(
- *core::any::request_ref::(report.as_ref()).expect("requested value not found"),
+ *core::error::request_ref::(report.as_ref()).expect("requested value not found"),
10
);
}
diff --git a/libs/error-stack/tests/test_debug.rs b/libs/error-stack/tests/test_debug.rs
index 65ecf7b8d87..0f9a6166797 100644
--- a/libs/error-stack/tests/test_debug.rs
+++ b/libs/error-stack/tests/test_debug.rs
@@ -1,6 +1,5 @@
-#![cfg_attr(nightly, feature(provide_any))]
#![cfg(not(miri))] // debug formatting does not utilize any unsafe code
-#![cfg_attr(all(nightly, feature = "std"), feature(error_generic_member_access))]
+#![cfg_attr(nightly, feature(error_in_core, error_generic_member_access))]
#![allow(clippy::std_instead_of_core)]
mod common;
@@ -255,7 +254,7 @@ mod full {
//! There are still some big snapshot tests, which are used evaluate all of the above.
#[cfg(nightly)]
- use std::any::Demand;
+ use std::error::Request;
use std::{
error::Error,
fmt::{Display, Formatter},
@@ -575,7 +574,7 @@ mod full {
#[cfg(nightly)]
impl Error for ContextD {
- fn provide<'a>(&'a self, req: &mut Demand<'a>) {
+ fn provide<'a>(&'a self, req: &mut Request<'a>) {
req.provide_ref(&self.code);
req.provide_ref(&self.reason);
}
diff --git a/libs/error-stack/tests/test_display.rs b/libs/error-stack/tests/test_display.rs
index 0ac5243c04b..b849b72ef7d 100644
--- a/libs/error-stack/tests/test_display.rs
+++ b/libs/error-stack/tests/test_display.rs
@@ -1,5 +1,4 @@
-#![cfg_attr(nightly, feature(provide_any))]
-#![cfg_attr(all(nightly, feature = "std"), feature(error_generic_member_access))]
+#![cfg_attr(nightly, feature(error_in_core, error_generic_member_access))]
mod common;
diff --git a/libs/error-stack/tests/test_downcast.rs b/libs/error-stack/tests/test_downcast.rs
index 9919f157ddc..480c77edb60 100644
--- a/libs/error-stack/tests/test_downcast.rs
+++ b/libs/error-stack/tests/test_downcast.rs
@@ -1,5 +1,4 @@
-#![cfg_attr(nightly, feature(provide_any))]
-#![cfg_attr(all(nightly, feature = "std"), feature(error_generic_member_access))]
+#![cfg_attr(nightly, feature(error_in_core, error_generic_member_access))]
mod common;
diff --git a/libs/error-stack/tests/test_extend.rs b/libs/error-stack/tests/test_extend.rs
index e02006587e2..6155da964f1 100644
--- a/libs/error-stack/tests/test_extend.rs
+++ b/libs/error-stack/tests/test_extend.rs
@@ -1,5 +1,4 @@
-#![cfg_attr(nightly, feature(provide_any))]
-#![cfg_attr(all(nightly, feature = "std"), feature(error_generic_member_access))]
+#![cfg_attr(nightly, feature(error_in_core, error_generic_member_access))]
mod common;
use core::fmt::{Display, Formatter};
diff --git a/libs/error-stack/tests/test_frame.rs b/libs/error-stack/tests/test_frame.rs
index 8f7937d89ca..ad761b44698 100644
--- a/libs/error-stack/tests/test_frame.rs
+++ b/libs/error-stack/tests/test_frame.rs
@@ -1,5 +1,4 @@
-#![cfg_attr(nightly, feature(provide_any))]
-#![cfg_attr(all(nightly, feature = "std"), feature(error_generic_member_access))]
+#![cfg_attr(nightly, feature(error_in_core, error_generic_member_access))]
mod common;
diff --git a/libs/error-stack/tests/test_iter.rs b/libs/error-stack/tests/test_iter.rs
index 9992e8bf99e..150b956dd6a 100644
--- a/libs/error-stack/tests/test_iter.rs
+++ b/libs/error-stack/tests/test_iter.rs
@@ -1,8 +1,6 @@
-#![cfg_attr(nightly, feature(provide_any))]
-#![cfg_attr(all(nightly, feature = "std"), feature(error_generic_member_access))]
+#![cfg_attr(nightly, feature(error_in_core, error_generic_member_access))]
extern crate alloc;
-extern crate core;
use core::fmt::{Display, Formatter, Write};
diff --git a/libs/error-stack/tests/test_macros.rs b/libs/error-stack/tests/test_macros.rs
index 59cd0219c56..8058b597e2c 100644
--- a/libs/error-stack/tests/test_macros.rs
+++ b/libs/error-stack/tests/test_macros.rs
@@ -1,5 +1,4 @@
-#![cfg_attr(nightly, feature(provide_any))]
-#![cfg_attr(all(nightly, feature = "std"), feature(error_generic_member_access))]
+#![cfg_attr(nightly, feature(error_in_core, error_generic_member_access))]
mod common;
diff --git a/libs/error-stack/tests/test_provision.rs b/libs/error-stack/tests/test_provision.rs
index 085d3d18dfd..ad748653b68 100644
--- a/libs/error-stack/tests/test_provision.rs
+++ b/libs/error-stack/tests/test_provision.rs
@@ -1,6 +1,5 @@
#![cfg(nightly)]
-#![feature(provide_any)]
-#![cfg_attr(feature = "std", feature(error_generic_member_access))]
+#![cfg_attr(nightly, feature(error_in_core, error_generic_member_access))]
mod common;
diff --git a/libs/error-stack/tests/test_serialize.rs b/libs/error-stack/tests/test_serialize.rs
index abf8e66ea02..fd91923567f 100644
--- a/libs/error-stack/tests/test_serialize.rs
+++ b/libs/error-stack/tests/test_serialize.rs
@@ -4,8 +4,7 @@
// can be considered safe, because we only check the output, which in itself does not use **any**
// unsafe code.
#![cfg(not(miri))]
-#![cfg_attr(all(nightly, feature = "std"), feature(error_generic_member_access))]
-#![cfg_attr(nightly, feature(provide_any))]
+#![cfg_attr(nightly, feature(error_in_core, error_generic_member_access))]
#![allow(clippy::std_instead_of_core)]
use insta::assert_ron_snapshot;
diff --git a/libs/error-stack/tests/test_span_trace.rs b/libs/error-stack/tests/test_span_trace.rs
index 50614d8e099..75bf4fd9b6c 100644
--- a/libs/error-stack/tests/test_span_trace.rs
+++ b/libs/error-stack/tests/test_span_trace.rs
@@ -1,6 +1,5 @@
#![cfg(feature = "spantrace")]
-#![cfg_attr(nightly, feature(provide_any))]
-#![cfg_attr(all(nightly, feature = "std"), feature(error_generic_member_access))]
+#![cfg_attr(nightly, feature(error_in_core, error_generic_member_access))]
mod common;
From 17169b8e6fb1a110c531bd6375535ee968ccb7fe Mon Sep 17 00:00:00 2001
From: Tim Diekmann
Date: Wed, 16 Aug 2023 00:00:23 +0200
Subject: [PATCH 2/2] Update snapshots
---
.../test_debug__sources_nested@spantrace.snap | 20 +++++++++----------
...g__sources_nested_alternate@spantrace.snap | 20 +++++++++----------
2 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace.snap b/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace.snap
index d451c09014c..226df323729 100644
--- a/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace.snap
+++ b/libs/error-stack/tests/snapshots/test_debug__sources_nested@spantrace.snap
@@ -3,12 +3,12 @@ source: tests/test_debug.rs
expression: "format!(\"{report:?}\")"
---
context A
-├╴at tests/test_debug.rs:207:10
+├╴at tests/test_debug.rs:206:10
├╴2
├╴1
│
╰┬▶ context A
- │ ├╴at tests/test_debug.rs:201:10
+ │ ├╴at tests/test_debug.rs:200:10
│ ├╴4
│ ├╴3
│ │
@@ -18,16 +18,16 @@ context A
│ ╰╴6
│
╰▶ context A
- ├╴at tests/test_debug.rs:196:10
+ ├╴at tests/test_debug.rs:195:10
├╴5
├╴3
│
├─▶ context A
- │ ├╴at tests/test_debug.rs:194:10
+ │ ├╴at tests/test_debug.rs:193:10
│ ╰╴7
│
╰┬▶ context A
- │ ├╴at tests/test_debug.rs:185:34
+ │ ├╴at tests/test_debug.rs:184:34
│ ├╴9
│ ├╴8
│ │
@@ -36,7 +36,7 @@ context A
│ ╰╴span trace with 2 frames (2)
│
├▶ context A
- │ ├╴at tests/test_debug.rs:179:10
+ │ ├╴at tests/test_debug.rs:178:10
│ ├╴13
│ ├╴10
│ ├╴16
@@ -48,7 +48,7 @@ context A
│ ╰╴span trace with 2 frames (3)
│
├▶ context A
- │ ├╴at tests/test_debug.rs:165:10
+ │ ├╴at tests/test_debug.rs:164:10
│ ├╴15
│ ├╴14
│ ├╴10
@@ -61,7 +61,7 @@ context A
│ ╰╴span trace with 2 frames (4)
│
├▶ context A
- │ ├╴at tests/test_debug.rs:175:10
+ │ ├╴at tests/test_debug.rs:174:10
│ ├╴11
│ ├╴9
│ ├╴8
@@ -71,13 +71,13 @@ context A
│ ╰╴span trace with 2 frames (5)
│
╰▶ context A
- ├╴at tests/test_debug.rs:171:10
+ ├╴at tests/test_debug.rs:170:10
├╴12
├╴9
├╴8
│
├─▶ context A
- │ ╰╴at tests/test_debug.rs:170:10
+ │ ╰╴at tests/test_debug.rs:169:10
│
╰─▶ root error
├╴at tests/common.rs:4:5
diff --git a/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace.snap b/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace.snap
index 8253fb54cce..bf6257e3b5d 100644
--- a/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace.snap
+++ b/libs/error-stack/tests/snapshots/test_debug__sources_nested_alternate@spantrace.snap
@@ -3,12 +3,12 @@ source: tests/test_debug.rs
expression: "format!(\"{report:#?}\")"
---
context A
-├╴at tests/test_debug.rs:207:10
+├╴at tests/test_debug.rs:206:10
├╴2
├╴1
│
╰┬▶ context A
- │ ├╴at tests/test_debug.rs:201:10
+ │ ├╴at tests/test_debug.rs:200:10
│ ├╴4
│ ├╴3
│ │
@@ -18,16 +18,16 @@ context A
│ ╰╴6
│
╰▶ context A
- ├╴at tests/test_debug.rs:196:10
+ ├╴at tests/test_debug.rs:195:10
├╴5
├╴3
│
├─▶ context A
- │ ├╴at tests/test_debug.rs:194:10
+ │ ├╴at tests/test_debug.rs:193:10
│ ╰╴7
│
╰┬▶ context A
- │ ├╴at tests/test_debug.rs:185:34
+ │ ├╴at tests/test_debug.rs:184:34
│ ├╴9
│ ├╴8
│ │
@@ -36,7 +36,7 @@ context A
│ ╰╴span trace with 2 frames (2)
│
├▶ context A
- │ ├╴at tests/test_debug.rs:179:10
+ │ ├╴at tests/test_debug.rs:178:10
│ ├╴13
│ ├╴10
│ ├╴16
@@ -48,7 +48,7 @@ context A
│ ╰╴span trace with 2 frames (3)
│
├▶ context A
- │ ├╴at tests/test_debug.rs:165:10
+ │ ├╴at tests/test_debug.rs:164:10
│ ├╴15
│ ├╴14
│ ├╴10
@@ -61,7 +61,7 @@ context A
│ ╰╴span trace with 2 frames (4)
│
├▶ context A
- │ ├╴at tests/test_debug.rs:175:10
+ │ ├╴at tests/test_debug.rs:174:10
│ ├╴11
│ ├╴9
│ ├╴8
@@ -71,13 +71,13 @@ context A
│ ╰╴span trace with 2 frames (5)
│
╰▶ context A
- ├╴at tests/test_debug.rs:171:10
+ ├╴at tests/test_debug.rs:170:10
├╴12
├╴9
├╴8
│
├─▶ context A
- │ ╰╴at tests/test_debug.rs:170:10
+ │ ╰╴at tests/test_debug.rs:169:10
│
╰─▶ root error
├╴at tests/common.rs:4:5
| |