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: update nightly to 2024-01-20 #468

Merged
merged 14 commits into from
Jan 21, 2024
Merged
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
1,257 changes: 684 additions & 573 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bitfield/src/from_bits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ macro_rules! enum_from_bits {
}

impl $Type {
const VARIANTS: &[Self] = &[
const VARIANTS: &'static [Self] = &[
Self::$Variant1,
$(
Self::$Variant,
Expand Down
21 changes: 6 additions & 15 deletions bitfield/src/pack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -703,11 +703,7 @@ macro_rules! make_packers {

impl<T, F> Clone for $Pack<T, F> {
fn clone(&self) -> Self {
Self {
mask: self.mask,
shift: self.shift,
_dst_ty: PhantomData,
}
*self
}
}

Expand Down Expand Up @@ -773,14 +769,14 @@ macro_rules! make_packers {
impl<A, B, F> PartialEq<&'_ $Pack<B, F>> for $Pack<A, F> {
#[inline]
fn eq(&self, other: &&'_ $Pack<B, F>) -> bool {
self.eq(*other)
<Self as PartialEq<$Pack<B, F>>>::eq(self, *other)
}
}

impl<A, B, F> PartialEq<$Pack<B, F>> for &'_ $Pack<A, F> {
#[inline]
fn eq(&self, other: &$Pack<B, F>) -> bool {
(*self).eq(other)
<$Pack<A, F> as PartialEq<$Pack<B, F>>>::eq(*self, other)
}
}

Expand Down Expand Up @@ -992,12 +988,7 @@ macro_rules! make_packers {

impl<T> Clone for $Pair<T> {
fn clone(&self) -> Self {
Self {
src: self.src,
dst: self.dst,
dst_shl: self.dst_shl,
dst_shr: self.dst_shr,
}
*self
}
}

Expand Down Expand Up @@ -1061,14 +1052,14 @@ macro_rules! make_packers {
impl<A, B> PartialEq<&'_ $Pair<B>> for $Pair<A> {
#[inline]
fn eq(&self, other: &&'_ $Pair<B>) -> bool {
self.eq(*other)
<Self as PartialEq<$Pair<B>>>::eq(self, *other)
}
}

impl<A, B> PartialEq<$Pair<B>> for &'_ $Pair<A> {
#[inline]
fn eq(&self, other: &$Pair<B>) -> bool {
(*self).eq(other)
<$Pair<A> as PartialEq<$Pair<B>>>::eq(*self, other)
}
}

Expand Down
11 changes: 4 additions & 7 deletions cordyceps/src/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ impl<T: Linked<Links<T>> + ?Sized> List<T> {
let split_idx = match at {
// trying to split at the 0th index. we can just return the whole
// list, leaving `self` empty.
at if at == 0 => return Some(mem::replace(self, Self::new())),
0 => return Some(mem::replace(self, Self::new())),
// trying to split at the last index. the new list will be empty.
at if at == len => return Some(Self::new()),
// we cannot split at an index that is greater than the length of
Expand Down Expand Up @@ -901,12 +901,9 @@ impl<T: Linked<Links<T>> + ?Sized> List<T> {
/// If the closure returns `false`, the element will remain in the list and
/// will not be yielded by the iterator.
///
/// Note that *unlike* the [`drain_filter` method][std-filter] on
/// [`std::collections::LinkedList`], the closure is *not* permitted to
/// mutate the elements of the list, as a mutable reference could be used to
/// improperly unlink list nodes.
///
/// [std-filter]: std::collections::LinkedList::drain_filter
/// Note that the closure is *not* permitted to mutate the elements of the
/// list, as a mutable reference could be used to improperly unlink list
/// nodes.
#[must_use]
pub fn drain_filter<F>(&mut self, pred: F) -> DrainFilter<'_, T, F>
where
Expand Down
4 changes: 2 additions & 2 deletions cordyceps/src/loom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ mod inner {

#[cfg(not(loom))]
mod inner {
#![allow(dead_code)]
#![allow(dead_code, unused_imports)]
pub(crate) mod sync {
pub use core::sync::*;

Expand Down Expand Up @@ -229,7 +229,7 @@ mod inner {
}

thread_local! {
static REGISTRY: RefCell<Option<Registry>> = RefCell::new(None);
static REGISTRY: RefCell<Option<Registry>> = const { RefCell::new(None) };
}

impl Registry {
Expand Down
2 changes: 1 addition & 1 deletion cordyceps/src/mpsc_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1516,7 +1516,7 @@ mod tests {
mod test_util {
use super::*;
use crate::loom::alloc;
pub use std::{boxed::Box, pin::Pin, println, ptr, vec, vec::Vec};
pub use std::{boxed::Box, pin::Pin, ptr, vec::Vec};

pub(super) struct Entry {
links: Links<Entry>,
Expand Down
6 changes: 1 addition & 5 deletions hal-x86_64/src/cpu/msr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,11 +309,7 @@ impl<V> Msr<V> {
impl<V> Clone for Msr<V> {
#[inline]
fn clone(&self) -> Self {
Self {
num: self.num,
name: self.name,
_ty: PhantomData,
}
*self
}
}

Expand Down
1 change: 1 addition & 0 deletions hal-x86_64/src/interrupt/apic/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ impl Default for DeliveryMode {
}
}

#[cfg(test)]
mod test {
use super::*;

Expand Down
18 changes: 9 additions & 9 deletions hal-x86_64/src/serial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ impl<'a> Lock<'a> {
}
}

impl<'a, B> Lock<'a, B> {
impl<B> Lock<'_, B> {
/// Set the serial port's baud rate for this `Lock`.
///
/// When the `Lock` is dropped, the baud rate will be set to the previous value.
Expand Down Expand Up @@ -281,7 +281,7 @@ impl<'a, B> Lock<'a, B> {
}
}

impl<'a> io::Read for Lock<'a, Blocking> {
impl io::Read for Lock<'_, Blocking> {
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
for byte in buf.iter_mut() {
*byte = self.inner.read_blocking();
Expand All @@ -290,7 +290,7 @@ impl<'a> io::Read for Lock<'a, Blocking> {
}
}

impl<'a> io::Read for Lock<'a, Nonblocking> {
impl io::Read for Lock<'_, Nonblocking> {
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
for byte in buf.iter_mut() {
*byte = self.inner.read_nonblocking()?;
Expand All @@ -299,7 +299,7 @@ impl<'a> io::Read for Lock<'a, Nonblocking> {
}
}

impl<'a> io::Write for Lock<'a, Blocking> {
impl io::Write for Lock<'_, Blocking> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
for &byte in buf.iter() {
self.inner.write_blocking(byte)
Expand All @@ -313,7 +313,7 @@ impl<'a> io::Write for Lock<'a, Blocking> {
}
}

impl<'a> fmt::Write for Lock<'a, Blocking> {
impl fmt::Write for Lock<'_, Blocking> {
fn write_str(&mut self, s: &str) -> fmt::Result {
for byte in s.bytes() {
self.inner.write_blocking(byte)
Expand All @@ -322,7 +322,7 @@ impl<'a> fmt::Write for Lock<'a, Blocking> {
}
}

impl<'a> io::Write for Lock<'a, Nonblocking> {
impl io::Write for Lock<'_, Nonblocking> {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
for &byte in buf.iter() {
self.inner.write_nonblocking(byte)?;
Expand All @@ -336,7 +336,7 @@ impl<'a> io::Write for Lock<'a, Nonblocking> {
}
}

impl<'a> LockInner<'a> {
impl LockInner<'_> {
#[inline(always)]
fn is_write_ready(&self) -> bool {
self.inner.is_write_ready()
Expand Down Expand Up @@ -373,7 +373,7 @@ impl<'a> LockInner<'a> {
}
}

impl<'a> Drop for LockInner<'a> {
impl Drop for LockInner<'_> {
fn drop(&mut self) {
if let Some(divisor) = self.prev_divisor {
// Disable IRQs.
Expand All @@ -385,7 +385,7 @@ impl<'a> Drop for LockInner<'a> {
}
}

impl<'a> mycelium_trace::writer::MakeWriter<'a> for &'static Port {
impl<'a> mycelium_trace::writer::MakeWriter<'a> for &Port {
type Writer = Lock<'a, Blocking>;
fn make_writer(&'a self) -> Self::Writer {
self.lock()
Expand Down
2 changes: 1 addition & 1 deletion inoculate/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ impl Paths {
// === impl BootloaderOptions ===

impl BootloaderOptions {
const ARG_GROUP: &str = "boot-opts";
const ARG_GROUP: &'static str = "boot-opts";

fn boot_config(&self) -> bootloader_boot_config::BootConfig {
let mut bootcfg = bootloader::BootConfig::default();
Expand Down
2 changes: 1 addition & 1 deletion maitake-sync/src/loom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ mod inner {
}

thread_local! {
static REGISTRY: RefCell<Option<Registry>> = RefCell::new(None);
static REGISTRY: RefCell<Option<Registry>> = const { RefCell::new(None) };
}

impl Registry {
Expand Down
8 changes: 4 additions & 4 deletions maitake-sync/src/rwlock/owned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ impl<T: ?Sized> RwLock<T> {
///
/// This method is identical to [`RwLock::read`], execept that it requires
/// the `RwLock` to be wrapped in an [`Arc`], and returns an
/// [`OwnedRwLockReadGuard`][guard] that clones the [`Arc`] rather than
/// [`OwnedRwLockReadGuard`] that clones the [`Arc`] rather than
/// borrowing the lock. Therefore, the returned guard is valid for the
/// `'static` lifetime.
///
Expand Down Expand Up @@ -171,7 +171,7 @@ impl<T: ?Sized> RwLock<T> {
///
/// This method is identical to [`RwLock::write`], execept that it requires
/// the `RwLock` to be wrapped in an [`Arc`], and returns an
/// [`OwnedRwLockWriteGuard`][guard] that clones the [`Arc`] rather than
/// [`OwnedRwLockWriteGuard`] that clones the [`Arc`] rather than
/// borrowing the lock. Therefore, the returned guard is valid for the
/// `'static` lifetime.
///
Expand Down Expand Up @@ -226,7 +226,7 @@ impl<T: ?Sized> RwLock<T> {
///
/// This method is identical to [`RwLock::try_read`], execept that it requires
/// the `RwLock` to be wrapped in an [`Arc`], and returns an
/// [`OwnedRwLockReadGuard`][guard] that clones the [`Arc`] rather than
/// [`OwnedRwLockReadGuard`] that clones the [`Arc`] rather than
/// borrowing the lock. Therefore, the returned guard is valid for the
/// `'static` lifetime.
///
Expand Down Expand Up @@ -273,7 +273,7 @@ impl<T: ?Sized> RwLock<T> {
///
/// This method is identical to [`RwLock::try_write`], execept that it requires
/// the `RwLock` to be wrapped in an [`Arc`], and returns an
/// [`OwnedRwLockWriteGuard`][guard] that clones the [`Arc`] rather than
/// [`OwnedRwLockWriteGuard`] that clones the [`Arc`] rather than
/// borrowing the lock. Therefore, the returned guard is valid for the
/// `'static` lifetime.
///
Expand Down
2 changes: 1 addition & 1 deletion maitake-sync/src/wait_map/tests/alloc_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ struct CountDropKey {

impl PartialEq for CountDropKey {
fn eq(&self, other: &Self) -> bool {
self.idx.eq(&other.idx)
self.idx == other.idx
}
}

Expand Down
2 changes: 1 addition & 1 deletion maitake/src/loom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ mod inner {
}

thread_local! {
static REGISTRY: RefCell<Option<Registry>> = RefCell::new(None);
static REGISTRY: RefCell<Option<Registry>> = const { RefCell::new(None) };
}

impl Registry {
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[toolchain]
channel = "nightly-2023-03-06"
channel = "nightly-2024-01-20"
components = [
"clippy",
"rustfmt",
Expand Down
4 changes: 2 additions & 2 deletions src/arch/x86_64/boot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ impl BootInfo for BootloaderApiBootInfo {
let com1 = AnsiEscapes::new(com1);
com1.with_filter(serial_filter as for<'a, 'b> fn(&'a tracing::Metadata<'b>) -> bool)
});
Subscriber::display_only(display_writer).with_serial(serial)
Subscriber::<_, Option<FilteredSerial>>::display_only(display_writer)
.with_serial(serial)
});

Some(tracing::Dispatch::from_static(collector))
}

Expand Down
3 changes: 2 additions & 1 deletion src/arch/x86_64/interrupt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ static TSS: sync::Lazy<task::StateSegment> = sync::Lazy::new(|| {
let mut tss = task::StateSegment::empty();
tss.interrupt_stacks[Idt::DOUBLE_FAULT_IST_OFFSET] = unsafe {
// safety: asdf
VAddr::of(&DOUBLE_FAULT_STACK).offset(DOUBLE_FAULT_STACK_SIZE as i32)
VAddr::from_usize_unchecked(core::ptr::addr_of!(DOUBLE_FAULT_STACK) as usize)
.offset(DOUBLE_FAULT_STACK_SIZE as i32)
};
tracing::debug!(?tss, "TSS initialized");
tss
Expand Down
2 changes: 1 addition & 1 deletion trace/src/color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ where
}

impl<W> AnsiEscapes<W> {
const ANSI_FG_COLOR_TABLE: [&str; 17] = [
const ANSI_FG_COLOR_TABLE: [&'static str; 17] = [
"30", // black
"31", // red
"32", // green
Expand Down
2 changes: 1 addition & 1 deletion trace/src/embedded_graphics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
Point { x, y }
}

impl<'mk, D> fmt::Write for TextWriter<'mk, D>
impl<D> fmt::Write for TextWriter<'_, D>
where
D: Draw,
{
Expand Down Expand Up @@ -129,7 +129,7 @@
Ordering::Relaxed,
) {
Ok(_) => Ok(()),
Err(actual_point) => unsafe {

Check warning on line 132 in trace/src/embedded_graphics.rs

View workflow job for this annotation

GitHub Actions / cargo check (host)

warning: unused variable: `actual_point` --> trace/src/embedded_graphics.rs:132:17 | 132 | Err(actual_point) => unsafe { | ^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_actual_point` | = note: `#[warn(unused_variables)]` on by default
mycelium_util::unreachable_unchecked!(
"lock should guard this, could actually be totally unsync; curr_point={}; actual_point={}",
unpack_point(curr_packed),
Expand Down
24 changes: 14 additions & 10 deletions trace/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ struct Visitor<'writer, W> {

impl<D> Default for Subscriber<D>
where
for<'a> D: MakeWriter<'a>,
for<'a> D: MakeWriter<'a> + 'static,
for<'a> <D as MakeWriter<'a>>::Writer: SetColor,
D: Default,
{
fn default() -> Self {
Expand All @@ -92,8 +93,10 @@ const _ACTUAL_ID_BITS: u64 = !(SERIAL_BIT | VGA_BIT);
impl<D, S> Subscriber<D, S> {
pub fn display_only(display: D) -> Self
where
for<'a> D: MakeWriter<'a>,
for<'a> S: MakeWriter<'a>,
for<'a> D: MakeWriter<'a> + 'static,
// for<'a> <D as MakeWriter<'a>>::Writer: SetColor,
for<'a> S: MakeWriter<'a> + 'static,
// for<'a> <S as MakeWriter<'a>>::Writer: SetColor,
S: Default,
{
Self {
Expand All @@ -103,9 +106,10 @@ impl<D, S> Subscriber<D, S> {
}
}

pub fn with_serial(self, port: S) -> Subscriber<D, S>
pub fn with_serial<S2>(self, port: S2) -> Subscriber<D, S2>
where
for<'a> S: MakeWriter<'a>,
for<'a> S2: MakeWriter<'a> + 'static,
// for<'a> <S2 as MakeWriter<'a>>::Writer: SetColor,
{
Subscriber {
serial: Output::new(port, Self::SERIAL_INDENT_CFG),
Expand Down Expand Up @@ -139,12 +143,12 @@ impl<D, S> Subscriber<D, S> {
}
}

impl<D, S, DW, SW> tracing_core::Collect for Subscriber<D, S>
impl<D, S> tracing_core::Collect for Subscriber<D, S>
where
for<'a> D: MakeWriter<'a, Writer = DW> + 'static,
DW: Write + SetColor,
for<'a> S: MakeWriter<'a, Writer = SW> + 'static,
SW: Write + SetColor,
for<'a> D: MakeWriter<'a> + 'static,
for<'a> <D as MakeWriter<'a>>::Writer: SetColor,
for<'a> S: MakeWriter<'a> + 'static,
for<'a> <S as MakeWriter<'a>>::Writer: SetColor,
{
fn enabled(&self, meta: &Metadata) -> bool {
self.display.enabled(meta) || self.serial.enabled(meta)
Expand Down
Loading