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

Implied bounds for transparent attribute #149

Merged
merged 2 commits into from Sep 5, 2021
Merged

Implied bounds for transparent attribute #149

merged 2 commits into from Sep 5, 2021

Conversation

dtolnay
Copy link
Owner

@dtolnay dtolnay commented Sep 5, 2021

This is the remaining piece of #79.

The field of a transparent variant is required to implement Display and Error (not necessarily 'static), since we delegate those two traits to it.

#[derive(Error, Debug)]
enum MyError<E> {
    #[error(transparent)]
    Delegate(#[from] E),
}
// generated

impl<E> Error for MyError<E>
where
    E: Error,
    Self: Debug + Display;

impl<E> Display for MyError<E>
where
    E: Display;

impl<E> From<E> for MyError<E>;

@dtolnay dtolnay merged commit 0a1c5bd into master Sep 5, 2021
@dtolnay dtolnay deleted the bound branch September 5, 2021 02:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant