From 8ec08c9c7622133570d8266ca5890400179f2db0 Mon Sep 17 00:00:00 2001 From: bunnie Date: Thu, 4 Jan 2024 19:15:28 +0800 Subject: [PATCH] fix rust v1.75.0 warnings that are probably benign a lot of re-import warnings have cropped up. While I appreciate their studiousness on this, the problem is that removing some of these exports in the API crate could mean that future users who want access to some API features that aren't used in this configuration are now unaccessible. I think it's not a huge problem at the moment, just spam-cleaning the warnings because there are too many to deal with carefully at the moment. --- RELEASE-v0.9.md | 3 +++ kernel/src/services.rs | 1 + libs/mass-storage/packing/packing/src/lib.rs | 1 + .../packing/packing/src/primitive_packing/mod.rs | 2 ++ libs/mass-storage/usbd_scsi/src/scsi/enums/mod.rs | 2 ++ loader/curve25519-dalek-loader/src/field.rs | 1 + locales/src/lib.rs | 1 - services/net/src/api.rs | 1 + services/pddb/src/backend.rs | 1 - services/root-keys/src/api.rs | 1 - services/root-keys/src/lib.rs | 1 + services/usb-device-xous/src/mappings.rs | 2 +- .../src/platform/precursor/implementation.rs | 14 -------------- utralib/src/lib.rs | 1 + 14 files changed, 14 insertions(+), 18 deletions(-) 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/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/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/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::*;