Skip to content

Commit 72503ca

Browse files
committed
Don't use a turbofish when all parameters are lifetimes.
For some reason rustc doesn't like this, and its easy, so whatever.
1 parent a5137ff commit 72503ca

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

c-bindings-gen/src/main.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1125,6 +1125,14 @@ fn writeln_impl<W: std::io::Write>(w: &mut W, i: &syn::ItemImpl, types: &mut Typ
11251125
if idx != 0 { t_gen_args += ", " };
11261126
t_gen_args += "_"
11271127
}
1128+
// rustc doesn't like <_> if the _ is actually a lifetime, so
1129+
// if all the parameters are lifetimes just skip it.
1130+
let mut nonlifetime_param = false;
1131+
for param in $trait.generics.params.iter() {
1132+
if let syn::GenericParam::Lifetime(_) = param {}
1133+
else { nonlifetime_param = true; }
1134+
}
1135+
if !nonlifetime_param { t_gen_args = String::new(); }
11281136
if takes_self {
11291137
write!(w, "<native{} as {}<{}>>::{}(unsafe {{ &mut *(this_arg as *mut native{}) }}, ", ident, $trait_path, t_gen_args, $m.sig.ident, ident).unwrap();
11301138
} else {

0 commit comments

Comments
 (0)