Skip to content

Commit 3e06be9

Browse files
committed
Allow generation of manual types in reference options
The limiting of supported types in `write_template_generics` isn't super useful as its only called once per type - later uses of the same type with the reference flag set or wiped doesn't change anything. Still, it is relied on somewhat, so we can't drop it entirely. Now that we've moved more of the `[u8; 32]` newtypes to option wrappers, failing for non-primitive references spuriously breaks. Instead, we just allow it for manually-mapped types and let the compiler complain if we do something invalid.
1 parent 5aaf753 commit 3e06be9

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

c-bindings-gen/src/types.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2681,17 +2681,14 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
26812681
} else { unimplemented!(); }
26822682
} else if let syn::Type::Path(p_arg) = t {
26832683
if let Some(resolved) = self.maybe_resolve_path(&p_arg.path, generics) {
2684-
if !self.is_primitive(&resolved) {
2684+
if !self.is_primitive(&resolved) && self.c_type_from_path(&resolved, false, false).is_none() {
26852685
if is_ref {
26862686
// We don't currently support outer reference types for non-primitive inners
26872687
return false;
26882688
}
26892689
}
26902690
} else {
2691-
if is_ref {
2692-
// We don't currently support outer reference types for non-primitive inners
2693-
return false;
2694-
}
2691+
return false;
26952692
}
26962693
if !self.write_c_type_intern(w, t, generics, false, false, false, true, true) { return false; }
26972694
} else {

0 commit comments

Comments
 (0)