Skip to content
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
8 changes: 1 addition & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ exclude = [

[workspace.package]
rust-version = "1.88"
edition = "2021"
edition = "2024"

[workspace.dependencies]
xtask_fuzz = { path = "xtask/xtask_fuzz" }
Expand Down Expand Up @@ -611,12 +611,6 @@ pbjson-build = { git = "https://github.com/jstarks/pbjson", branch = "aliases" }
future_incompatible = { level = "deny", priority = -2 }
rust_2018_idioms = { level = "warn", priority = -2 }

rust-2024-compatibility = { level = "warn", priority = -1 }
edition_2024_expr_fragment_specifier = "allow"
# TODO: Fix all of the below, https://github.com/microsoft/openvmm/issues/288
tail-expr-drop-order = "allow"
if-let-rescope = "allow"

unused_qualifications = "warn"
missing_docs = "warn"

Expand Down
2 changes: 1 addition & 1 deletion Guide/mdbook-openvmm-shim/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

[package]
name = "mdbook-openvmm-shim"
edition = "2021"
edition = "2024"

[package.metadata.xtask.house-rules]
# emits a binary, where kebab-case is more natural
Expand Down
18 changes: 6 additions & 12 deletions flowey/flowey_core/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2393,7 +2393,7 @@ mod node_luts {
pub(super) fn modpath_by_node_typeid() -> &'static HashMap<NodeHandle, &'static str> {
static TYPEID_TO_MODPATH: OnceLock<HashMap<NodeHandle, &'static str>> = OnceLock::new();

let lookup = TYPEID_TO_MODPATH.get_or_init(|| {
TYPEID_TO_MODPATH.get_or_init(|| {
let mut lookup = HashMap::new();
for crate::node::private::FlowNodeMeta {
module_path,
Expand All @@ -2413,9 +2413,7 @@ mod node_luts {
}

lookup
});

lookup
})
}

pub(super) fn erased_node_by_typeid()
Expand All @@ -2424,7 +2422,7 @@ mod node_luts {
HashMap<NodeHandle, fn() -> Box<dyn FlowNodeBase<Request = Box<[u8]>>>>,
> = OnceLock::new();

let lookup = LOOKUP.get_or_init(|| {
LOOKUP.get_or_init(|| {
let mut lookup = HashMap::new();
for crate::node::private::FlowNodeMeta {
module_path: _,
Expand All @@ -2439,9 +2437,7 @@ mod node_luts {
}

lookup
});

lookup
})
}

pub(super) fn erased_node_by_modpath() -> &'static HashMap<
Expand All @@ -2461,7 +2457,7 @@ mod node_luts {
>,
> = OnceLock::new();

let lookup = MODPATH_LOOKUP.get_or_init(|| {
MODPATH_LOOKUP.get_or_init(|| {
let mut lookup = HashMap::new();
for crate::node::private::FlowNodeMeta { module_path, ctor, get_typeid } in crate::node::private::FLOW_NODES {
let existing = lookup.insert(module_path.strip_suffix("::_only_one_call_to_flowey_node_per_module").unwrap(), (NodeHandle(get_typeid()), *ctor));
Expand All @@ -2470,9 +2466,7 @@ mod node_luts {
}
}
lookup
});

lookup
})
}
}

Expand Down
6 changes: 2 additions & 4 deletions flowey/flowey_core/src/patch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,15 @@ where
pub fn patchfn_by_modpath() -> &'static BTreeMap<String, PatchFn> {
static MODPATH_LOOKUP: OnceLock<BTreeMap<String, PatchFn>> = OnceLock::new();

let lookup = MODPATH_LOOKUP.get_or_init(|| {
MODPATH_LOOKUP.get_or_init(|| {
let mut lookup = BTreeMap::new();
for (f, module_path, fn_name) in private::PATCH_FNS {
let existing = lookup.insert(format!("{}::{}", module_path, fn_name), *f);
// Rust would've errored out at module defn time with a duplicate fn name error
assert!(existing.is_none());
}
lookup
});

lookup
})
}

/// [`PatchResolver`]
Expand Down
2 changes: 1 addition & 1 deletion openhcl/ohcldiag-dev/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ fn create_or_stderr(path: &Option<PathBuf>) -> std::io::Result<fs_err::File> {

async fn capture_packets(
client: DiagClient,
streams: Vec<impl std::future::Future<Output = Result<u64, std::io::Error>>>,
streams: Vec<impl Future<Output = Result<u64, std::io::Error>>>,
capture_duration: Duration,
) {
let mut capture_streams = FuturesUnordered::from_iter(streams);
Expand Down
3 changes: 1 addition & 2 deletions openhcl/openhcl_boot/src/arch/x86_64/address_space.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,7 @@ unsafe fn get_pde_for_va(va: u64) -> &'static mut PageTableEntry {
let entry = pdpt.entry(va, 2);
assert!(entry.is_present());
let pd = page_table_at_address(entry.get_addr());
let entry = pd.entry(va, 1);
entry
pd.entry(va, 1)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,7 @@ mod tests {
let payload = result.unwrap();

let header = openhcl_attestation_protocol::igvm_attest::get::IgvmAttestWrappedKeyResponseHeader::new_zeroed();
let response = [header.as_bytes(), payload.as_bytes()].concat();

response
[header.as_bytes(), payload.as_bytes()].concat()
}

#[test]
Expand Down
4 changes: 2 additions & 2 deletions openhcl/underhill_core/src/emuplat/netvsp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@ impl HclNetworkVFManager {
) -> anyhow::Result<Box<dyn netvsp::VirtualFunction>>
where
F: Fn(bool) -> R + Sync + Send + 'static,
R: std::future::Future<Output = bool> + Send,
R: Future<Output = bool> + Send,
{
let (tx_update, rx_update) = mesh::channel();
let guest_state = self
Expand Down Expand Up @@ -1095,7 +1095,7 @@ impl<F> HclNetworkVFManagerInstance<F> {
impl<F, R> netvsp::VirtualFunction for HclNetworkVFManagerInstance<F>
where
F: Fn(bool) -> R + Sync + Send + 'static,
R: std::future::Future<Output = bool> + Send,
R: Future<Output = bool> + Send,
{
async fn id(&self) -> Option<u32> {
self.guest_state.vtl0_vfid().await
Expand Down
4 changes: 2 additions & 2 deletions support/clap_dyn_complete/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ pub trait CustomCompleterFactory: Send + Sync {
type CustomCompleter: CustomCompleter + 'static;

/// Build a new [`CustomCompleter`].
fn build(&self, ctx: &RootCtx<'_>) -> impl std::future::Future<Output = Self::CustomCompleter>;
fn build(&self, ctx: &RootCtx<'_>) -> impl Future<Output = Self::CustomCompleter>;
}

/// A custom completer for a particular argument.
Expand All @@ -297,7 +297,7 @@ pub trait CustomCompleter: Send + Sync {
ctx: &RootCtx<'_>,
subcommand_path: &[&str],
arg_id: &str,
) -> impl Send + std::future::Future<Output = Vec<String>>;
) -> impl Send + Future<Output = Vec<String>>;
}

#[async_trait::async_trait]
Expand Down
5 changes: 2 additions & 3 deletions support/mesh/mesh_channel_core/src/oneshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,14 +368,13 @@ impl OneshotReceiverCore {
// avoid taking the lock here. A naive implementation would require
// extra storage in `OneshotReceiverCore` to remember this, which is
// probably undesirable.
let v = if let SlotState::Sent(value) =
if let SlotState::Sent(value) =
std::mem::replace(&mut *slot.state.lock(), SlotState::Done)
{
Some(value)
} else {
None
};
v
}
}
if let Some(v) = clear(self) {
// SAFETY: the value is of type `T`.
Expand Down
5 changes: 2 additions & 3 deletions support/mesh/mesh_node/src/local_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2168,7 +2168,7 @@ impl LocalNode {
fn get_remote(&self, id: NodeId) -> Arc<RemoteNode> {
assert!(id != self.id());
let mut state = self.inner.state.lock();
let remote_node = match state.nodes.entry(id) {
match state.nodes.entry(id) {
hash_map::Entry::Occupied(entry) => entry.get().clone(),
hash_map::Entry::Vacant(entry) => {
let (remote_node, handle) = RemoteNode::new(self.inner.clone(), id);
Expand All @@ -2180,8 +2180,7 @@ impl LocalNode {
}
remote_node
}
};
remote_node
}
}

/// Gets the local port with ID `port_id`.
Expand Down
13 changes: 8 additions & 5 deletions support/mesh/mesh_process/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,17 @@ async fn node_from_environment() -> anyhow::Result<Option<NodeResult>> {
// Clear the string to avoid leaking the invitation information into child
// processes.
//
// TODO: this function will become unsafe in a future Rust edition because
// TODO: this function is unsafe because
// it can cause UB if non-Rust code is concurrently accessing the
// environment in another thread. To be completely sound (even in the
// current edition), either this function and its callers need to become
// environment in another thread. To be completely sound,
// either this function and its callers need to become
// `unsafe`, or we need to avoid using the environment to propagate the
// invitation so that we can avoid this call.
#[expect(deprecated_safe_2024)]
std::env::remove_var(INVITATION_ENV_NAME);
//
// SAFETY: Seems to work so far.
unsafe {
std::env::remove_var(INVITATION_ENV_NAME);
}

let invitation: Invitation = mesh::payload::decode(
&base64::engine::general_purpose::STANDARD
Expand Down
5 changes: 1 addition & 4 deletions vm/devices/input_core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,7 @@ pub struct KeyboardData {
pub trait InputSource<T>: futures::Stream<Item = T> + Unpin + Send {
/// Sets this input source active, so that the sending side can choose which
/// device to send input to.
fn set_active(
&mut self,
active: bool,
) -> Pin<Box<dyn '_ + std::future::Future<Output = ()> + Send>>;
fn set_active(&mut self, active: bool) -> Pin<Box<dyn '_ + Future<Output = ()> + Send>>;
}

/// A resolved [`InputSource`].
Expand Down
5 changes: 1 addition & 4 deletions vm/devices/input_core/src/mesh_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ pub struct MeshInputSource<T> {
}

impl<T: 'static + Send> InputSource<T> for MeshInputSource<T> {
fn set_active(
&mut self,
active: bool,
) -> Pin<Box<dyn '_ + std::future::Future<Output = ()> + Send>> {
fn set_active(&mut self, active: bool) -> Pin<Box<dyn '_ + Future<Output = ()> + Send>> {
Box::pin(async move {
if *self.active.get() != active {
self.active.set(active).await;
Expand Down
3 changes: 1 addition & 2 deletions vm/devices/net/mana_driver/src/mana.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,7 @@ impl VportState {

/// Get current filter setting if known.
pub fn get_direction_to_vtl0(&self) -> Option<bool> {
let direction_to_vtl0 = *self.direction_to_vtl0.lock();
direction_to_vtl0
*self.direction_to_vtl0.lock()
}
}

Expand Down
5 changes: 2 additions & 3 deletions vm/devices/net/netvsp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1706,7 +1706,7 @@ impl Nic {
.iter()
.map(|worker| {
worker.state().map(|worker| {
let channel = if let Some(ready) = worker.state.ready() {
if let Some(ready) = worker.state.ready() {
// In flight tx will be considered as dropped packets through save/restore, but need
// to complete the requests back to the guest.
let pending_tx_completions = ready
Expand Down Expand Up @@ -1740,8 +1740,7 @@ impl Nic {
pending_tx_completions: Vec::new(),
in_use_rx: Vec::new(),
}
};
channel
}
})
})
.collect();
Expand Down
2 changes: 1 addition & 1 deletion vm/devices/storage/disk_crypt/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ impl DiskIo for CryptDisk {
sector: u64,
count: u64,
block_level_only: bool,
) -> impl std::future::Future<Output = Result<(), DiskError>> + Send {
) -> impl Future<Output = Result<(), DiskError>> + Send {
self.inner.unmap(sector, count, block_level_only)
}

Expand Down
2 changes: 1 addition & 1 deletion vm/devices/storage/disk_delay/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ impl DiskIo for DelayDisk {
sector: u64,
count: u64,
block_level_only: bool,
) -> impl std::future::Future<Output = Result<(), DiskError>> + Send {
) -> impl Future<Output = Result<(), DiskError>> + Send {
self.inner.unmap(sector, count, block_level_only)
}

Expand Down
2 changes: 1 addition & 1 deletion vm/devices/storage/disk_nvme/nvme_driver/src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ impl<T: DeviceBacking> NvmeDriver<T> {
drop(self);
}

fn reset(&mut self) -> impl Send + std::future::Future<Output = ()> + use<T> {
fn reset(&mut self) -> impl Send + Future<Output = ()> + use<T> {
let driver = self.driver.clone();
let mut task = std::mem::take(&mut self.task).unwrap();
async move {
Expand Down
2 changes: 1 addition & 1 deletion vm/devices/storage/disk_striped/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ impl DiskIo for StripedDisk {
async fn await_all_and_check<T, E>(futures: T) -> Result<(), E>
where
T: IntoIterator,
T::Item: core::future::Future<Output = Result<(), E>>,
T::Item: Future<Output = Result<(), E>>,
{
// Use join_all to wait for all IOs even if one fails. This is necessary to
// avoid dropping IOs while they are in flight.
Expand Down
2 changes: 1 addition & 1 deletion vm/devices/storage/storvsp/benches/ioperf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use std::cell::RefCell;
struct WrappedExecutor(RefCell<DefaultPool>);

impl AsyncExecutor for &'_ WrappedExecutor {
fn block_on<T>(&self, future: impl std::future::Future<Output = T>) -> T {
fn block_on<T>(&self, future: impl Future<Output = T>) -> T {
self.0.borrow_mut().run_until(future)
}
}
Expand Down
2 changes: 1 addition & 1 deletion vm/devices/vmbus/vmbus_server/src/hvsock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ impl HvsockRelay {
&self,
ctx: &mut CancelContext,
service_id: Guid,
) -> impl std::future::Future<Output = anyhow::Result<UnixStream>> + Send + use<> {
) -> impl Future<Output = anyhow::Result<UnixStream>> + Send + use<> {
let inner = self.inner.clone();
let host_send = self.host_send.clone();
let (send, recv) = mesh::oneshot();
Expand Down
9 changes: 3 additions & 6 deletions vm/loader/src/uefi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -498,12 +498,9 @@ pub mod x86_64 {
importer,
CONFIG_BLOB_GPA_BASE / HV_PAGE_SIZE,
match isolation.isolation_type {
IsolationType::Snp => {
let table = shared_vis_page_tables
.as_ref()
.expect("should be shared vis page tables");
table
}
IsolationType::Snp => shared_vis_page_tables
.as_ref()
.expect("should be shared vis page tables"),
_ => &[],
},
)?
Expand Down
6 changes: 3 additions & 3 deletions vm/vmcore/src/vm_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ pub trait TargetedDriver: 'static + Send + Sync + Inspect {
true
}
/// Waits for this driver's target VP to be ready for tasks and IO.
fn wait_target_vp_ready(&self) -> impl std::future::Future<Output = ()> + Send {
fn wait_target_vp_ready(&self) -> impl Future<Output = ()> + Send {
std::future::ready(())
}
}
Expand All @@ -89,7 +89,7 @@ trait DynTargetedDriver: 'static + Send + Sync + Inspect {
fn driver(&self) -> &dyn Driver;
fn retarget_vp(&self, target_vp: u32);
fn is_ready(&self) -> bool;
fn wait_ready(&self) -> Pin<Box<dyn '_ + std::future::Future<Output = ()> + Send>>;
fn wait_ready(&self) -> Pin<Box<dyn '_ + Future<Output = ()> + Send>>;
}

impl<T: TargetedDriver> DynTargetedDriver for T {
Expand All @@ -109,7 +109,7 @@ impl<T: TargetedDriver> DynTargetedDriver for T {
self.is_target_vp_ready()
}

fn wait_ready(&self) -> Pin<Box<dyn '_ + std::future::Future<Output = ()> + Send>> {
fn wait_ready(&self) -> Pin<Box<dyn '_ + Future<Output = ()> + Send>> {
Box::pin(self.wait_target_vp_ready())
}
}
Expand Down
Loading
Loading