diff --git a/swarm-derive/CHANGELOG.md b/swarm-derive/CHANGELOG.md index 464bec7f..0c64fd35 100644 --- a/swarm-derive/CHANGELOG.md +++ b/swarm-derive/CHANGELOG.md @@ -2,8 +2,10 @@ - Fix an issue where the derive would generate bad code if the type parameters between the behaviour and a custom out event differed. See [PR 2907]. +- Fix an issue where the derive would generate incorrect code depending on available imports. See [PR 2921]. [PR 2907]: https://github.com/libp2p/rust-libp2p/pull/2907 +[PR 2921]: https://github.com/libp2p/rust-libp2p/pull/2921 # 0.30.0 diff --git a/swarm-derive/src/lib.rs b/swarm-derive/src/lib.rs index 6899ba7d..426e4fae 100644 --- a/swarm-derive/src/lib.rs +++ b/swarm-derive/src/lib.rs @@ -125,7 +125,7 @@ fn build_struct(ast: &DeriveInput, data_struct: &DataStruct) -> TokenStream { ) .unwrap(); let ty = &field.ty; - quote! {#variant(<#ty as NetworkBehaviour>::OutEvent)} + quote! {#variant(<#ty as #trait_to_impl>::OutEvent)} }) .collect::>(); let visibility = &ast.vis;