Skip to content

Commit 414318d

Browse files
authored
[meta] update rust to 1.84 (#7334)
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.
1 parent 90898fb commit 414318d

File tree

42 files changed

+99
-113
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+99
-113
lines changed

clients/dpd-client/src/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
// That test passes for code that lives in omicron, but fails for code imported
1010
// by omicron.
1111
#![allow(rustdoc::broken_intra_doc_links)]
12-
// Temporary workaround while Rust is being updated to 1.84.
13-
#![allow(unknown_lints)]
1412

1513
use std::net::IpAddr;
1614

cockroach-admin/types/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ where
7575
D: serde::Deserializer<'de>,
7676
{
7777
struct CockroachTimestampVisitor;
78-
impl<'de> de::Visitor<'de> for CockroachTimestampVisitor {
78+
impl de::Visitor<'_> for CockroachTimestampVisitor {
7979
type Value = DateTime<Utc>;
8080

8181
fn expecting(
@@ -185,7 +185,7 @@ where
185185
{
186186
struct CockroachNodeMembershipVisitor;
187187

188-
impl<'de> de::Visitor<'de> for CockroachNodeMembershipVisitor {
188+
impl de::Visitor<'_> for CockroachNodeMembershipVisitor {
189189
type Value = NodeMembership;
190190

191191
fn expecting(

common/src/api/external/error.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ impl MessagePair {
147147

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

150-
impl<'a> Display for MessagePairDisplayInternal<'a> {
150+
impl Display for MessagePairDisplayInternal<'_> {
151151
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
152152
write!(f, "{}", self.0.external_message)?;
153153
if !self.0.internal_context.is_empty() {

dev-tools/downloader/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ async fn download_file_and_verify(
458458
Ok(())
459459
}
460460

461-
impl<'a> Downloader<'a> {
461+
impl Downloader<'_> {
462462
async fn download_cargo_hack(&self) -> Result<()> {
463463
let os = os_name()?;
464464
let arch = arch()?;

dev-tools/omdb/src/bin/omdb/mgs.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ fn show_sp_ids(sp_ids: &[SpIdentifier]) -> Result<(), anyhow::Error> {
197197
slot: u32,
198198
}
199199

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

227-
impl<'a> From<&'a SpIgnitionInfo> for IgnitionRow {
227+
impl From<&SpIgnitionInfo> for IgnitionRow {
228228
fn from(value: &SpIgnitionInfo) -> Self {
229229
IgnitionRow {
230230
type_: sp_type_to_str(&value.id.type_),

dev-tools/releng/src/job.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ impl Job {
164164
}
165165
}
166166

167-
impl<'a> Selector<'a> {
167+
impl Selector<'_> {
168168
#[track_caller]
169169
pub(crate) fn after(self, other: impl AsRef<str>) -> Self {
170170
let (sender, receiver) = oneshot::channel();

dns-server/src/storage.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ struct UpdateGuard<'store, 'req_id> {
711711
finished: bool,
712712
}
713713

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

735-
impl<'a, 'b> Drop for UpdateGuard<'a, 'b> {
735+
impl Drop for UpdateGuard<'_, '_> {
736736
fn drop(&mut self) {
737737
// UpdateGuard exists because we must enforce at most one Update is
738738
// happening at a time, but we also want to catch the case where an

illumos-utils/src/svc.rs

+8-2
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,15 @@ mod inner {
2525
// properties to not exist when the command returns.
2626
//
2727
// We workaround this by querying for these properties in a loop.
28-
pub async fn wait_for_service<'a, 'b>(
28+
//
29+
// TODO: remove this when clippy no longer flags
30+
// https://github.com/rust-lang/rust-clippy/issues/13923 (ideally we'd have
31+
// used `expect` but on 1.84, it says that it's unfulfilled even though it
32+
// is fulfilled?)
33+
#[allow(clippy::needless_lifetimes)]
34+
pub async fn wait_for_service<'a>(
2935
zone: Option<&'a str>,
30-
fmri: &'b str,
36+
fmri: &str,
3137
log: Logger,
3238
) -> Result<(), Error> {
3339
let name = smf::PropertyName::new("restarter", "state").unwrap();

installinator/src/write.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ struct SlotWriteContext<'a> {
352352
progress: DriveWriteProgress,
353353
}
354354

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

519519
impl ArtifactsToWrite<'_> {
520520
/// Attempt to write the host phase 2 image.
521-
async fn write_host_phase_2<'b, WT: WriteTransport>(
521+
async fn write_host_phase_2<WT: WriteTransport>(
522522
&self,
523523
log: &Logger,
524524
slot: M2Slot,
525525
destinations: &ArtifactDestination,
526-
transport: &'b mut WT,
526+
transport: &mut WT,
527527
cx: &StepContext<WriteSpec>,
528528
) -> Result<StepResult<Option<usize>, WriteSpec>, WriteError> {
529529
let block_size = write_artifact_impl(

internal-dns/types/src/diff.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ impl<'a> DnsDiff<'a> {
136136
}
137137
}
138138

139-
impl<'a> std::fmt::Display for DnsDiff<'a> {
139+
impl std::fmt::Display for DnsDiff<'_> {
140140
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
141141
let names_changed = !self.is_empty();
142142
let zone_name = &self.zone_name;

nexus/authz-macros/src/lib.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ use quote::{format_ident, quote};
1212
use serde_tokenstream::ParseWrapper;
1313
use syn::parse_quote;
1414

15+
// Allow private intra-doc links. This is useful because the `Input` struct
16+
// cannot be exported (since we're a proc macro crate, and we can't expose
17+
// a struct), but its documentation is very useful.
18+
#[allow(rustdoc::private_intra_doc_links)]
1519
/// Defines a structure and helpers for describing an API resource for authz
1620
///
1721
/// For context, see the module-level documentation for `omicron-nexus::authz`.
@@ -141,11 +145,6 @@ use syn::parse_quote;
141145
/// polar_snippet = FleetChild,
142146
/// }
143147
/// ```
144-
145-
// Allow private intra-doc links. This is useful because the `Input` struct
146-
// cannot be exported (since we're a proc macro crate, and we can't expose
147-
// a struct), but its documentation is very useful.
148-
#[allow(rustdoc::private_intra_doc_links)]
149148
#[proc_macro]
150149
pub fn authz_resource(
151150
input: proc_macro::TokenStream,

nexus/db-queries/src/db/datastore/dns.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -706,7 +706,7 @@ pub trait DataStoreDnsTest: Send + Sync {
706706
opctx: &'a OpContext,
707707
dns_group: DnsGroup,
708708
version: omicron_common::api::external::Generation,
709-
) -> BoxFuture<'_, Result<DnsConfigParams, Error>>;
709+
) -> BoxFuture<'a, Result<DnsConfigParams, Error>>;
710710
}
711711

712712
impl DataStoreDnsTest for DataStore {
@@ -715,7 +715,7 @@ impl DataStoreDnsTest for DataStore {
715715
opctx: &'a OpContext,
716716
dns_group: DnsGroup,
717717
version: omicron_common::api::external::Generation,
718-
) -> BoxFuture<'_, Result<DnsConfigParams, Error>> {
718+
) -> BoxFuture<'a, Result<DnsConfigParams, Error>> {
719719
async move {
720720
use db::schema::dns_version::dsl;
721721
let dns_version = dsl::dns_version

nexus/db-queries/src/db/datastore/instance.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1560,7 +1560,6 @@ impl DataStore {
15601560
/// using [`DataStore::instance_updater_unlock`], or use
15611561
/// [`DataStore::instance_commit_update`] to release the lock and write back
15621562
/// a new [`InstanceRuntimeState`] in a single atomic query.
1563-
15641563
///
15651564
/// This method is idempotent: if the instance is already locked by the same
15661565
/// saga, it will succeed, as though the lock was acquired.

nexus/db-queries/src/db/datastore/region.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,7 @@ impl DataStore {
170170
let size = size.to_bytes();
171171

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

177175
(blocks_per_extent, extent_count)
178176
}

nexus/inventory/src/collector.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -535,21 +535,21 @@ mod test {
535535
}
536536

537537
write!(&mut s, "\nerrors:\n").unwrap();
538+
let os_error_re = regex::Regex::new(r"os error \d+").unwrap();
539+
let comm_error_re =
540+
regex::Regex::new(r"Communication Error.*").unwrap();
538541
for e in &collection.errors {
539542
// Some error strings have OS error numbers in them. We want to
540543
// ignore those, particularly for CI, which runs these tests on
541544
// multiple OSes.
542-
let message = regex::Regex::new(r"os error \d+")
543-
.unwrap()
544-
.replace_all(&e, "os error <<redacted>>");
545+
let message = os_error_re.replace_all(&e, "os error <<redacted>>");
545546
// Communication errors differ based on the configuration of the
546547
// machine running the test. For example whether or not the machine
547548
// has IPv6 configured will determine if an error is network
548549
// unreachable or a timeout due to sending a packet to a known
549550
// discard prefix. So just key in on the communication error in a
550551
// general sense.
551-
let message = regex::Regex::new(r"Communication Error.*")
552-
.unwrap()
552+
let message = comm_error_re
553553
.replace_all(&message, "Communication Error <<redacted>>");
554554
write!(&mut s, "error: {}\n", message).unwrap();
555555
}

nexus/saga-recovery/src/recovery.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ struct PlanBuilder<'a> {
318318

319319
impl<'a> PlanBuilder<'a> {
320320
/// Begin building a `Plan`
321-
fn new(log: &'a slog::Logger) -> PlanBuilder {
321+
fn new(log: &'a slog::Logger) -> Self {
322322
PlanBuilder {
323323
log,
324324
needs_recovery: BTreeMap::new(),

nexus/src/app/background/tasks/blueprint_execution.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,7 @@ impl BlueprintExecutor {
6262
/// The presence of `boxed()` in `BackgroundTask::activate` has caused some
6363
/// confusion with compilation errors in the past. So separate this method
6464
/// out.
65-
async fn activate_impl<'a>(
66-
&mut self,
67-
opctx: &OpContext,
68-
) -> serde_json::Value {
65+
async fn activate_impl(&mut self, opctx: &OpContext) -> serde_json::Value {
6966
// Get the latest blueprint, cloning to prevent holding a read lock
7067
// on the watch.
7168
let update = self.rx_blueprint.borrow_and_update().clone();

nexus/src/app/background/tasks/inventory_collection.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ struct DbSledAgentEnumerator<'a> {
215215
datastore: &'a DataStore,
216216
}
217217

218-
impl<'a> nexus_inventory::SledAgentEnumerator for DbSledAgentEnumerator<'a> {
218+
impl nexus_inventory::SledAgentEnumerator for DbSledAgentEnumerator<'_> {
219219
fn list_sled_agents(
220220
&self,
221221
) -> BoxFuture<'_, Result<Vec<String>, InventoryError>> {

nexus/src/app/background/tasks/support_bundle_collector.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ struct BundleCollection<'a> {
421421
bundle: &'a SupportBundle,
422422
}
423423

424-
impl<'a> BundleCollection<'a> {
424+
impl BundleCollection<'_> {
425425
// Collect the bundle within Nexus, and store it on a target sled.
426426
async fn collect_bundle_and_store_on_sled(
427427
&self,

nexus/src/app/background/tasks/sync_switch_configuration.rs

+13-13
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ impl SwitchPortSettingsManager {
8585
Self { datastore, resolver }
8686
}
8787

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

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

191-
async fn db_loopback_addresses<'a>(
192-
&'a mut self,
191+
async fn db_loopback_addresses(
192+
&mut self,
193193
opctx: &OpContext,
194194
log: &slog::Logger,
195195
) -> Result<
@@ -224,8 +224,8 @@ impl SwitchPortSettingsManager {
224224
Ok(set)
225225
}
226226

227-
async fn bfd_peer_configs_from_db<'a>(
228-
&'a mut self,
227+
async fn bfd_peer_configs_from_db(
228+
&mut self,
229229
opctx: &OpContext,
230230
) -> Result<
231231
Vec<sled_agent_client::types::BfdPeerConfig>,
@@ -299,7 +299,7 @@ impl BackgroundTask for SwitchPortSettingsManager {
299299
let racks = match self.datastore.rack_list_initialized(opctx, &DataPageParams::max_page()).await {
300300
Ok(racks) => racks,
301301
Err(e) => {
302-
error!(log, "failed to retrieve racks from database";
302+
error!(log, "failed to retrieve racks from database";
303303
"error" => %DisplayErrorChain::new(&e)
304304
);
305305
return json!({
@@ -329,7 +329,7 @@ impl BackgroundTask for SwitchPortSettingsManager {
329329
{
330330
Ok(addrs) => addrs,
331331
Err(e) => {
332-
error!(log, "failed to resolve addresses for Dendrite services";
332+
error!(log, "failed to resolve addresses for Dendrite services";
333333
"error" => %DisplayErrorChain::new(&e));
334334
continue;
335335
},
@@ -935,7 +935,7 @@ impl BackgroundTask for SwitchPortSettingsManager {
935935
},
936936
};
937937

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

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

1938-
async fn add_static_routes<'a>(
1938+
async fn add_static_routes(
19391939
mgd_clients: &HashMap<SwitchLocation, mg_admin_client::Client>,
19401940
routes_to_add: HashMap<SwitchLocation, AddStaticRoute4Request>,
19411941
log: &slog::Logger,

nexus/tests/integration_tests/silos.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -1619,6 +1619,10 @@ async fn test_silo_user_views(cptestctx: &ControlPlaneTestContext) {
16191619
let test_silo2 =
16201620
TestSilo { silo: &silo2, expected_users: silo2_expected_users };
16211621

1622+
// Strip the identifier out of error messages because the uuid changes each
1623+
// time.
1624+
let id_re = regex::Regex::new("\".*?\"").unwrap();
1625+
16221626
let mut output = String::new();
16231627
for test_silo in [test_silo1, test_silo2] {
16241628
let silo_name = &test_silo.silo.identity().name;
@@ -1696,10 +1700,7 @@ async fn test_silo_user_views(cptestctx: &ControlPlaneTestContext) {
16961700
let error = test_response
16971701
.parsed_body::<dropshot::HttpErrorResponseBody>()
16981702
.unwrap();
1699-
// Strip the identifier out of the error message because the
1700-
// uuid changes each time.
1701-
let pattern = regex::Regex::new("\".*?\"").unwrap();
1702-
let message = pattern.replace_all(&error.message, "...");
1703+
let message = id_re.replace_all(&error.message, "...");
17031704
write!(&mut output, " (message = {:?})", message).unwrap();
17041705
}
17051706

nexus/tests/integration_tests/unauthorized.rs

-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ G GET PUT POST DEL TRCE G URL
159159
/// associated to the results of the setup request with any `{id}` params in the
160160
/// URL replaced with the result's URL. This is used to later verify ID
161161
/// endpoints without first having to know the ID.
162-
163162
enum SetupReq {
164163
Get {
165164
url: &'static str,

0 commit comments

Comments
 (0)