diff --git a/Cargo.lock b/Cargo.lock index a4b24bbed..5371a7cd3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3805,6 +3805,15 @@ dependencies = [ "rand_core 0.5.1", ] +[[package]] +name = "rand_xorshift" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" +dependencies = [ + "rand_core 0.6.3", +] + [[package]] name = "random-number" version = "0.1.7" @@ -4483,6 +4492,7 @@ dependencies = [ "png", "rand 0.8.5", "rand_chacha 0.3.1", + "rand_xorshift", "random-pick", "ring", "rkyv", diff --git a/RELEASE-v0.9.md b/RELEASE-v0.9.md index 942161b19..eb8fe9c1c 100644 --- a/RELEASE-v0.9.md +++ b/RELEASE-v0.9.md @@ -441,6 +441,9 @@ perform the Xous firmware upgrade. This requires running manual update commands, - Fix an issue where uninitialized memory is being returned from the kernel due to a pointer assumed to be pointing to `usize` actually pointing to `u8`, thus having its length incorrectly divided by the size of a `usize` ## New in 0.9.16 +- Incorporate more stability fixes and formatting changes from @xobs +- Clean up warning and breakages due to Rust 1.75.0. Note that cleaning up one warning forces the code to be + backward-incompatible with earlier versions of Rust. 😖 ## Roadmap - Lots of testing and bug fixes diff --git a/kernel/src/arch/hosted/mem.rs b/kernel/src/arch/hosted/mem.rs index f13ac3ace..72e91510b 100644 --- a/kernel/src/arch/hosted/mem.rs +++ b/kernel/src/arch/hosted/mem.rs @@ -26,7 +26,7 @@ impl MemoryMapping { } /// Get the "PID" (actually, ASID) from the current mapping - pub fn get_pid(self) -> PID { + pub fn get_pid(self) -> Option { unimplemented!() } diff --git a/kernel/src/services.rs b/kernel/src/services.rs index c3fed4c23..9c1a91ac3 100644 --- a/kernel/src/services.rs +++ b/kernel/src/services.rs @@ -4,6 +4,7 @@ use crate::arch; use crate::arch::mem::MemoryMapping; pub use crate::arch::process::Process as ArchProcess; +#[cfg(not(any(windows, unix)))] pub use crate::arch::process::Thread; use crate::platform; use xous_kernel::arch::ProcessStartup; diff --git a/libs/mass-storage/packing/packing/src/lib.rs b/libs/mass-storage/packing/packing/src/lib.rs index 851d94828..853a054e7 100644 --- a/libs/mass-storage/packing/packing/src/lib.rs +++ b/libs/mass-storage/packing/packing/src/lib.rs @@ -5,6 +5,7 @@ // SPDX-LIcense-Identifier: Apache 2.0 #![no_std] +#![allow(unused_imports)] pub use typenum::{ Unsigned, U0, U1, U2, U3, U4, U5, U6, U7, U8, U9, U10, U11, U12, U13, U14, U15, U16, U17, U18, U19, U20, diff --git a/libs/mass-storage/packing/packing/src/primitive_packing/mod.rs b/libs/mass-storage/packing/packing/src/primitive_packing/mod.rs index 17f295a98..03b4eb458 100644 --- a/libs/mass-storage/packing/packing/src/primitive_packing/mod.rs +++ b/libs/mass-storage/packing/packing/src/primitive_packing/mod.rs @@ -4,6 +4,8 @@ // SPDX-License-Identifier: MIT // SPDX-LIcense-Identifier: Apache 2.0 +#![allow(unused_imports)] + mod bool_pack; pub use bool_pack::*; diff --git a/libs/mass-storage/usbd_scsi/src/scsi/enums/mod.rs b/libs/mass-storage/usbd_scsi/src/scsi/enums/mod.rs index 782be1f10..ac1d3fe87 100644 --- a/libs/mass-storage/usbd_scsi/src/scsi/enums/mod.rs +++ b/libs/mass-storage/usbd_scsi/src/scsi/enums/mod.rs @@ -4,6 +4,8 @@ // SPDX-License-Identifier: MIT // SPDX-LIcense-Identifier: Apache 2.0 +#![allow(unused_imports)] + mod op_code; pub use op_code::*; diff --git a/loader/curve25519-dalek-loader/src/field.rs b/loader/curve25519-dalek-loader/src/field.rs index 16d5d03f9..0d1a07254 100644 --- a/loader/curve25519-dalek-loader/src/field.rs +++ b/loader/curve25519-dalek-loader/src/field.rs @@ -69,6 +69,7 @@ pub use backend::serial::u32::field::*; pub type FieldElement = backend::serial::u32::field::FieldElement2625; #[cfg(feature = "u32e_backend")] +#[allow(unused_imports)] // this may be used by some other configs, so don't un-export it. pub use backend::serial::u32e::field::*; /// A `FieldElement` represents an element of the field /// \\( \mathbb Z / (2\^{255} - 19)\\). diff --git a/locales/src/lib.rs b/locales/src/lib.rs index 3cc6efd6e..dbe781b9d 100644 --- a/locales/src/lib.rs +++ b/locales/src/lib.rs @@ -4,4 +4,3 @@ pub mod locale; pub use locale::LANG; pub mod generated; -pub use generated::*; diff --git a/services/modals/src/lib.rs b/services/modals/src/lib.rs index b41e59e0a..2c7d972a7 100644 --- a/services/modals/src/lib.rs +++ b/services/modals/src/lib.rs @@ -94,7 +94,8 @@ impl<'a> AlertModalBuilder<'a> { final_placeholders = Some(pl) } 0 => (), - _ => panic!("somehow len of placeholders was neither zero or >= 1...?"), + // Note: if you are getting an error on compilation, this line below is required for Rust < 1.75.0 + // _ => panic!("somehow len of placeholders was neither zero or >= 1...?"), } let mut spec = ManagedPromptWithTextResponse { diff --git a/services/net/src/api.rs b/services/net/src/api.rs index 041420d64..b1c28d91f 100644 --- a/services/net/src/api.rs +++ b/services/net/src/api.rs @@ -19,6 +19,7 @@ use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr}; use xous_semver::SemVer; // republish this so we can decode the icmpv4 error codes +#[allow(unused_imports)] pub use smoltcp::wire::Icmpv4DstUnreachable; // note: this name cannot be changed, because it is baked into `libstd` diff --git a/services/pddb/src/backend.rs b/services/pddb/src/backend.rs index bbe162c3b..eb34ad978 100644 --- a/services/pddb/src/backend.rs +++ b/services/pddb/src/backend.rs @@ -11,7 +11,6 @@ pub use fastspace::*; mod types; pub use types::*; mod bcrypt; -pub use bcrypt::*; // local to the backend mod murmur3; diff --git a/services/root-keys/src/api.rs b/services/root-keys/src/api.rs index e6e45667b..6baf4a7f0 100644 --- a/services/root-keys/src/api.rs +++ b/services/root-keys/src/api.rs @@ -144,7 +144,6 @@ pub enum RootkeyResult { } /// AES operation definitions -pub use cipher::{BlockCipher, consts::U16}; use keyboard::KeyMap; use zeroize::Zeroize; diff --git a/services/root-keys/src/lib.rs b/services/root-keys/src/lib.rs index 1c6e07987..140830237 100644 --- a/services/root-keys/src/lib.rs +++ b/services/root-keys/src/lib.rs @@ -14,6 +14,7 @@ use std::convert::TryInto; pub use cipher::{BlockSizeUser, BlockClosure, ParBlocksSizeUser, BlockBackend, BlockEncrypt, BlockDecrypt, consts::U16, inout::InOut, generic_array::GenericArray, + BlockCipher }; pub(crate) type BatchBlocks = GenericArray; diff --git a/services/usb-device-xous/src/mappings.rs b/services/usb-device-xous/src/mappings.rs index c68b9a18b..1b1a1d076 100644 --- a/services/usb-device-xous/src/mappings.rs +++ b/services/usb-device-xous/src/mappings.rs @@ -1,4 +1,4 @@ -#![allow(dead_code)] +#![allow(unused_imports)] pub use xous_usb_hid::page::Keyboard as UsbKeyCode; #[cfg(any(feature="precursor", feature="renode"))] diff --git a/services/xous-log/src/main.rs b/services/xous-log/src/main.rs index 8f24b3ffa..007982582 100644 --- a/services/xous-log/src/main.rs +++ b/services/xous-log/src/main.rs @@ -12,32 +12,36 @@ use num_traits::FromPrimitive; use platform::implementation; /// A page-aligned stack allocation for connection requests (used by USB resolver) -#[cfg(feature="usb")] +#[cfg(feature = "usb")] #[repr(C, align(4096))] struct ConnectRequest { name: [u8; 64], len: u32, _padding: [u8; 4096 - 4 - 64], } -#[cfg(feature="usb")] +#[cfg(feature = "usb")] impl Default for ConnectRequest { fn default() -> Self { - ConnectRequest { name: [0u8; 64], len: 0, _padding: [0u8; 4096 - 4 - 64] } + ConnectRequest { + name: [0u8; 64], + len: 0, + _padding: [0u8; 4096 - 4 - 64], + } } } -#[cfg(feature="usb")] +#[cfg(feature = "usb")] #[derive(Debug, rkyv::Archive, rkyv::Serialize, rkyv::Deserialize, Copy, Clone)] pub struct UsbString { - pub s: xous_ipc::String::<4000>, + pub s: xous_ipc::String<4000>, pub sent: Option, } -#[cfg(feature="usb")] +#[cfg(feature = "usb")] fn usb_send_str(conn: xous::CID, s: &str) { let serializer = UsbString { s: xous_ipc::String::<4000>::from_str(s), - sent: None + sent: None, }; let buf = xous_ipc::Buffer::into_buf(serializer).expect("usb error"); // failures to send are silent & ignored; also, this API doesn't block. @@ -49,10 +53,10 @@ fn reader_thread(arg: usize) { writeln!(output, "LOG: Xous Logging Server starting up...").ok(); let server_addr = xous::create_server_with_address(b"xous-log-server ").expect("create server"); writeln!(output, "LOG: Server listening on address {:?}", server_addr).ok(); - #[cfg(feature="usb")] + #[cfg(feature = "usb")] let mut usb_serial: Option = None; // use a stack-allocated string to ensure no heap thrashing results from String manipulations - #[cfg(feature="usb")] + #[cfg(feature = "usb")] let mut usb_str = xous_ipc::String::<4000>::new(); println!("LOG: my PID is {}", xous::process::id()); @@ -118,9 +122,10 @@ fn reader_thread(arg: usize) { write!(output, ":{}", line.get()).ok(); } writeln!(output, ")").ok(); - #[cfg(feature="usb")] + #[cfg(feature = "usb")] if let Some(conn) = usb_serial { - if usb_str.len() > 0 { // test length so we aren't constantly copying 4096 bytes of 0's clearing an already cleared structure. + if usb_str.len() > 0 { + // test length so we aren't constantly copying 4096 bytes of 0's clearing an already cleared structure. usb_str.clear(); } // duplicate the above code because doing repeated calls to the USB stack is inefficient @@ -165,10 +170,15 @@ fn reader_thread(arg: usize) { buffer_length, ) }; - output.write_all(buffer).unwrap(); + for c in buffer { + if *c == b'\n' { + output.putc(b'\r'); + } + output.putc(*c); + } // TODO: If the buffer is mutable, set `length` to 0. - #[cfg(feature="usb")] + #[cfg(feature = "usb")] if let Some(conn) = usb_serial { // safety: this routine will just blow up if you try to pass non utf-8 to it, // so it's not very safe. On the other hand, it's fast and shame on you for sending diff --git a/services/xous-log/src/platform/hosted/implementation.rs b/services/xous-log/src/platform/hosted/implementation.rs index 8e8f507b6..d52c4c45e 100644 --- a/services/xous-log/src/platform/hosted/implementation.rs +++ b/services/xous-log/src/platform/hosted/implementation.rs @@ -71,20 +71,6 @@ impl OutputWriter { pub fn putc(&self, c: u8) { self.tx.send(ControlMessage::Byte(c)).unwrap(); } - - /// Write a buffer to the output and return the number of - /// bytes written. This is mostly compatible with `std::io::Write`, - /// except it is infallible. - pub fn write(&mut self, buf: &[u8]) -> usize { - for c in buf { - self.putc(*c); - } - buf.len() - } - - pub fn write_all(&mut self, buf: &[u8]) -> core::result::Result { - Ok(self.write(buf)) - } } impl Write for OutputWriter { diff --git a/services/xous-log/src/platform/precursor/implementation.rs b/services/xous-log/src/platform/precursor/implementation.rs index 9570d70b9..f77b7bb4f 100644 --- a/services/xous-log/src/platform/precursor/implementation.rs +++ b/services/xous-log/src/platform/precursor/implementation.rs @@ -105,20 +105,6 @@ impl OutputWriter { // uart_csr.wfo(utra::uart::EV_PENDING_RX, 1); } } - - /// Write a buffer to the output and return the number of - /// bytes written. This is mostly compatible with `std::io::Write`, - /// except it is infallible. - pub fn write(&mut self, buf: &[u8]) -> usize { - for c in buf { - self.putc(*c); - } - buf.len() - } - - pub fn write_all(&mut self, buf: &[u8]) -> core::result::Result { - Ok(self.write(buf)) - } } impl Write for OutputWriter { diff --git a/utralib/src/lib.rs b/utralib/src/lib.rs index 94f7bfa82..b9208d1fb 100644 --- a/utralib/src/lib.rs +++ b/utralib/src/lib.rs @@ -1,3 +1,4 @@ #![cfg_attr(any(target_os = "none", not(feature = "std")), no_std)] pub mod generated; +#[cfg(not(any(windows, unix)))] pub use generated::*;