From 72503ca9301568cc9d53a295d2dbd115bcf19dd8 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Fri, 23 Sep 2022 18:57:13 +0000 Subject: [PATCH] Don't use a turbofish when all parameters are lifetimes. For some reason rustc doesn't like this, and its easy, so whatever. --- c-bindings-gen/src/main.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/c-bindings-gen/src/main.rs b/c-bindings-gen/src/main.rs index 2aeadaf..b07bb26 100644 --- a/c-bindings-gen/src/main.rs +++ b/c-bindings-gen/src/main.rs @@ -1125,6 +1125,14 @@ fn writeln_impl(w: &mut W, i: &syn::ItemImpl, types: &mut Typ if idx != 0 { t_gen_args += ", " }; t_gen_args += "_" } + // rustc doesn't like <_> if the _ is actually a lifetime, so + // if all the parameters are lifetimes just skip it. + let mut nonlifetime_param = false; + for param in $trait.generics.params.iter() { + if let syn::GenericParam::Lifetime(_) = param {} + else { nonlifetime_param = true; } + } + if !nonlifetime_param { t_gen_args = String::new(); } if takes_self { write!(w, ">::{}(unsafe {{ &mut *(this_arg as *mut native{}) }}, ", ident, $trait_path, t_gen_args, $m.sig.ident, ident).unwrap(); } else { -- 2.30.2