Skip to content

Commit 1afc4cc

Browse files
committed
Accept DerefMut bounds on generics as if they were Deref
1 parent 15635d0 commit 1afc4cc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

c-bindings-gen/src/types.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,8 @@ impl<'a, 'p: 'a> GenericTypes<'a, 'p> {
225225
if path == "Sized" { continue; }
226226
if non_lifetimes_processed { return false; }
227227
non_lifetimes_processed = true;
228-
if path != "std::ops::Deref" && path != "core::ops::Deref" {
228+
if path != "std::ops::Deref" && path != "core::ops::Deref" &&
229+
path != "std::ops::DerefMut" && path != "core::ops::DerefMut" {
229230
let p = string_path_to_syn_path(&path);
230231
let ref_ty = parse_quote!(&#p);
231232
let mut_ref_ty = parse_quote!(&mut #p);
@@ -347,7 +348,8 @@ impl<'a, 'p: 'a> GenericTypes<'a, 'p> {
347348
// implement Deref<Target=Self> for relevant types). We don't
348349
// bother to implement it for associated types, however, so we just
349350
// ignore such bounds.
350-
if path != "std::ops::Deref" && path != "core::ops::Deref" {
351+
if path != "std::ops::Deref" && path != "core::ops::Deref" &&
352+
path != "std::ops::DerefMut" && path != "core::ops::DerefMut" {
351353
self.typed_generics.insert(&t.ident, path);
352354
}
353355
} else { unimplemented!(); }

0 commit comments

Comments
 (0)