]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #90284 - tonyyzy:patch-1, r=JohnTitor
authorbors <bors@rust-lang.org>
Tue, 26 Oct 2021 11:45:13 +0000 (11:45 +0000)
committerbors <bors@rust-lang.org>
Tue, 26 Oct 2021 11:45:13 +0000 (11:45 +0000)
Remove redundant Aligner

The `Aligner` struct seems to be unnecessary.
Previously noted by `@arthurprs` https://github.com/rust-lang/rust/pull/44963#discussion_r145340754
Reddit discussion: https://www.reddit.com/r/rust/comments/pfvvz2/aligner_and_cachealigned/
Playground: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=fa7ca554922755f9d1b62b017d785c6f

library/std/src/sync/mpsc/cache_aligned.rs

index b0842144328a8bfa2f21f11d2f2e338fc5bd04cf..f95b0ddd589ac4b311c4a7d4abfe96c186c80dd0 100644 (file)
@@ -2,10 +2,7 @@
 
 #[derive(Copy, Clone, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
 #[repr(align(64))]
-pub(super) struct Aligner;
-
-#[derive(Copy, Clone, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
-pub(super) struct CacheAligned<T>(pub T, pub Aligner);
+pub(super) struct CacheAligned<T>(pub T);
 
 impl<T> Deref for CacheAligned<T> {
     type Target = T;
@@ -22,6 +19,6 @@ fn deref_mut(&mut self) -> &mut Self::Target {
 
 impl<T> CacheAligned<T> {
     pub(super) fn new(t: T) -> Self {
-        CacheAligned(t, Aligner)
+        CacheAligned(t)
     }
 }