about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorAndrei Homescu <ah@immunant.com>2019-07-12 15:32:46 -0700
committerAndrei Homescu <ah@immunant.com>2019-07-14 18:14:15 -0700
commit0c981e0a8a01426dbcac895d67dd33db7f5b6ff4 (patch)
tree54b0be1d57de26d32e273350f8f4c8710c13d864 /src/libcore
parent71f9384e3bec467158a628e2d11e77ffada16a90 (diff)
downloadrust-0c981e0a8a01426dbcac895d67dd33db7f5b6ff4.tar.gz
rust-0c981e0a8a01426dbcac895d67dd33db7f5b6ff4.zip
Make VaListImpl<'f> invariant over the 'f lifetime
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/ffi.rs13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/libcore/ffi.rs b/src/libcore/ffi.rs
index 4f87cc506ef..eda0e7c518c 100644
--- a/src/libcore/ffi.rs
+++ b/src/libcore/ffi.rs
@@ -60,7 +60,10 @@ impl fmt::Debug for c_void {
 #[lang = "va_list"]
 pub struct VaListImpl<'f> {
     ptr: *mut c_void,
-    _marker: PhantomData<&'f c_void>,
+
+    // Invariant over `'f`, so each `VaListImpl<'f>` object is tied to
+    // the region of the function it's defined in
+    _marker: PhantomData<&'f mut &'f c_void>,
 }
 
 #[cfg(any(all(not(target_arch = "aarch64"), not(target_arch = "powerpc"),
@@ -96,7 +99,7 @@ pub struct VaListImpl<'f> {
     vr_top: *mut c_void,
     gr_offs: i32,
     vr_offs: i32,
-    _marker: PhantomData<&'f c_void>,
+    _marker: PhantomData<&'f mut &'f c_void>,
 }
 
 /// PowerPC ABI implementation of a `va_list`.
@@ -114,7 +117,7 @@ pub struct VaListImpl<'f> {
     reserved: u16,
     overflow_arg_area: *mut c_void,
     reg_save_area: *mut c_void,
-    _marker: PhantomData<&'f c_void>,
+    _marker: PhantomData<&'f mut &'f c_void>,
 }
 
 /// x86_64 ABI implementation of a `va_list`.
@@ -131,7 +134,7 @@ pub struct VaListImpl<'f> {
     fp_offset: i32,
     overflow_arg_area: *mut c_void,
     reg_save_area: *mut c_void,
-    _marker: PhantomData<&'f c_void>,
+    _marker: PhantomData<&'f mut &'f c_void>,
 }
 
 /// asm.js ABI implementation of a `va_list`.
@@ -148,7 +151,7 @@ pub struct VaListImpl<'f> {
 #[lang = "va_list"]
 pub struct VaListImpl<'f> {
     inner: [crate::mem::MaybeUninit<i32>; 4],
-    _marker: PhantomData<&'f c_void>,
+    _marker: PhantomData<&'f mut &'f c_void>,
 }
 
 #[cfg(all(target_arch = "asmjs", not(windows)))]