From a67841988fc2908719061fa969c8100531807a77 Mon Sep 17 00:00:00 2001 From: Mark Poliakov Date: Mon, 16 Jun 2025 09:42:43 +0300 Subject: [PATCH] maint: fix warnings related to new rustc --- boot/yboot/src/main.rs | 2 +- boot/yboot/src/mem.rs | 2 +- kernel/arch/interface/src/sync.rs | 4 ++-- kernel/driver/block/ahci/src/port.rs | 2 +- kernel/driver/bus/pci/src/space/mod.rs | 2 +- kernel/driver/bus/usb/src/device.rs | 2 +- kernel/driver/fs/ext2/src/dir/walk.rs | 4 ++-- kernel/driver/net/core/src/lib.rs | 2 +- .../driver/net/core/src/socket/local/mod.rs | 4 ++-- .../net/core/src/socket/tcp/listener.rs | 2 +- .../driver/net/core/src/socket/tcp/stream.rs | 2 +- kernel/driver/usb/xhci/src/ring/transfer.rs | 2 +- .../driver/virtio/core/src/transport/pci.rs | 2 +- kernel/driver/virtio/gpu/src/lib.rs | 2 +- kernel/lib/device-tree/src/tree.rs | 6 +++--- kernel/libk/libk-mm/src/process.rs | 2 +- kernel/libk/libk-util/src/lru_hash_table.rs | 4 ++-- kernel/libk/libk-util/src/ring.rs | 12 +++++------ kernel/libk/libk-util/src/string.rs | 2 +- kernel/libk/libk-util/src/sync/spin_rwlock.rs | 4 ++-- kernel/libk/src/device/display/console.rs | 2 +- kernel/libk/src/dma.rs | 4 ++-- kernel/libk/src/lib.rs | 1 - kernel/libk/src/task/process.rs | 4 +++- kernel/libk/src/task/sync.rs | 4 ++-- kernel/libk/src/task/thread.rs | 2 +- kernel/libk/src/vfs/filesystem.rs | 4 +++- lib/runtime/src/lib.rs | 1 + .../lib/ygglibc/src/headers/setjmp/riscv64.rs | 21 +++++++++++++++---- .../src/headers/stdio/printf/format.rs | 3 +-- .../lib/ygglibc/src/headers/stdlib/conv.rs | 4 ---- userspace/lib/ygglibc/src/io/buffer.rs | 12 ----------- userspace/lib/ygglibc/src/lib.rs | 2 -- 33 files changed, 63 insertions(+), 65 deletions(-) diff --git a/boot/yboot/src/main.rs b/boot/yboot/src/main.rs index 02bf1105..8546d435 100644 --- a/boot/yboot/src/main.rs +++ b/boot/yboot/src/main.rs @@ -93,7 +93,7 @@ fn locate_rsdp(st: &SystemTable) -> Option { fn boot_partition( image: Handle, bs: &BootServices, -) -> Result, Error> { +) -> Result, Error> { let loaded_image = bs.open_protocol_exclusive::(image)?; let device_handle = loaded_image.device(); diff --git a/boot/yboot/src/mem.rs b/boot/yboot/src/mem.rs index 272bc87b..1240c964 100644 --- a/boot/yboot/src/mem.rs +++ b/boot/yboot/src/mem.rs @@ -66,7 +66,7 @@ impl MemoryDescriptorExt for MemoryDescriptor { } } -pub fn memory_map(bs: &BootServices) -> Result { +pub fn memory_map(bs: &BootServices) -> Result, Error> { bs.memory_map(unsafe { &mut MMAP_BUFFER.data }) } diff --git a/kernel/arch/interface/src/sync.rs b/kernel/arch/interface/src/sync.rs index 7de21964..ec70f4b6 100644 --- a/kernel/arch/interface/src/sync.rs +++ b/kernel/arch/interface/src/sync.rs @@ -42,7 +42,7 @@ impl Spinlock { } } - pub fn lock(&self) -> SpinlockGuard { + pub fn lock(&self) -> SpinlockGuard<'_, A, T> { // Loop until the lock can be acquired if LOCK_HACK.load(Ordering::Acquire) { return SpinlockGuard { lock: self }; @@ -103,7 +103,7 @@ impl IrqSafeSpinlock { } /// Attempts to acquire a lock. IRQs will be disabled until the lock is released. - pub fn lock(&self) -> IrqSafeSpinlockGuard { + pub fn lock(&self) -> IrqSafeSpinlockGuard<'_, A, T> { // Disable IRQs to avoid IRQ handler trying to acquire the same lock let irq_guard = IrqGuard::acquire(); diff --git a/kernel/driver/block/ahci/src/port.rs b/kernel/driver/block/ahci/src/port.rs index 84caba99..82dc3e34 100644 --- a/kernel/driver/block/ahci/src/port.rs +++ b/kernel/driver/block/ahci/src/port.rs @@ -235,7 +235,7 @@ impl AhciPort { .await } - async fn submit(&self, command: &C) -> Result { + async fn submit(&self, command: &C) -> Result, AhciError> { if command.prd_count() > 2 { log::warn!("TODO: AHCI doesn't like 3+ PRD transfers"); return Err(AhciError::RegionTooLarge); diff --git a/kernel/driver/bus/pci/src/space/mod.rs b/kernel/driver/bus/pci/src/space/mod.rs index bd71551f..9035627a 100644 --- a/kernel/driver/bus/pci/src/space/mod.rs +++ b/kernel/driver/bus/pci/src/space/mod.rs @@ -349,7 +349,7 @@ pub trait PciConfigurationSpace { } /// Returns an iterator over the PCI capabilities - fn capability_iter(&self) -> CapabilityIterator { + fn capability_iter(&self) -> CapabilityIterator<'_, Self> { let status = PciStatusRegister::from_bits_retain(self.status()); let current = if status.contains(PciStatusRegister::CAPABILITIES_LIST) { diff --git a/kernel/driver/bus/usb/src/device.rs b/kernel/driver/bus/usb/src/device.rs index ab61f518..90af7038 100644 --- a/kernel/driver/bus/usb/src/device.rs +++ b/kernel/driver/bus/usb/src/device.rs @@ -166,7 +166,7 @@ impl UsbDeviceAccess { pub fn read_current_configuration( &self, - ) -> IrqSafeRwLockReadGuard> { + ) -> IrqSafeRwLockReadGuard<'_, Option> { self.current_configuration.read() } diff --git a/kernel/driver/fs/ext2/src/dir/walk.rs b/kernel/driver/fs/ext2/src/dir/walk.rs index 2e0cb173..3265794e 100644 --- a/kernel/driver/fs/ext2/src/dir/walk.rs +++ b/kernel/driver/fs/ext2/src/dir/walk.rs @@ -127,7 +127,7 @@ impl<'a> DirentIter<'a> { self.offset } - pub fn next_record(&mut self) -> Option> { + pub fn next_record(&mut self) -> Option> { if self.offset + size_of::() > self.block.len() { return None; } @@ -183,7 +183,7 @@ impl<'a> DirentIterMut<'a> { Self { fs, block, offset } } - pub fn next_record(&mut self) -> Option> { + pub fn next_record(&mut self) -> Option> { if self.offset + size_of::() > self.block.len() { return None; } diff --git a/kernel/driver/net/core/src/lib.rs b/kernel/driver/net/core/src/lib.rs index 1bfd339f..0c849ebf 100644 --- a/kernel/driver/net/core/src/lib.rs +++ b/kernel/driver/net/core/src/lib.rs @@ -1,4 +1,4 @@ -#![feature(map_try_insert, let_chains, result_flattening)] +#![feature(map_try_insert, let_chains)] #![allow(clippy::type_complexity, clippy::new_without_default)] #![no_std] diff --git a/kernel/driver/net/core/src/socket/local/mod.rs b/kernel/driver/net/core/src/socket/local/mod.rs index 2a45d61d..1e3e68b5 100644 --- a/kernel/driver/net/core/src/socket/local/mod.rs +++ b/kernel/driver/net/core/src/socket/local/mod.rs @@ -15,7 +15,7 @@ enum OwnedAddress { Anonymous(u64), } -pub fn load_address(bytes: &[u8]) -> Result { +pub fn load_address(bytes: &[u8]) -> Result, Error> { Ok(wire::from_slice(bytes)?) } @@ -76,7 +76,7 @@ pub fn write_ancillary( } impl OwnedAddress { - fn to_borrowed(&self) -> LocalSocketAddress { + fn to_borrowed(&self) -> LocalSocketAddress<'_> { match self { Self::Path(path) => LocalSocketAddress::Path(path.as_ref()), Self::Anonymous(anon) => LocalSocketAddress::Anonymous(*anon), diff --git a/kernel/driver/net/core/src/socket/tcp/listener.rs b/kernel/driver/net/core/src/socket/tcp/listener.rs index ff807dca..ebf50098 100644 --- a/kernel/driver/net/core/src/socket/tcp/listener.rs +++ b/kernel/driver/net/core/src/socket/tcp/listener.rs @@ -70,7 +70,7 @@ impl TcpListener { pub(super) fn poll_accept( &self, cx: &mut Context<'_>, - ) -> Poll>>> { + ) -> Poll>>> { let lock = self.pending_accept.lock(); self.accept_notify.register(cx.waker()); if !lock.is_empty() { diff --git a/kernel/driver/net/core/src/socket/tcp/stream.rs b/kernel/driver/net/core/src/socket/tcp/stream.rs index 3a94e93d..26156fa1 100644 --- a/kernel/driver/net/core/src/socket/tcp/stream.rs +++ b/kernel/driver/net/core/src/socket/tcp/stream.rs @@ -214,7 +214,7 @@ impl TcpStream { pub(super) fn poll_receive( &self, cx: &mut Context<'_>, - ) -> Poll, Error>> { + ) -> Poll, Error>> { let lock = self.connection.write(); match lock.poll_receive(cx) { Poll::Ready(Ok(())) => Poll::Ready(Ok(lock)), diff --git a/kernel/driver/usb/xhci/src/ring/transfer.rs b/kernel/driver/usb/xhci/src/ring/transfer.rs index cd062188..241dac59 100644 --- a/kernel/driver/usb/xhci/src/ring/transfer.rs +++ b/kernel/driver/usb/xhci/src/ring/transfer.rs @@ -94,7 +94,7 @@ impl TransferRing { }) } - pub fn transaction_builder(self: &Arc) -> Result { + pub fn transaction_builder(self: &Arc) -> Result, UsbError> { if self.shutdown.load(Ordering::Acquire) { return Err(UsbError::DeviceDisconnected); } diff --git a/kernel/driver/virtio/core/src/transport/pci.rs b/kernel/driver/virtio/core/src/transport/pci.rs index 2965fa8b..4ffb9401 100644 --- a/kernel/driver/virtio/core/src/transport/pci.rs +++ b/kernel/driver/virtio/core/src/transport/pci.rs @@ -40,7 +40,7 @@ impl Transport for PciTransport { true } - fn device_cfg(&self) -> Option<&DeviceMemoryIo<[u8]>> { + fn device_cfg(&self) -> Option<&DeviceMemoryIo<'_, [u8]>> { Some(&self.device_cfg) } diff --git a/kernel/driver/virtio/gpu/src/lib.rs b/kernel/driver/virtio/gpu/src/lib.rs index 660994c8..928403b3 100644 --- a/kernel/driver/virtio/gpu/src/lib.rs +++ b/kernel/driver/virtio/gpu/src/lib.rs @@ -161,7 +161,7 @@ impl VirtioGpu { Ok(()) } - fn begin_command(&self) -> CommandExecution { + fn begin_command(&self) -> CommandExecution<'_, T> { CommandExecution { transport: &self.transport, control: &self.queues.get().control, diff --git a/kernel/lib/device-tree/src/tree.rs b/kernel/lib/device-tree/src/tree.rs index e7ba4a20..9065741b 100644 --- a/kernel/lib/device-tree/src/tree.rs +++ b/kernel/lib/device-tree/src/tree.rs @@ -78,7 +78,7 @@ impl<'a> DeviceTree<'a> { } /// Returns the root node of this device tree - pub fn root(&self) -> TNode { + pub fn root(&self) -> TNode<'_> { self.index.root() } @@ -172,12 +172,12 @@ impl<'a> DeviceTree<'a> { } /// Returns an iterator over the memory regions specified by this device tree - pub fn memory_regions(&self) -> DeviceTreeMemoryRegionIter { + pub fn memory_regions(&self) -> DeviceTreeMemoryRegionIter<'_> { DeviceTreeMemoryRegionIter::new(self) } /// Returns an iterator over the reserved memory regions specified by this device tree - pub fn reserved_regions(&self) -> DeviceTreeReservedRegionIter { + pub fn reserved_regions(&self) -> DeviceTreeReservedRegionIter<'_> { DeviceTreeReservedRegionIter::new(self) } diff --git a/kernel/libk/libk-mm/src/process.rs b/kernel/libk/libk-mm/src/process.rs index 4629501b..dafa3dc1 100644 --- a/kernel/libk/libk-mm/src/process.rs +++ b/kernel/libk/libk-mm/src/process.rs @@ -524,7 +524,7 @@ impl ProcessAddressSpace { /// Same as [ProcessAddressSpace::translate], except the lock on the address space is held /// until the resulting [TranslateGuard] is dropped. - pub fn translate_lock(&self, address: usize) -> Result, Error> { + pub fn translate_lock(&self, address: usize) -> Result, Error> { let guard = self.inner.lock(); let address = guard.table.translate(address).map(|e| e.0)?; Ok(TranslateGuard { diff --git a/kernel/libk/libk-util/src/lru_hash_table.rs b/kernel/libk/libk-util/src/lru_hash_table.rs index d890263a..12391d73 100644 --- a/kernel/libk/libk-util/src/lru_hash_table.rs +++ b/kernel/libk/libk-util/src/lru_hash_table.rs @@ -51,7 +51,7 @@ impl LruCacheBucket { } impl LruCacheBucket { - pub fn entry_mut(&mut self, key: &K) -> EntryMut { + pub fn entry_mut(&mut self, key: &K) -> EntryMut<'_, K, V> { let mut cursor = self.data.cursor_front_mut(); loop { @@ -125,7 +125,7 @@ impl LruCache { .find_map(|bucket| bucket.pop_front()) } - pub fn flush(&mut self) -> FlushIter { + pub fn flush(&mut self) -> FlushIter<'_, K, V, H> { FlushIter { cache: self } } } diff --git a/kernel/libk/libk-util/src/ring.rs b/kernel/libk/libk-util/src/ring.rs index 98425a30..6927b23f 100644 --- a/kernel/libk/libk-util/src/ring.rs +++ b/kernel/libk/libk-util/src/ring.rs @@ -203,7 +203,7 @@ impl LossyRingQueue { } #[inline] - pub fn try_read_lock(&self) -> Option>> { + pub fn try_read_lock(&self) -> Option>> { let lock = self.ring.lock(); lock.is_readable().then_some(lock) } @@ -214,12 +214,12 @@ impl LossyRingQueue { unsafe { lock.read_single_unchecked() } } - pub async fn read_lock(&self) -> IrqSafeSpinlockGuard> { + pub async fn read_lock(&self) -> IrqSafeSpinlockGuard<'_, RingBuffer> { poll_fn(|cx| self.poll_lock(cx)).await } #[inline] - pub fn poll_lock(&self, cx: &mut Context<'_>) -> Poll>> { + pub fn poll_lock(&self, cx: &mut Context<'_>) -> Poll>> { self.read_notify.register(cx.waker()); if let Some(lock) = self.try_read_lock() { self.read_notify.remove(cx.waker()); @@ -284,7 +284,7 @@ impl BlockingRingQueue { true } - pub async fn read_lock(&self) -> IrqSafeSpinlockGuard> { + pub async fn read_lock(&self) -> IrqSafeSpinlockGuard<'_, RingBuffer> { poll_fn(|cx| self.poll_read_lock(cx)).await } @@ -292,7 +292,7 @@ impl BlockingRingQueue { pub fn poll_read_lock( &self, cx: &mut Context<'_>, - ) -> Poll>> { + ) -> Poll>> { if let Some(lock) = self.try_read_lock() { self.read_notify.remove(cx.waker()); Poll::Ready(lock) @@ -303,7 +303,7 @@ impl BlockingRingQueue { } #[inline] - pub fn try_read_lock(&self) -> Option>> { + pub fn try_read_lock(&self) -> Option>> { let lock = self.ring.lock(); lock.is_readable().then_some(lock) } diff --git a/kernel/libk/libk-util/src/string.rs b/kernel/libk/libk-util/src/string.rs index 5fc190c8..838eb831 100644 --- a/kernel/libk/libk-util/src/string.rs +++ b/kernel/libk/libk-util/src/string.rs @@ -28,7 +28,7 @@ impl Utf16LeStr { core::mem::transmute(raw) } - pub fn chars(&self) -> Utf16LeIter { + pub fn chars(&self) -> Utf16LeIter<'_> { Utf16LeIter { chars: self.raw.chunks_exact(size_of::()), } diff --git a/kernel/libk/libk-util/src/sync/spin_rwlock.rs b/kernel/libk/libk-util/src/sync/spin_rwlock.rs index e66cabf1..e21b246d 100644 --- a/kernel/libk/libk-util/src/sync/spin_rwlock.rs +++ b/kernel/libk/libk-util/src/sync/spin_rwlock.rs @@ -131,7 +131,7 @@ impl IrqSafeRwLock { } } - pub fn read(&self) -> IrqSafeRwLockReadGuard { + pub fn read(&self) -> IrqSafeRwLockReadGuard<'_, T> { let guard = IrqGuard::acquire(); self.inner.acquire_read(); IrqSafeRwLockReadGuard { @@ -140,7 +140,7 @@ impl IrqSafeRwLock { } } - pub fn write(&self) -> IrqSafeRwLockWriteGuard { + pub fn write(&self) -> IrqSafeRwLockWriteGuard<'_, T> { let guard = IrqGuard::acquire(); self.inner.acquire_write(); IrqSafeRwLockWriteGuard { diff --git a/kernel/libk/src/device/display/console.rs b/kernel/libk/src/device/display/console.rs index ff616b3f..d8b48078 100644 --- a/kernel/libk/src/device/display/console.rs +++ b/kernel/libk/src/device/display/console.rs @@ -284,7 +284,7 @@ impl ConsoleBuffer { } /// Returns an iterator over dirty rows, while clearing dirty flag for them - pub fn flush_rows(&mut self) -> RowIter { + pub fn flush_rows(&mut self) -> RowIter<'_> { RowIter { buffer: self, index: 0, diff --git a/kernel/libk/src/dma.rs b/kernel/libk/src/dma.rs index bcfd07fb..7a6a0369 100644 --- a/kernel/libk/src/dma.rs +++ b/kernel/libk/src/dma.rs @@ -198,7 +198,7 @@ impl DmaBuffer<[T]> { assert!(range.start <= range.end, "Invalid DMA slice range"); } - pub fn slice(&self, range: Range) -> DmaSlice { + pub fn slice(&self, range: Range) -> DmaSlice<'_, T> { self.slice_range_check(&range); DmaSlice { buffer: self, @@ -206,7 +206,7 @@ impl DmaBuffer<[T]> { } } - pub fn slice_mut(&mut self, range: Range) -> DmaSliceMut { + pub fn slice_mut(&mut self, range: Range) -> DmaSliceMut<'_, T> { self.slice_range_check(&range); DmaSliceMut { buffer: self, diff --git a/kernel/libk/src/lib.rs b/kernel/libk/src/lib.rs index 59c77932..6edd90dc 100644 --- a/kernel/libk/src/lib.rs +++ b/kernel/libk/src/lib.rs @@ -18,7 +18,6 @@ arbitrary_self_types, slice_split_once, arbitrary_self_types_pointers, - result_flattening, negative_impls, decl_macro, optimize_attribute diff --git a/kernel/libk/src/task/process.rs b/kernel/libk/src/task/process.rs index 7538fe2c..1945e539 100644 --- a/kernel/libk/src/task/process.rs +++ b/kernel/libk/src/task/process.rs @@ -464,7 +464,9 @@ impl Process { } } - fn poll_any_child_exit(&self) -> Option<(Arc, IrqSafeRwLockWriteGuard)> { + fn poll_any_child_exit( + &self, + ) -> Option<(Arc, IrqSafeRwLockWriteGuard<'_, ProcessInner>)> { let read = self.inner.read(); if let Some(child) = read.any_exited_child() { let write = IrqSafeRwLockReadGuard::upgrade(read); diff --git a/kernel/libk/src/task/sync.rs b/kernel/libk/src/task/sync.rs index 5e4b4517..04f5f0a4 100644 --- a/kernel/libk/src/task/sync.rs +++ b/kernel/libk/src/task/sync.rs @@ -59,7 +59,7 @@ impl AsyncMutex { .is_ok() } - pub fn poll_lock(&self, cx: &mut Context<'_>) -> Poll> { + pub fn poll_lock(&self, cx: &mut Context<'_>) -> Poll> { self.waker.register(cx.waker()); if self.try_lock() { @@ -70,7 +70,7 @@ impl AsyncMutex { Poll::Pending } - pub async fn lock(&self) -> AsyncMutexGuard { + pub async fn lock(&self) -> AsyncMutexGuard<'_, T> { poll_fn(|cx| self.poll_lock(cx)).await } diff --git a/kernel/libk/src/task/thread.rs b/kernel/libk/src/task/thread.rs index 7b4b644a..4fe107fc 100644 --- a/kernel/libk/src/task/thread.rs +++ b/kernel/libk/src/task/thread.rs @@ -552,7 +552,7 @@ impl Thread { self.enqueue(); } - pub fn hold_suspended(&self) -> Result { + pub fn hold_suspended(&self) -> Result, Error> { let sched = self.sched.lock(); if sched.state == ThreadState::Running { return Err(Error::InvalidOperation); diff --git a/kernel/libk/src/vfs/filesystem.rs b/kernel/libk/src/vfs/filesystem.rs index ba78c0b5..217f11a1 100644 --- a/kernel/libk/src/vfs/filesystem.rs +++ b/kernel/libk/src/vfs/filesystem.rs @@ -23,7 +23,9 @@ pub enum FilesystemMountOption<'a> { FsSpecific(&'a str), } -pub fn parse_mount_options(options: Option<&str>) -> impl Iterator { +pub fn parse_mount_options( + options: Option<&str>, +) -> impl Iterator> { options .unwrap_or("") .trim() diff --git a/lib/runtime/src/lib.rs b/lib/runtime/src/lib.rs index 46ffe515..8897269a 100644 --- a/lib/runtime/src/lib.rs +++ b/lib/runtime/src/lib.rs @@ -9,6 +9,7 @@ generic_const_exprs, maybe_uninit_array_assume_init )] +#![allow(stable_features)] // TODO sync userspace rustc with cross-rustc #![no_std] #![warn(missing_docs)] #![allow(nonstandard_style, clippy::new_without_default, incomplete_features)] diff --git a/userspace/lib/ygglibc/src/headers/setjmp/riscv64.rs b/userspace/lib/ygglibc/src/headers/setjmp/riscv64.rs index dd1ba9fb..4581e0cd 100644 --- a/userspace/lib/ygglibc/src/headers/setjmp/riscv64.rs +++ b/userspace/lib/ygglibc/src/headers/setjmp/riscv64.rs @@ -1,11 +1,18 @@ use core::ffi::c_int; pub type __jmp_buf = [usize; 8]; +pub type __sigjmp_buf = [usize; 8]; // TODO +#[no_mangle] +#[unsafe(naked)] +unsafe extern "C" fn sigsetjmp(buf: *mut __sigjmp_buf, savesigs: c_int) -> c_int { + // TODO: I don't yet have signal masking + core::arch::naked_asm!("j setjmp") +} #[no_mangle] -#[naked] +#[unsafe(naked)] unsafe extern "C" fn setjmp(buf: *mut __jmp_buf) -> c_int { core::arch::naked_asm!( r#" @@ -15,13 +22,13 @@ unsafe extern "C" fn setjmp(buf: *mut __jmp_buf) -> c_int { } #[no_mangle] -#[naked] +#[unsafe(naked)] unsafe extern "C" fn _setjmp(buf: *mut __jmp_buf) -> c_int { core::arch::naked_asm!("j ."); } #[no_mangle] -#[naked] +#[unsafe(naked)] unsafe extern "C" fn longjmp(buf: *mut __jmp_buf, val: c_int) -> c_int { core::arch::naked_asm!( r#" @@ -31,7 +38,13 @@ unsafe extern "C" fn longjmp(buf: *mut __jmp_buf, val: c_int) -> c_int { } #[no_mangle] -#[naked] +#[unsafe(naked)] +unsafe extern "C" fn siglongjmp(buf: *mut __sigjmp_buf, val: c_int) -> ! { + core::arch::naked_asm!("j longjmp") +} + +#[no_mangle] +#[unsafe(naked)] unsafe extern "C" fn _longjmp(buf: *mut __jmp_buf, val: c_int) -> c_int { core::arch::naked_asm!("j .") } diff --git a/userspace/lib/ygglibc/src/headers/stdio/printf/format.rs b/userspace/lib/ygglibc/src/headers/stdio/printf/format.rs index cc6a89f0..4abafed2 100644 --- a/userspace/lib/ygglibc/src/headers/stdio/printf/format.rs +++ b/userspace/lib/ygglibc/src/headers/stdio/printf/format.rs @@ -1,7 +1,6 @@ use core::{ ffi::{ - c_char, c_double, c_int, c_long, c_longlong, c_short, c_uchar, c_uint, c_ulong, - c_ulonglong, c_ushort, CStr, VaList, + c_char, c_double, c_int, c_long, c_longlong, c_uint, c_ulong, c_ulonglong, CStr, VaList, }, fmt, }; diff --git a/userspace/lib/ygglibc/src/headers/stdlib/conv.rs b/userspace/lib/ygglibc/src/headers/stdlib/conv.rs index 2b9c64f3..27ea860c 100644 --- a/userspace/lib/ygglibc/src/headers/stdlib/conv.rs +++ b/userspace/lib/ygglibc/src/headers/stdlib/conv.rs @@ -142,8 +142,6 @@ enum Radix { trait StrToInt { type Unsigned: StrToUint; - const ZERO: Self; - fn from_unsigned(value: Self::Unsigned, sign: bool) -> Self; } @@ -173,7 +171,6 @@ impl Radix { impl StrToInt for i32 { type Unsigned = u32; - const ZERO: Self = 0; fn from_unsigned(value: Self::Unsigned, sign: bool) -> Self { match sign { @@ -185,7 +182,6 @@ impl StrToInt for i32 { impl StrToInt for i64 { type Unsigned = u64; - const ZERO: Self = 0; fn from_unsigned(value: Self::Unsigned, sign: bool) -> Self { match sign { diff --git a/userspace/lib/ygglibc/src/io/buffer.rs b/userspace/lib/ygglibc/src/io/buffer.rs index 4632e17d..9d6378f6 100644 --- a/userspace/lib/ygglibc/src/io/buffer.rs +++ b/userspace/lib/ygglibc/src/io/buffer.rs @@ -29,7 +29,6 @@ pub trait FileWriter: Write { fn is_line_buffered(&self) -> bool; fn capacity(&self) -> usize; fn pending_bytes(&self) -> usize; - fn reset(&mut self); } pub struct UnbufferedWriter { @@ -131,8 +130,6 @@ impl Write for UnbufferedWriter { } impl FileWriter for UnbufferedWriter { - fn reset(&mut self) {} - fn pending_bytes(&self) -> usize { 0 } @@ -192,10 +189,6 @@ impl Write for FullBufferedWriter { } impl FileWriter for FullBufferedWriter { - fn reset(&mut self) { - self.buffer.clear(); - } - fn pending_bytes(&self) -> usize { self.buffer.len() } @@ -249,11 +242,6 @@ impl Write for LineBufferedWriter { } impl FileWriter for LineBufferedWriter { - fn reset(&mut self) { - self.inner.reset(); - self.need_flush = false; - } - fn pending_bytes(&self) -> usize { self.inner.pending_bytes() } diff --git a/userspace/lib/ygglibc/src/lib.rs b/userspace/lib/ygglibc/src/lib.rs index 2d67db33..aa3e347a 100644 --- a/userspace/lib/ygglibc/src/lib.rs +++ b/userspace/lib/ygglibc/src/lib.rs @@ -8,8 +8,6 @@ slice_internals, linkage, rustc_private, - naked_functions, - non_null_from_ref, thread_local, let_chains, int_roundings,