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

Provide From<E> for Box<dyn Error + Send> and Box<dyn Error + Sync> #62824

Open
2 tasks
dodomorandi opened this issue Jul 20, 2019 · 0 comments
Open
2 tasks
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@dodomorandi
Copy link

As explained in the Rust User forum, I noticed that the following impls are not available:

impl<'a, E: Error + Send + 'a> From<E> for Box<dyn Error + Send + 'a> {}
impl<'a, E: Error + Sync + 'a> From<E> for Box<dyn Error + Sync + 'a> {}

The first one is pretty useful when working with rayon and errors, which only need to be Send to be passed across threads. In theory, a stateful error with a Cell or a RefCell is a possible example of dyn Error + Send + !Sync.

The second impl is mainly for coherence and symmetry, I still do not have in mind a possible realistic situation.

In any case, IMHO this feature should not require a RFC. In that case I can create a PR and follow these steps:

  • Implement the two impls
  • Adjust the docs

It is the first time I contribute to Rust, and I am not sure if this feature should require a stabilization process. In this case just let me know, and I will update this document in order to include the addition of a feature gate and everything needed.

Any feedback is appreciated to make me do things nicely and your review less painful.

@jonas-schievink jonas-schievink added C-feature-request Category: A feature request, i.e: not implemented / a PR. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Jul 20, 2019
@Mark-Simulacrum Mark-Simulacrum changed the title Tracking issue for From<E> for Box<dyn Error + Send> and Box<dyn Error + Sync> Provide From<E> for Box<dyn Error + Send> and Box<dyn Error + Sync> Aug 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: A feature request, i.e: not implemented / a PR. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants