add maintenance notes around the fix for https://github.com/rust-lang/rust/issues/90195

This commit is contained in:
bunnie 2021-10-23 17:50:33 +08:00
parent c245e78255
commit 7de925d3f1

View file

@ -45,7 +45,6 @@ impl Into<u32> for UartType {
}
/////////////////////// I2C
pub (crate) const I2C_MAX_LEN: usize = 33;
// a small book-keeping struct used to report back to I2C requestors as to the status of a transaction
#[derive(Debug, Copy, Clone, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize, Eq, PartialEq)]
pub enum I2cStatus {
@ -76,10 +75,12 @@ pub(crate) enum I2cCallback {
// maybe once things stabilize, it's probably a good idea to make this structure private to the crate,
// and create a "public" version for return values via callbacks. But for now, it's pretty
// convenient to reach into the state of the I2C machine to debug problems in the callbacks.
pub (crate) const I2C_MAX_LEN: usize = 33; // note: due to a regression in Rust 1.56, we can't use the I2C_MAX_LEN symbol in the structure below. So you must manually update that if you change it here.
#[derive(Debug, Copy, Clone, Archive, Serialize, Deserialize)]
pub struct I2cTransaction {
pub bus_addr: u8,
// write address and read address are encoded in the packet field below
// NOTE: the number 33 that appears twice below mirrors I2C_MAX_LEN; due to a regression in Rust 1.56 we can't use constants in array types
pub txbuf: Option<[u8; 33]>, // long enough for a 256-byte operation + 2 bytes of "register address"
pub txlen: u32,
pub rxbuf: Option<[u8; 33]>,