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: roll nightly to 2022-10-07 #335

Merged
merged 16 commits into from
Nov 16, 2022
Merged
Show file tree
Hide file tree
Changes from 15 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
7 changes: 3 additions & 4 deletions alloc/src/buddy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,15 +318,14 @@ impl<const FREE_LISTS: usize> Alloc<FREE_LISTS> {
tracing::trace!(?min_order);
let min_order = min_order.ok_or_else(AllocErr::oom)?;

let size = match self.size_for(layout) {
Some(size) => size,
let Some(size) = self.size_for(layout) else {
// XXX(eliza): is it better to just leak it?
None => panic!(
panic!(
"couldn't determine the correct layout for an allocation \
we previously allocated successfully, what the actual fuck!\n \
addr={:?}; layout={:?}; min_order={}",
paddr, layout, min_order,
),
)
};

// Construct a new free block.
Expand Down
2 changes: 1 addition & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {

// Build our helloworld.wast into binary.
let binary = wat::parse_file("src/helloworld.wast")?;
fs::write(out_dir.join("helloworld.wasm"), &binary)?;
fs::write(out_dir.join("helloworld.wasm"), binary)?;
Ok(())
}
39 changes: 16 additions & 23 deletions cordyceps/src/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,14 +312,11 @@ impl<T: Linked<Links<T>> + ?Sized> List<T> {
///
/// This operation should compute in *O*(1) time and *O*(1) memory.
pub fn append(&mut self, other: &mut Self) {
let tail = match self.tail {
let Some(tail) = self.tail else {
// if this list is empty, simply replace it with `other`
None => {
debug_assert!(self.is_empty());
mem::swap(self, other);
return;
}
Some(tail) => tail,
debug_assert!(self.is_empty());
mem::swap(self, other);
return;
};

// if `other` is empty, do nothing.
Expand Down Expand Up @@ -450,19 +447,16 @@ impl<T: Linked<Links<T>> + ?Sized> List<T> {
/// Asserts as many of the linked list's invariants as possible.
#[track_caller]
pub(crate) fn assert_valid_named(&self, name: &str) {
let head = match self.head {
Some(head) => head,
None => {
assert!(
self.tail.is_none(),
"{name}if the linked list's head is null, the tail must also be null"
);
assert_eq!(
self.len, 0,
"{name}if a linked list's head is null, its length must be 0"
);
return;
}
let Some(head) = self.head else {
assert!(
self.tail.is_none(),
"{name}if the linked list's head is null, the tail must also be null"
);
assert_eq!(
self.len, 0,
"{name}if a linked list's head is null, its length must be 0"
);
return;
};

assert_ne!(
Expand Down Expand Up @@ -928,9 +922,8 @@ impl<T: Linked<Links<T>> + ?Sized> List<T> {

#[inline]
unsafe fn split_after_node(&mut self, split_node: Link<T>, idx: usize) -> Self {
let split_node = match split_node {
Some(node) => node,
None => return mem::replace(self, Self::new()),
let Some(split_node) = split_node else {
return mem::replace(self, Self::new());
};

// the head of the new list is the split node's `next` node (which is
Expand Down
15 changes: 6 additions & 9 deletions cordyceps/src/list/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,10 +334,9 @@ impl<'list, T: Linked<Links<T>> + ?Sized> CursorMut<'list, T> {
let split_at = self.core.index;
self.core.index = 0;

let split_node = match self.core.curr {
Some(node) => node,
let Some(split_node) = self.core.curr else {
// the split portion is the entire list. just return it.
None => return mem::replace(self.core.list, List::new()),
return mem::replace(self.core.list, List::new())
};

// the tail of the new list is the split node's `prev` node (which is
Expand Down Expand Up @@ -374,10 +373,9 @@ impl<'list, T: Linked<Links<T>> + ?Sized> CursorMut<'list, T> {
/// If the cursor is pointing at the null element, then the contents of
/// `spliced` are inserted at the beginning of the `List` the cursor points to.
pub fn splice_after(&mut self, mut spliced: List<T>) {
let (splice_head, splice_tail, splice_len) = match spliced.take_all() {
Some(spliced) => spliced,
let Some((splice_head, splice_tail, splice_len)) = spliced.take_all() else {
// the spliced list is empty, do nothing.
None => return,
return;
};

let next = self.core.next_link();
Expand All @@ -404,10 +402,9 @@ impl<'list, T: Linked<Links<T>> + ?Sized> CursorMut<'list, T> {
/// If the cursor is pointing at the null element, then the contents of
/// `spliced` are inserted at the end of the `List` the cursor points to.
pub fn splice_before(&mut self, mut spliced: List<T>) {
let (splice_head, splice_tail, splice_len) = match spliced.take_all() {
Some(spliced) => spliced,
let Some((splice_head, splice_tail, splice_len)) = spliced.take_all() else {
// the spliced list is empty, do nothing.
None => return,
return;
};

let prev = self.core.prev_link();
Expand Down
2 changes: 1 addition & 1 deletion hal-core/src/addr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub trait Address:
return self;
}
let aligned = (u | mask) + 1;
Self::from_usize(aligned as usize)
Self::from_usize(aligned)
}

/// Align `self` up to the required alignment for a value of type `T`.
Expand Down
2 changes: 1 addition & 1 deletion hal-x86_64/src/interrupt/idt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ mod tests {
// Z: this bit is 0 for a 64-bit IDT. for a 32-bit IDT, this may be 1 for task gates.
// Gate Type: 32-bit interrupt gate is 0b1110. that's just how it is.
assert_eq!(
present_32bit_interrupt.0 as u8, 0b1000_1110,
present_32bit_interrupt.0, 0b1000_1110,
"\n attrs: {:#?}",
present_32bit_interrupt
);
Expand Down
7 changes: 6 additions & 1 deletion hal-x86_64/src/vga.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,12 @@ impl fmt::Write for Buffer {

impl fmt::Debug for Buffer {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let Self { row, col, color, buf: _} = self;
let Self {
row,
col,
color,
buf: _,
} = self;
f.debug_struct("vga::Buffer")
.field("row", row)
.field("col", col)
Expand Down
4 changes: 2 additions & 2 deletions inoculate/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,9 @@ impl Options {
let mut cmd = self.cargo_cmd("builder");
cmd.current_dir(run_dir)
.arg("--kernel-manifest")
.arg(&paths.kernel_manifest())
.arg(paths.kernel_manifest())
.arg("--kernel-binary")
.arg(&paths.kernel_bin())
.arg(paths.kernel_bin())
.arg("--out-dir")
.arg(out_dir)
.arg("--target-dir")
Expand Down
8 changes: 5 additions & 3 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ _fmt := if env_var_or_default("GITHUB_ACTIONS", "") != "true" { "" } else {
```
}

# arguments to pass to all RustDoc invocations
_rustdoc := _cargo + " doc --no-deps --all-features --document-private-items"

# default recipe to display help information
default:
@echo "justfile for Mycelium"
Expand Down Expand Up @@ -81,14 +84,13 @@ check-docs crate='': (build-docs crate '--cfg docsrs -Dwarnings') (test-docs cra

# open RustDoc documentation for `crate` (or for the whole workspace).
docs crate='' $RUSTDOCFLAGS='--cfg docsrs': (build-docs crate RUSTDOCFLAGS)
{{ _cargo }} doc \
{{ _rustdoc }} \
{{ if crate == '' { '--workspace' } else { '--package' } }} {{ crate }} \
--no-deps --all-features \
--open

# build RustDoc documentation for the workspace.
build-docs crate='' $RUSTDOCFLAGS='--cfg docsrs':
{{ _cargo }} doc --no-deps --all-features --document-private-items \
{{ _rustdoc }} \
{{ if crate == '' { '--workspace' } else { '--package' } }} {{ crate }} \
{{ _fmt }}

Expand Down
5 changes: 1 addition & 4 deletions maitake/src/scheduler/steal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,7 @@ impl<'worker, S: Schedule> Stealer<'worker, S> {
/// - `true` if a task was successfully stolen.
/// - `false` if the targeted queue is empty.
pub fn spawn_one(&self, scheduler: &S) -> bool {
let task = match self.queue.dequeue() {
Some(task) => task,
None => return false,
};
let Some(task) = self.queue.dequeue() else { return false };
test_trace!(?task, "stole");

// decrement the target queue's task count
Expand Down
5 changes: 1 addition & 4 deletions maitake/src/sync/wait_cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,10 +446,7 @@ pub(crate) mod test_util {
let this = Arc::downgrade(&self);
drop(self);
futures_util::future::poll_fn(move |cx| {
let this = match this.upgrade() {
Some(this) => this,
None => return Poll::Ready(()),
};
let Some(this) = this.upgrade() else {return Poll::Ready(()) };

let res = this.task.wait();
futures_util::pin_mut!(res);
Expand Down
3 changes: 1 addition & 2 deletions maitake/src/sync/wait_map/tests/loom.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

use super::*;
use crate::loom::{self, future, sync::Arc, thread};

Expand Down Expand Up @@ -90,4 +89,4 @@ fn wake_and_drop() {

thread.join().unwrap();
});
}
}
6 changes: 5 additions & 1 deletion maitake/src/time/timer/sleep.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,11 @@ impl PinnedDrop for Sleep<'_> {

impl fmt::Debug for Sleep<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let Self { state, entry, timer } = self;
let Self {
state,
entry,
timer,
} = self;
f.debug_struct("Sleep")
.field("duration", &self.duration())
.field("state", state)
Expand Down
Loading