Skip to content

Commit

Permalink
Auto merge of rust-lang#90284 - tonyyzy:patch-1, r=JohnTitor
Browse files Browse the repository at this point in the history
Remove redundant Aligner

The `Aligner` struct seems to be unnecessary.
Previously noted by `@arthurprs` rust-lang#44963 (comment)
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
  • Loading branch information
bors committed Oct 26, 2021
2 parents c7a30c8 + f546637 commit 3c8f001
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions library/std/src/sync/mpsc/cache_aligned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ use crate::ops::{Deref, DerefMut};

#[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;
Expand All @@ -22,6 +19,6 @@ impl<T> DerefMut for CacheAligned<T> {

impl<T> CacheAligned<T> {
pub(super) fn new(t: T) -> Self {
CacheAligned(t, Aligner)
CacheAligned(t)
}
}

0 comments on commit 3c8f001

Please sign in to comment.