Skip to content

Commit 0c670c4

Browse files
committed
refactor: use #![feature(pin_macro)]
`core::pin::pin!` was unstably added by [rust-lang/rust#93176][1]. This replaces `pin_utils::pin_mut!`. [1]: rust-lang/rust#93176
1 parent 76df6ea commit 0c670c4

File tree

7 files changed

+10
-10
lines changed

7 files changed

+10
-10
lines changed

Cargo.lock

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/r3_kernel/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ _full = []
3131
[dependencies]
3232
num-integer = { version = "0.1.42", default-features = false }
3333
num-traits = { version = "0.2.11", default-features = false }
34-
pin-utils = { version = "0.1.0" }
3534
svgbobdoc = { version = "0.3.0" }
3635
tokenlock = { version = "0.3.4", default-features = false }
3736
arrayvec = { version = "0.7.1", default-features = false }

src/r3_kernel/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#![feature(const_swap)]
2929
#![feature(never_type)] // `!`
3030
#![feature(decl_macro)]
31+
#![feature(pin_macro)]
3132
#![feature(let_else)]
3233
#![feature(doc_cfg)] // `#[doc(cfg(...))]`
3334
#![deny(unsafe_op_in_unsafe_fn)]

src/r3_kernel/src/wait.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use core::{cell::Cell, fmt, ops, ptr::NonNull};
1+
use core::{cell::Cell, fmt, ops, pin::pin, ptr::NonNull};
22
use r3_core::{
33
kernel::{EventGroupBits, EventGroupWaitFlags, WaitError, WaitTimeoutError},
44
utils::Init,
@@ -233,8 +233,11 @@ impl<Traits: PortThreading> Init for TaskWait<Traits> {
233233
macro_rules! setup_timeout_wait {
234234
($lock:ident, $task_cb:expr, $duration_time32:expr) => {
235235
// Create a timeout object.
236-
let timeout = new_timeout_object_for_task($lock.borrow_mut(), $task_cb, $duration_time32);
237-
pin_utils::pin_mut!(timeout);
236+
let timeout = pin!(new_timeout_object_for_task(
237+
$lock.borrow_mut(),
238+
$task_cb,
239+
$duration_time32
240+
));
238241

239242
// Use `TimeoutGuard` to automatically unregister the timeout when
240243
// leaving the current lexical scope.

src/r3_test_runner/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ env_logger = { version = "0.8.4" }
1919
serde_json = { version = "1.0.57" }
2020
serialport = { version = "4.0.0" }
2121
itertools = { version = "0.10.0" }
22-
pin-utils = { version = "0.1.0" }
2322
thiserror = { version = "1.0.20" }
2423
probe-rs = { version = "0.12.0" }
2524
tempdir = { version = "0.3.7" }

src/r3_test_runner/src/driverinterface.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use std::{
33
fmt::Write,
44
future::Future,
55
path::{Path, PathBuf},
6-
pin::Pin,
6+
pin::{pin, Pin},
77
time::Duration,
88
};
99
use tokio::io::AsyncReadExt;
@@ -480,8 +480,7 @@ async fn read_to_end_timeout(
480480
) -> tokio::io::Result<Vec<u8>> {
481481
let mut output = Vec::new();
482482
let mut buffer = vec![0u8; 16384];
483-
let timeout_fut = tokio::time::sleep(timeout);
484-
pin_utils::pin_mut!(timeout_fut);
483+
let mut timeout_fut = pin!(tokio::time::sleep(timeout));
485484

486485
log::trace!("read_to_end_timeout: Got a stream");
487486

src/r3_test_runner/src/main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#![feature(generic_arg_infer)]
33
#![feature(must_not_suspend)] // `must_not_suspend` lint
44
#![feature(decl_macro)] // `macro`
5+
#![feature(pin_macro)] // `core::pin::pin!`
56
#![feature(let_else)] // `let ... = ... else { ... }`
67
#![warn(must_not_suspend)]
78
use anyhow::Context;

0 commit comments

Comments
 (0)