-
-
Notifications
You must be signed in to change notification settings - Fork 173
any chance of having something like #[serde(crate = "...")] for thiserror? #386
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
Comments
I would prefer not to support this. |
@hmacias-avaya as an alternative you could try something like this: External lib pub use thiserror::*; And then trick thiserror to use the common library:
|
thanks, I'll give it a try. |
At first I thought that it works, vs code does not show any errors using rust-analyzer. But when compiling, it fails: use thiserror::Error;
#[derive(Debug, Error)]
pub enum TestError {
#[error("Test {0}")]
PleaseWork(String),
}
So, I can just say that I'd also love to have this feature. I am unaware of how this affects the code exactly. If it makes things very complicated and way harder to maintain, it's not worth it, of course. But if that's not the case, I kindly ask for this feature again. |
If anyone would like to work on this, rust-lang/rust#54363 (comment) has a writeup of my preferred approach. |
This require add `thiserror` as direct dependencies of crate that use. Our previous way of providing `thiserror` from a utils crate no longer work CF issue [dtolnay/thiserror#386](dtolnay/thiserror#386). This could be fixed by [rust-lang/rust#54363](rust-lang/rust#54363).
This require add `thiserror` as direct dependencies of crate that use. Our previous way of providing `thiserror` from a utils crate no longer work CF issue [dtolnay/thiserror#386](dtolnay/thiserror#386). This could be fixed by [rust-lang/rust#54363](rust-lang/rust#54363). To limit further error, `thiserror` is not longer re-exported by `libparsec_types`.
This require add `thiserror` as direct dependencies of crate that use. Our previous way of providing `thiserror` from a utils crate no longer work CF issue [dtolnay/thiserror#386](dtolnay/thiserror#386). This could be fixed by [rust-lang/rust#54363](rust-lang/rust#54363). To limit further error, `thiserror` is not longer re-exported by `libparsec_types`.
This require add `thiserror` as direct dependencies of crate that use. Our previous way of providing `thiserror` from a utils crate no longer work CF issue [dtolnay/thiserror#386](dtolnay/thiserror#386). This could be fixed by [rust-lang/rust#54363](rust-lang/rust#54363). To limit further error, `thiserror` is not longer re-exported by `libparsec_types`.
remove: thiserror see dtolnay/thiserror#386
I'm trying to use the latest thiserror 2 and until now I was reexporting thiserror from a common dependency so my "end project" was not depending on thiserror directly.
Now this is no longer possible and is mentioned on the breaking changes section:
is there any chance of having something like serde's 'crate' annotation in order to be able to use thiserror derives without depending on thiserror directly?
https://serde.rs/container-attrs.html#crate
This seems to work nicely when using serde's derives; perhaps it could work here as well?
The text was updated successfully, but these errors were encountered: