aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 6f4a007..1cf086c 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -95,15 +95,6 @@ pub fn dynamize(_attr: TokenStream, input: TokenStream) -> TokenStream {
let mut original_trait = parse_macro_input!(input as ItemTrait);
assert!(original_trait.auto_token.is_none());
- let original_trait_name = original_trait.ident.clone();
-
- let mut objectifiable_methods: Vec<(Signature, SignatureChanges)> = Vec::new();
-
- let mut type_converter = TypeConverter::default();
-
- let mut blanket_impl_attrs = Vec::new();
- let mut dyn_trait_attrs = Vec::new();
-
// just to provide a better error message
for bound in trait_bounds(&original_trait.supertraits) {
if let Some(assoc_type) = iter_path(&bound.path)
@@ -117,6 +108,11 @@ pub fn dynamize(_attr: TokenStream, input: TokenStream) -> TokenStream {
}
}
+ let mut type_converter = TypeConverter::default();
+
+ let mut blanket_impl_attrs = Vec::new();
+ let mut dyn_trait_attrs = Vec::new();
+
// FUTURE: use Vec::drain_filter once it's stable
let mut i = 0;
while i < original_trait.attrs.len() {
@@ -186,6 +182,8 @@ pub fn dynamize(_attr: TokenStream, input: TokenStream) -> TokenStream {
}
}
+ let mut objectifiable_methods: Vec<(Signature, SignatureChanges)> = Vec::new();
+
for item in &original_trait.items {
if let TraitItem::Method(method) = item {
let mut signature = method.sig.clone();
@@ -280,6 +278,8 @@ pub fn dynamize(_attr: TokenStream, input: TokenStream) -> TokenStream {
}
}
+ let original_trait_name = original_trait.ident.clone();
+
for (signature, parsed_method) in objectifiable_methods {
let mut new_method = TraitItemMethod {
attrs: Vec::new(),