From 4e394493d63c2348a08d486562dc2082cbdfe306 Mon Sep 17 00:00:00 2001 From: Kendall Koning Date: Fri, 18 Jun 2021 14:27:18 -0400 Subject: [PATCH] Ignore PhantomPinned cbindgen already ignores `PhantomData`. It should ignore `PhantomPinned` for the same reasons. Closes #695 Fixes #694 --- docs.md | 1 + src/bindgen/ir/ty.rs | 2 +- tests/rust/struct.rs | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs.md b/docs.md index 7dfa3923c..5bece0cb1 100644 --- a/docs.md +++ b/docs.md @@ -159,6 +159,7 @@ cbindgen contains the following hardcoded mappings (again completely ignoring na * f64 => double * VaList => va_list * PhantomData => *evaporates*, can only appear as the field of a type +* PhantomPinned => *evaporates*, can only appear as the field of a type * () => *evaporates*, can only appear as the field of a type diff --git a/src/bindgen/ir/ty.rs b/src/bindgen/ir/ty.rs index e4452f391..0bae11c85 100644 --- a/src/bindgen/ir/ty.rs +++ b/src/bindgen/ir/ty.rs @@ -398,7 +398,7 @@ impl Type { syn::Type::Path(ref path) => { let generic_path = GenericPath::load(&path.path)?; - if generic_path.name() == "PhantomData" { + if generic_path.name() == "PhantomData" || generic_path.name() == "PhantomPinned" { return Ok(None); } diff --git a/tests/rust/struct.rs b/tests/rust/struct.rs index 5fb9f18a3..7569901a4 100644 --- a/tests/rust/struct.rs +++ b/tests/rust/struct.rs @@ -17,6 +17,7 @@ struct NormalWithZST { y: f32, z: (), w: PhantomData, + v: PhantomPinned, } /// cbindgen:rename-all=GeckoCase