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

Add support for dyn Error references #329

Open
demurgos opened this issue Jan 3, 2024 · 2 comments
Open

Add support for dyn Error references #329

demurgos opened this issue Jan 3, 2024 · 2 comments
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. P-medium Priority: Medium

Comments

@demurgos
Copy link
Contributor

demurgos commented Jan 3, 2024

The PR #327 adds support for error references. Unfortunately it's missing support for dyn Error. Error trait objects are fairly common so it's unfortunate that it's not supported, we should try to add support for it.

@Techcable Techcable added C-enhancement Category: An issue proposing an enhancement or a PR with one. P-medium Priority: Medium labels Jan 4, 2024
@Techcable
Copy link
Member

As far as I know, using an owned trait object (Box<dyn Error>) should work fine with the existing ErrorValue. The only problem is using a borrowed &dyn Error with the new ErrorRef.

Please let me know if this is incorrect.

@Techcable Techcable changed the title Add dyn Error support Add support for dyn Error references Jan 4, 2024
@Techcable
Copy link
Member

Ah, we need to change the bound to E: ?Sized + std::error::Error (and add a new test for this scenario).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: An issue proposing an enhancement or a PR with one. P-medium Priority: Medium
Projects
None yet
Development

No branches or pull requests

2 participants