Skip to content

Commit 6584a26

Browse files
author
toasteater
committed
Take self by value when deriving OwnedToVariant
This was preventing the macro from working on types whose fields actually require OwnedToVariant.
1 parent bec872c commit 6584a26

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

gdnative-derive/src/variant/to.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ pub(crate) fn expand_to_variant(
5858
}).collect::<Result<Vec<_>,syn::Error>>()?;
5959

6060
quote! {
61-
match &self {
61+
match #to_variant_receiver {
6262
#( #match_arms ),*
6363
}
6464
}

gdnative/tests/ui/variant_pass.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,12 @@ pub struct Foo {
3636
skip_from: String,
3737
}
3838

39+
#[derive(OwnedToVariant)]
40+
pub struct Owned;
41+
42+
#[derive(OwnedToVariant)]
43+
pub struct Bar {
44+
owned: Owned,
45+
}
46+
3947
fn main() {}

0 commit comments

Comments
 (0)