Skip to content

Commit

Permalink
Merge pull request #382 from dtolnay/corerequest
Browse files Browse the repository at this point in the history
Access generic_member_access APIs through core
  • Loading branch information
dtolnay authored Sep 6, 2024
2 parents c378a2c + 3e70139 commit 1eabf69
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions build/probe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

#![feature(error_generic_member_access)]

use core::error::{self, Error, Request};
use core::fmt::{self, Debug, Display};
use std::backtrace::Backtrace;
use std::error::{self, Error, Request};
use std::fmt::{self, Debug, Display};

struct MyError(Thing);
struct Thing;
Expand Down
3 changes: 2 additions & 1 deletion src/backtrace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ macro_rules! backtrace {
#[cfg(error_generic_member_access)]
macro_rules! backtrace_if_absent {
($err:expr) => {
match std::error::request_ref::<std::backtrace::Backtrace>($err as &dyn std::error::Error) {
match core::error::request_ref::<std::backtrace::Backtrace>($err as &dyn core::error::Error)
{
Some(_) => None,
None => backtrace!(),
}
Expand Down
2 changes: 1 addition & 1 deletion src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use core::convert::Infallible;
use core::fmt::{self, Debug, Display, Write};

#[cfg(error_generic_member_access)]
use std::error::Request;
use core::error::Request;

mod ext {
use super::*;
Expand Down
4 changes: 2 additions & 2 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ use crate::ptr::{Own, Ref};
use crate::{Error, StdError};
use alloc::boxed::Box;
use core::any::TypeId;
#[cfg(error_generic_member_access)]
use core::error::{self, Request};
use core::fmt::{self, Debug, Display};
use core::mem::ManuallyDrop;
#[cfg(not(anyhow_no_ptr_addr_of))]
use core::ptr;
use core::ptr::NonNull;
#[cfg(error_generic_member_access)]
use std::error::{self, Request};

#[cfg(feature = "std")]
use core::ops::{Deref, DerefMut};
Expand Down
2 changes: 1 addition & 1 deletion src/wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use core::fmt::{self, Debug, Display};
use alloc::boxed::Box;

#[cfg(error_generic_member_access)]
use std::error::Request;
use core::error::Request;

#[repr(transparent)]
pub struct MessageError<M>(pub M);
Expand Down

0 comments on commit 1eabf69

Please sign in to comment.