Skip to content

Instantly share code, notes, and snippets.

@huitseeker
Created October 22, 2025 04:28
Show Gist options
  • Save huitseeker/5dc80da17604f60350b99e8bc8ae8397 to your computer and use it in GitHub Desktop.
Save huitseeker/5dc80da17604f60350b99e8bc8ae8397 to your computer and use it in GitHub Desktop.
Compiling enum_dispatch_test v0.1.0 (/private/tmp/enum_dispatch_test)
error[E0308]: `match` arms have incompatible types
--> src/lib.rs:34:1
|
19 | fn to_builder(&self) -> impl Builder {
| ------------ the expected opaque type
...
28 | fn to_builder(&self) -> impl Builder {
| ------------ the found opaque type
...
34 | #[enum_dispatch(MastNodeExt)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| expected opaque type, found a different opaque type
| this is found to be of type `impl Builder`
| `match` arms have incompatible types
| in this attribute macro expansion
|
::: /Users/huitseeker/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/enum_dispatch-0.3.13/src/lib.rs:366:1
|
366 | pub fn enum_dispatch(attr: proc_macro::TokenStream, item: proc_macro::TokenStream) -> proc_macro::TokenStream {
| ------------------------------------------------------------------------------------------------------------- in this expansion of `#[enum_dispatch]`
|
= note: expected opaque type `impl Builder`
found opaque type `impl Builder`
= note: distinct uses of `impl Trait` result in different opaque types
help: you could change the return type to be a boxed trait object
|
34 - #[enum_dispatch(MastNodeExt)]
34 + Box<dynum_dispatch(MastNodeExt)]>
|
help: if you change the return type to expect trait objects, box the returned expressions
|
34 | Box::new(#[enum_dispatch(MastNodeExt)])
| +++++++++ +
For more information about this error, try `rustc --explain E0308`.
error: could not compile `enum_dispatch_test` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: could not compile `enum_dispatch_test` (lib test) due to 1 previous error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment