Repository: alexcrichton/tar-rs (language: rust)

Issue:
Is AlignHigher still needed?
The `AlignHigher` struct has a comment that it is a workaround for rust-lang/rust#26403. That issue is closed, so is there still any need for `AlignHigher`?


Discussion / hints:
Oh dear this is indeed a **very** old bug, the hack can probably be removed now!

Fix patch:
diff --git a/src/archive.rs b/src/archive.rs
index fa6614fb..b61c569c 100644
--- a/src/archive.rs
+++ b/src/archive.rs
@@ -21,7 +21,7 @@ pub struct ArchiveInner<R: ?Sized> {
     pos: Cell<u64>,
     unpack_xattrs: bool,
     preserve_permissions: bool,
-    obj: RefCell<::AlignHigher<R>>,
+    obj: RefCell<R>,
 }
 
 /// An iterator over the entries of an archive.
@@ -44,7 +44,7 @@ impl<R: Read> Archive<R> {
             inner: ArchiveInner {
                 unpack_xattrs: false,
                 preserve_permissions: false,
-                obj: RefCell::new(::AlignHigher(0, obj)),
+                obj: RefCell::new(obj),
                 pos: Cell::new(0),
             },
         }
@@ -52,7 +52,7 @@ impl<R: Read> Archive<R> {
 
     /// Unwrap this archive, returning the underlying object.
     pub fn into_inner(self) -> R {
-        self.inner.obj.into_inner().1
+        self.inner.obj.into_inner()
     }
 
     /// Construct an iterator over the entries in this archive.
diff --git a/src/lib.rs b/src/lib.rs
index 4188cfd1..4954007b 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -30,7 +30,6 @@ extern crate syscall;
 extern crate xattr;
 
 use std::io::{Error, ErrorKind};
-use std::ops::{Deref, DerefMut};
 
 pub use archive::{Archive, Entries};
 pub use builder::Builder;
@@ -48,28 +47,6 @@ mod error;
 mod header;
 mod pax;
 
-// FIXME(rust-lang/rust#26403):
-//      Right now there's a bug when a DST struct's last field has more
-//      alignment than the rest of a structure, causing invalid pointers to be
-//      created when it's casted around at runtime. To work around this we force
-//      our DST struct to instead have a forcibly higher alignment via a
-//      synthesized u64 (hopefully the largest alignment we'll run into in
-//      practice), and this should hopefully ensure that the pointers all work
-//      out.
-struct AlignHigher<R: ?Sized>(u64, R);
-
-impl<R: ?Sized> Deref for AlignHigher<R> {
-    type Target = R;
-    fn deref(&self) -> &R {
-        &self.1
-    }
-}
-impl<R: ?Sized> DerefMut for AlignHigher<R> {
-    fn deref_mut(&mut self) -> &mut R {
-        &mut self.1
-    }
-}
-
 fn other(msg: &str) -> Error {
     Error::new(ErrorKind::Other, msg)
 }


Test patch: