Skip to content

Commit

Permalink
Bump the toolchain to latest nightly.
Browse files Browse the repository at this point in the history
Also fixed _some_ new warnings reported by the toolchain, and many
places where rustfmt has apparently changed its mind about some things.

Removed size constraints for tasks that increased in size rather than
playing guess-the-number.

This leaves a number of warnings, which I'm hoping to divide up and not
have to fix myself.
  • Loading branch information
cbiffle committed Apr 4, 2024
1 parent 858c297 commit d091330
Show file tree
Hide file tree
Showing 54 changed files with 164 additions and 149 deletions.
2 changes: 0 additions & 2 deletions .cargo/config

This file was deleted.

10 changes: 10 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[alias]
xtask = "run --package xtask --"

[build]
# The purpose of this flag is to block crates using version_detect from "detecting"
# features that are no longer supported by the toolchain, because despite its name,
# version_detect is basically "if nightly { return true; }". This setting gets
# overridden within xtask for Hubris programs, so this only affects host tools like
# xtask.
rustflags = ["-Zallow-features=proc_macro_diagnostic,asm_const,naked_functions,used_with_arg"]
2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
cargo-features = ["resolver", "named-profiles"]

[workspace]
members = [
"build/*",
Expand Down
2 changes: 1 addition & 1 deletion app/gimlet/base.toml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ features = ["gimlet"]
name = "task-thermal"
features = ["gimlet"]
priority = 5
max-sizes = {flash = 32768, ram = 8192 }
max-sizes = {flash = 65536, ram = 8192 }
stacksize = 6000
start = true
task-slots = ["i2c_driver", "sensor", "gimlet_seq", "jefe"]
Expand Down
1 change: 0 additions & 1 deletion app/oxide-rot-1/app.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ task-slots = ["syscon_driver"]
[tasks.sprot]
name = "drv-lpc55-sprot-server"
priority = 6
max-sizes = {flash = 48608, ram = 32768}
uses = ["flexcomm8", "bootrom"]
features = ["spi0"]
start = true
Expand Down
2 changes: 1 addition & 1 deletion app/sidecar/base.toml
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ notifications = ["timer"]
name = "task-thermal"
features = ["sidecar"]
priority = 5
max-sizes = {flash = 32768, ram = 16384 }
max-sizes = {flash = 65536, ram = 16384 }
stacksize = 8096
start = true
task-slots = ["i2c_driver", "sensor", "sequencer"]
Expand Down
21 changes: 3 additions & 18 deletions build/i2c/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,21 +269,6 @@ struct DeviceRefdesKey {
kind: Sensor,
}

#[derive(Debug, PartialEq, Eq, Hash)]
struct DeviceBusKey {
device: String,
bus: String,
kind: Sensor,
}

#[derive(Debug, PartialEq, Eq, Hash)]
struct DeviceBusNameKey {
device: String,
bus: String,
name: String,
kind: Sensor,
}

#[derive(Debug, Clone, PartialEq, Eq)]
pub struct DeviceSensor {
pub name: Option<String>,
Expand Down Expand Up @@ -573,7 +558,7 @@ impl ConfigGenerator {
d.device, d.address
);
}
(_, Some(bus)) if buses.get(bus).is_none() => {
(_, Some(bus)) if !buses.contains_key(bus) => {
panic!(
"device {} at address {:#x} specifies \
unknown bus \"{}\"",
Expand Down Expand Up @@ -1254,7 +1239,7 @@ impl ConfigGenerator {
// returned by `device_descriptions()` below: if we change the ordering
// here, it must be updated there as well.
for (index, device) in self.devices.iter().enumerate() {
if drivers.get(&device.device).is_some() {
if drivers.contains(&device.device) {
let driver = device.device.to_case(Case::UpperCamel);
let out = self.generate_device(device, 24);

Expand Down Expand Up @@ -1471,7 +1456,7 @@ impl ConfigGenerator {
{
writeln!(
&mut self.output,
"\n #[allow(non_camel_case_types)]
"\n #[allow(non_camel_case_types, dead_code)]
pub struct Sensors_{struct_name} {{",
)?;
let mut f = |name, count| match count {
Expand Down
2 changes: 1 addition & 1 deletion build/util/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ pub fn build_notifications() -> Result<()> {
);
}
if full_task_config.name == "task-jefe"
&& full_task_config.notifications.get(0).cloned()
&& full_task_config.notifications.first().cloned()
!= Some("fault".to_string())
{
bail!("`jefe` must have \"fault\" as its first notification");
Expand Down
6 changes: 3 additions & 3 deletions build/xtask/src/caboose_pos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ pub fn get_caboose_pos_table_entry(
) -> Result<Option<CaboosePosTableEntry>> {
// If the section isn't present, then we're not reading the caboose position
// from this task.
let Some(caboose_pos_table_section) = elf::get_section_by_name(
elf, CABOOSE_POS_TABLE_SECTION
) else {
let Some(caboose_pos_table_section) =
elf::get_section_by_name(elf, CABOOSE_POS_TABLE_SECTION)
else {
return Ok(None);
};

Expand Down
4 changes: 0 additions & 4 deletions build/xtask/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ struct RawConfig {
#[serde(default)]
image_names: Vec<String>,
#[serde(default)]
external_images: Vec<String>,
#[serde(default)]
signing: Option<RoTMfgSettings>,
stacksize: Option<u32>,
kernel: Kernel,
Expand All @@ -56,7 +54,6 @@ pub struct Config {
pub version: u32,
pub fwid: bool,
pub image_names: Vec<String>,
pub external_images: Vec<String>,
pub signing: Option<RoTMfgSettings>,
pub stacksize: Option<u32>,
pub kernel: Kernel,
Expand Down Expand Up @@ -176,7 +173,6 @@ impl Config {
target: toml.target,
board: toml.board,
image_names: img_names,
external_images: toml.external_images,
chip: toml.chip,
epoch: toml.epoch,
version: toml.version,
Expand Down
6 changes: 4 additions & 2 deletions build/xtask/src/lsp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,9 @@ impl PackageGraph {
while let Some((pkg_name, feat)) = todo.pop() {
// Anything not in `packages` is something from outside the
// workspace, so we don't care about it.
let Some(pkg) = self.0.get(&pkg_name) else { continue };
let Some(pkg) = self.0.get(&pkg_name) else {
continue;
};

// If we've never seen this package before, then insert all of
// its non-optional dependencies with their features.
Expand Down Expand Up @@ -277,7 +279,7 @@ fn check_task(
extra_env: build_cfg.env,
hash: "".to_owned(),
build_override_command,
app: app_name.clone().to_owned(),
app: app_name.to_owned(),
task: task_name.to_owned(),
};

Expand Down
8 changes: 4 additions & 4 deletions build/xtask/src/sizes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ pub fn run(

#[derive(Copy, Clone, Debug)]
enum Recommended {
FixedSize(u32),
FixedSize,
MaxSize(u32),
}
#[derive(Clone, Debug)]
Expand Down Expand Up @@ -183,7 +183,7 @@ fn build_memory_map<'a>(
.get(mem_name.to_owned())
.cloned()
.map(match name {
"kernel" => Recommended::FixedSize,
"kernel" => |_| Recommended::FixedSize,
_ => Recommended::MaxSize,
}),
},
Expand Down Expand Up @@ -265,7 +265,7 @@ fn print_task_table(
match chunk.recommended {
None => print!("(auto)"),
Some(Recommended::MaxSize(m)) => print!("{}", m),
Some(Recommended::FixedSize(_)) => print!("(fixed)"),
Some(Recommended::FixedSize) => print!("(fixed)"),
}
println!();
}
Expand Down Expand Up @@ -359,7 +359,7 @@ fn print_memory_map(
match chunk.recommended {
None => print!("(auto)"),
Some(Recommended::MaxSize(m)) => print!("{}", m),
Some(Recommended::FixedSize(_)) => print!("(fixed)"),
Some(Recommended::FixedSize) => print!("(fixed)"),
}
}
println!();
Expand Down
2 changes: 1 addition & 1 deletion drv/gimlet-seq-server/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use build_fpga_regmap::fpga_regs;
use serde::Deserialize;
use sha2::Digest;
use std::{convert::TryInto, fs, io::Write, path::PathBuf};
use std::{fs, io::Write, path::PathBuf};

#[derive(Deserialize)]
#[serde(deny_unknown_fields)]
Expand Down
1 change: 0 additions & 1 deletion drv/i2c-devices/src/at24csw080.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
//! Driver for the AT24CSW080/4 I2C EEPROM
use crate::Validate;
use core::convert::TryInto;
use drv_i2c_api::*;
use userlib::{hl::sleep_for, FromPrimitive, ToPrimitive};
use zerocopy::{AsBytes, FromBytes};
Expand Down
2 changes: 2 additions & 0 deletions drv/i2c-devices/src/ds2482.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ impl Ds2482 {
pub fn search(&mut self) -> Result<Option<Identifier>, Error> {
let device = &self.device;

// TODO: lint is buggy in 2024-04-04 toolchain, retest later.
#[allow(clippy::manual_unwrap_or_default)]
let branches = match self.branches {
Some(branches) => {
if branches.0 == 0 {
Expand Down
1 change: 0 additions & 1 deletion drv/i2c-devices/src/max31790.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use crate::Validate;
use bitfield::bitfield;
use core::convert::TryFrom;
use drv_i2c_api::*;
use ringbuf::*;
use userlib::units::*;
Expand Down
4 changes: 3 additions & 1 deletion drv/sidecar-front-io/src/transceivers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,9 @@ impl Transceivers {
FpgaController::Left => ldata,
FpgaController::Right => rdata,
};
let Some(local_data) = local_data else { continue };
let Some(local_data) = local_data else {
continue;
};

// loop through the 8 different fields we need to map
for (word, out) in local_data.iter().zip(status_masks.iter_mut()) {
Expand Down
1 change: 0 additions & 1 deletion drv/sidecar-mainboard-controller/src/tofino2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use crate::{Addr, MainboardController, Reg};
use bitfield::bitfield;
use core::convert::Into;
use derive_more::{From, Into};
use drv_fpga_api::{FpgaError, FpgaUserDesign, WriteOp};
use drv_fpga_user_api::power_rail::*;
Expand Down
1 change: 0 additions & 1 deletion drv/sidecar-seq-server/src/tofino.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use crate::*;
use drv_i2c_devices::raa229618::Raa229618;
use drv_sidecar_mainboard_controller::tofino2::{DebugPort, Sequencer};

pub(crate) struct Tofino {
pub policy: TofinoSequencerPolicy,
Expand Down
1 change: 0 additions & 1 deletion drv/stm32h7-eth/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#![no_std]

use core::convert::TryFrom;
use core::sync::atomic::{self, Ordering};

#[cfg(feature = "h743")]
Expand Down
1 change: 0 additions & 1 deletion drv/stm32h7-hash/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ use drv_hash_api::HashError;
#[cfg(feature = "h753")]
use stm32h7::stm32h753 as device;

use core::convert::TryInto;
use core::mem::size_of;
use userlib::*;
use zerocopy::AsBytes;
Expand Down
2 changes: 2 additions & 0 deletions drv/stm32h7-spi-server-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,8 @@ impl SpiServerCore {
// run off the end of their lease, or the fixed padding byte if
// we have.
let byte = if let Some(txbuf) = &mut tx {
// TODO: lint is buggy in 2024-04-04 toolchain, retest later
#[allow(clippy::manual_unwrap_or_default)]
if let Some(b) = txbuf.read() {
b
} else {
Expand Down
1 change: 0 additions & 1 deletion drv/stm32h7-sprot-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#![deny(elided_lifetimes_in_paths)]

use attest_api::{AttestError, HashAlgorithm, NONCE_MAX_SIZE, NONCE_MIN_SIZE};
use core::convert::Into;
use drv_lpc55_update_api::{
RotBootInfo, RotPage, SlotId, SwitchDuration, UpdateTarget,
};
Expand Down
5 changes: 3 additions & 2 deletions drv/stm32xx-i2c-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ fn main() -> ! {

let mut nread = 0;

match controller.write_read(
let controller_result = controller.write_read(
addr,
winfo.len,
|pos| wbuf.read_at(pos),
Expand All @@ -470,7 +470,8 @@ fn main() -> ! {
rbuf.write_at(pos, byte)
},
&ctrl,
) {
);
match controller_result {
Err(code) => {
//
// NoDevice errors aren't hugely interesting --
Expand Down
5 changes: 3 additions & 2 deletions drv/stm32xx-i2c/src/ltc4306.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ fn read_reg_u8(
let mut rval = 0u8;
let wlen = 1;

match controller.write_read(
let controller_result = controller.write_read(
mux.address,
wlen,
|_| Some(reg),
Expand All @@ -103,7 +103,8 @@ fn read_reg_u8(
Some(())
},
ctrl,
) {
);
match controller_result {
Err(code) => Err(mux.error_code(code)),
_ => Ok(rval),
}
Expand Down
5 changes: 3 additions & 2 deletions drv/stm32xx-i2c/src/max7358.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ fn read_regs(
rbuf: &mut [u8],
ctrl: &I2cControl,
) -> Result<(), ResponseCode> {
match controller.write_read(
let controller_result = controller.write_read(
mux.address,
0,
|_| Some(0),
Expand All @@ -86,7 +86,8 @@ fn read_regs(
Some(())
},
ctrl,
) {
);
match controller_result {
Err(code) => Err(mux.error_code(code)),
_ => {
for (i, &byte) in rbuf.iter().enumerate() {
Expand Down
4 changes: 2 additions & 2 deletions drv/stm32xx-sys-api/src/h7.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ pub enum Peripheral {

#[cfg(any(feature = "h753", feature = "h743"))]
Rng = periph(Group::Ahb2, 6),
#[cfg(any(feature = "h753"))]
#[cfg(feature = "h753")]
Hash = periph(Group::Ahb2, 5),
#[cfg(any(feature = "h753"))]
#[cfg(feature = "h753")]
Crypt = periph(Group::Ahb2, 4),

#[cfg(feature = "h7b3")]
Expand Down
2 changes: 0 additions & 2 deletions drv/vsc85xx/src/vsc8562.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// 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/.

use core::convert::TryInto;

use zerocopy::{AsBytes, FromBytes};

use crate::{Phy, PhyRw, Trace};
Expand Down
2 changes: 0 additions & 2 deletions lib/gnarle/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
#![cfg_attr(not(feature = "std"), no_std)]

use core::convert::TryFrom;

/// Internal definition of how long the run count is. Tuning this might improve
/// performance, though its current value seems optimal in practice.
type RunType = u8;
Expand Down
2 changes: 0 additions & 2 deletions lib/stage0-handoff/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

#![cfg_attr(not(test), no_std)]

use core::convert::From;
use core::marker::Sized;
use core::ops::Range;
use hubpack::SerializedSize;
use serde::{Deserialize, Serialize};
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[toolchain]
channel = "nightly-2022-11-01"
channel = "nightly-2024-04-04"
targets = [ "thumbv6m-none-eabi", "thumbv7em-none-eabihf", "thumbv8m.main-none-eabihf" ]
profile = "minimal"
components = [ "rustfmt" ]
Loading

0 comments on commit d091330

Please sign in to comment.