From b72178756eccb0c8cb4450eabc3073a56a739680 Mon Sep 17 00:00:00 2001 From: whitequark Date: Mon, 25 Dec 2017 17:16:05 +0000 Subject: [PATCH] firmware: fix compatibility with newer rustc. NFC. --- artiq/firmware/ksupport/lib.rs | 6 +++--- artiq/firmware/runtime/config.rs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/artiq/firmware/ksupport/lib.rs b/artiq/firmware/ksupport/lib.rs index 904c069e1..d7ea126ae 100644 --- a/artiq/firmware/ksupport/lib.rs +++ b/artiq/firmware/ksupport/lib.rs @@ -167,7 +167,7 @@ extern fn rpc_recv(slot: *mut ()) -> usize { }) } -fn terminate(exception: &eh::Exception, mut backtrace: &mut [usize]) -> ! { +fn terminate(exception: &eh::Exception, backtrace: &mut [usize]) -> ! { let mut cursor = 0; for index in 0..backtrace.len() { if backtrace[index] > kernel_proto::KERNELCPU_PAYLOAD_ADDRESS { @@ -333,8 +333,8 @@ extern fn dma_record_output_wide(timestamp: i64, channel: i32, address: i32, wor if DMA_RECORDER.buffer.len() - DMA_RECORDER.data_len < length { dma_record_flush() } - let mut dst = &mut DMA_RECORDER.buffer[DMA_RECORDER.data_len.. - DMA_RECORDER.data_len + length]; + let dst = &mut DMA_RECORDER.buffer[DMA_RECORDER.data_len.. + DMA_RECORDER.data_len + length]; dst[..header_length].copy_from_slice(&header[..]); dst[header_length..].copy_from_slice(&data[..]); DMA_RECORDER.data_len += length; diff --git a/artiq/firmware/runtime/config.rs b/artiq/firmware/runtime/config.rs index c4b45ee6c..4a1407a08 100644 --- a/artiq/firmware/runtime/config.rs +++ b/artiq/firmware/runtime/config.rs @@ -10,9 +10,9 @@ mod imp { mod lock { use core::slice; - use core::sync::atomic::{AtomicUsize, Ordering}; + use core::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT}; - static LOCKED: AtomicUsize = AtomicUsize::new(0); + static LOCKED: AtomicUsize = ATOMIC_USIZE_INIT; pub struct Lock;