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

Update rustc #636

Merged
merged 3 commits into from
Sep 17, 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 change: 0 additions & 1 deletion http/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#![feature(
async_iterator,
const_mut_refs,
extract_if,
impl_trait_in_assoc_type,
maybe_uninit_uninit_array,
Expand Down
1 change: 1 addition & 0 deletions inbox/src/oneshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ impl<T> Drop for Sender<T> {

if has_receiver(old_status) {
// Receiver is still alive, so we need to wake it.
#[allow(clippy::significant_drop_in_scrutinee)]
if let Some(waker) = shared.receiver_waker.lock().unwrap().take() {
waker.wake();
}
Expand Down
6 changes: 1 addition & 5 deletions rt/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,16 +180,12 @@
doc_cfg_hide,
extract_if,
impl_trait_in_assoc_type,
io_slice_advance,
is_sorted,
maybe_uninit_array_assume_init,
maybe_uninit_uninit_array,
never_type,
new_uninit,
noop_waker,
ptr_metadata,
stmt_expr_attributes,
waker_getters
stmt_expr_attributes
)]
#![warn(
anonymous_parameters,
Expand Down
11 changes: 6 additions & 5 deletions rt/src/scheduler/inactive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,12 @@ impl Inactive {
/// Removes the process with id `pid`, if any.
pub(crate) fn remove(&mut self, pid: ProcessId) -> Option<Pin<Box<ProcessData>>> {
debug_assert!(ok_pid(pid));
self.root.remove(pid, pid.0 >> SKIP_BITS).map(|process| {
debug_assert_eq!(process.as_ref().id(), pid);
self.length -= 1;
process
})
self.root
.remove(pid, pid.0 >> SKIP_BITS)
.inspect(|process| {
debug_assert_eq!(process.as_ref().id(), pid);
self.length -= 1;
})
}
}

Expand Down
27 changes: 10 additions & 17 deletions rt/src/scheduler/shared/runqueue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,24 +53,17 @@ impl RunQueue {
/// Add `process` to the queue of running processes.
pub(crate) fn add(&self, process: Pin<Box<ProcessData>>) {
let mut next_node = &mut *self.root.lock().unwrap();
loop {
match next_node {
Some(node) => {
// Select the next node in the branch to attempt to add
// ourselves to.
if node.process < process {
next_node = &mut node.left;
} else {
next_node = &mut node.right;
}
}
None => {
// Last node in the branch add our process to it.
*next_node = Some(Box::new(Node::new(process)));
return;
}
}
while let Some(node) = next_node {
// Select the next node in the branch to attempt to add
// ourselves to.
next_node = if node.process < process {
&mut node.left
} else {
&mut node.right
};
}
// Last node in the branch add our process to it.
*next_node = Some(Box::new(Node::new(process)));
}

/// Remove the next process to run from the queue.
Expand Down
4 changes: 2 additions & 2 deletions rt/src/timers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ fn add_timer<T: Ord>(timers: &mut Vec<Timer<T>>, deadline: T, waker: task::Waker
let idx = match timers.binary_search_by(|timer| timer.deadline.cmp(&deadline)) {
Ok(idx) | Err(idx) => idx,
};
let token = TimerToken(waker.as_raw().data() as usize);
let token = TimerToken(waker.data() as usize);
timers.insert(idx, Timer { deadline, waker });
token
}
Expand All @@ -334,7 +334,7 @@ fn add_timer<T: Ord>(timers: &mut Vec<Timer<T>>, deadline: T, waker: task::Waker
#[allow(clippy::needless_pass_by_value)]
fn remove_timer<T: Ord>(timers: &mut Vec<Timer<T>>, deadline: T, token: TimerToken) {
if let Ok(idx) = timers.binary_search_by(|timer| timer.deadline.cmp(&deadline)) {
if timers[idx].waker.as_raw().data() as usize == token.0 {
if timers[idx].waker.data() as usize == token.0 {
_ = timers.remove(idx);
}
}
Expand Down
12 changes: 6 additions & 6 deletions rt/src/wakers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,15 +234,15 @@ impl<Fut: Future> Future for NoRing<Fut> {
/// `None` if the ctx doesn't use a Heph provided waker implementation.
#[allow(clippy::needless_pass_by_ref_mut)] // Matching `Future::poll` signature.
pub(crate) fn create_no_ring_waker(ctx: &mut task::Context<'_>) -> Option<task::Waker> {
let raw_waker = ctx.waker().as_raw();
let vtable = *raw_waker.vtable();
let waker = ctx.waker();
let vtable = waker.vtable();
// SAFETY: the `data` comes from a waker and when check which waker
// implementation is used.
unsafe {
Some(task::Waker::from_raw(if vtable == WAKER_VTABLE {
waker_vtable_no_ring::clone_wake_data(raw_waker.data())
} else if vtable == shared::WAKER_VTABLE {
shared::waker_vtable_no_ring::clone_wake_data(raw_waker.data())
Some(task::Waker::from_raw(if vtable == &WAKER_VTABLE {
waker_vtable_no_ring::clone_wake_data(waker.data())
} else if vtable == &shared::WAKER_VTABLE {
shared::waker_vtable_no_ring::clone_wake_data(waker.data())
} else {
return None;
}))
Expand Down