Skip to content

Tracking Issue for error_generic_member_access #99301

Open

Description

Feature gate: #![feature(error_generic_member_access)]

This is a tracking issue for the generic member access API on the error trait, which generalizes the pattern of fn source(&self) -> Option<&dyn Error> and fn backtrace(&self) -> Option<&Backtrace> into fn request_ref::<T>(&self) -> Option<&T>

Public API

// std::error

pub trait Error: Debug + Display {
    // existing API unchanged

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

impl dyn Error + Send + Sync + 'static { // and all combinations of send/sync
    pub fn request_ref<T: ?Sized + 'static>(&self) -> Option<&T> {
        core::any::request_ref(self)
    }

    pub fn request_value<T: 'static>(&self) -> Option<T> {
        core::any::request_value(self)
    }
}

Steps / History

Now tracked by @waynr in #99301 (comment)

Unresolved Questions

  • None yet.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

C-tracking-issueCategory: A tracking issue for an RFC or an unstable feature.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions