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
2 changes: 2 additions & 0 deletions flowey/flowey_hvlite/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

//! Flowey pipelines used by the OpenVMM project

#![forbid(unsafe_code)]

fn main() {
flowey_cli::flowey_main::<flowey_hvlite::pipelines::OpenvmmPipelines>(
"flowey_hvlite",
Expand Down
2 changes: 2 additions & 0 deletions hyperv/tools/hypestv/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

//! Interactive CLI for Hyper-V VMs.

#![forbid(unsafe_code)]

mod windows;

#[cfg(windows)]
Expand Down
1 change: 1 addition & 0 deletions openhcl/ohcldiag-dev/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
//! guarantees.

#![expect(missing_docs)]
#![forbid(unsafe_code)]

mod completions;

Expand Down
2 changes: 2 additions & 0 deletions openhcl/openvmm_hcl/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

//! Root binary crate for builds of OpenVMM-HCL.

#![forbid(unsafe_code)]

// Link resources.
#[cfg(target_os = "linux")]
use openvmm_hcl_resources as _;
Expand Down
2 changes: 2 additions & 0 deletions openvmm/openvmm/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

//! Root binary crate for OpenVMM.

#![forbid(unsafe_code)]

// Ensure openvmm_resources gets linked.
extern crate openvmm_resources as _;

Expand Down
2 changes: 2 additions & 0 deletions petri/petri-tool/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

//! Tool for using petri functionality from the command line.

#![forbid(unsafe_code)]

use anyhow::Context as _;
use clap::Parser;
use petri::ArtifactResolver;
Expand Down
2 changes: 0 additions & 2 deletions petri/pipette/src/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

//! The main pipette agent, which is run when the process starts.
#![cfg(any(target_os = "linux", target_os = "windows"))]

use anyhow::Context;
use futures::future::FutureExt;
use futures_concurrency::future::RaceOk;
Expand Down
2 changes: 0 additions & 2 deletions petri/pipette/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

//! Handler for the execute request.

#![cfg(any(target_os = "linux", target_os = "windows"))]

use futures::executor::block_on;
use futures::io::AllowStdIo;
use std::process::Stdio;
Expand Down
20 changes: 12 additions & 8 deletions petri/pipette/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,20 @@
//! This is the petri pipette agent, which runs on the guest and executes
//! commands and other requests from the host.

#![cfg_attr(not(windows), forbid(unsafe_code))]

#[cfg(any(target_os = "linux", windows))]
mod agent;
#[cfg(any(target_os = "linux", windows))]
mod execute;
#[cfg(any(target_os = "linux", windows))]
mod shutdown;
#[cfg(any(target_os = "linux", windows))]
mod trace;
#[cfg(windows)]
mod winsvc;

// This is here to satisfy rust-analyzer on macos. Pipette does not yet support
// macos.
#[cfg(target_os = "macos")]
fn main() -> anyhow::Result<()> {
anyhow::bail!("unsupported on macos")
}

#[cfg(any(target_os = "linux", target_os = "windows"))]
#[cfg(any(target_os = "linux", windows))]
fn main() -> anyhow::Result<()> {
#[cfg(windows)]
if std::env::args().nth(1).as_deref() == Some("--service") {
Expand All @@ -30,3 +29,8 @@ fn main() -> anyhow::Result<()> {
agent.run().await
})
}

#[cfg(not(any(target_os = "linux", windows)))]
fn main() -> anyhow::Result<()> {
anyhow::bail!("unsupported platform");
}
1 change: 0 additions & 1 deletion petri/pipette/src/shutdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

//! Handler for the power off request.

#![cfg(any(target_os = "linux", target_os = "windows"))]
// UNSAFETY: required for Windows shutdown API
#![cfg_attr(windows, expect(unsafe_code))]

Expand Down
2 changes: 0 additions & 2 deletions petri/pipette/src/trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

//! [`tracing`] support.

#![cfg(any(target_os = "linux", target_os = "windows"))]

use std::sync::Arc;
use tracing_subscriber::filter::Targets;
use tracing_subscriber::fmt::format::FmtSpan;
Expand Down
2 changes: 2 additions & 0 deletions support/atomic_ringbuf/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
//! for when they miss an update and the ring buffer wraps around. Writing
//! is synchronized with a lock, but read attempts are never blocked.

#![forbid(unsafe_code)]

cfg_if::cfg_if! {
if #[cfg(all(target_arch = "x86_64", test))] { // xtask-fmt allow-target-arch dependency
use loom::sync::Mutex;
Expand Down
5 changes: 2 additions & 3 deletions support/cache_topology/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
//! Provides ways to describe a machine's cache topology and to query it from
//! the current running machine.

// UNSAFETY: needed to call Win32 functions to query cache topology
#![cfg_attr(windows, expect(unsafe_code))]

use thiserror::Error;

/// A machine's cache topology.
Expand Down Expand Up @@ -63,6 +60,8 @@ impl CacheTopology {
}

#[cfg(windows)]
// UNSAFETY: needed to call Win32 functions to query cache topology
#[expect(unsafe_code)]
mod windows {
use super::CacheTopology;
use crate::Cache;
Expand Down
3 changes: 0 additions & 3 deletions vm/devices/storage/disk_vhd1/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ zerocopy.workspace = true
[dev-dependencies]
tempfile.workspace = true

[target.'cfg(unix)'.dependencies]

[target.'cfg(target_os = "linux")'.dependencies]

[lints]
workspace = true
2 changes: 1 addition & 1 deletion vm/devices/support/fs/lxutil/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2087,7 +2087,7 @@ mod tests {
// the case sensitive directory attribute, which is only enabled if the WSL optional component
// is installed.
#[test]
#[cfg(any(unix, not(feature = "ci")))]
#[cfg(not(all(windows, feature = "ci")))]
fn case_sensitive() {
let env = TestEnv::with_options(LxVolumeOptions::new().create_case_sensitive_dirs(true));

Expand Down
2 changes: 2 additions & 0 deletions vm/loader/igvmfilegen/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

//! Implements a command line utility to generate IGVM files.

#![forbid(unsafe_code)]

mod file_loader;
mod identity_mapping;
mod signed_measurement;
Expand Down
1 change: 1 addition & 0 deletions vm/vmgs/vmgstool/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT License.

#![expect(missing_docs)]
#![forbid(unsafe_code)]

mod storage_backend;
#[cfg(feature = "test_helpers")]
Expand Down
1 change: 1 addition & 0 deletions vmm_tests/vmm_tests/tests/tests/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT License.

#![expect(missing_docs)]
#![forbid(unsafe_code)]

//! A collection of end-to-end VMM tests.
//!
Expand Down
2 changes: 2 additions & 0 deletions vmm_tests/vmm_tests/tests/tmks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

//! Test entrypoint for running TMK tests in different environments.

#![forbid(unsafe_code)]

// Include all the tests.
//
// FUTURE: probably the tmk_tests package should own this crate, rather than
Expand Down
2 changes: 2 additions & 0 deletions xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
//! Follows the xtask workflow/convention, as described at
//! <https://github.com/matklad/cargo-xtask>

#![forbid(unsafe_code)]

use anyhow::Context;
use clap::Parser;
use clap::Subcommand;
Expand Down