aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/checks/errors/borrowck/ffi-polonius/src/gccrs_ffi.rs11
-rw-r--r--gcc/rust/checks/errors/borrowck/ffi-polonius/src/lib.rs2
2 files changed, 8 insertions, 5 deletions
diff --git a/gcc/rust/checks/errors/borrowck/ffi-polonius/src/gccrs_ffi.rs b/gcc/rust/checks/errors/borrowck/ffi-polonius/src/gccrs_ffi.rs
index 0cb85078..7377e3a 100644
--- a/gcc/rust/checks/errors/borrowck/ffi-polonius/src/gccrs_ffi.rs
+++ b/gcc/rust/checks/errors/borrowck/ffi-polonius/src/gccrs_ffi.rs
@@ -30,11 +30,16 @@
// ```
include!("gccrs_ffi_generated.rs");
+use std::marker::{PhantomData, PhantomPinned};
+
use crate::GccrsAtom;
-// Using opqaue types
-extern "C" {
- pub type FFIVector;
+// We define an opaque C type per the nomicon's recommendation:
+// https://doc.rust-lang.org/nomicon/ffi.html#representing-opaque-structs
+#[repr(C)]
+pub struct FFIVector {
+ _empty: [u8; 0],
+ marker: PhantomData<(*mut u8, PhantomPinned)>,
}
impl<T1, T2> Into<(GccrsAtom, GccrsAtom)> for Pair<T1, T2>
diff --git a/gcc/rust/checks/errors/borrowck/ffi-polonius/src/lib.rs b/gcc/rust/checks/errors/borrowck/ffi-polonius/src/lib.rs
index 782a63f..c5c0ae9 100644
--- a/gcc/rust/checks/errors/borrowck/ffi-polonius/src/lib.rs
+++ b/gcc/rust/checks/errors/borrowck/ffi-polonius/src/lib.rs
@@ -16,8 +16,6 @@
// along with GCC; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
-#![feature(extern_types)]
-
mod gccrs_ffi;
use gccrs_ffi::FFIVector;