From 3ad64a6289a556ea9d3a288180e508eec933b6b7 Mon Sep 17 00:00:00 2001 From: Rain Date: Mon, 15 Dec 2025 22:39:47 +0000 Subject: [PATCH 1/2] add missing pq-sys Created using spr 1.3.6-beta.1 --- Cargo.lock | 11 +++++++--- common/src/api/external/mod.rs | 11 ++++++---- .../api/internal/shared/external_ip/mod.rs | 2 +- .../src/api/internal/shared/external_ip/v1.rs | 2 +- illumos-utils/src/vmm_reservoir.rs | 2 +- installinator/src/write.rs | 2 +- nexus/db-queries/src/db/datastore/probe.rs | 20 ------------------- .../src/db/datastore/switch_port.rs | 10 ++-------- nexus/db-queries/src/db/datastore/vpc.rs | 2 +- nexus/mgs-updates/src/common_sp_update.rs | 1 - nexus/networking/Cargo.toml | 5 +++++ nexus/networking/build.rs | 10 ++++++++++ nexus/reconfigurator/preparation/Cargo.toml | 5 +++++ nexus/reconfigurator/preparation/build.rs | 10 ++++++++++ nexus/src/app/disk.rs | 8 ++++++-- nexus/src/app/instance.rs | 5 ++++- nexus/src/app/sagas/disk_create.rs | 5 ++--- nexus/src/app/sagas/instance_create.rs | 18 +---------------- .../src/app/sagas/region_replacement_start.rs | 4 ++-- nexus/test-utils/Cargo.toml | 5 +++++ nexus/test-utils/build.rs | 10 ++++++++++ nexus/test-utils/src/starter.rs | 2 +- nexus/tests/integration_tests/instances.rs | 4 ++-- .../integration_tests/multicast/instances.rs | 2 +- nexus/types/src/external_api/params.rs | 8 ++------ nexus/types/src/external_api/shared.rs | 8 ++------ nexus/types/src/inventory.rs | 2 +- ntp-admin/src/http_entrypoints.rs | 1 - oximeter/db/src/oxql/ast/literal.rs | 2 +- oximeter/instruments/src/http.rs | 3 +-- oximeter/instruments/src/kstat/sampler.rs | 2 +- rust-toolchain.toml | 5 +++-- .../src/debug_collector/helpers.rs | 1 - .../config-reconciler/src/host_phase_2.rs | 3 +-- sled-agent/src/rack_setup/service.rs | 7 ------- sled-agent/src/sim/disk.rs | 2 +- sled-agent/src/sim/storage.rs | 4 ++-- update-common/src/errors.rs | 1 - wicket/src/ui/widgets/rack.rs | 4 ++-- workspace-hack/Cargo.toml | 4 ++-- 40 files changed, 105 insertions(+), 108 deletions(-) create mode 100644 nexus/networking/build.rs create mode 100644 nexus/reconfigurator/preparation/build.rs create mode 100644 nexus/test-utils/build.rs diff --git a/Cargo.lock b/Cargo.lock index 004917e5a80..075640b50dc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7087,9 +7087,11 @@ dependencies = [ "nexus-db-lookup", "nexus-db-queries", "omicron-common", + "omicron-rpaths", "omicron-uuid-kinds", "omicron-workspace-hack", "oxnet", + "pq-sys", "reqwest", "sled-agent-client", "slog", @@ -7267,8 +7269,10 @@ dependencies = [ "nexus-db-queries", "nexus-types", "omicron-common", + "omicron-rpaths", "omicron-uuid-kinds", "omicron-workspace-hack", + "pq-sys", "slog", "slog-error-chain", ] @@ -7408,6 +7412,7 @@ dependencies = [ "omicron-cockroach-admin", "omicron-common", "omicron-passwords", + "omicron-rpaths", "omicron-sled-agent", "omicron-test-utils", "omicron-uuid-kinds", @@ -7416,6 +7421,7 @@ dependencies = [ "oximeter-collector", "oximeter-producer", "oxnet", + "pq-sys", "pretty_assertions", "serde", "serde_json", @@ -7677,11 +7683,10 @@ dependencies = [ [[package]] name = "num-bigint-dig" -version = "0.8.4" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc84195820f291c7697304f3cbdadd1cb7199c0efc917ff5eafd71225c136151" +checksum = "e661dda6640fad38e827a6d4a310ff4763082116fe217f279885c97f511bb0b7" dependencies = [ - "byteorder", "lazy_static", "libm", "num-integer", diff --git a/common/src/api/external/mod.rs b/common/src/api/external/mod.rs index 85c54095344..90e13c47c2e 100644 --- a/common/src/api/external/mod.rs +++ b/common/src/api/external/mod.rs @@ -578,13 +578,16 @@ impl ByteCount { impl Display for ByteCount { fn fmt(&self, f: &mut Formatter<'_>) -> FormatResult { - if self.to_bytes() >= TiB && self.to_bytes() % TiB == 0 { + if self.to_bytes() >= TiB && self.to_bytes().is_multiple_of(TiB) { write!(f, "{} TiB", self.to_whole_tebibytes()) - } else if self.to_bytes() >= GiB && self.to_bytes() % GiB == 0 { + } else if self.to_bytes() >= GiB && self.to_bytes().is_multiple_of(GiB) + { write!(f, "{} GiB", self.to_whole_gibibytes()) - } else if self.to_bytes() >= MiB && self.to_bytes() % MiB == 0 { + } else if self.to_bytes() >= MiB && self.to_bytes().is_multiple_of(MiB) + { write!(f, "{} MiB", self.to_whole_mebibytes()) - } else if self.to_bytes() >= KiB && self.to_bytes() % KiB == 0 { + } else if self.to_bytes() >= KiB && self.to_bytes().is_multiple_of(KiB) + { write!(f, "{} KiB", self.to_whole_kibibytes()) } else { write!(f, "{} B", self.to_bytes()) diff --git a/common/src/api/internal/shared/external_ip/mod.rs b/common/src/api/internal/shared/external_ip/mod.rs index 99b872bec4c..44f2312c4da 100644 --- a/common/src/api/internal/shared/external_ip/mod.rs +++ b/common/src/api/internal/shared/external_ip/mod.rs @@ -195,7 +195,7 @@ impl SourceNatConfig { first_port: u16, last_port: u16, ) -> Result { - if first_port % NUM_SOURCE_NAT_PORTS == 0 + if first_port.is_multiple_of(NUM_SOURCE_NAT_PORTS) && last_port .checked_sub(first_port) .and_then(|diff| diff.checked_add(1)) diff --git a/common/src/api/internal/shared/external_ip/v1.rs b/common/src/api/internal/shared/external_ip/v1.rs index b87f24be282..7a3300e7810 100644 --- a/common/src/api/internal/shared/external_ip/v1.rs +++ b/common/src/api/internal/shared/external_ip/v1.rs @@ -77,7 +77,7 @@ impl SourceNatConfig { first_port: u16, last_port: u16, ) -> Result { - if first_port % NUM_SOURCE_NAT_PORTS == 0 + if first_port.is_multiple_of(NUM_SOURCE_NAT_PORTS) && last_port .checked_sub(first_port) .and_then(|diff| diff.checked_add(1)) diff --git a/illumos-utils/src/vmm_reservoir.rs b/illumos-utils/src/vmm_reservoir.rs index 2ff2925fcc4..ce5acbc86b2 100644 --- a/illumos-utils/src/vmm_reservoir.rs +++ b/illumos-utils/src/vmm_reservoir.rs @@ -62,5 +62,5 @@ pub fn align_reservoir_size(size_bytes: u64) -> u64 { } pub fn reservoir_size_is_aligned(size_bytes: u64) -> bool { - (size_bytes % RESERVOIR_SZ_ALIGN) == 0 + size_bytes.is_multiple_of(RESERVOIR_SZ_ALIGN) } diff --git a/installinator/src/write.rs b/installinator/src/write.rs index 40a4993fb8e..d3266d91743 100644 --- a/installinator/src/write.rs +++ b/installinator/src/write.rs @@ -1167,7 +1167,7 @@ impl WriteTransport for BlockDeviceTransport { // When writing to a block device, we must write a multiple of the block // size. We can assume the image we're given should be // appropriately-sized: return an error here if it is not. - if total_bytes % block_size != 0 { + if !total_bytes.is_multiple_of(block_size) { return Err(WriteError::WriteError { component, slot, diff --git a/nexus/db-queries/src/db/datastore/probe.rs b/nexus/db-queries/src/db/datastore/probe.rs index 725c34a108b..61157a13f99 100644 --- a/nexus/db-queries/src/db/datastore/probe.rs +++ b/nexus/db-queries/src/db/datastore/probe.rs @@ -39,29 +39,9 @@ use omicron_uuid_kinds::GenericUuid as _; use omicron_uuid_kinds::ProbeUuid; use omicron_uuid_kinds::SledUuid; use ref_cast::RefCast; -use schemars::JsonSchema; -use serde::{Deserialize, Serialize}; use sled_agent_client::types::ProbeCreate; use uuid::Uuid; -#[derive(Debug, Clone, JsonSchema, Serialize, Deserialize)] -#[serde(rename_all = "snake_case")] -pub enum IpKind { - Snat, - Floating, - Ephemeral, -} - -impl From for IpKind { - fn from(value: nexus_db_model::IpKind) -> Self { - match value { - nexus_db_model::IpKind::SNat => Self::Snat, - nexus_db_model::IpKind::Ephemeral => Self::Ephemeral, - nexus_db_model::IpKind::Floating => Self::Floating, - } - } -} - impl super::DataStore { /// List the probes for the given project. pub async fn probe_list( diff --git a/nexus/db-queries/src/db/datastore/switch_port.rs b/nexus/db-queries/src/db/datastore/switch_port.rs index c4093806eda..f1080f87497 100644 --- a/nexus/db-queries/src/db/datastore/switch_port.rs +++ b/nexus/db-queries/src/db/datastore/switch_port.rs @@ -15,8 +15,8 @@ use crate::db::model::{ LldpLinkConfig, Name, SwitchInterfaceConfig, SwitchLinkFec, SwitchLinkSpeed, SwitchPort, SwitchPortAddressConfig, SwitchPortBgpPeerConfig, SwitchPortConfig, SwitchPortLinkConfig, - SwitchPortRouteConfig, SwitchPortSettings, SwitchPortSettingsGroup, - SwitchPortSettingsGroups, SwitchVlanInterfaceConfig, TxEqConfig, + SwitchPortRouteConfig, SwitchPortSettings, SwitchPortSettingsGroups, + SwitchVlanInterfaceConfig, TxEqConfig, }; use crate::db::pagination::paginated; use async_bb8_diesel::{AsyncRunQueryDsl, Connection}; @@ -149,12 +149,6 @@ impl Into for SwitchPortSettingsCombinedResult { } } -#[derive(Clone, Debug, Deserialize, Serialize)] -pub struct SwitchPortSettingsGroupCreateResult { - pub group: SwitchPortSettingsGroup, - pub settings: SwitchPortSettingsCombinedResult, -} - #[derive(Clone, Debug, Deserialize, Serialize)] pub struct LinkConfigCombinedResult { pub port_settings_id: Uuid, diff --git a/nexus/db-queries/src/db/datastore/vpc.rs b/nexus/db-queries/src/db/datastore/vpc.rs index 750e10d38a2..fe2fb4a5280 100644 --- a/nexus/db-queries/src/db/datastore/vpc.rs +++ b/nexus/db-queries/src/db/datastore/vpc.rs @@ -438,7 +438,7 @@ impl DataStore { } Err(e) => return Err(e), Ok(None) => { - crate::probes::vni__search__range__empty!(|| (&id)); + crate::probes::vni__search__range__empty!(|| &id); debug!( opctx.log, "No VNIs available within current search range, retrying"; diff --git a/nexus/mgs-updates/src/common_sp_update.rs b/nexus/mgs-updates/src/common_sp_update.rs index 739c686f443..c7d9552ba0d 100644 --- a/nexus/mgs-updates/src/common_sp_update.rs +++ b/nexus/mgs-updates/src/common_sp_update.rs @@ -19,7 +19,6 @@ use nexus_types::deployment::PendingMgsUpdate; use nexus_types::deployment::PendingMgsUpdateDetails; use nexus_types::inventory::SpType; use omicron_common::disk::M2Slot; -use slog::error; use std::net::SocketAddrV6; use std::time::Duration; use thiserror::Error; diff --git a/nexus/networking/Cargo.toml b/nexus/networking/Cargo.toml index b972a8a202d..23315339eb4 100644 --- a/nexus/networking/Cargo.toml +++ b/nexus/networking/Cargo.toml @@ -7,6 +7,9 @@ license = "MPL-2.0" [lints] workspace = true +[build-dependencies] +omicron-rpaths.workspace = true + [dependencies] futures.workspace = true ipnetwork.workspace = true @@ -20,3 +23,5 @@ slog.workspace = true uuid.workspace = true omicron-workspace-hack.workspace = true omicron-uuid-kinds.workspace = true +# See omicron-rpaths for more about the "pq-sys" dependency. +pq-sys = "*" diff --git a/nexus/networking/build.rs b/nexus/networking/build.rs new file mode 100644 index 00000000000..1ba9acd41c9 --- /dev/null +++ b/nexus/networking/build.rs @@ -0,0 +1,10 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. + +// See omicron-rpaths for documentation. +// NOTE: This file MUST be kept in sync with the other build.rs files in this +// repository. +fn main() { + omicron_rpaths::configure_default_omicron_rpaths(); +} diff --git a/nexus/reconfigurator/preparation/Cargo.toml b/nexus/reconfigurator/preparation/Cargo.toml index aabbd645023..d6cec285dea 100644 --- a/nexus/reconfigurator/preparation/Cargo.toml +++ b/nexus/reconfigurator/preparation/Cargo.toml @@ -6,6 +6,9 @@ edition.workspace = true [lints] workspace = true +[build-dependencies] +omicron-rpaths.workspace = true + [dependencies] anyhow.workspace = true futures.workspace = true @@ -14,6 +17,8 @@ nexus-db-queries.workspace = true nexus-types.workspace = true omicron-common.workspace = true omicron-uuid-kinds.workspace = true +# See omicron-rpaths for more about the "pq-sys" dependency. +pq-sys = "*" slog.workspace = true slog-error-chain.workspace = true diff --git a/nexus/reconfigurator/preparation/build.rs b/nexus/reconfigurator/preparation/build.rs new file mode 100644 index 00000000000..1ba9acd41c9 --- /dev/null +++ b/nexus/reconfigurator/preparation/build.rs @@ -0,0 +1,10 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. + +// See omicron-rpaths for documentation. +// NOTE: This file MUST be kept in sync with the other build.rs files in this +// repository. +fn main() { + omicron_rpaths::configure_default_omicron_rpaths(); +} diff --git a/nexus/src/app/disk.rs b/nexus/src/app/disk.rs index a3dcf53ebe9..0b0038b5957 100644 --- a/nexus/src/app/disk.rs +++ b/nexus/src/app/disk.rs @@ -175,7 +175,7 @@ impl super::Nexus { // Reject disks where the block size doesn't evenly divide the // total size - if (params.size.to_bytes() % block_size) != 0 { + if !params.size.to_bytes().is_multiple_of(block_size) { return Err(Error::invalid_value( "size and block_size", format!( @@ -199,7 +199,11 @@ impl super::Nexus { // Reject disks where the MIN_DISK_SIZE_BYTES doesn't evenly // divide the size - if (params.size.to_bytes() % u64::from(MIN_DISK_SIZE_BYTES)) != 0 { + if !params + .size + .to_bytes() + .is_multiple_of(u64::from(MIN_DISK_SIZE_BYTES)) + { return Err(Error::invalid_value( "size", format!( diff --git a/nexus/src/app/instance.rs b/nexus/src/app/instance.rs index b5449953304..4606304335e 100644 --- a/nexus/src/app/instance.rs +++ b/nexus/src/app/instance.rs @@ -2559,7 +2559,10 @@ fn check_instance_cpu_memory_sizes( // Reject instances where the memory is not divisible by // MIN_MEMORY_BYTES_PER_INSTANCE - if (memory.to_bytes() % u64::from(MIN_MEMORY_BYTES_PER_INSTANCE)) != 0 { + if !memory + .to_bytes() + .is_multiple_of(u64::from(MIN_MEMORY_BYTES_PER_INSTANCE)) + { return Err(Error::invalid_value( "size", format!( diff --git a/nexus/src/app/sagas/disk_create.rs b/nexus/src/app/sagas/disk_create.rs index c0917875c11..c971b60ffe1 100644 --- a/nexus/src/app/sagas/disk_create.rs +++ b/nexus/src/app/sagas/disk_create.rs @@ -603,15 +603,14 @@ async fn sdc_regions_ensure( // Each ID should be unique to this disk if let Some(read_only_parent) = &mut read_only_parent { - *read_only_parent = Box::new( + **read_only_parent = randomize_volume_construction_request_ids(&read_only_parent) .map_err(|e| { ActionError::action_failed(Error::internal_error(&format!( "failed to randomize ids: {}", e, ))) - })?, - ); + })?; } // Create volume construction request for this disk diff --git a/nexus/src/app/sagas/instance_create.rs b/nexus/src/app/sagas/instance_create.rs index 9acfb435e36..dd6f94e3600 100644 --- a/nexus/src/app/sagas/instance_create.rs +++ b/nexus/src/app/sagas/instance_create.rs @@ -25,8 +25,7 @@ use omicron_common::api::external::NameOrId; use omicron_common::api::external::{Error, InternalContext}; use omicron_common::api::internal::shared::SwitchLocation; use omicron_uuid_kinds::{ - AffinityGroupUuid, AntiAffinityGroupUuid, GenericUuid, InstanceUuid, - MulticastGroupUuid, + AntiAffinityGroupUuid, GenericUuid, InstanceUuid, MulticastGroupUuid, }; use ref_cast::RefCast; use serde::Deserialize; @@ -61,13 +60,6 @@ struct NetParams { new_id: Uuid, } -#[derive(Debug, Deserialize, Serialize)] -struct AffinityParams { - serialized_authn: authn::saga::Serialized, - instance_id: InstanceUuid, - group: AffinityGroupUuid, -} - #[derive(Debug, Deserialize, Serialize)] struct AntiAffinityParams { serialized_authn: authn::saga::Serialized, @@ -75,14 +67,6 @@ struct AntiAffinityParams { group: AntiAffinityGroupUuid, } -#[derive(Debug, Deserialize, Serialize)] -struct NetworkConfigParams { - saga_params: Params, - instance_id: InstanceUuid, - which: usize, - switch_location: SwitchLocation, -} - #[derive(Debug, Deserialize, Serialize)] struct DiskAttachParams { serialized_authn: authn::saga::Serialized, diff --git a/nexus/src/app/sagas/region_replacement_start.rs b/nexus/src/app/sagas/region_replacement_start.rs index e9038addc5e..2098e9b8655 100644 --- a/nexus/src/app/sagas/region_replacement_start.rs +++ b/nexus/src/app/sagas/region_replacement_start.rs @@ -898,7 +898,7 @@ pub(crate) mod test { async fn test_find_only_new_region(cptestctx: &ControlPlaneTestContext) { let log = &cptestctx.logctx.log; - let datasets = vec![ + let datasets = [ CrucibleDataset::new( DatasetUuid::new_v4(), ZpoolUuid::new_v4(), @@ -921,7 +921,7 @@ pub(crate) mod test { ), ]; - let regions = vec![ + let regions = [ Region::new( datasets[0].id(), VolumeUuid::new_v4(), diff --git a/nexus/test-utils/Cargo.toml b/nexus/test-utils/Cargo.toml index fc47798a24f..c0444b36b27 100644 --- a/nexus/test-utils/Cargo.toml +++ b/nexus/test-utils/Cargo.toml @@ -7,6 +7,9 @@ license = "MPL-2.0" [lints] workspace = true +[build-dependencies] +omicron-rpaths.workspace = true + [dependencies] anyhow.workspace = true bytes.workspace = true @@ -47,6 +50,8 @@ oximeter.workspace = true oximeter-collector.workspace = true oximeter-producer.workspace = true oxnet.workspace = true +# See omicron-rpaths for more about the "pq-sys" dependency. +pq-sys = "*" pretty_assertions.workspace = true serde.workspace = true serde_json.workspace = true diff --git a/nexus/test-utils/build.rs b/nexus/test-utils/build.rs new file mode 100644 index 00000000000..1ba9acd41c9 --- /dev/null +++ b/nexus/test-utils/build.rs @@ -0,0 +1,10 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. + +// See omicron-rpaths for documentation. +// NOTE: This file MUST be kept in sync with the other build.rs files in this +// repository. +fn main() { + omicron_rpaths::configure_default_omicron_rpaths(); +} diff --git a/nexus/test-utils/src/starter.rs b/nexus/test-utils/src/starter.rs index 412959d3d63..d045fe79671 100644 --- a/nexus/test-utils/src/starter.rs +++ b/nexus/test-utils/src/starter.rs @@ -1978,7 +1978,7 @@ impl oximeter::Producer for IntegrationProducer { fn produce( &mut self, ) -> Result< - Box<(dyn Iterator + 'static)>, + Box + 'static>, oximeter::MetricsError, > { use oximeter::Metric; diff --git a/nexus/tests/integration_tests/instances.rs b/nexus/tests/integration_tests/instances.rs index d7e626c7bb0..ea907b8e142 100644 --- a/nexus/tests/integration_tests/instances.rs +++ b/nexus/tests/integration_tests/instances.rs @@ -3095,7 +3095,7 @@ async fn test_instance_create_delete_network_interface( ); // Parameters for the interfaces to create/attach - let if_params = vec![ + let if_params = [ params::InstanceNetworkInterfaceCreate { identity: IdentityMetadataCreateParams { name: "if0".parse().unwrap(), @@ -3340,7 +3340,7 @@ async fn test_instance_update_network_interfaces( ); // Parameters for each interface to try to modify. - let if_params = vec![ + let if_params = [ params::InstanceNetworkInterfaceCreate { identity: IdentityMetadataCreateParams { name: "if0".parse().unwrap(), diff --git a/nexus/tests/integration_tests/multicast/instances.rs b/nexus/tests/integration_tests/multicast/instances.rs index 335a269e049..d2c53236eb6 100644 --- a/nexus/tests/integration_tests/multicast/instances.rs +++ b/nexus/tests/integration_tests/multicast/instances.rs @@ -90,7 +90,7 @@ async fn test_multicast_lifecycle(cptestctx: &ControlPlaneTestContext) { wait_for_groups_active(client, &group_names).await; // Create multiple instances in parallel - test various attachment scenarios - let instances = vec![ + let instances = [ // Instance with group attached at creation instance_for_multicast_groups( cptestctx, diff --git a/nexus/types/src/external_api/params.rs b/nexus/types/src/external_api/params.rs index 9be5cbba1bb..6ec29550d2f 100644 --- a/nexus/types/src/external_api/params.rs +++ b/nexus/types/src/external_api/params.rs @@ -1147,6 +1147,7 @@ pub struct FloatingIpAttach { // in the path of endpoints handling instance operations. #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] #[serde(tag = "type", content = "params", rename_all = "snake_case")] +#[derive(Default)] pub enum InstanceNetworkInterfaceAttachment { /// Create one or more `InstanceNetworkInterface`s for the `Instance`. /// @@ -1157,18 +1158,13 @@ pub enum InstanceNetworkInterfaceAttachment { /// The default networking configuration for an instance is to create a /// single primary interface with an automatically-assigned IP address. The /// IP will be pulled from the Project's default VPC / VPC Subnet. + #[default] Default, /// No network interfaces at all will be created for the instance. None, } -impl Default for InstanceNetworkInterfaceAttachment { - fn default() -> Self { - Self::Default - } -} - /// Describe the instance's disks at creation time #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema)] #[serde(tag = "type", rename_all = "snake_case")] diff --git a/nexus/types/src/external_api/shared.rs b/nexus/types/src/external_api/shared.rs index ccc74425550..6af5b2dc6e8 100644 --- a/nexus/types/src/external_api/shared.rs +++ b/nexus/types/src/external_api/shared.rs @@ -753,17 +753,13 @@ impl RelayState { /// Type of IP pool. #[derive(Clone, Debug, Deserialize, Serialize, JsonSchema, PartialEq)] #[serde(rename_all = "snake_case")] +#[derive(Default)] pub enum IpPoolType { /// Unicast IP pool for standard IP allocations. + #[default] Unicast, /// Multicast IP pool for multicast group allocations. /// /// All ranges in a multicast pool must be either ASM or SSM (not mixed). Multicast, } - -impl Default for IpPoolType { - fn default() -> Self { - Self::Unicast - } -} diff --git a/nexus/types/src/inventory.rs b/nexus/types/src/inventory.rs index b95527e2d06..34614d545e9 100644 --- a/nexus/types/src/inventory.rs +++ b/nexus/types/src/inventory.rs @@ -279,7 +279,7 @@ impl Collection { self.clickhouse_keeper_cluster_membership .iter() .max_by_key(|membership| membership.leader_committed_log_index) - .map(|membership| (membership.clone())) + .map(|membership| membership.clone()) } /// Return a type which can be used to display a collection in a diff --git a/ntp-admin/src/http_entrypoints.rs b/ntp-admin/src/http_entrypoints.rs index 2add00f3161..cbaf4a9388c 100644 --- a/ntp-admin/src/http_entrypoints.rs +++ b/ntp-admin/src/http_entrypoints.rs @@ -8,7 +8,6 @@ use dropshot::HttpResponseOk; use dropshot::RequestContext; use ntp_admin_api::*; use ntp_admin_types::TimeSync; -use slog::error; use slog::info; use slog_error_chain::InlineErrorChain; use std::net::IpAddr; diff --git a/oximeter/db/src/oxql/ast/literal.rs b/oximeter/db/src/oxql/ast/literal.rs index 83f541aeb4b..be3873bd216 100644 --- a/oximeter/db/src/oxql/ast/literal.rs +++ b/oximeter/db/src/oxql/ast/literal.rs @@ -278,7 +278,7 @@ fn duration_to_db_interval(dur: &Duration) -> (u64, &'static str) { fn as_whole_multiple(dur: &Duration, base: &Duration) -> Option { let d = dur.as_nanos(); let base = base.as_nanos(); - if d % base == 0 { + if d.is_multiple_of(base) { Some(u64::try_from(d / base).unwrap()) } else { None diff --git a/oximeter/instruments/src/http.rs b/oximeter/instruments/src/http.rs index 2f63e38b4b9..11026da0017 100644 --- a/oximeter/instruments/src/http.rs +++ b/oximeter/instruments/src/http.rs @@ -196,8 +196,7 @@ impl LatencyTracker { impl Producer for LatencyTracker { fn produce( &mut self, - ) -> Result + 'static)>, MetricsError> - { + ) -> Result + 'static>, MetricsError> { // Clippy isn't correct here. It recommends using the iterator // over the latencies directly, but there is a lifetime mismatch // in that case: '_ would have to be 'static. The point is that diff --git a/oximeter/instruments/src/kstat/sampler.rs b/oximeter/instruments/src/kstat/sampler.rs index bce4dd7a514..e57f9c9290b 100644 --- a/oximeter/instruments/src/kstat/sampler.rs +++ b/oximeter/instruments/src/kstat/sampler.rs @@ -1377,7 +1377,7 @@ impl KstatSampler { impl oximeter::Producer for KstatSampler { fn produce( &mut self, - ) -> Result)>, MetricsError> { + ) -> Result>, MetricsError> { // Swap the _entries_ of all the existing per-target sample queues, but // we need to leave empty queues in their place. I.e., we can't remove // keys. diff --git a/rust-toolchain.toml b/rust-toolchain.toml index d38e2a878c3..bc859251325 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,6 +1,7 @@ [toolchain] # We choose a specific toolchain (rather than "stable") for repeatability. The # intent is to keep this up-to-date with recently-released stable Rust. - -channel = "1.89.0" +# +# Rust 1.92.0 runs into https://github.com/rust-lang/rust/issues/147648. +channel = "1.91.1" profile = "default" diff --git a/sled-agent/config-reconciler/src/debug_collector/helpers.rs b/sled-agent/config-reconciler/src/debug_collector/helpers.rs index 5624cc61d77..22a4ec768ca 100644 --- a/sled-agent/config-reconciler/src/debug_collector/helpers.rs +++ b/sled-agent/config-reconciler/src/debug_collector/helpers.rs @@ -13,7 +13,6 @@ use illumos_utils::dumpadm::{DumpAdm, DumpContentType}; use illumos_utils::zone::ZONE_PREFIX; use illumos_utils::zpool::ZpoolName; use sled_storage::config::MountConfig; -use slog::error; use std::ffi::OsString; use zone::{Zone, ZoneError}; diff --git a/sled-agent/config-reconciler/src/host_phase_2.rs b/sled-agent/config-reconciler/src/host_phase_2.rs index b2bd07e5488..2c2ed448b67 100644 --- a/sled-agent/config-reconciler/src/host_phase_2.rs +++ b/sled-agent/config-reconciler/src/host_phase_2.rs @@ -19,7 +19,6 @@ use sled_agent_types::inventory::HostPhase2DesiredSlots; use sled_agent_types::zone_images::ResolverStatus; use sled_hardware::PooledDiskError; use slog::Logger; -use slog::error; use slog::info; use slog::o; use slog::warn; @@ -488,7 +487,7 @@ mod boot_partition_details { // `MediaInfoExtended`; we'll allocate a buffer of this size when we // read, so if we get back something wild as the logical block size, // we'll assume that's wrong and cap it at 128 MiB. - if block_size < ONE_MIB && ONE_MIB % block_size == 0 { + if block_size < ONE_MIB && ONE_MIB.is_multiple_of(block_size) { block_size = ONE_MIB; } else if block_size > 128 * ONE_MIB { block_size = 128 * ONE_MIB; diff --git a/sled-agent/src/rack_setup/service.rs b/sled-agent/src/rack_setup/service.rs index efc282eeb4a..aa2b92d9161 100644 --- a/sled-agent/src/rack_setup/service.rs +++ b/sled-agent/src/rack_setup/service.rs @@ -119,7 +119,6 @@ use sled_agent_types::rack_init::{ }; use sled_agent_types::rack_ops::RssStep; use sled_agent_types::sled::BaseboardId; -use sled_agent_types::sled::StartSledAgentRequest; use sled_hardware_types::underlay::BootstrapInterface; use slog::Logger; use slog_error_chain::{InlineErrorChain, SlogInlineError}; @@ -252,12 +251,6 @@ pub enum SetupServiceError { TrustQuorumProxyCommitPending(BaseboardId), } -// The workload / information allocated to a single sled. -#[derive(Clone, Debug, Deserialize, Serialize, PartialEq)] -struct SledAllocation { - initialization_request: StartSledAgentRequest, -} - /// The interface to the Rack Setup Service. pub struct RackSetupService { handle: tokio::task::JoinHandle>, diff --git a/sled-agent/src/sim/disk.rs b/sled-agent/src/sim/disk.rs index 027c971780a..7aa8a701c2d 100644 --- a/sled-agent/src/sim/disk.rs +++ b/sled-agent/src/sim/disk.rs @@ -115,7 +115,7 @@ mod producers { fn produce( &mut self, ) -> Result< - Box<(dyn Iterator + 'static)>, + Box + 'static>, oximeter::MetricsError, > { let samples = vec![ diff --git a/sled-agent/src/sim/storage.rs b/sled-agent/src/sim/storage.rs index 92652801f06..4e9e93df6cc 100644 --- a/sled-agent/src/sim/storage.rs +++ b/sled-agent/src/sim/storage.rs @@ -2230,14 +2230,14 @@ impl Pantry { } }; - if (offset % region_block_size) != 0 { + if !offset.is_multiple_of(region_block_size) { return Err(HttpError::for_bad_request( None, "offset not multiple of block size!".to_string(), )); } - if (data.len() as u64 % region_block_size) != 0 { + if !(data.len() as u64).is_multiple_of(region_block_size) { return Err(HttpError::for_bad_request( None, "data length not multiple of block size!".to_string(), diff --git a/update-common/src/errors.rs b/update-common/src/errors.rs index c638b05d724..6be8d34bf05 100644 --- a/update-common/src/errors.rs +++ b/update-common/src/errors.rs @@ -8,7 +8,6 @@ use camino::Utf8PathBuf; use display_error_chain::DisplayErrorChain; use dropshot::HttpError; use omicron_common::update::ArtifactId; -use slog::error; use thiserror::Error; use tufaceous_artifact::{ ArtifactHashId, ArtifactKind, ArtifactVersion, KnownArtifactKind, diff --git a/wicket/src/ui/widgets/rack.rs b/wicket/src/ui/widgets/rack.rs index 0c25c3aca7c..85e10aa088b 100644 --- a/wicket/src/ui/widgets/rack.rs +++ b/wicket/src/ui/widgets/rack.rs @@ -71,7 +71,7 @@ impl Rack<'_> { self.state.knight_rider_mode { let width = inner.width as usize; - let go_right = (count / width) % 2 == 0; + let go_right = (count / width).is_multiple_of(2); let offset = if go_right { count % width } else { @@ -415,5 +415,5 @@ type ComponentRectsMap = BTreeMap; /// Ensure that a u16 is an even number by adding 1 if necessary. pub fn make_even(val: u16) -> u16 { - if val % 2 == 0 { val } else { val + 1 } + if val.is_multiple_of(2) { val } else { val + 1 } } diff --git a/workspace-hack/Cargo.toml b/workspace-hack/Cargo.toml index 43c01d3b65e..81fd0fd9cde 100644 --- a/workspace-hack/Cargo.toml +++ b/workspace-hack/Cargo.toml @@ -84,7 +84,7 @@ managed = { version = "0.8.0", default-features = false, features = ["alloc", "m memchr = { version = "2.7.4" } newtype-uuid = { version = "1.3.2", features = ["proptest1"] } nix = { version = "0.29.0", features = ["feature", "net", "uio"] } -num-bigint-dig = { version = "0.8.4", default-features = false, features = ["i128", "prime", "serde", "u64_digit", "zeroize"] } +num-bigint-dig = { version = "0.8.6", default-features = false, features = ["i128", "prime", "serde", "u64_digit", "zeroize"] } num-integer = { version = "0.1.46", features = ["i128"] } num-iter = { version = "0.1.45", default-features = false, features = ["i128"] } num-traits = { version = "0.2.19", features = ["i128", "libm"] } @@ -223,7 +223,7 @@ managed = { version = "0.8.0", default-features = false, features = ["alloc", "m memchr = { version = "2.7.4" } newtype-uuid = { version = "1.3.2", features = ["proptest1"] } nix = { version = "0.29.0", features = ["feature", "net", "uio"] } -num-bigint-dig = { version = "0.8.4", default-features = false, features = ["i128", "prime", "serde", "u64_digit", "zeroize"] } +num-bigint-dig = { version = "0.8.6", default-features = false, features = ["i128", "prime", "serde", "u64_digit", "zeroize"] } num-integer = { version = "0.1.46", features = ["i128"] } num-iter = { version = "0.1.45", default-features = false, features = ["i128"] } num-traits = { version = "0.2.19", features = ["i128", "libm"] } From e4aae9e36e1bb5b4d10699349b5faa578658e448 Mon Sep 17 00:00:00 2001 From: Rain Date: Mon, 15 Dec 2025 22:56:50 +0000 Subject: [PATCH 2/2] fix rustdoc Created using spr 1.3.6-beta.1 --- nexus/types/src/identity.rs | 4 ++-- sled-agent/src/bootstrap/secret_retriever.rs | 6 +++--- sled-storage/zfs-test-harness/src/lib.rs | 2 +- wicket/src/ui/splash.rs | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/nexus/types/src/identity.rs b/nexus/types/src/identity.rs index 6f214d6f9a3..d505c549e9a 100644 --- a/nexus/types/src/identity.rs +++ b/nexus/types/src/identity.rs @@ -22,7 +22,7 @@ use uuid::Uuid; /// For durable objects which do not require soft-deletion or descriptions, /// consider the [`Asset`] trait instead. /// -/// May be derived from [`macro@db-macros::Resource`]. +/// May be derived from `db-macros::Resource`. pub trait Resource { type IdType: GenericUuid; @@ -61,7 +61,7 @@ pub struct AssetIdentityMetadata { /// These are objects similar to [`Resource`], but without /// names, descriptions, or soft deletions. /// -/// May be derived from [`macro@db-macros::Asset`]. +/// May be derived from `db-macros::Asset`. pub trait Asset { type IdType: GenericUuid; diff --git a/sled-agent/src/bootstrap/secret_retriever.rs b/sled-agent/src/bootstrap/secret_retriever.rs index b45d0026b96..b91557bacfe 100644 --- a/sled-agent/src/bootstrap/secret_retriever.rs +++ b/sled-agent/src/bootstrap/secret_retriever.rs @@ -2,7 +2,7 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. -//! Key retrieval mechanisms for use by [`key-manager::KeyManager`] +//! Key retrieval mechanisms for use by [`key_manager::KeyManager`] use async_trait::async_trait; use bootstore::schemes::v0::NodeHandle; @@ -87,7 +87,7 @@ impl LrtqOrHardcodedSecretRetriever { } } -/// A [`key-manager::SecretRetriever`] for use before trust quorum is production +/// A [`key_manager::SecretRetriever`] for use before trust quorum is production /// ready /// /// The local retriever only returns keys for epoch 0 @@ -116,7 +116,7 @@ impl SecretRetriever for HardcodedSecretRetriever { } } -/// A [`key-manager::SecretRetriever`] for use with LRTQ +/// A [`key_manager::SecretRetriever`] for use with LRTQ /// /// The LRTQ retriever only returns keys for epoch 1 #[derive(Debug)] diff --git a/sled-storage/zfs-test-harness/src/lib.rs b/sled-storage/zfs-test-harness/src/lib.rs index be0b9b45c41..6ff3cceec04 100644 --- a/sled-storage/zfs-test-harness/src/lib.rs +++ b/sled-storage/zfs-test-harness/src/lib.rs @@ -409,7 +409,7 @@ struct DatasetCreationDetails { full_name: String, } -/// A [`key-manager::SecretRetriever`] that only returns hardcoded IKM for +/// A [`key_manager::SecretRetriever`] that only returns hardcoded IKM for /// epoch 0 #[derive(Debug, Default)] struct HardcodedSecretRetriever; diff --git a/wicket/src/ui/splash.rs b/wicket/src/ui/splash.rs index ce5ce2fa58d..4b760d32f23 100644 --- a/wicket/src/ui/splash.rs +++ b/wicket/src/ui/splash.rs @@ -2,7 +2,7 @@ // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. -//! The splash [`Screen'] +//! The splash screen //! //! This is the first screen the user sees