Skip to content

Commit

Permalink
update to Rust 1.85 (#7573)
Browse files Browse the repository at this point in the history
This is a major update (Rust 2024, async closures!), so let's kick it off now
so that we can gradually migrate over.

I ran a quick `cargo check --all-targets` to time it:

```
before: 901.01s user 158.67s system 957% cpu 1:50.66 total
after:  903.61s user 153.73s system 950% cpu 1:51.24 total
```

-- basically even.
  • Loading branch information
sunshowers authored and hawkw committed Feb 21, 2025
1 parent ad530fa commit eceb915
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 23 deletions.
2 changes: 1 addition & 1 deletion nexus/db-model/src/ipv6net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl Ipv6Net {
StdRng::from_entropy()
};
let random =
u128::from(rng.next_u64()) << 64 | u128::from(rng.next_u64());
(u128::from(rng.next_u64()) << 64) | u128::from(rng.next_u64());

// Generate a mask for the new address.
//
Expand Down
10 changes: 5 additions & 5 deletions nexus/src/app/background/tasks/networking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ pub(crate) fn api_to_dpd_port_settings(
let link_id = LinkId(0);
let tx_eq = if let Some(Some(t)) = settings.tx_eq.get(0) {
Some(TxEq {
pre1: t.pre1.map(Into::into),
pre2: t.pre2.map(Into::into),
main: t.main.map(Into::into),
post2: t.post2.map(Into::into),
post1: t.post2.map(Into::into),
pre1: t.pre1,
pre2: t.pre2,
main: t.main,
post2: t.post2,
post1: t.post2,
})
} else {
None
Expand Down
10 changes: 5 additions & 5 deletions nexus/src/app/background/tasks/sync_switch_configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -938,11 +938,11 @@ impl BackgroundTask for SwitchPortSettingsManager {
// 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),
pre2: c.pre2.map(Into::into),
main: c.main.map(Into::into),
post2: c.post2.map(Into::into),
post1: c.post1.map(Into::into),
pre1: c.pre1,
pre2: c.pre2,
main: c.main,
post2: c.post2,
post1: c.post1,
})
} else {
None
Expand Down
1 change: 0 additions & 1 deletion oximeter/instruments/src/kstat/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ mod tests {
rand::thread_rng()
.sample_iter(Uniform::new('a', 'z'))
.take(5)
.map(char::from)
.collect::<String>(),
);
Self::create(&name);
Expand Down
2 changes: 1 addition & 1 deletion oximeter/oxql-types/src/point.rs
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ impl Points {
let mut new = Vec::with_capacity(doubles.len());
for maybe_double in doubles.iter().copied() {
match maybe_double {
Some(d) if d == 0.0 => new.push(Some(false)),
Some(0.0) => new.push(Some(false)),
Some(_) => new.push(Some(true)),
None => new.push(None),
}
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,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.84.1"
channel = "1.85.0"
profile = "default"
7 changes: 1 addition & 6 deletions sled-agent/src/rack_setup/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -972,12 +972,7 @@ impl ServiceInner {
.iter()
.map(|config| NexusTypes::BgpConfig {
asn: config.asn,
originate: config
.originate
.iter()
.cloned()
.map(Into::into)
.collect(),
originate: config.originate.to_vec(),
shaper: config.shaper.clone(),
checker: config.checker.clone(),
})
Expand Down
6 changes: 3 additions & 3 deletions sled-hardware/types/src/underlay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ fn mac_to_bootstrap_ip(mac: MacAddr, interface_id: u64) -> Ipv6Addr {
(u16::from(mac_bytes[0]) << 8) | u16::from(mac_bytes[1]),
(u16::from(mac_bytes[2]) << 8) | u16::from(mac_bytes[3]),
(u16::from(mac_bytes[4]) << 8) | u16::from(mac_bytes[5]),
(interface_id >> 48 & 0xffff).try_into().unwrap(),
(interface_id >> 32 & 0xffff).try_into().unwrap(),
(interface_id >> 16 & 0xffff).try_into().unwrap(),
((interface_id >> 48) & 0xffff).try_into().unwrap(),
((interface_id >> 32) & 0xffff).try_into().unwrap(),
((interface_id >> 16) & 0xffff).try_into().unwrap(),
(interface_id & 0xfff).try_into().unwrap(),
)
}
Expand Down

0 comments on commit eceb915

Please sign in to comment.