Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bump rust-toolchain to nightly-2024-03-17 #311

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions foyer-common/src/code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use paste::paste;
pub type CodingError = anyhow::Error;
pub type CodingResult<T> = Result<T, CodingError>;

trait BufExt: Buf {
pub trait BufExt: Buf {
cfg_match! {
cfg(target_pointer_width = "16") => {
fn get_usize(&mut self) -> usize {
Expand Down Expand Up @@ -54,7 +54,7 @@ trait BufExt: Buf {

impl<T: Buf> BufExt for T {}

trait BufMutExt: BufMut {
pub trait BufMutExt: BufMut {
cfg_match! {
cfg(target_pointer_width = "16") => {
fn put_usize(&mut self, v: usize) {
Expand Down
2 changes: 0 additions & 2 deletions foyer-common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@

#![feature(trait_alias)]
#![feature(lint_reasons)]
#![feature(bound_map)]
#![feature(associated_type_defaults)]
#![feature(cfg_match)]
#![feature(let_chains)]
#![cfg_attr(coverage_nightly, feature(coverage_attribute))]

pub mod async_queue;
Expand Down
1 change: 0 additions & 1 deletion foyer-experimental/src/notify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ impl Notified {
#[cfg(test)]
mod tests {
use std::{
sync::Arc,
thread::{sleep, spawn},
time::Duration,
};
Expand Down
7 changes: 6 additions & 1 deletion foyer-experimental/src/wal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,12 @@ impl<H: HashValue> TombstoneLog<H> {

path.push(format!("tombstone-{:08X}", config.id));

let file = OpenOptions::new().write(true).read(true).create(true).open(path)?;
let file = OpenOptions::new()
.write(true)
.read(true)
.truncate(true)
.create(true)
.open(path)?;

let inner = Arc::new(TombstoneLogInner {
inflights: Mutex::new(vec![]),
Expand Down
9 changes: 9 additions & 0 deletions foyer-intrusive/src/collections/dlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@ where
}
}

impl<A> Default for Dlist<A>
where
A: Adapter<Link = DlistLink>,
{
fn default() -> Self {
Self::new()
}
}

impl<A> Dlist<A>
where
A: Adapter<Link = DlistLink>,
Expand Down
8 changes: 1 addition & 7 deletions foyer-intrusive/src/core/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,6 @@ pub unsafe trait PriorityAdapter: Adapter {
/// # Examples
///
/// ```
/// #![feature(offset_of)]
///
/// use foyer_intrusive::{intrusive_adapter, key_adapter};
/// use foyer_intrusive::core::adapter::{Adapter, KeyAdapter, Link};
/// use foyer_intrusive::core::pointer::Pointer;
Expand Down Expand Up @@ -215,8 +213,6 @@ macro_rules! intrusive_adapter {
/// # Examples
///
/// ```
/// #![feature(offset_of)]
///
/// use foyer_intrusive::{intrusive_adapter, key_adapter};
/// use foyer_intrusive::core::adapter::{Adapter, KeyAdapter, Link};
/// use foyer_intrusive::core::pointer::Pointer;
Expand Down Expand Up @@ -286,8 +282,6 @@ macro_rules! key_adapter {
/// # Examples
///
/// ```
/// #![feature(offset_of)]
///
/// use foyer_intrusive::{intrusive_adapter, priority_adapter};
/// use foyer_intrusive::core::adapter::{Adapter, PriorityAdapter, Link};
/// use foyer_intrusive::core::pointer::Pointer;
Expand Down Expand Up @@ -343,7 +337,7 @@ mod tests {
use itertools::Itertools;

use super::*;
use crate::{collections::dlist::*, intrusive_adapter};
use crate::collections::dlist::*;

#[derive(Debug)]
struct DlistItem {
Expand Down
39 changes: 20 additions & 19 deletions foyer-intrusive/src/core/pointer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@ unsafe impl<T: ?Sized + Debug> DowngradablePointerOps for Arc<T> {

#[cfg(test)]
mod tests {
use std::{boxed::Box, fmt::Debug, mem, pin::Pin, rc::Rc, sync::Arc};

use std::mem::transmute;

use super::*;

Expand Down Expand Up @@ -319,14 +320,14 @@ mod tests {
unsafe {
let p = Box::new(1) as Box<dyn Debug>;
let a: *const dyn Debug = &*p;
let b: (usize, usize) = mem::transmute(a);
let b: (usize, usize) = transmute(a);
let r = p.into_ptr();
assert_eq!(a, r);
assert_eq!(b, mem::transmute(r));
assert_eq!(b, transmute(r));
let p2: Box<dyn Debug> = <Box<_> as Pointer>::from_ptr(r);
let a2: *const dyn Debug = &*p2;
assert_eq!(a, a2);
assert_eq!(b, mem::transmute(a2));
assert_eq!(b, transmute(a2));
}
}

Expand All @@ -335,14 +336,14 @@ mod tests {
unsafe {
let p = Rc::new(1) as Rc<dyn Debug>;
let a: *const dyn Debug = &*p;
let b: (usize, usize) = mem::transmute(a);
let b: (usize, usize) = transmute(a);
let r = p.into_ptr();
assert_eq!(a, r);
assert_eq!(b, mem::transmute(r));
assert_eq!(b, transmute(r));
let p2: Rc<dyn Debug> = <Rc<_> as Pointer>::from_ptr(r);
let a2: *const dyn Debug = &*p2;
assert_eq!(a, a2);
assert_eq!(b, mem::transmute(a2));
assert_eq!(b, transmute(a2));
}
}

Expand All @@ -351,14 +352,14 @@ mod tests {
unsafe {
let p = Arc::new(1) as Arc<dyn Debug>;
let a: *const dyn Debug = &*p;
let b: (usize, usize) = mem::transmute(a);
let b: (usize, usize) = transmute(a);
let r = p.into_ptr();
assert_eq!(a, r);
assert_eq!(b, mem::transmute(r));
assert_eq!(b, transmute(r));
let p2: Arc<dyn Debug> = <Arc<_> as Pointer>::from_ptr(r);
let a2: *const dyn Debug = &*p2;
assert_eq!(a, a2);
assert_eq!(b, mem::transmute(a2));
assert_eq!(b, transmute(a2));
}
}

Expand Down Expand Up @@ -426,14 +427,14 @@ mod tests {
unsafe {
let p = Pin::new(Box::new(1)) as Pin<Box<dyn Debug>>;
let a: *const dyn Debug = &*p;
let b: (usize, usize) = mem::transmute(a);
let b: (usize, usize) = transmute(a);
let r = p.into_ptr();
assert_eq!(a, r);
assert_eq!(b, mem::transmute(r));
assert_eq!(b, transmute(r));
let p2: Pin<Box<dyn Debug>> = <Pin<Box<_>> as Pointer>::from_ptr(r);
let a2: *const dyn Debug = &*p2;
assert_eq!(a, a2);
assert_eq!(b, mem::transmute(a2));
assert_eq!(b, transmute(a2));
}
}

Expand All @@ -442,14 +443,14 @@ mod tests {
unsafe {
let p = Pin::new(Rc::new(1)) as Pin<Rc<dyn Debug>>;
let a: *const dyn Debug = &*p;
let b: (usize, usize) = mem::transmute(a);
let b: (usize, usize) = transmute(a);
let r = p.into_ptr();
assert_eq!(a, r);
assert_eq!(b, mem::transmute(r));
assert_eq!(b, transmute(r));
let p2: Pin<Rc<dyn Debug>> = <Pin<Rc<_>> as Pointer>::from_ptr(r);
let a2: *const dyn Debug = &*p2;
assert_eq!(a, a2);
assert_eq!(b, mem::transmute(a2));
assert_eq!(b, transmute(a2));
}
}

Expand All @@ -458,14 +459,14 @@ mod tests {
unsafe {
let p = Pin::new(Arc::new(1)) as Pin<Arc<dyn Debug>>;
let a: *const dyn Debug = &*p;
let b: (usize, usize) = mem::transmute(a);
let b: (usize, usize) = transmute(a);
let r = p.into_ptr();
assert_eq!(a, r);
assert_eq!(b, mem::transmute(r));
assert_eq!(b, transmute(r));
let p2: Pin<Arc<dyn Debug>> = <Pin<Arc<_>> as Pointer>::from_ptr(r);
let a2: *const dyn Debug = &*p2;
assert_eq!(a, a2);
assert_eq!(b, mem::transmute(a2));
assert_eq!(b, transmute(a2));
}
}

Expand Down
2 changes: 0 additions & 2 deletions foyer-intrusive/src/eviction/sfifo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,6 @@ where
mod tests {
use std::sync::Arc;

use itertools::Itertools;

use super::*;
use crate::{eviction::EvictionPolicyExt, priority_adapter};

Expand Down
5 changes: 0 additions & 5 deletions foyer-intrusive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,8 @@
// limitations under the License.

#![feature(associated_type_bounds)]
#![feature(ptr_metadata)]
#![feature(trait_alias)]
#![feature(lint_reasons)]
#![feature(offset_of)]
#![expect(clippy::new_without_default)]

pub use memoffset::offset_of;

Expand All @@ -27,8 +24,6 @@ pub use memoffset::offset_of;
/// # Examples
///
/// ```
/// #![feature(offset_of)]
///
/// use foyer_intrusive::container_of;
///
/// struct S { x: u32, y: u32 };
Expand Down
1 change: 0 additions & 1 deletion foyer-memory/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@
//! destroyed.

#![feature(trait_alias)]
#![feature(offset_of)]

pub trait Key: Send + Sync + 'static + std::hash::Hash + Eq + Ord {}
pub trait Value: Send + Sync + 'static {}
Expand Down
4 changes: 2 additions & 2 deletions foyer-storage/src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ mod tests {

let res = buffer.write(entry).await;
let entry = match res {
Err(BufferError::NeedRotate(entry)) => Box::into_inner(entry),
Err(BufferError::NeedRotate(entry)) => *entry,
_ => panic!("should be not enough error"),
};

Expand Down Expand Up @@ -396,7 +396,7 @@ mod tests {

let res = buffer.write(entry).await;
let entry = match res {
Err(BufferError::NeedRotate(entry)) => Box::into_inner(entry),
Err(BufferError::NeedRotate(entry)) => *entry,
_ => panic!("should be not enough error"),
};

Expand Down
6 changes: 3 additions & 3 deletions foyer-storage/src/device/allocator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ mod tests {
let allocator = AlignedAllocator::new(ALIGN);

let mut buf: Vec<u8, _> = Vec::with_capacity_in(ALIGN * 8, &allocator);
bits::assert_aligned(ALIGN, buf.as_ptr().addr());
bits::assert_aligned(ALIGN, buf.as_ptr() as _);

buf.extend_from_slice(&[b'x'; ALIGN * 8]);
bits::assert_aligned(ALIGN, buf.as_ptr().addr());
bits::assert_aligned(ALIGN, buf.as_ptr() as _);
assert_eq!(buf, [b'x'; ALIGN * 8]);

buf.extend_from_slice(&[b'x'; ALIGN * 8]);
bits::assert_aligned(ALIGN, buf.as_ptr().addr());
bits::assert_aligned(ALIGN, buf.as_ptr() as _);
assert_eq!(buf, [b'x'; ALIGN * 16])
}
}
2 changes: 1 addition & 1 deletion foyer-storage/src/flusher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ where
let old_region = self.buffer.region();

let entry = match self.buffer.write(entry).await {
Err(BufferError::NeedRotate(entry)) => Box::into_inner(entry),
Err(BufferError::NeedRotate(entry)) => *entry,
Ok(entries) => return self.update_catalog(entries).await,
Err(e) => return Err(e.into()),
};
Expand Down
6 changes: 1 addition & 5 deletions foyer-storage/src/lazy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,7 @@ mod tests {
use foyer_intrusive::eviction::fifo::FifoConfig;

use super::*;
use crate::{
device::fs::FsDeviceConfig,
storage::StorageExt,
store::{FifoFsStoreConfig, Store},
};
use crate::{device::fs::FsDeviceConfig, storage::StorageExt, store::FifoFsStoreConfig};

const KB: usize = 1024;
const MB: usize = 1024 * 1024;
Expand Down
5 changes: 0 additions & 5 deletions foyer-storage/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,12 @@
// limitations under the License.

#![feature(allocator_api)]
#![feature(strict_provenance)]
#![feature(trait_alias)]
#![feature(get_mut_unchecked)]
#![feature(let_chains)]
#![feature(error_generic_member_access)]
#![feature(lazy_cell)]
#![feature(lint_reasons)]
#![feature(associated_type_defaults)]
#![feature(box_into_inner)]
#![feature(try_trait_v2)]
#![feature(offset_of)]

pub mod admission;
pub mod buffer;
Expand Down
1 change: 0 additions & 1 deletion foyer-storage/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,6 @@ impl<S> ForceStorageExt for S where S: Storage {}

#[cfg(test)]
mod tests {
//! storage interface test

use std::{path::Path, sync::Arc, time::Duration};

Expand Down
3 changes: 0 additions & 3 deletions foyer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#![feature(trait_alias)]
#![feature(pattern)]

pub use foyer_common as common;
pub use foyer_intrusive as intrusive;
pub use foyer_memory as memory;
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[toolchain]
channel = "nightly-2023-12-26"
channel = "nightly-2024-03-17"
Loading