Skip to content

Commit

Permalink
error::Error: rename the Demand arguments from req to demand
Browse files Browse the repository at this point in the history
Signed-off-by: Nick Cameron <nrc@ncameron.org>
  • Loading branch information
nrc committed Aug 24, 2022
1 parent 80442f3 commit b556a5b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 19 deletions.
14 changes: 7 additions & 7 deletions library/core/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ pub trait Error: Debug + Display {
/// }
///
/// impl std::error::Error for Error {
/// fn provide<'a>(&'a self, req: &mut Demand<'a>) {
/// req
/// fn provide<'a>(&'a self, demand: &mut Demand<'a>) {
/// demand
/// .provide_ref::<MyBacktrace>(&self.backtrace)
/// .provide_ref::<dyn std::error::Error + 'static>(&self.source);
/// }
Expand All @@ -201,16 +201,16 @@ pub trait Error: Debug + Display {
/// ```
#[unstable(feature = "error_generic_member_access", issue = "99301")]
#[allow(unused_variables)]
fn provide<'a>(&'a self, req: &mut Demand<'a>) {}
fn provide<'a>(&'a self, demand: &mut Demand<'a>) {}
}

#[unstable(feature = "error_generic_member_access", issue = "99301")]
impl<E> Provider for E
where
E: Error + ?Sized,
{
fn provide<'a>(&'a self, req: &mut Demand<'a>) {
self.provide(req)
fn provide<'a>(&'a self, demand: &mut Demand<'a>) {
self.provide(demand)
}
}

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

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

Expand Down
23 changes: 11 additions & 12 deletions library/std/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,8 @@ pub trait Error: Debug + Display {
/// }
///
/// impl std::error::Error for Error {
/// fn provide<'a>(&'a self, req: &mut Demand<'a>) {
/// req
/// fn provide<'a>(&'a self, demand: &mut Demand<'a>) {
/// demand
/// .provide_ref::<MyBacktrace>(&self.backtrace)
/// .provide_ref::<dyn std::error::Error + 'static>(&self.source);
/// }
Expand All @@ -240,14 +240,14 @@ pub trait Error: Debug + Display {
/// ```
#[unstable(feature = "error_generic_member_access", issue = "99301")]
#[allow(unused_variables)]
fn provide<'a>(&'a self, req: &mut Demand<'a>) {}
fn provide<'a>(&'a self, demand: &mut Demand<'a>) {}
}

#[cfg(bootstrap)]
#[unstable(feature = "error_generic_member_access", issue = "99301")]
impl<'b> Provider for dyn Error + 'b {
fn provide<'a>(&'a self, req: &mut Demand<'a>) {
self.provide(req)
fn provide<'a>(&'a self, demand: &mut Demand<'a>) {
self.provide(demand)
}
}

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

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

Expand All @@ -681,8 +681,8 @@ impl<T: Error + ?Sized> Error for Arc<T> {
Error::source(&**self)
}

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

Expand Down Expand Up @@ -1442,9 +1442,8 @@ impl<E> Report<E> {
/// }
///
/// impl Error for SuperErrorSideKick {
/// fn provide<'a>(&'a self, req: &mut Demand<'a>) {
/// req
/// .provide_ref::<Backtrace>(&self.backtrace);
/// fn provide<'a>(&'a self, demand: &mut Demand<'a>) {
/// demand.provide_ref::<Backtrace>(&self.backtrace);
/// }
/// }
///
Expand Down

0 comments on commit b556a5b

Please sign in to comment.