Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump Rust Toolchain to 1.72.0 #4025

Merged
merged 3 commits into from
Sep 2, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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: 1 addition & 1 deletion .github/buildomat/jobs/build-and-test-helios.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#: name = "build-and-test (helios)"
#: variety = "basic"
#: target = "helios-2.0"
#: rust_toolchain = "1.70.0"
#: rust_toolchain = "1.72.0"
#: output_rules = [
#: "/var/tmp/omicron_tmp/*",
#: "!/var/tmp/omicron_tmp/crdb-base*",
Expand Down
2 changes: 1 addition & 1 deletion .github/buildomat/jobs/build-and-test-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#: name = "build-and-test (ubuntu-20.04)"
#: variety = "basic"
#: target = "ubuntu-20.04"
#: rust_toolchain = "1.70.0"
#: rust_toolchain = "1.72.0"
#: output_rules = [
#: "/var/tmp/omicron_tmp/*",
#: "!/var/tmp/omicron_tmp/crdb-base*",
Expand Down
2 changes: 1 addition & 1 deletion .github/buildomat/jobs/ci-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#: name = "helios / CI tools"
#: variety = "basic"
#: target = "helios-2.0"
#: rust_toolchain = "1.70.0"
#: rust_toolchain = "1.72.0"
#: output_rules = [
#: "=/work/end-to-end-tests/*.gz",
#: "=/work/caboose-util.gz",
Expand Down
2 changes: 1 addition & 1 deletion .github/buildomat/jobs/clippy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#: name = "clippy (helios)"
#: variety = "basic"
#: target = "helios-2.0"
#: rust_toolchain = "1.70.0"
#: rust_toolchain = "1.72.0"
#: output_rules = []

# Run clippy on illumos (not just other systems) because a bunch of our code
Expand Down
2 changes: 1 addition & 1 deletion .github/buildomat/jobs/host-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#: name = "helios / build OS image"
#: variety = "basic"
#: target = "helios-2.0"
#: rust_toolchain = "1.70.0"
#: rust_toolchain = "1.72.0"
#: output_rules = [
#: "=/work/helios/image/output/os.tar.gz",
#: ]
Expand Down
2 changes: 1 addition & 1 deletion .github/buildomat/jobs/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#: name = "helios / package"
#: variety = "basic"
#: target = "helios-2.0"
#: rust_toolchain = "1.70.0"
#: rust_toolchain = "1.72.0"
#: output_rules = [
#: "=/work/version.txt",
#: "=/work/package.tar.gz",
Expand Down
2 changes: 1 addition & 1 deletion .github/buildomat/jobs/trampoline-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#: name = "helios / build trampoline OS image"
#: variety = "basic"
#: target = "helios-2.0"
#: rust_toolchain = "1.70.0"
#: rust_toolchain = "1.72.0"
#: output_rules = [
#: "=/work/helios/image/output/os.tar.gz",
#: ]
Expand Down
4 changes: 2 additions & 2 deletions bootstore/src/schemes/v0/peer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -762,8 +762,8 @@ impl Node {
peer_id,
} => {
let Some(accepted_handle) =
self.accepted_connections.remove(&accepted_addr) else
{
self.accepted_connections.remove(&accepted_addr)
else {
warn!(
self.log,
concat!(
Expand Down
4 changes: 2 additions & 2 deletions bootstore/src/trust_quorum/rack_secret.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl Eq for RackSecret {}
impl RackSecret {
/// Create a secret based on Curve25519
pub fn new() -> RackSecret {
let mut rng = OsRng::default();
let mut rng = OsRng;
RackSecret { secret: Secret::new(Scalar::random(&mut rng)) }
}

Expand All @@ -78,7 +78,7 @@ impl RackSecret {
threshold: u8,
total_shares: u8,
) -> Result<Secret<Vec<Vec<u8>>>, vsss_rs::Error> {
let mut rng = OsRng::default();
let mut rng = OsRng;
Ok(Secret::new(shamir::split_secret::<WrappedScalar, u8, Vec<u8>>(
threshold as usize,
total_shares as usize,
Expand Down
5 changes: 3 additions & 2 deletions bootstore/tests/v0-fsm-proptest-rack-coordinator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,9 @@ impl TestState {
for (i, envelope) in envelopes.into_iter().enumerate() {
let Envelope {
to,
msg: Msg::Req(Request { id, type_: RequestType::Init(pkg)})
} = envelope else {
msg: Msg::Req(Request { id, type_: RequestType::Init(pkg) }),
} = envelope
else {
panic!("Already verified the RequestType");
};
self.shares.insert(to.clone(), Share(pkg.common.share.clone()));
Expand Down
4 changes: 3 additions & 1 deletion gateway-test-utils/src/sim_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ pub async fn current_simulator_state(simrack: &SimRack) -> Vec<SpInfo> {
let mut all_sps: Vec<SpInfo> = Vec::new();
let mut slot = 0;
for state in sim_state {
let Some(target_state) = state.target else { continue; };
let Some(target_state) = state.target else {
continue;
};
let typ = match target_state.system_type {
SystemType::Sidecar => SpType::Switch,
SystemType::Gimlet => SpType::Sled,
Expand Down
6 changes: 2 additions & 4 deletions gateway/src/http_entrypoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1174,10 +1174,8 @@ async fn sp_host_phase2_progress_get(
// this SP most recently requested. We'll treat that as "no progress
// information", since it almost certainly means our progress info on this
// SP is very stale.
let Ok(total_size) = apictx
.host_phase2_provider
.total_size(progress.hash)
.await
let Ok(total_size) =
apictx.host_phase2_provider.total_size(progress.hash).await
else {
return Ok(HttpResponseOk(HostPhase2Progress::None));
};
Expand Down
4 changes: 3 additions & 1 deletion illumos-utils/src/running_zone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,9 @@ impl RunningZone {
let binary = Utf8PathBuf::from(path);

// Fetch any log files for this SMF service.
let Some((log_file, rotated_log_files)) = self.service_log_files(&service_name)? else {
let Some((log_file, rotated_log_files)) =
self.service_log_files(&service_name)?
else {
error!(
self.inner.log,
"failed to find log files for existing service";
Expand Down
4 changes: 4 additions & 0 deletions installinator/src/mock_peers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
// 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/.

// TODO: Remove when https://github.com/frozenlib/test-strategy/commit/c0ca38711757d2b51f74b28e80ef4c78275c284f
// is pulled into a new published version of "test_strategy" that we can use.
#![allow(clippy::arc_with_non_send_sync)]

use std::{
collections::BTreeMap,
fmt,
Expand Down
9 changes: 6 additions & 3 deletions nexus/db-queries/src/authz/actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,12 @@ impl AuthenticatedActor {
/// this actor's Silo
pub fn confers_fleet_role(&self, fleet_role_str: &str) -> Vec<String> {
let Ok(fleet_role) = FleetRole::from_database_string(fleet_role_str)
else { return vec![] };
let Some(silo_policy) = self.silo_policy.as_ref()
else { return vec![] };
else {
return vec![];
};
let Some(silo_policy) = self.silo_policy.as_ref() else {
return vec![];
};
silo_policy
.mapped_fleet_roles()
.into_iter()
Expand Down
8 changes: 4 additions & 4 deletions nexus/db-queries/src/authz/api_resources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,10 @@ impl ApiResourceWithRoles for Fleet {
// If the actor is associated with a Silo, and if that Silo has a policy
// that grants fleet-level roles, then we must look up the actor's
// Silo-level roles when looking up their roles on the Fleet.
let Some(silo_id) = authn
.actor()
.and_then(|actor| actor.silo_id())
else { return Ok(None); };
let Some(silo_id) = authn.actor().and_then(|actor| actor.silo_id())
else {
return Ok(None);
};
let silo_authn_policy = authn.silo_authn_policy().ok_or_else(|| {
Error::internal_error(&format!(
"actor had a Silo ({}) but no SiloAuthnPolicy",
Expand Down
4 changes: 3 additions & 1 deletion nexus/db-queries/src/db/datastore/db_metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ impl DataStore {
};

let Some(config) = config else {
return Err("Not configured to automatically update schema".to_string());
return Err(
"Not configured to automatically update schema".to_string()
);
};

if current_version > desired_version {
Expand Down
6 changes: 4 additions & 2 deletions nexus/test-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -653,10 +653,12 @@ impl<'a, N: NexusServer> ControlPlaneTestContextBuilder<'a, N> {

let dns = dns_server::TransientServer::new(&log).await.unwrap();

let SocketAddr::V6(dns_address) = *dns.dns_server.local_address() else {
let SocketAddr::V6(dns_address) = *dns.dns_server.local_address()
else {
panic!("Unsupported IPv4 DNS address");
};
let SocketAddr::V6(dropshot_address) = dns.dropshot_server.local_addr() else {
let SocketAddr::V6(dropshot_address) = dns.dropshot_server.local_addr()
else {
panic!("Unsupported IPv4 Dropshot address");
};

Expand Down
2 changes: 1 addition & 1 deletion nexus/tests/integration_tests/authn_http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ async fn test_authn_spoof_allowed() {
HashMap::new(),
)
.await;
let tried_spoof = vec![SPOOF_SCHEME_NAME]
let tried_spoof = [SPOOF_SCHEME_NAME]
.iter()
.map(|s| s.to_string())
.collect::<Vec<String>>();
Expand Down
9 changes: 4 additions & 5 deletions nexus/tests/integration_tests/vpc_subnets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,7 @@ async fn test_vpc_subnets(cptestctx: &ControlPlaneTestContext) {
let other_ipv4_block = Ipv4Net("172.31.0.0/16".parse().unwrap());
// Create the first two available IPv6 address ranges. */
let prefix = vpc.ipv6_prefix.network();
let ipv6_block =
Some(Ipv6Net(ipnetwork::Ipv6Network::new(prefix, 64).unwrap()));
let ipv6_block = Ipv6Net(ipnetwork::Ipv6Network::new(prefix, 64).unwrap());
let mut segments = prefix.segments();
segments[3] = 1;
let addr = std::net::Ipv6Addr::from(segments);
Expand All @@ -177,7 +176,7 @@ async fn test_vpc_subnets(cptestctx: &ControlPlaneTestContext) {
description: "it's below the net".to_string(),
},
ipv4_block,
ipv6_block,
ipv6_block: Some(ipv6_block),
};
let subnet: VpcSubnet =
NexusRequest::objects_post(client, &subnets_url, &new_subnet)
Expand All @@ -191,7 +190,7 @@ async fn test_vpc_subnets(cptestctx: &ControlPlaneTestContext) {
assert_eq!(subnet.identity.description, "it's below the net");
assert_eq!(subnet.vpc_id, vpc.identity.id);
assert_eq!(subnet.ipv4_block, ipv4_block);
assert_eq!(subnet.ipv6_block, ipv6_block.unwrap());
assert_eq!(subnet.ipv6_block, ipv6_block);
assert!(subnet.ipv6_block.is_vpc_subnet(&vpc.ipv6_prefix));

// get subnet, should be the same
Expand Down Expand Up @@ -228,7 +227,7 @@ async fn test_vpc_subnets(cptestctx: &ControlPlaneTestContext) {
description: "it's below the net".to_string(),
},
ipv4_block,
ipv6_block,
ipv6_block: Some(ipv6_block),
};
let expected_error = format!(
"IP address range '{}' conflicts with an existing subnet",
Expand Down
8 changes: 4 additions & 4 deletions oximeter/db/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ impl From<DbFieldList> for Vec<FieldSchema> {
fn from(list: DbFieldList) -> Self {
list.names
.into_iter()
.zip(list.types.into_iter())
.zip(list.sources.into_iter())
.zip(list.types)
.zip(list.sources)
.map(|((name, ty), source)| FieldSchema {
name,
ty: ty.into(),
Expand Down Expand Up @@ -599,9 +599,9 @@ where
FieldSchema { name: name.to_string(), ty: value.field_type(), source }
};
let target_field_schema =
target.field_names().iter().zip(target.field_values().into_iter());
target.field_names().iter().zip(target.field_values());
let metric_field_schema =
metric.field_names().iter().zip(metric.field_values().into_iter());
metric.field_names().iter().zip(metric.field_values());
let field_schema = target_field_schema
.map(|(name, value)| {
make_field_schema(name, value, FieldSource::Target)
Expand Down
4 changes: 2 additions & 2 deletions oximeter/db/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,9 @@ impl SelectQueryBuilder {
let schema = crate::model::schema_for_parts(target, metric);
let mut builder = Self::new(&schema);
let target_fields =
target.field_names().iter().zip(target.field_values().into_iter());
target.field_names().iter().zip(target.field_values());
let metric_fields =
metric.field_names().iter().zip(metric.field_values().into_iter());
metric.field_names().iter().zip(metric.field_values());
for (name, value) in target_fields.chain(metric_fields) {
builder = builder.filter(name, FieldCmp::Eq, value)?;
}
Expand Down
4 changes: 2 additions & 2 deletions oximeter/oximeter/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ pub trait Target {
fn fields(&self) -> Vec<Field> {
self.field_names()
.iter()
.zip(self.field_values().into_iter())
.zip(self.field_values())
.map(|(name, value)| Field { name: name.to_string(), value })
.collect()
}
Expand Down Expand Up @@ -153,7 +153,7 @@ pub trait Metric {
fn fields(&self) -> Vec<Field> {
self.field_names()
.iter()
.zip(self.field_values().into_iter())
.zip(self.field_values())
.map(|(name, value)| Field { name: name.to_string(), value })
.collect()
}
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
#
# 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.70.0"
channel = "1.72.0"
profile = "default"
5 changes: 4 additions & 1 deletion sled-agent/src/bin/zone-bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,10 @@ async fn main() -> anyhow::Result<()> {
let priority = match args.priority {
None => None,
Some(pri) => {
let Ok(arr): Result<[PriorityDimension; EXPECTED_DIMENSIONS], _> = pri.try_into() else {
let Ok(arr): Result<
[PriorityDimension; EXPECTED_DIMENSIONS],
_,
> = pri.try_into() else {
bail!("must provide {EXPECTED_DIMENSIONS} priority dimensions");
};
Some(PriorityOrder::from(arr))
Expand Down
9 changes: 7 additions & 2 deletions sled-agent/src/http_entrypoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,20 @@ async fn zone_bundle_get(
let zone_name = params.zone_name;
let bundle_id = params.bundle_id;
let sa = rqctx.context();
let Some(path) = sa.get_zone_bundle_paths(&zone_name, &bundle_id)
let Some(path) = sa
.get_zone_bundle_paths(&zone_name, &bundle_id)
.await
.map_err(HttpError::from)?
.into_iter()
.next()
else {
return Err(HttpError::for_not_found(
None,
format!("No zone bundle for zone '{}' with ID '{}'", zone_name, bundle_id)));
format!(
"No zone bundle for zone '{}' with ID '{}'",
zone_name, bundle_id
),
));
};
let f = tokio::fs::File::open(&path).await.map_err(|e| {
HttpError::for_internal_error(format!(
Expand Down
4 changes: 3 additions & 1 deletion sled-agent/src/instance_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,9 @@ impl InstanceManager {
.lock()
.unwrap()
.values()
.find(|(propolis_id, _instance)| name == propolis_zone_name(propolis_id))
.find(|(propolis_id, _instance)| {
name == propolis_zone_name(propolis_id)
})
.cloned()
else {
return Err(BundleError::NoSuchZone { name: name.to_string() });
Expand Down
Loading