Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Error::provide to Error::provide_context #112531

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions library/alloc/src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2966,7 +2966,7 @@ impl<T: core::error::Error + ?Sized> core::error::Error for Arc<T> {
core::error::Error::source(&**self)
}

fn provide<'a>(&'a self, req: &mut core::any::Demand<'a>) {
core::error::Error::provide(&**self, req);
fn provide_context<'a>(&'a self, req: &mut core::any::Demand<'a>) {
core::error::Error::provide_context(&**self, req);
}
}
10 changes: 5 additions & 5 deletions library/core/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ pub trait Error: Debug + Display {
/// }
///
/// impl std::error::Error for Error {
/// fn provide<'a>(&'a self, demand: &mut Demand<'a>) {
/// fn provide_context<'a>(&'a self, demand: &mut Demand<'a>) {
/// demand
/// .provide_ref::<MyBacktrace>(&self.backtrace)
/// .provide_ref::<dyn std::error::Error + 'static>(&self.source);
Expand All @@ -191,7 +191,7 @@ pub trait Error: Debug + Display {
/// ```
#[unstable(feature = "error_generic_member_access", issue = "99301")]
#[allow(unused_variables)]
fn provide<'a>(&'a self, demand: &mut Demand<'a>) {}
fn provide_context<'a>(&'a self, demand: &mut Demand<'a>) {}
}

#[unstable(feature = "error_generic_member_access", issue = "99301")]
Expand All @@ -200,7 +200,7 @@ where
E: Error + ?Sized,
{
fn provide<'a>(&'a self, demand: &mut Demand<'a>) {
self.provide(demand)
self.provide_context(demand)
}
}

Expand Down Expand Up @@ -449,8 +449,8 @@ impl<'a, T: Error + ?Sized> Error for &'a T {
Error::source(&**self)
}

fn provide<'b>(&'b self, demand: &mut Demand<'b>) {
Error::provide(&**self, demand);
fn provide_context<'b>(&'b self, demand: &mut Demand<'b>) {
Error::provide_context(&**self, demand);
}
}

Expand Down
2 changes: 1 addition & 1 deletion library/std/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ impl<E> Report<E> {
/// }
///
/// impl Error for SuperErrorSideKick {
/// fn provide<'a>(&'a self, demand: &mut Demand<'a>) {
/// fn provide_context<'a>(&'a self, demand: &mut Demand<'a>) {
/// demand.provide_ref::<Backtrace>(&self.backtrace);
/// }
/// }
Expand Down
2 changes: 1 addition & 1 deletion library/std/src/error/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ where
self.source.as_deref()
}

fn provide<'a>(&'a self, req: &mut Demand<'a>) {
fn provide_context<'a>(&'a self, req: &mut Demand<'a>) {
self.backtrace.as_ref().map(|bt| req.provide_ref::<Backtrace>(bt));
}
}
Expand Down