Skip to content

Commit

Permalink
[meta] update rust to 1.84 (#7334)
Browse files Browse the repository at this point in the history
We're moving three versions ahead, so this is something we should do
with some caution. However there's at least one important
illumos-specific fix that's in 1.84
(rust-lang/rust#132984) so we should definitely
move over.

I've verified that rust-lang/rust#132064 no
longer affects us. To be more precise, its impact has been mostly taken
care of -- there's still a small regression, see [this
comment](rust-lang/rust#132064 (comment)),
but the Rust team has said it's one that should get better in the next
few months.
  • Loading branch information
sunshowers authored Jan 15, 2025

Verified

This commit was signed with the committer’s verified signature.
SebouChu Sébastien Gaya
1 parent 90898fb commit 414318d
Showing 42 changed files with 99 additions and 113 deletions.
2 changes: 0 additions & 2 deletions clients/dpd-client/src/lib.rs
Original file line number Diff line number Diff line change
@@ -9,8 +9,6 @@
// That test passes for code that lives in omicron, but fails for code imported
// by omicron.
#![allow(rustdoc::broken_intra_doc_links)]
// Temporary workaround while Rust is being updated to 1.84.
#![allow(unknown_lints)]

use std::net::IpAddr;

4 changes: 2 additions & 2 deletions cockroach-admin/types/src/lib.rs
Original file line number Diff line number Diff line change
@@ -75,7 +75,7 @@ where
D: serde::Deserializer<'de>,
{
struct CockroachTimestampVisitor;
impl<'de> de::Visitor<'de> for CockroachTimestampVisitor {
impl de::Visitor<'_> for CockroachTimestampVisitor {
type Value = DateTime<Utc>;

fn expecting(
@@ -185,7 +185,7 @@ where
{
struct CockroachNodeMembershipVisitor;

impl<'de> de::Visitor<'de> for CockroachNodeMembershipVisitor {
impl de::Visitor<'_> for CockroachNodeMembershipVisitor {
type Value = NodeMembership;

fn expecting(
2 changes: 1 addition & 1 deletion common/src/api/external/error.rs
Original file line number Diff line number Diff line change
@@ -147,7 +147,7 @@ impl MessagePair {

struct MessagePairDisplayInternal<'a>(&'a MessagePair);

impl<'a> Display for MessagePairDisplayInternal<'a> {
impl Display for MessagePairDisplayInternal<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.0.external_message)?;
if !self.0.internal_context.is_empty() {
2 changes: 1 addition & 1 deletion dev-tools/downloader/src/lib.rs
Original file line number Diff line number Diff line change
@@ -458,7 +458,7 @@ async fn download_file_and_verify(
Ok(())
}

impl<'a> Downloader<'a> {
impl Downloader<'_> {
async fn download_cargo_hack(&self) -> Result<()> {
let os = os_name()?;
let arch = arch()?;
4 changes: 2 additions & 2 deletions dev-tools/omdb/src/bin/omdb/mgs.rs
Original file line number Diff line number Diff line change
@@ -197,7 +197,7 @@ fn show_sp_ids(sp_ids: &[SpIdentifier]) -> Result<(), anyhow::Error> {
slot: u32,
}

impl<'a> From<&'a SpIdentifier> for SpIdRow {
impl From<&SpIdentifier> for SpIdRow {
fn from(id: &SpIdentifier) -> Self {
SpIdRow { type_: sp_type_to_str(&id.type_), slot: id.slot }
}
@@ -224,7 +224,7 @@ fn show_sps_from_ignition(
system_type: String,
}

impl<'a> From<&'a SpIgnitionInfo> for IgnitionRow {
impl From<&SpIgnitionInfo> for IgnitionRow {
fn from(value: &SpIgnitionInfo) -> Self {
IgnitionRow {
type_: sp_type_to_str(&value.id.type_),
2 changes: 1 addition & 1 deletion dev-tools/releng/src/job.rs
Original file line number Diff line number Diff line change
@@ -164,7 +164,7 @@ impl Job {
}
}

impl<'a> Selector<'a> {
impl Selector<'_> {
#[track_caller]
pub(crate) fn after(self, other: impl AsRef<str>) -> Self {
let (sender, receiver) = oneshot::channel();
4 changes: 2 additions & 2 deletions dns-server/src/storage.rs
Original file line number Diff line number Diff line change
@@ -711,7 +711,7 @@ struct UpdateGuard<'store, 'req_id> {
finished: bool,
}

impl<'a, 'b> UpdateGuard<'a, 'b> {
impl UpdateGuard<'_, '_> {
async fn finish(mut self) {
let store = self.store;
let mut update = store.updating.lock().await;
@@ -732,7 +732,7 @@ impl<'a, 'b> UpdateGuard<'a, 'b> {
}
}

impl<'a, 'b> Drop for UpdateGuard<'a, 'b> {
impl Drop for UpdateGuard<'_, '_> {
fn drop(&mut self) {
// UpdateGuard exists because we must enforce at most one Update is
// happening at a time, but we also want to catch the case where an
10 changes: 8 additions & 2 deletions illumos-utils/src/svc.rs
Original file line number Diff line number Diff line change
@@ -25,9 +25,15 @@ mod inner {
// properties to not exist when the command returns.
//
// We workaround this by querying for these properties in a loop.
pub async fn wait_for_service<'a, 'b>(
//
// TODO: remove this when clippy no longer flags
// https://github.com/rust-lang/rust-clippy/issues/13923 (ideally we'd have
// used `expect` but on 1.84, it says that it's unfulfilled even though it
// is fulfilled?)
#[allow(clippy::needless_lifetimes)]
pub async fn wait_for_service<'a>(
zone: Option<&'a str>,
fmri: &'b str,
fmri: &str,
log: Logger,
) -> Result<(), Error> {
let name = smf::PropertyName::new("restarter", "state").unwrap();
6 changes: 3 additions & 3 deletions installinator/src/write.rs
Original file line number Diff line number Diff line change
@@ -352,7 +352,7 @@ struct SlotWriteContext<'a> {
progress: DriveWriteProgress,
}

impl<'a> SlotWriteContext<'a> {
impl SlotWriteContext<'_> {
fn register_steps<'b>(
&'b self,
engine: &UpdateEngine<'b, WriteSpec>,
@@ -518,12 +518,12 @@ struct ArtifactsToWrite<'a> {

impl ArtifactsToWrite<'_> {
/// Attempt to write the host phase 2 image.
async fn write_host_phase_2<'b, WT: WriteTransport>(
async fn write_host_phase_2<WT: WriteTransport>(
&self,
log: &Logger,
slot: M2Slot,
destinations: &ArtifactDestination,
transport: &'b mut WT,
transport: &mut WT,
cx: &StepContext<WriteSpec>,
) -> Result<StepResult<Option<usize>, WriteSpec>, WriteError> {
let block_size = write_artifact_impl(
2 changes: 1 addition & 1 deletion internal-dns/types/src/diff.rs
Original file line number Diff line number Diff line change
@@ -136,7 +136,7 @@ impl<'a> DnsDiff<'a> {
}
}

impl<'a> std::fmt::Display for DnsDiff<'a> {
impl std::fmt::Display for DnsDiff<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let names_changed = !self.is_empty();
let zone_name = &self.zone_name;
9 changes: 4 additions & 5 deletions nexus/authz-macros/src/lib.rs
Original file line number Diff line number Diff line change
@@ -12,6 +12,10 @@ use quote::{format_ident, quote};
use serde_tokenstream::ParseWrapper;
use syn::parse_quote;

// Allow private intra-doc links. This is useful because the `Input` struct
// cannot be exported (since we're a proc macro crate, and we can't expose
// a struct), but its documentation is very useful.
#[allow(rustdoc::private_intra_doc_links)]
/// Defines a structure and helpers for describing an API resource for authz
///
/// For context, see the module-level documentation for `omicron-nexus::authz`.
@@ -141,11 +145,6 @@ use syn::parse_quote;
/// polar_snippet = FleetChild,
/// }
/// ```
// Allow private intra-doc links. This is useful because the `Input` struct
// cannot be exported (since we're a proc macro crate, and we can't expose
// a struct), but its documentation is very useful.
#[allow(rustdoc::private_intra_doc_links)]
#[proc_macro]
pub fn authz_resource(
input: proc_macro::TokenStream,
4 changes: 2 additions & 2 deletions nexus/db-queries/src/db/datastore/dns.rs
Original file line number Diff line number Diff line change
@@ -706,7 +706,7 @@ pub trait DataStoreDnsTest: Send + Sync {
opctx: &'a OpContext,
dns_group: DnsGroup,
version: omicron_common::api::external::Generation,
) -> BoxFuture<'_, Result<DnsConfigParams, Error>>;
) -> BoxFuture<'a, Result<DnsConfigParams, Error>>;
}

impl DataStoreDnsTest for DataStore {
@@ -715,7 +715,7 @@ impl DataStoreDnsTest for DataStore {
opctx: &'a OpContext,
dns_group: DnsGroup,
version: omicron_common::api::external::Generation,
) -> BoxFuture<'_, Result<DnsConfigParams, Error>> {
) -> BoxFuture<'a, Result<DnsConfigParams, Error>> {
async move {
use db::schema::dns_version::dsl;
let dns_version = dsl::dns_version
1 change: 0 additions & 1 deletion nexus/db-queries/src/db/datastore/instance.rs
Original file line number Diff line number Diff line change
@@ -1560,7 +1560,6 @@ impl DataStore {
/// using [`DataStore::instance_updater_unlock`], or use
/// [`DataStore::instance_commit_update`] to release the lock and write back
/// a new [`InstanceRuntimeState`] in a single atomic query.
///
/// This method is idempotent: if the instance is already locked by the same
/// saga, it will succeed, as though the lock was acquired.
4 changes: 1 addition & 3 deletions nexus/db-queries/src/db/datastore/region.rs
Original file line number Diff line number Diff line change
@@ -170,9 +170,7 @@ impl DataStore {
let size = size.to_bytes();

// allocate enough extents to fit all the disk blocks, rounding up.
let extent_count = size / Self::EXTENT_SIZE
+ ((size % Self::EXTENT_SIZE) + Self::EXTENT_SIZE - 1)
/ Self::EXTENT_SIZE;
let extent_count = size.div_ceil(Self::EXTENT_SIZE);

(blocks_per_extent, extent_count)
}
10 changes: 5 additions & 5 deletions nexus/inventory/src/collector.rs
Original file line number Diff line number Diff line change
@@ -535,21 +535,21 @@ mod test {
}

write!(&mut s, "\nerrors:\n").unwrap();
let os_error_re = regex::Regex::new(r"os error \d+").unwrap();
let comm_error_re =
regex::Regex::new(r"Communication Error.*").unwrap();
for e in &collection.errors {
// Some error strings have OS error numbers in them. We want to
// ignore those, particularly for CI, which runs these tests on
// multiple OSes.
let message = regex::Regex::new(r"os error \d+")
.unwrap()
.replace_all(&e, "os error <<redacted>>");
let message = os_error_re.replace_all(&e, "os error <<redacted>>");
// Communication errors differ based on the configuration of the
// machine running the test. For example whether or not the machine
// has IPv6 configured will determine if an error is network
// unreachable or a timeout due to sending a packet to a known
// discard prefix. So just key in on the communication error in a
// general sense.
let message = regex::Regex::new(r"Communication Error.*")
.unwrap()
let message = comm_error_re
.replace_all(&message, "Communication Error <<redacted>>");
write!(&mut s, "error: {}\n", message).unwrap();
}
2 changes: 1 addition & 1 deletion nexus/saga-recovery/src/recovery.rs
Original file line number Diff line number Diff line change
@@ -318,7 +318,7 @@ struct PlanBuilder<'a> {

impl<'a> PlanBuilder<'a> {
/// Begin building a `Plan`
fn new(log: &'a slog::Logger) -> PlanBuilder {
fn new(log: &'a slog::Logger) -> Self {
PlanBuilder {
log,
needs_recovery: BTreeMap::new(),
5 changes: 1 addition & 4 deletions nexus/src/app/background/tasks/blueprint_execution.rs
Original file line number Diff line number Diff line change
@@ -62,10 +62,7 @@ impl BlueprintExecutor {
/// The presence of `boxed()` in `BackgroundTask::activate` has caused some
/// confusion with compilation errors in the past. So separate this method
/// out.
async fn activate_impl<'a>(
&mut self,
opctx: &OpContext,
) -> serde_json::Value {
async fn activate_impl(&mut self, opctx: &OpContext) -> serde_json::Value {
// Get the latest blueprint, cloning to prevent holding a read lock
// on the watch.
let update = self.rx_blueprint.borrow_and_update().clone();
2 changes: 1 addition & 1 deletion nexus/src/app/background/tasks/inventory_collection.rs
Original file line number Diff line number Diff line change
@@ -215,7 +215,7 @@ struct DbSledAgentEnumerator<'a> {
datastore: &'a DataStore,
}

impl<'a> nexus_inventory::SledAgentEnumerator for DbSledAgentEnumerator<'a> {
impl nexus_inventory::SledAgentEnumerator for DbSledAgentEnumerator<'_> {
fn list_sled_agents(
&self,
) -> BoxFuture<'_, Result<Vec<String>, InventoryError>> {
2 changes: 1 addition & 1 deletion nexus/src/app/background/tasks/support_bundle_collector.rs
Original file line number Diff line number Diff line change
@@ -421,7 +421,7 @@ struct BundleCollection<'a> {
bundle: &'a SupportBundle,
}

impl<'a> BundleCollection<'a> {
impl BundleCollection<'_> {
// Collect the bundle within Nexus, and store it on a target sled.
async fn collect_bundle_and_store_on_sled(
&self,
26 changes: 13 additions & 13 deletions nexus/src/app/background/tasks/sync_switch_configuration.rs
Original file line number Diff line number Diff line change
@@ -85,8 +85,8 @@ impl SwitchPortSettingsManager {
Self { datastore, resolver }
}

async fn switch_ports<'a>(
&'a mut self,
async fn switch_ports(
&mut self,
opctx: &OpContext,
log: &slog::Logger,
) -> Result<Vec<nexus_db_model::SwitchPort>, serde_json::Value> {
@@ -115,8 +115,8 @@ impl SwitchPortSettingsManager {
Ok(port_list)
}

async fn changes<'a>(
&'a mut self,
async fn changes(
&mut self,
port_list: Vec<nexus_db_model::SwitchPort>,
opctx: &OpContext,
log: &slog::Logger,
@@ -188,8 +188,8 @@ impl SwitchPortSettingsManager {
Ok(changes)
}

async fn db_loopback_addresses<'a>(
&'a mut self,
async fn db_loopback_addresses(
&mut self,
opctx: &OpContext,
log: &slog::Logger,
) -> Result<
@@ -224,8 +224,8 @@ impl SwitchPortSettingsManager {
Ok(set)
}

async fn bfd_peer_configs_from_db<'a>(
&'a mut self,
async fn bfd_peer_configs_from_db(
&mut self,
opctx: &OpContext,
) -> Result<
Vec<sled_agent_client::types::BfdPeerConfig>,
@@ -299,7 +299,7 @@ impl BackgroundTask for SwitchPortSettingsManager {
let racks = match self.datastore.rack_list_initialized(opctx, &DataPageParams::max_page()).await {
Ok(racks) => racks,
Err(e) => {
error!(log, "failed to retrieve racks from database";
error!(log, "failed to retrieve racks from database";
"error" => %DisplayErrorChain::new(&e)
);
return json!({
@@ -329,7 +329,7 @@ impl BackgroundTask for SwitchPortSettingsManager {
{
Ok(addrs) => addrs,
Err(e) => {
error!(log, "failed to resolve addresses for Dendrite services";
error!(log, "failed to resolve addresses for Dendrite services";
"error" => %DisplayErrorChain::new(&e));
continue;
},
@@ -935,7 +935,7 @@ impl BackgroundTask for SwitchPortSettingsManager {
},
};

// TODO https://github.com/oxidecomputer/omicron/issues/3062
// TODO https://github.com/oxidecomputer/omicron/issues/3062
let tx_eq = if let Some(Some(c)) = info.tx_eq.get(0) {
Some(TxEqConfig {
pre1: c.pre1.map(Into::into),
@@ -1844,7 +1844,7 @@ async fn apply_switch_port_changes(
}
}

async fn static_routes_on_switch<'a>(
async fn static_routes_on_switch(
mgd_clients: &HashMap<SwitchLocation, mg_admin_client::Client>,
log: &slog::Logger,
) -> HashMap<SwitchLocation, SwitchStaticRoutes> {
@@ -1935,7 +1935,7 @@ async fn delete_static_routes(
}
}

async fn add_static_routes<'a>(
async fn add_static_routes(
mgd_clients: &HashMap<SwitchLocation, mg_admin_client::Client>,
routes_to_add: HashMap<SwitchLocation, AddStaticRoute4Request>,
log: &slog::Logger,
9 changes: 5 additions & 4 deletions nexus/tests/integration_tests/silos.rs
Original file line number Diff line number Diff line change
@@ -1619,6 +1619,10 @@ async fn test_silo_user_views(cptestctx: &ControlPlaneTestContext) {
let test_silo2 =
TestSilo { silo: &silo2, expected_users: silo2_expected_users };

// Strip the identifier out of error messages because the uuid changes each
// time.
let id_re = regex::Regex::new("\".*?\"").unwrap();

let mut output = String::new();
for test_silo in [test_silo1, test_silo2] {
let silo_name = &test_silo.silo.identity().name;
@@ -1696,10 +1700,7 @@ async fn test_silo_user_views(cptestctx: &ControlPlaneTestContext) {
let error = test_response
.parsed_body::<dropshot::HttpErrorResponseBody>()
.unwrap();
// Strip the identifier out of the error message because the
// uuid changes each time.
let pattern = regex::Regex::new("\".*?\"").unwrap();
let message = pattern.replace_all(&error.message, "...");
let message = id_re.replace_all(&error.message, "...");
write!(&mut output, " (message = {:?})", message).unwrap();
}

1 change: 0 additions & 1 deletion nexus/tests/integration_tests/unauthorized.rs
Original file line number Diff line number Diff line change
@@ -159,7 +159,6 @@ G GET PUT POST DEL TRCE G URL
/// associated to the results of the setup request with any `{id}` params in the
/// URL replaced with the result's URL. This is used to later verify ID
/// endpoints without first having to know the ID.
enum SetupReq {
Get {
url: &'static str,
Loading

0 comments on commit 414318d

Please sign in to comment.