From 929b97a07daa8fc205b6b1795b597a8cde8bb346 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Fri, 24 Jun 2022 01:20:33 +0000 Subject: [PATCH] Do not force `Deref` generic params to always be a `&T` This is a bit of a toss-up, really neither option is fully correct, really we need it to depend on the type of object in question, but that takes more work and it looks like we don't use the `&T` resolution anymore. --- c-bindings-gen/src/types.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/c-bindings-gen/src/types.rs b/c-bindings-gen/src/types.rs index 2ea9221..b988a7b 100644 --- a/c-bindings-gen/src/types.rs +++ b/c-bindings-gen/src/types.rs @@ -283,14 +283,12 @@ impl<'a, 'p: 'a> GenericTypes<'a, 'p> { non_lifetimes_processed = true; assert_simple_bound(&trait_bound); let resolved = types.resolve_path(&trait_bound.path, None); - let ref_ty = syn::Type::Reference(syn::TypeReference { - and_token: syn::Token![&](Span::call_site()), - lifetime: None, mutability: None, - elem: Box::new(syn::Type::Path(syn::TypePath { - qself: None, path: string_path_to_syn_path(&resolved) - })), + let ty = syn::Type::Path(syn::TypePath { + qself: None, path: string_path_to_syn_path(&resolved) }); - self.default_generics.insert(p_ident, (ref_ty.clone(), ref_ty)); + let ref_ty = parse_quote!(&#ty); + self.default_generics.insert(p_ident, (ty, ref_ty)); + *gen = Some(resolved); } } -- 2.30.2