Skip to content

Commit 0521d0a

Browse files
authored
Merge branch 'master' into programmatic-backtraces
2 parents ede6e06 + 2f89914 commit 0521d0a

File tree

3 files changed

+29
-10
lines changed

3 files changed

+29
-10
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ run loom tests that test unstable features.
201201
You can run miri tests with
202202
```
203203
MIRIFLAGS="-Zmiri-disable-isolation -Zmiri-strict-provenance -Zmiri-retag-fields" \
204-
cargo +nightly miri test --features full --lib
204+
cargo +nightly miri test --features full --lib --tests
205205
```
206206

207207
### Performing spellcheck on tokio codebase

tokio/src/runtime/io/registration_set.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,17 +106,20 @@ impl RegistrationSet {
106106

107107
for io in pending {
108108
// safety: the registration is part of our list
109-
unsafe { self.remove(synced, io.as_ref()) }
109+
unsafe { self.remove(synced, &io) }
110110
}
111111

112112
self.num_pending_release.store(0, Release);
113113
}
114114

115115
// This function is marked as unsafe, because the caller must make sure that
116116
// `io` is part of the registration set.
117-
pub(super) unsafe fn remove(&self, synced: &mut Synced, io: &ScheduledIo) {
118-
super::EXPOSE_IO.unexpose_provenance(io);
119-
let _ = synced.registrations.remove(io.into());
117+
pub(super) unsafe fn remove(&self, synced: &mut Synced, io: &Arc<ScheduledIo>) {
118+
// SAFETY: Pointers into an Arc are never null.
119+
let io = unsafe { NonNull::new_unchecked(Arc::as_ptr(io).cast_mut()) };
120+
121+
super::EXPOSE_IO.unexpose_provenance(io.as_ptr());
122+
let _ = synced.registrations.remove(io);
120123
}
121124
}
122125

tokio/tests/io_async_fd.rs

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![warn(rust_2018_idioms)]
2-
#![cfg(all(unix, feature = "full", not(miri)))]
2+
#![cfg(all(unix, feature = "full"))]
33

44
use std::os::unix::io::{AsRawFd, RawFd};
55
use std::sync::{
@@ -148,6 +148,7 @@ fn drain(mut fd: &FileDescriptor, mut amt: usize) {
148148
}
149149

150150
#[tokio::test]
151+
#[cfg_attr(miri, ignore)] // No F_GETFL for fcntl in miri.
151152
async fn initially_writable() {
152153
let (a, b) = socketpair();
153154

@@ -166,6 +167,7 @@ async fn initially_writable() {
166167
}
167168

168169
#[tokio::test]
170+
#[cfg_attr(miri, ignore)] // No F_GETFL for fcntl in miri.
169171
async fn reset_readable() {
170172
let (a, mut b) = socketpair();
171173

@@ -210,6 +212,7 @@ async fn reset_readable() {
210212
}
211213

212214
#[tokio::test]
215+
#[cfg_attr(miri, ignore)] // No F_GETFL for fcntl in miri.
213216
async fn reset_writable() {
214217
let (a, b) = socketpair();
215218

@@ -247,6 +250,7 @@ impl<T: AsRawFd> AsRawFd for ArcFd<T> {
247250
}
248251

249252
#[tokio::test]
253+
#[cfg_attr(miri, ignore)] // No F_GETFL for fcntl in miri.
250254
async fn drop_closes() {
251255
let (a, mut b) = socketpair();
252256

@@ -287,6 +291,7 @@ async fn drop_closes() {
287291
}
288292

289293
#[tokio::test]
294+
#[cfg_attr(miri, ignore)] // No F_GETFL for fcntl in miri.
290295
async fn reregister() {
291296
let (a, _b) = socketpair();
292297

@@ -296,6 +301,7 @@ async fn reregister() {
296301
}
297302

298303
#[tokio::test]
304+
#[cfg_attr(miri, ignore)] // No F_GETFL for fcntl in miri.
299305
async fn try_io() {
300306
let (a, mut b) = socketpair();
301307

@@ -331,6 +337,7 @@ async fn try_io() {
331337
}
332338

333339
#[tokio::test]
340+
#[cfg_attr(miri, ignore)] // No F_GETFL for fcntl in miri.
334341
async fn multiple_waiters() {
335342
let (a, mut b) = socketpair();
336343
let afd_a = Arc::new(AsyncFd::new(a).unwrap());
@@ -379,6 +386,7 @@ async fn multiple_waiters() {
379386
}
380387

381388
#[tokio::test]
389+
#[cfg_attr(miri, ignore)] // No F_GETFL for fcntl in miri.
382390
async fn poll_fns() {
383391
let (a, b) = socketpair();
384392
let afd_a = Arc::new(AsyncFd::new(a).unwrap());
@@ -472,6 +480,7 @@ fn rt() -> tokio::runtime::Runtime {
472480
}
473481

474482
#[test]
483+
#[cfg_attr(miri, ignore)] // No F_GETFL for fcntl in miri.
475484
fn driver_shutdown_wakes_currently_pending() {
476485
let rt = rt();
477486

@@ -493,6 +502,7 @@ fn driver_shutdown_wakes_currently_pending() {
493502
}
494503

495504
#[test]
505+
#[cfg_attr(miri, ignore)] // No F_GETFL for fcntl in miri.
496506
fn driver_shutdown_wakes_future_pending() {
497507
let rt = rt();
498508

@@ -508,6 +518,7 @@ fn driver_shutdown_wakes_future_pending() {
508518
}
509519

510520
#[test]
521+
#[cfg_attr(miri, ignore)] // No F_GETFL for fcntl in miri.
511522
fn driver_shutdown_wakes_pending_race() {
512523
// TODO: make this a loom test
513524
for _ in 0..100 {
@@ -538,6 +549,7 @@ async fn poll_writable<T: AsRawFd>(fd: &AsyncFd<T>) -> std::io::Result<AsyncFdRe
538549
}
539550

540551
#[test]
552+
#[cfg_attr(miri, ignore)] // No F_GETFL for fcntl in miri.
541553
fn driver_shutdown_wakes_currently_pending_polls() {
542554
let rt = rt();
543555

@@ -560,6 +572,7 @@ fn driver_shutdown_wakes_currently_pending_polls() {
560572
}
561573

562574
#[test]
575+
#[cfg_attr(miri, ignore)] // No F_GETFL for fcntl in miri.
563576
fn driver_shutdown_wakes_poll() {
564577
let rt = rt();
565578

@@ -576,6 +589,7 @@ fn driver_shutdown_wakes_poll() {
576589
}
577590

578591
#[test]
592+
#[cfg_attr(miri, ignore)] // No F_GETFL for fcntl in miri.
579593
fn driver_shutdown_then_clear_readiness() {
580594
let rt = rt();
581595

@@ -593,6 +607,7 @@ fn driver_shutdown_then_clear_readiness() {
593607
}
594608

595609
#[test]
610+
#[cfg_attr(miri, ignore)] // No F_GETFL for fcntl in miri.
596611
fn driver_shutdown_wakes_poll_race() {
597612
// TODO: make this a loom test
598613
for _ in 0..100 {
@@ -615,6 +630,7 @@ fn driver_shutdown_wakes_poll_race() {
615630
}
616631

617632
#[tokio::test]
633+
#[cfg_attr(miri, ignore)] // No socket in miri.
618634
#[cfg(any(target_os = "linux", target_os = "android"))]
619635
async fn priority_event_on_oob_data() {
620636
use std::net::SocketAddr;
@@ -655,7 +671,7 @@ fn send_oob_data<S: AsRawFd>(stream: &S, data: &[u8]) -> io::Result<usize> {
655671
}
656672

657673
#[tokio::test]
658-
#[cfg_attr(miri, ignore)]
674+
#[cfg_attr(miri, ignore)] // No F_GETFL for fcntl in miri.
659675
async fn clear_ready_matching_clears_ready() {
660676
use tokio::io::{Interest, Ready};
661677

@@ -679,7 +695,7 @@ async fn clear_ready_matching_clears_ready() {
679695
}
680696

681697
#[tokio::test]
682-
#[cfg_attr(miri, ignore)]
698+
#[cfg_attr(miri, ignore)] // No F_GETFL for fcntl in miri.
683699
async fn clear_ready_matching_clears_ready_mut() {
684700
use tokio::io::{Interest, Ready};
685701

@@ -703,8 +719,8 @@ async fn clear_ready_matching_clears_ready_mut() {
703719
}
704720

705721
#[tokio::test]
722+
#[cfg_attr(miri, ignore)] // No socket in miri.
706723
#[cfg(target_os = "linux")]
707-
#[cfg_attr(miri, ignore)]
708724
async fn await_error_readiness_timestamping() {
709725
use std::net::{Ipv4Addr, SocketAddr};
710726

@@ -760,8 +776,8 @@ fn configure_timestamping_socket(udp_socket: &std::net::UdpSocket) -> std::io::R
760776
}
761777

762778
#[tokio::test]
779+
#[cfg_attr(miri, ignore)] // No F_GETFL for fcntl in miri.
763780
#[cfg(target_os = "linux")]
764-
#[cfg_attr(miri, ignore)]
765781
async fn await_error_readiness_invalid_address() {
766782
use std::net::{Ipv4Addr, SocketAddr};
767783
use tokio::io::{Interest, Ready};

0 commit comments

Comments
 (0)