-
Notifications
You must be signed in to change notification settings - Fork 114
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
Confusing derive(From)
compilation error.
#96
Comments
Please share the type definition. Otherwise it's impossible to give the reason for this error. Also, you haven't posted the error output for the second implementation of From. Are you sure you have not implemented one yourself as well? |
Apologies for missing the type definition. I've edited the original description to include it. There is no other error output! That's why I'm confused. I'm not aware of any other Edit: Moved the type definition from this comment up to the original description for clarity for newcomers to the ticket. |
That should definitely work (assuming the tokio Error is not a type alias
of the std). Two things that you can try:
- try latest master of derive_more
- check the output of the derive using "cargo expand", copy paste it in
your source file, remove the derive, compile. That way you get much clearer
errors. https://github.com/dtolnay/cargo-expand
Let me know if master fixes it, I can release a beta release if it does.
|
Ah, it looks like Apologies for the confusion. Would it be possible for |
That definitely explains it. And no it's not possible to give better errors in this case, because macro expansion doesn't have any type information (only AST info). |
I am confused by a compilation error for
derive(From)
:My type's definition is:
My projects' dependencies are:
My toolchain versions:
$ cargo --version ; rustc --version cargo 1.40.0-nightly (3a9abe3f0 2019-10-15) rustc 1.40.0-nightly (7979016af 2019-10-20)
Discussion:
The error message leads me to believe there are identical/ambiguous types in an enum, so that
derive(From)
cannot distinguish between them. Yet I believestd::io::Error
andtokio::io::Error
are distinct types. Here are the docs fortokio::io::Error
at v0.2.0-alpha.6.Where does my confusion lie? Either something is wrong about my understanding or there is a bug in
derive(From)
.You can browse the project in question at the appropriate revision:
iomux
@ 8e65ea81Edit: Added the type definition here to make this ticket clearer for newcomers.
Edit: Added toolchain versions.
The text was updated successfully, but these errors were encountered: