]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #51786 - cuviper:stat64-pointers, r=Mark-Simulacrum
authorPietro Albini <pietro@pietroalbini.org>
Tue, 26 Jun 2018 09:35:41 +0000 (11:35 +0200)
committerGitHub <noreply@github.com>
Tue, 26 Jun 2018 09:35:41 +0000 (11:35 +0200)
Remove unnecessary stat64 pointer casts

In effect, these just casted `&mut stat64` to `*mut stat64`, twice.
That's harmless, but it masked a problem when this was copied to new
code calling `fstatat`, which takes a pointer to `struct stat`.  That
will be fixed by #51785, but let's remove the unnecessary casts here
too.

src/libstd/sys/unix/fs.rs

index e186b115821649d37155da058a835f2bff6425b0..662a76d6725a68d7bb3493c7229330d446e1dd80 100644 (file)
@@ -803,7 +803,7 @@ pub fn stat(p: &Path) -> io::Result<FileAttr> {
     let p = cstr(p)?;
     let mut stat: stat64 = unsafe { mem::zeroed() };
     cvt(unsafe {
-        stat64(p.as_ptr(), &mut stat as *mut _ as *mut _)
+        stat64(p.as_ptr(), &mut stat)
     })?;
     Ok(FileAttr { stat: stat })
 }
@@ -812,7 +812,7 @@ pub fn lstat(p: &Path) -> io::Result<FileAttr> {
     let p = cstr(p)?;
     let mut stat: stat64 = unsafe { mem::zeroed() };
     cvt(unsafe {
-        lstat64(p.as_ptr(), &mut stat as *mut _ as *mut _)
+        lstat64(p.as_ptr(), &mut stat)
     })?;
     Ok(FileAttr { stat: stat })
 }