From: Matt Corallo Date: Fri, 23 Sep 2022 18:57:13 +0000 (+0000) Subject: Don't use a turbofish when all parameters are lifetimes. X-Git-Tag: v0.0.111.0~1^2~5 X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=ldk-c-bindings;a=commitdiff_plain;h=72503ca9301568cc9d53a295d2dbd115bcf19dd8 Don't use a turbofish when all parameters are lifetimes. For some reason rustc doesn't like this, and its easy, so whatever. --- 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 {