id stringlengths 22 133 | text stringlengths 40 40.2k | arch stringclasses 1
value | syntax stringclasses 1
value | kind stringclasses 4
values | repo stringclasses 27
values | path stringlengths 5 116 | license stringclasses 6
values | commit stringlengths 40 40 | source_host stringclasses 1
value | category stringclasses 16
values | source_url stringlengths 85 196 | line_start int64 1 4.28k | line_end int64 4 4.31k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
tokio-rs/tokio:tokio/src/util/slab/slot.rs:1 | use crate::loom::cell::CausalCell;
use crate::util::slab::{Entry, Generation};
/// Stores an entry in the slab.
pub(super) struct Slot<T> {
next: CausalCell<usize>,
entry: T,
}
impl<T: Entry> Slot<T> {
/// Initialize a new `Slot` linked to `next`.
///
/// The entry is initialized to a default valu... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/slab/slot.rs | MIT | 8656b7b8eb6f3635ec40694eb71f14fb84211e05 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8656b7b8eb6f3635ec40694eb71f14fb84211e05/tokio/src/util/slab/slot.rs | 1 | 42 |
tokio-rs/tokio:tokio/src/util/slab/slot.rs:1 | use crate::loom::cell::CausalCell;
use crate::util::slab::{Generation, Entry};
/// Stores an entry in the slab.
pub(super) struct Slot<T> {
next: CausalCell<usize>,
entry: T,
}
impl<T: Entry> Slot<T> {
/// Initialize a new `Slot` linked to `next`.
///
/// The entry is initialized to a default valu... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/slab/slot.rs | MIT | 69975fb9601bbb21659db283d888470733bae660 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/69975fb9601bbb21659db283d888470733bae660/tokio/src/util/slab/slot.rs | 1 | 42 |
tokio-rs/tokio:tokio/src/util/slab/stack.rs:1 | use crate::loom::sync::atomic::AtomicUsize;
use crate::util::slab::Address;
use std::fmt;
use std::sync::atomic::Ordering;
use std::usize;
pub(super) struct TransferStack {
head: AtomicUsize,
}
impl TransferStack {
pub(super) fn new() -> Self {
Self {
head: AtomicUsize::new(Address::NULL)... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/slab/stack.rs | MIT | 69975fb9601bbb21659db283d888470733bae660 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/69975fb9601bbb21659db283d888470733bae660/tokio/src/util/slab/stack.rs | 1 | 58 |
tokio-rs/tokio:tokio/src/util/slab/tests/loom_slab.rs:1 | use crate::io::driver::ScheduledIo;
use crate::util::slab::{Address, Slab};
use loom::sync::{Arc, Condvar, Mutex};
use loom::thread;
#[test]
fn local_remove() {
loom::model(|| {
let slab = Arc::new(Slab::new());
let s = slab.clone();
let t1 = thread::spawn(move || {
let idx = ... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/util/slab/tests/loom_slab.rs | MIT | 942feab040e28d1e1547012a0fb81212299e6596 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/942feab040e28d1e1547012a0fb81212299e6596/tokio/src/util/slab/tests/loom_slab.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/util/slab/tests/loom_slab.rs:2 | assert_eq!(get_val(&s, idx1), None);
assert_eq!(get_val(&s, idx2), Some(6));
s.remove(idx2);
assert_eq!(get_val(&s, idx2), None);
t1.join().expect("thread 1 should not panic");
t2.join().expect("thread 2 should not panic");
});
}
#[test]
fn remove_remote() {
loom::model... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/util/slab/tests/loom_slab.rs | MIT | 942feab040e28d1e1547012a0fb81212299e6596 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/942feab040e28d1e1547012a0fb81212299e6596/tokio/src/util/slab/tests/loom_slab.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/util/slab/tests/loom_slab.rs:3 | assert_eq!(get_val(&slab, idx1), Some(1));
assert_eq!(get_val(&slab, idx2), None);
assert_eq!(get_val(&slab, idx3), None);
});
}
#[test]
fn remove_remote_and_reuse() {
loom::model(|| {
let slab = Arc::new(Slab::new());
let idx1 = store_val(&slab, 1);
let idx2 = store_va... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/util/slab/tests/loom_slab.rs | MIT | 942feab040e28d1e1547012a0fb81212299e6596 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/942feab040e28d1e1547012a0fb81212299e6596/tokio/src/util/slab/tests/loom_slab.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/util/slab/tests/loom_slab.rs:4 | let slab = Arc::new(Slab::new());
let pair = Arc::new((Mutex::new(None), Condvar::new()));
let slab2 = slab.clone();
let pair2 = pair.clone();
let remover = thread::spawn(move || {
let (lock, cvar) = &*pair2;
for _ in 0..2 {
let mut next = lock.lo... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/util/slab/tests/loom_slab.rs | MIT | 942feab040e28d1e1547012a0fb81212299e6596 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/942feab040e28d1e1547012a0fb81212299e6596/tokio/src/util/slab/tests/loom_slab.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/util/slab/tests/loom_slab.rs:5 | fn concurrent_remove_remote_and_reuse() {
loom::model(|| {
let slab = Arc::new(Slab::new());
let idx1 = store_val(&slab, 1);
let idx2 = store_val(&slab, 2);
assert_eq!(get_val(&slab, idx1), Some(1));
assert_eq!(get_val(&slab, idx2), Some(2));
let s = slab.clone();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/util/slab/tests/loom_slab.rs | MIT | 942feab040e28d1e1547012a0fb81212299e6596 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/942feab040e28d1e1547012a0fb81212299e6596/tokio/src/util/slab/tests/loom_slab.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/util/slab/tests/loom_slab.rs:6 | let (lock, cvar) = &*pair2;
// allocate one entry just so that we have to use the final one for
// all future allocations.
let _key0 = store_val(&slab, 0);
let key = store_val(&slab, 1);
let mut next = lock.lock().unwrap();
*next = Some(key);
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/util/slab/tests/loom_slab.rs | MIT | 942feab040e28d1e1547012a0fb81212299e6596 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/942feab040e28d1e1547012a0fb81212299e6596/tokio/src/util/slab/tests/loom_slab.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/util/slab/tests/loom_slab.rs:7 | let pair2 = pair.clone();
let t1 = thread::spawn(move || {
let slab = slab2;
let (lock, cvar) = &*pair2;
// allocate one entry just so that we have to use the final one for
// all future allocations.
let _key0 = store_val(&slab, 0);
let key... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/util/slab/tests/loom_slab.rs | MIT | 942feab040e28d1e1547012a0fb81212299e6596 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/942feab040e28d1e1547012a0fb81212299e6596/tokio/src/util/slab/tests/loom_slab.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/util/slab/tests/loom_slab.rs:8 | let key2 = t1.join().unwrap();
// after the remove, we must not see the value written with the
// stale index either.
assert_eq!(
get_val(&slab, key),
None,
"stale set must no longer be visible"
);
assert_eq!(get_val(&slab, key2), Some(0));
... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/util/slab/tests/loom_slab.rs | MIT | 942feab040e28d1e1547012a0fb81212299e6596 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/942feab040e28d1e1547012a0fb81212299e6596/tokio/src/util/slab/tests/loom_slab.rs | 281 | 327 |
tokio-rs/tokio:tokio/src/util/slab/tests/loom_slab.rs:3 | assert_eq!(get_val(&slab, idx1), Some(1));
assert_eq!(get_val(&slab, idx2), None);
assert_eq!(get_val(&slab, idx3), None);
});
}
#[test]
fn remove_remote_and_reuse() {
loom::model(|| {
let slab = Arc::new(Slab::new());
let idx1 = store_val(&slab, 1);
let idx2 = store_va... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/util/slab/tests/loom_slab.rs | MIT | 69975fb9601bbb21659db283d888470733bae660 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/69975fb9601bbb21659db283d888470733bae660/tokio/src/util/slab/tests/loom_slab.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/util/slab/tests/loom_stack.rs:1 | use crate::util::slab::TransferStack;
use loom::cell::UnsafeCell;
use loom::sync::Arc;
use loom::thread;
#[test]
fn transfer_stack() {
loom::model(|| {
let causalities = [UnsafeCell::new(None), UnsafeCell::new(None)];
let shared = Arc::new((causalities, TransferStack::new()));
let shared1 ... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/util/slab/tests/loom_stack.rs | MIT | 1cb1e291c10adf6b4e530cb1475b95ba10fa615f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1cb1e291c10adf6b4e530cb1475b95ba10fa615f/tokio/src/util/slab/tests/loom_stack.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/util/slab/tests/loom_stack.rs:2 | }
let idx = idx.unwrap();
let saw_both = causalities[idx].with(|val| {
let val = unsafe { *val };
assert!(
val.is_some(),
"UnsafeCell write must happen-before index is pushed to the stack!",
);
// were there two entries in ... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/util/slab/tests/loom_stack.rs | MIT | 1cb1e291c10adf6b4e530cb1475b95ba10fa615f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1cb1e291c10adf6b4e530cb1475b95ba10fa615f/tokio/src/util/slab/tests/loom_stack.rs | 41 | 88 |
tokio-rs/tokio:tokio/src/util/slab/tests/loom_stack.rs:1 | use crate::util::slab::TransferStack;
use loom::cell::CausalCell;
use loom::sync::Arc;
use loom::thread;
#[test]
fn transfer_stack() {
loom::model(|| {
let causalities = [CausalCell::new(None), CausalCell::new(None)];
let shared = Arc::new((causalities, TransferStack::new()));
let shared1 ... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/util/slab/tests/loom_stack.rs | MIT | 69975fb9601bbb21659db283d888470733bae660 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/69975fb9601bbb21659db283d888470733bae660/tokio/src/util/slab/tests/loom_stack.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/util/slab/tests/loom_stack.rs:2 | }
let idx = idx.unwrap();
let saw_both = causalities[idx].with(|val| {
let val = unsafe { *val };
assert!(
val.is_some(),
"CausalCell write must happen-before index is pushed to the stack!",
);
// were there two entries in ... | rust | rust | testsuite | tokio-rs/tokio | tokio/src/util/slab/tests/loom_stack.rs | MIT | 69975fb9601bbb21659db283d888470733bae660 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/69975fb9601bbb21659db283d888470733bae660/tokio/src/util/slab/tests/loom_stack.rs | 41 | 88 |
tokio-rs/tokio:tokio/src/util/stream.rs:2 | /// with that item. Otherwise the stream will yield to an error.
///
/// # Examples
///
/// ```
/// use tokio::prelude::*;
/// use std::time::Duration;
/// # use futures::future::{self, FutureResult};
///
/// # fn long_future() -> FutureResult<(), ()> {
/// # future::ok(())
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/stream.rs | MIT | 6dda866191c1ff73bac534438d74f40ab326c65f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6dda866191c1ff73bac534438d74f40ab326c65f/tokio/src/util/stream.rs | 41 | 73 |
tokio-rs/tokio:tokio/src/util/stream.rs:1 | pub use crate::util::enumerate::Enumerate;
#[cfg(feature = "timer")]
use std::time::Duration;
#[cfg(feature = "timer")]
use tokio_timer::{throttle::Throttle, Timeout};
/// An extension trait for `Stream` that provides a variety of convenient
/// combinator functions.
///
/// Currently, there are only [`timeout`] and... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/stream.rs | MIT | 70eca184f0f52dd2d634b750bba698da9418ee5f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/70eca184f0f52dd2d634b750bba698da9418ee5f/tokio/src/util/stream.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/util/stream.rs:2 | /// # Overflow Behavior
///
/// The method does no guarding against overflows, so counting elements of
/// an iterator with more than [`std::usize::MAX`] elements either produces the
/// wrong result or panics.
fn enumerate(self) -> Enumerate<Self>
where
Self: Sized,
{
Enumer... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/stream.rs | MIT | 70eca184f0f52dd2d634b750bba698da9418ee5f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/70eca184f0f52dd2d634b750bba698da9418ee5f/tokio/src/util/stream.rs | 41 | 92 |
tokio-rs/tokio:tokio/src/util/stream.rs:3 | /// # }
/// ```
#[cfg(feature = "timer")]
fn timeout(self, timeout: Duration) -> Timeout<Self>
where
Self: Sized,
{
Timeout::new(self, timeout)
}
}
impl<T: ?Sized> StreamExt for T where T: Stream {} | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/stream.rs | MIT | 70eca184f0f52dd2d634b750bba698da9418ee5f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/70eca184f0f52dd2d634b750bba698da9418ee5f/tokio/src/util/stream.rs | 81 | 92 |
tokio-rs/tokio:tokio/src/util/stream.rs:1 | pub use crate::util::enumerate::Enumerate;
use futures::Stream;
#[cfg(feature = "timer")]
use std::time::Duration;
#[cfg(feature = "timer")]
use tokio_timer::{throttle::Throttle, Timeout};
/// An extension trait for `Stream` that provides a variety of convenient
/// combinator functions.
///
/// Currently, there are ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/stream.rs | MIT | cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0/tokio/src/util/stream.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/util/sync_wrapper.rs:1 | //! This module contains a type that can make `Send + !Sync` types `Sync` by
//! disallowing all immutable access to the value.
//!
//! A similar primitive is provided in the `sync_wrapper` crate.
use std::any::Any;
pub(crate) struct SyncWrapper<T> {
value: T,
}
// safety: The SyncWrapper being send allows you t... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/sync_wrapper.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/util/sync_wrapper.rs | 1 | 37 |
tokio-rs/tokio:tokio/src/util/sync_wrapper.rs:1 | //! This module contains a type that can make `Send + !Sync` types `Sync` by
//! disallowing all immutable access to the value.
//!
//! A similar primitive is provided in the `sync_wrapper` crate.
pub(crate) struct SyncWrapper<T> {
value: T,
}
// safety: The SyncWrapper being send allows you to send the inner val... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/sync_wrapper.rs | MIT | aef2d64b0a519ff6726f8c139ee1d3e6b1959b0b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/aef2d64b0a519ff6726f8c139ee1d3e6b1959b0b/tokio/src/util/sync_wrapper.rs | 1 | 26 |
tokio-rs/tokio:tokio/src/util/trace.rs:1 | cfg_rt! {
use std::marker::PhantomData;
#[derive(Copy, Clone)]
pub(crate) struct SpawnMeta<'a> {
/// The name of the task
#[cfg(all(tokio_unstable, feature = "tracing"))]
pub(crate) name: Option<&'a str>,
/// The original size of the future or function being spawned
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/trace.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/util/trace.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/util/trace.rs:2 | name: None,
#[cfg(all(tokio_unstable, feature = "tracing"))]
original_size,
spawned_at: crate::runtime::task::SpawnLocation::capture(),
_pd: PhantomData,
}
}
}
cfg_trace! {
use core::{
pin::Pin,
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/trace.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/util/trace.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/util/trace.rs:3 | )
}
use tracing::instrument::Instrument;
let span = get_span(kind, meta, id, mem::size_of::<F>());
task.instrument(span)
}
#[inline]
pub(crate) fn blocking_task<Fn, Fut>(task: Fut, spawn_meta: SpawnMeta<'_>, id: u64) -> Instrumented<Fut> {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/trace.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/util/trace.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/util/trace.rs:4 | drop(enter);
let tracing_ctx = AsyncOpTracingCtx {
async_op_span,
async_op_poll_span,
resource_span: resource_span.clone(),
};
InstrumentedAsyncOp {
inner,
tracing_ctx,
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/trace.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/util/trace.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/util/trace.rs:5 | let _async_op_poll_enter = this.tracing_ctx.async_op_poll_span.enter();
trace_poll_op!(poll_op_name, this.inner.poll(cx))
}
}
}
cfg_not_trace! {
#[inline]
pub(crate) fn task<F>(task: F, _kind: &'static str, _meta: SpawnMeta<'_>, _id: u64) -> F {
/... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/trace.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/util/trace.rs | 161 | 191 |
tokio-rs/tokio:tokio/src/util/trace.rs:1 | cfg_rt! {
use std::marker::PhantomData;
#[derive(Copy, Clone)]
pub(crate) struct SpawnMeta<'a> {
/// The name of the task
#[cfg(all(tokio_unstable, feature = "tracing"))]
pub(crate) name: Option<&'a str>,
/// The original size of the future or function being spawned
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/trace.rs | MIT | 512e9decfb683d22f4a145459142542caa0894c9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/512e9decfb683d22f4a145459142542caa0894c9/tokio/src/util/trace.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/util/trace.rs:2 | cfg_trace! {
use core::{
pin::Pin,
task::{Context, Poll},
};
use pin_project_lite::pin_project;
use std::mem;
use std::future::Future;
use tracing::instrument::Instrument;
pub(crate) use tracing::instrument::Instrumented;
#[inline]... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/trace.rs | MIT | 512e9decfb683d22f4a145459142542caa0894c9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/512e9decfb683d22f4a145459142542caa0894c9/tokio/src/util/trace.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/util/trace.rs:3 | #[inline]
#[track_caller]
pub(crate) fn blocking_task<Fn, Fut>(task: Fut, spawn_meta: SpawnMeta<'_>, id: u64) -> Instrumented<Fut> {
let location = std::panic::Location::caller();
let fn_size = mem::size_of::<Fn>();
let original_size = if spawn_meta.original_size != ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/trace.rs | MIT | 512e9decfb683d22f4a145459142542caa0894c9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/512e9decfb683d22f4a145459142542caa0894c9/tokio/src/util/trace.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/util/trace.rs:4 | async_op_poll_span,
resource_span: resource_span.clone(),
};
InstrumentedAsyncOp {
inner,
tracing_ctx,
poll_op_name,
}
})
}
#[derive(Debug, Clone)]
pub(cra... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/trace.rs | MIT | 512e9decfb683d22f4a145459142542caa0894c9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/512e9decfb683d22f4a145459142542caa0894c9/tokio/src/util/trace.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/util/trace.rs:5 | }
}
cfg_not_trace! {
#[inline]
pub(crate) fn task<F>(task: F, _kind: &'static str, _meta: SpawnMeta<'_>, _id: u64) -> F {
// nop
task
}
#[inline]
pub(crate) fn blocking_task<Fn, Fut>(task: Fut, _spawn_meta: SpawnMeta<'_>, _id: u64) -> Fut {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/trace.rs | MIT | 512e9decfb683d22f4a145459142542caa0894c9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/512e9decfb683d22f4a145459142542caa0894c9/tokio/src/util/trace.rs | 161 | 188 |
tokio-rs/tokio:tokio/src/util/trace.rs:1 | cfg_rt! {
use std::marker::PhantomData;
pub(crate) struct SpawnMeta<'a> {
/// The name of the task
#[cfg(all(tokio_unstable, feature = "tracing"))]
pub(crate) name: Option<&'a str>,
/// The original size of the future or function being spawned
#[cfg(all(tokio_unstable, f... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/trace.rs | MIT | c3a935541d911cd9afa6838a1bb02e4f499b244d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c3a935541d911cd9afa6838a1bb02e4f499b244d/tokio/src/util/trace.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/util/trace.rs:2 | use core::{
pin::Pin,
task::{Context, Poll},
};
use pin_project_lite::pin_project;
use std::mem;
use std::future::Future;
use tracing::instrument::Instrument;
pub(crate) use tracing::instrument::Instrumented;
#[inline]
#[track_call... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/trace.rs | MIT | c3a935541d911cd9afa6838a1bb02e4f499b244d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c3a935541d911cd9afa6838a1bb02e4f499b244d/tokio/src/util/trace.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/util/trace.rs:3 | #[inline]
#[track_caller]
pub(crate) fn blocking_task<Fn, Fut>(task: Fut, spawn_meta: SpawnMeta<'_>, id: u64) -> Instrumented<Fut> {
let location = std::panic::Location::caller();
let fn_size = mem::size_of::<Fn>();
let original_size = if spawn_meta.original_size != ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/trace.rs | MIT | c3a935541d911cd9afa6838a1bb02e4f499b244d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c3a935541d911cd9afa6838a1bb02e4f499b244d/tokio/src/util/trace.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/util/trace.rs:4 | resource_span: resource_span.clone(),
};
InstrumentedAsyncOp {
inner,
tracing_ctx,
poll_op_name,
}
})
}
#[derive(Debug, Clone)]
pub(crate) struct AsyncOpTracingCtx {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/trace.rs | MIT | c3a935541d911cd9afa6838a1bb02e4f499b244d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c3a935541d911cd9afa6838a1bb02e4f499b244d/tokio/src/util/trace.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/util/trace.rs:5 | }
cfg_not_trace! {
#[inline]
pub(crate) fn task<F>(task: F, _kind: &'static str, _meta: SpawnMeta<'_>, _id: u64) -> F {
// nop
task
}
#[inline]
pub(crate) fn blocking_task<Fn, Fut>(task: Fut, _spawn_meta: SpawnMeta<'_>, _id: u64) -> Fut {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/trace.rs | MIT | c3a935541d911cd9afa6838a1bb02e4f499b244d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c3a935541d911cd9afa6838a1bb02e4f499b244d/tokio/src/util/trace.rs | 161 | 187 |
tokio-rs/tokio:tokio/src/util/trace.rs:1 | cfg_trace! {
cfg_rt! {
use core::{
pin::Pin,
task::{Context, Poll},
};
use pin_project_lite::pin_project;
use std::future::Future;
pub(crate) use tracing::instrument::Instrumented;
#[inline]
#[track_caller]
pub(crate) fn task<F... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/trace.rs | MIT | 7a30504fd423aa782239ead92f3afa3474f8037c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7a30504fd423aa782239ead92f3afa3474f8037c/tokio/src/util/trace.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/util/trace.rs:2 | drop(enter);
let tracing_ctx = AsyncOpTracingCtx {
async_op_span,
async_op_poll_span,
resource_span: resource_span.clone(),
};
InstrumentedAsyncOp {
inner,
tracing_ctx,
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/trace.rs | MIT | 7a30504fd423aa782239ead92f3afa3474f8037c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7a30504fd423aa782239ead92f3afa3474f8037c/tokio/src/util/trace.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/util/trace.rs:3 | let _async_op_poll_enter = this.tracing_ctx.async_op_poll_span.enter();
trace_poll_op!(poll_op_name, this.inner.poll(cx))
}
}
}
}
cfg_time! {
#[track_caller]
pub(crate) fn caller_location() -> Option<&'static std::panic::Location<'static>> {
#[cfg(all(tokio_unstab... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/trace.rs | MIT | 7a30504fd423aa782239ead92f3afa3474f8037c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7a30504fd423aa782239ead92f3afa3474f8037c/tokio/src/util/trace.rs | 81 | 105 |
tokio-rs/tokio:tokio/src/util/trace.rs:1 | cfg_trace! {
cfg_rt! {
use core::{
pin::Pin,
task::{Context, Poll},
};
use pin_project_lite::pin_project;
use std::future::Future;
pub(crate) use tracing::instrument::Instrumented;
#[inline]
#[track_caller]
pub(crate) fn task<F... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/trace.rs | MIT | 304d14036184c9c65d88706e48dacb57bb172fcc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/304d14036184c9c65d88706e48dacb57bb172fcc/tokio/src/util/trace.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/util/trace.rs:2 | let tracing_ctx = AsyncOpTracingCtx {
async_op_span,
async_op_poll_span,
resource_span: resource_span.clone(),
};
InstrumentedAsyncOp {
inner,
tracing_ctx,
poll_op_name... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/trace.rs | MIT | 304d14036184c9c65d88706e48dacb57bb172fcc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/304d14036184c9c65d88706e48dacb57bb172fcc/tokio/src/util/trace.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/util/trace.rs:3 | trace_poll_op!(poll_op_name, this.inner.poll(cx))
}
}
}
}
cfg_time! {
#[track_caller]
pub(crate) fn caller_location() -> Option<&'static std::panic::Location<'static>> {
#[cfg(all(tokio_unstable, feature = "tracing"))]
return Some(std::panic::Location::caller());
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/trace.rs | MIT | 304d14036184c9c65d88706e48dacb57bb172fcc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/304d14036184c9c65d88706e48dacb57bb172fcc/tokio/src/util/trace.rs | 81 | 104 |
tokio-rs/tokio:tokio/src/util/trace.rs:1 | cfg_trace! {
cfg_rt! {
use core::{
pin::Pin,
task::{Context, Poll},
};
use pin_project_lite::pin_project;
use std::future::Future;
pub(crate) use tracing::instrument::Instrumented;
#[inline]
#[track_caller]
pub(crate) fn task<F... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/trace.rs | MIT | 1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/util/trace.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/util/trace.rs:2 | };
InstrumentedAsyncOp {
inner,
tracing_ctx,
poll_op_name,
}
})
}
#[derive(Debug, Clone)]
pub(crate) struct AsyncOpTracingCtx {
pub(crate) async_op_span: tracing::Span,
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/trace.rs | MIT | 1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/util/trace.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/util/trace.rs:3 | }
cfg_time! {
#[track_caller]
pub(crate) fn caller_location() -> Option<&'static std::panic::Location<'static>> {
#[cfg(all(tokio_unstable, feature = "tracing"))]
return Some(std::panic::Location::caller());
#[cfg(not(all(tokio_unstable, feature = "tracing")))]
None
}
}
cfg_... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/trace.rs | MIT | 1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1d3f12304e29dbb8fe3ef4089d01d5acb9edaae1/tokio/src/util/trace.rs | 81 | 100 |
tokio-rs/tokio:tokio/src/util/trace.rs:1 | cfg_trace! {
cfg_rt! {
use core::{
pin::Pin,
task::{Context, Poll},
};
use pin_project_lite::pin_project;
use std::future::Future;
pub(crate) use tracing::instrument::Instrumented;
#[inline]
#[track_caller]
pub(crate) fn task<F... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/trace.rs | MIT | 4e3268d222423e874f5bbfa67e20f773da3c025f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4e3268d222423e874f5bbfa67e20f773da3c025f/tokio/src/util/trace.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/util/trace.rs:2 | InstrumentedAsyncOp {
inner,
tracing_ctx,
poll_op_name,
}
})
}
#[derive(Debug, Clone)]
pub(crate) struct AsyncOpTracingCtx {
pub(crate) async_op_span: tracing::Span,
pub(crate) async_... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/trace.rs | MIT | 4e3268d222423e874f5bbfa67e20f773da3c025f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4e3268d222423e874f5bbfa67e20f773da3c025f/tokio/src/util/trace.rs | 41 | 99 |
tokio-rs/tokio:tokio/src/util/trace.rs:3 | cfg_time! {
#[track_caller]
pub(crate) fn caller_location() -> Option<&'static std::panic::Location<'static>> {
#[cfg(all(tokio_unstable, feature = "tracing"))]
return Some(std::panic::Location::caller());
#[cfg(not(all(tokio_unstable, feature = "tracing")))]
None
}
}
cfg_no... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/trace.rs | MIT | 4e3268d222423e874f5bbfa67e20f773da3c025f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4e3268d222423e874f5bbfa67e20f773da3c025f/tokio/src/util/trace.rs | 81 | 99 |
tokio-rs/tokio:tokio/src/util/trace.rs:1 | cfg_trace! {
cfg_rt! {
pub(crate) use tracing::instrument::Instrumented;
#[inline]
#[track_caller]
pub(crate) fn task<F>(task: F, kind: &'static str, name: Option<&str>) -> Instrumented<F> {
use tracing::instrument::Instrument;
let location = std::panic::Loca... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/trace.rs | MIT | cf3206842c0d94ecdaaeb421a58b1c963b627c3d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cf3206842c0d94ecdaaeb421a58b1c963b627c3d/tokio/src/util/trace.rs | 1 | 41 |
tokio-rs/tokio:tokio/src/util/trace.rs:1 | cfg_trace! {
cfg_rt! {
pub(crate) use tracing::instrument::Instrumented;
#[inline]
#[cfg_attr(tokio_track_caller, track_caller)]
pub(crate) fn task<F>(task: F, kind: &'static str, name: Option<&str>) -> Instrumented<F> {
use tracing::instrument::Instrument;
#... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/trace.rs | MIT | b9b59e4f15ad80775315ac1615a127c29725cb77 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b9b59e4f15ad80775315ac1615a127c29725cb77/tokio/src/util/trace.rs | 1 | 50 |
tokio-rs/tokio:tokio/src/util/trace.rs:1 | cfg_trace! {
cfg_rt! {
pub(crate) use tracing::instrument::Instrumented;
#[inline]
#[cfg_attr(tokio_track_caller, track_caller)]
pub(crate) fn task<F>(task: F, kind: &'static str, name: Option<&str>) -> Instrumented<F> {
use tracing::instrument::Instrument;
#... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/trace.rs | MIT | b9834f6d8b3563e6907456d19fe418cfe19983c3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b9834f6d8b3563e6907456d19fe418cfe19983c3/tokio/src/util/trace.rs | 1 | 48 |
tokio-rs/tokio:tokio/src/util/trace.rs:1 | cfg_trace! {
cfg_rt! {
pub(crate) use tracing::instrument::Instrumented;
#[inline]
#[cfg_attr(tokio_track_caller, track_caller)]
pub(crate) fn task<F>(task: F, kind: &'static str, name: Option<&str>) -> Instrumented<F> {
use tracing::instrument::Instrument;
#... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/trace.rs | MIT | d0305d57e56dedeb9fb4854d16fe9a11d503e2a2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d0305d57e56dedeb9fb4854d16fe9a11d503e2a2/tokio/src/util/trace.rs | 1 | 39 |
tokio-rs/tokio:tokio/src/util/trace.rs:1 | cfg_trace! {
cfg_rt! {
pub(crate) use tracing::instrument::Instrumented;
#[inline]
#[cfg_attr(tokio_track_caller, track_caller)]
pub(crate) fn task<F>(task: F, kind: &'static str, name: Option<&str>) -> Instrumented<F> {
use tracing::instrument::Instrument;
#... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/trace.rs | MIT | 8fa29cb00a486c0ffc28f295c749573cb58a8967 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8fa29cb00a486c0ffc28f295c749573cb58a8967/tokio/src/util/trace.rs | 1 | 39 |
tokio-rs/tokio:tokio/src/util/trace.rs:1 | cfg_trace! {
cfg_rt! {
pub(crate) use tracing::instrument::Instrumented;
#[inline]
#[cfg_attr(tokio_track_caller, track_caller)]
pub(crate) fn task<F>(task: F, kind: &'static str) -> Instrumented<F> {
use tracing::instrument::Instrument;
#[cfg(tokio_track_cal... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/trace.rs | MIT | fede3db76aef95c010c3e0c3da3b732380285097 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fede3db76aef95c010c3e0c3da3b732380285097/tokio/src/util/trace.rs | 1 | 37 |
tokio-rs/tokio:tokio/src/util/trace.rs:1 | cfg_trace! {
cfg_rt! {
use std::future::Future;
use std::pin::Pin;
use std::task::{Context, Poll};
use pin_project_lite::pin_project;
use tracing::Span;
pin_project! {
/// A future that has been instrumented with a `tracing` span.
#[derive(De... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/trace.rs | MIT | c90681bd8e629b5fde988b9f5be7b915e5cf8ae5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c90681bd8e629b5fde988b9f5be7b915e5cf8ae5/tokio/src/util/trace.rs | 1 | 57 |
tokio-rs/tokio:tokio/src/util/trace.rs:1 | cfg_trace! {
cfg_task! {
use std::future::Future;
use std::pin::Pin;
use std::task::{Context, Poll};
use pin_project_lite::pin_project;
use tracing::Span;
pin_project! {
/// A future that has been instrumented with a `tracing` span.
#[derive(... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/trace.rs | MIT | 8880222036f37c6204c8466f25e828447f16dacb | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8880222036f37c6204c8466f25e828447f16dacb/tokio/src/util/trace.rs | 1 | 57 |
tokio-rs/tokio:tokio/src/util/trace.rs:1 | cfg_trace! {
cfg_rt_core! {
use std::future::Future;
use std::pin::Pin;
use std::task::{Context, Poll};
use pin_project_lite::pin_project;
use tracing::Span;
pin_project! {
/// A future that has been instrumented with a `tracing` span.
#[deri... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/trace.rs | MIT | b9e3d2edde33a12ead6df3895caeafa90f9db7e4 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b9e3d2edde33a12ead6df3895caeafa90f9db7e4/tokio/src/util/trace.rs | 1 | 57 |
tokio-rs/tokio:tokio/src/util/try_lock.rs:1 | use crate::loom::sync::atomic::AtomicBool;
use std::cell::UnsafeCell;
use std::marker::PhantomData;
use std::ops::{Deref, DerefMut};
use std::sync::atomic::Ordering::SeqCst;
pub(crate) struct TryLock<T> {
locked: AtomicBool,
data: UnsafeCell<T>,
}
pub(crate) struct LockGuard<'a, T> {
lock: &'a TryLock<T>... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/try_lock.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/util/try_lock.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/util/try_lock.rs:2 | pub(crate) fn new(data: T) -> TryLock<T> {
new!(data)
}
/// Attempt to acquire lock
pub(crate) fn try_lock(&self) -> Option<LockGuard<'_, T>> {
if self
.locked
.compare_exchange(false, true, SeqCst, SeqCst)
.is_err()
{
return None;
... | rust | rust | macro-heavy | tokio-rs/tokio | tokio/src/util/try_lock.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/util/try_lock.rs | 41 | 80 |
tokio-rs/tokio:tokio/src/util/try_lock.rs:1 | use crate::loom::sync::atomic::AtomicBool;
use std::cell::UnsafeCell;
use std::marker::PhantomData;
use std::ops::{Deref, DerefMut};
use std::sync::atomic::Ordering::SeqCst;
pub(crate) struct TryLock<T> {
locked: AtomicBool,
data: UnsafeCell<T>,
}
pub(crate) struct LockGuard<'a, T> {
lock: &'a TryLock<T>... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/try_lock.rs | MIT | 8656b7b8eb6f3635ec40694eb71f14fb84211e05 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8656b7b8eb6f3635ec40694eb71f14fb84211e05/tokio/src/util/try_lock.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/util/try_lock.rs:2 | Some(LockGuard {
lock: self,
_p: PhantomData,
})
}
}
impl<T> Deref for LockGuard<'_, T> {
type Target = T;
fn deref(&self) -> &T {
unsafe { &*self.lock.data.get() }
}
}
impl<T> DerefMut for LockGuard<'_, T> {
fn deref_mut(&mut self) -> &mut T {
unsa... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/try_lock.rs | MIT | 8656b7b8eb6f3635ec40694eb71f14fb84211e05 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8656b7b8eb6f3635ec40694eb71f14fb84211e05/tokio/src/util/try_lock.rs | 41 | 67 |
tokio-rs/tokio:tokio/src/util/try_lock.rs:1 | use crate::loom::sync::atomic::AtomicBool;
use std::cell::UnsafeCell;
use std::marker::PhantomData;
use std::ops::{Deref, DerefMut};
use std::sync::atomic::Ordering::SeqCst;
pub(crate) struct TryLock<T> {
locked: AtomicBool,
data: UnsafeCell<T>,
}
pub(crate) struct LockGuard<'a, T> {
lock: &'a TryLock<T>... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/try_lock.rs | MIT | 8546ff826db8dba1e39b4119ad909fb6cab2492a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8546ff826db8dba1e39b4119ad909fb6cab2492a/tokio/src/util/try_lock.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/util/try_lock.rs:2 | })
}
}
impl<T> Deref for LockGuard<'_, T> {
type Target = T;
fn deref(&self) -> &T {
unsafe { &*self.lock.data.get() }
}
}
impl<T> DerefMut for LockGuard<'_, T> {
fn deref_mut(&mut self) -> &mut T {
unsafe { &mut *self.lock.data.get() }
}
}
impl<T> Drop for LockGuard<'_, T> {... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/try_lock.rs | MIT | 8546ff826db8dba1e39b4119ad909fb6cab2492a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8546ff826db8dba1e39b4119ad909fb6cab2492a/tokio/src/util/try_lock.rs | 41 | 63 |
tokio-rs/tokio:tokio/src/util/typeid.rs:1 | use std::{
any::TypeId,
marker::PhantomData,
mem::{self, ManuallyDrop},
};
// SAFETY: this function does not compare lifetimes. Values returned as `Ok`
// may have their lifetimes extended.
pub(super) unsafe fn try_transmute<Src, Target: 'static>(x: Src) -> Result<Target, Src> {
if nonstatic_typeid::<S... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/typeid.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/util/typeid.rs | 1 | 45 |
tokio-rs/tokio:tokio/src/util/typeid.rs:1 | use std::{
any::TypeId,
marker::PhantomData,
mem::{self, ManuallyDrop},
};
// SAFETY: this function does not compare lifetimes. Values returned as `Ok`
// may have their lifetimes extended.
pub(super) unsafe fn try_transmute<Src, Target: 'static>(x: Src) -> Result<Target, Src> {
if nonstatic_typeid::<S... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/typeid.rs | MIT | 817fa605ee6a2549fe8e6057ec23a8309d42d2e9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/817fa605ee6a2549fe8e6057ec23a8309d42d2e9/tokio/src/util/typeid.rs | 1 | 44 |
tokio-rs/tokio:tokio/src/util/vec_deque_cell.rs:1 | use crate::loom::cell::UnsafeCell;
use std::collections::VecDeque;
use std::marker::PhantomData;
/// This type is like VecDeque, except that it is not Sync and can be modified
/// through immutable references.
pub(crate) struct VecDequeCell<T> {
inner: UnsafeCell<VecDeque<T>>,
_not_sync: PhantomData<*const ()... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/vec_deque_cell.rs | MIT | 03969cdae7674681d1b10926e6a56fbb8908dbb8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/util/vec_deque_cell.rs | 1 | 53 |
tokio-rs/tokio:tokio/src/util/vec_deque_cell.rs:1 | use crate::loom::cell::UnsafeCell;
use std::collections::VecDeque;
use std::marker::PhantomData;
/// This type is like VecDeque, except that it is not Sync and can be modified
/// through immutable references.
pub(crate) struct VecDequeCell<T> {
inner: UnsafeCell<VecDeque<T>>,
_not_sync: PhantomData<*const ()... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/vec_deque_cell.rs | MIT | b501f25202aba8f50c1ded4204f0129939fabc79 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b501f25202aba8f50c1ded4204f0129939fabc79/tokio/src/util/vec_deque_cell.rs | 1 | 53 |
tokio-rs/tokio:tokio/src/util/wake.rs:1 | use crate::loom::sync::Arc;
use std::marker::PhantomData;
use std::mem::ManuallyDrop;
use std::ops::Deref;
use std::task::{RawWaker, RawWakerVTable, Waker};
/// Simplified waking interface based on Arcs.
pub(crate) trait Wake: Send + Sync + Sized + 'static {
/// Wake by value.
fn wake(arc_self: Arc<Self>);
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/wake.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/util/wake.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/util/wake.rs:2 | }
}
fn waker_vtable<W: Wake>() -> &'static RawWakerVTable {
&RawWakerVTable::new(
clone_arc_raw::<W>,
wake_arc_raw::<W>,
wake_by_ref_arc_raw::<W>,
drop_arc_raw::<W>,
)
}
unsafe fn clone_arc_raw<T: Wake>(data: *const ()) -> RawWaker {
// Safety: `data` was created from an `A... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/wake.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/util/wake.rs | 41 | 78 |
tokio-rs/tokio:tokio/src/util/wake.rs:1 | use crate::loom::sync::Arc;
use std::marker::PhantomData;
use std::mem::ManuallyDrop;
use std::ops::Deref;
use std::task::{RawWaker, RawWakerVTable, Waker};
/// Simplified waking interface based on Arcs.
pub(crate) trait Wake: Send + Sync + Sized + 'static {
/// Wake by value.
fn wake(arc_self: Arc<Self>);
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/wake.rs | MIT | f490029b8fc4552d54b527fc0052fb539e493ebf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f490029b8fc4552d54b527fc0052fb539e493ebf/tokio/src/util/wake.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/util/wake.rs:2 | }
}
fn waker_vtable<W: Wake>() -> &'static RawWakerVTable {
&RawWakerVTable::new(
clone_arc_raw::<W>,
wake_arc_raw::<W>,
wake_by_ref_arc_raw::<W>,
drop_arc_raw::<W>,
)
}
unsafe fn clone_arc_raw<T: Wake>(data: *const ()) -> RawWaker {
Arc::<T>::increment_strong_count(data as... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/wake.rs | MIT | f490029b8fc4552d54b527fc0052fb539e493ebf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f490029b8fc4552d54b527fc0052fb539e493ebf/tokio/src/util/wake.rs | 41 | 72 |
tokio-rs/tokio:tokio/src/util/wake.rs:1 | use crate::loom::sync::Arc;
use std::mem::ManuallyDrop;
use std::task::{RawWaker, RawWakerVTable, Waker};
/// Simplified waking interface based on Arcs.
pub(crate) trait Wake: Send + Sync + Sized + 'static {
/// Wake by value.
fn wake(arc_self: Arc<Self>);
/// Wake by reference.
fn wake_by_ref(arc_se... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/wake.rs | MIT | 4380de9fe9e0938790a2c06f4bdaa8bd91c08ed1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4380de9fe9e0938790a2c06f4bdaa8bd91c08ed1/tokio/src/util/wake.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/util/wake.rs:2 | waker: ManuallyDrop::new(waker),
_p: PhantomData,
}
}
}
/// Creates a waker from a `Arc<impl Wake>`.
pub(crate) fn waker<W: Wake>(wake: Arc<W>) -> Waker {
unsafe {
Waker::from_raw(RawWaker::new(
Arc::into_raw(wake).cast(),
waker_vtable::<W>(),
))
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/wake.rs | MIT | 4380de9fe9e0938790a2c06f4bdaa8bd91c08ed1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4380de9fe9e0938790a2c06f4bdaa8bd91c08ed1/tokio/src/util/wake.rs | 41 | 85 |
tokio-rs/tokio:tokio/src/util/wake.rs:1 | use crate::loom::sync::Arc;
use std::marker::PhantomData;
use std::mem::ManuallyDrop;
use std::ops::Deref;
use std::task::{RawWaker, RawWakerVTable, Waker};
/// Simplified waking interface based on Arcs.
pub(crate) trait Wake: Send + Sync + Sized + 'static {
/// Wake by value.
fn wake(arc_self: Arc<Self>);
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/wake.rs | MIT | 267a23158151b6b1e78d5d547fa9455217f79b3c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/267a23158151b6b1e78d5d547fa9455217f79b3c/tokio/src/util/wake.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/util/wake.rs:2 | }
}
fn waker_vtable<W: Wake>() -> &'static RawWakerVTable {
&RawWakerVTable::new(
clone_arc_raw::<W>,
wake_arc_raw::<W>,
wake_by_ref_arc_raw::<W>,
drop_arc_raw::<W>,
)
}
unsafe fn clone_arc_raw<T: Wake>(data: *const ()) -> RawWaker {
Arc::<T>::increment_strong_count(data as... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/wake.rs | MIT | 267a23158151b6b1e78d5d547fa9455217f79b3c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/267a23158151b6b1e78d5d547fa9455217f79b3c/tokio/src/util/wake.rs | 41 | 72 |
tokio-rs/tokio:tokio/src/util/wake.rs:1 | use crate::loom::sync::Arc;
use std::marker::PhantomData;
use std::mem::ManuallyDrop;
use std::ops::Deref;
use std::task::{RawWaker, RawWakerVTable, Waker};
/// Simplified waking interface based on Arcs.
pub(crate) trait Wake: Send + Sync + Sized + 'static {
/// Wake by value.
fn wake(arc_self: Arc<Self>);
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/wake.rs | MIT | 1be8e9dfb7b1140568ac10ac34f5f8171a89e40d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1be8e9dfb7b1140568ac10ac34f5f8171a89e40d/tokio/src/util/wake.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/util/wake.rs:2 | }
}
fn waker_vtable<W: Wake>() -> &'static RawWakerVTable {
&RawWakerVTable::new(
clone_arc_raw::<W>,
wake_arc_raw::<W>,
wake_by_ref_arc_raw::<W>,
drop_arc_raw::<W>,
)
}
unsafe fn inc_ref_count<T: Wake>(data: *const ()) {
// Retain Arc, but don't touch refcount by wrapping ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/wake.rs | MIT | 1be8e9dfb7b1140568ac10ac34f5f8171a89e40d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1be8e9dfb7b1140568ac10ac34f5f8171a89e40d/tokio/src/util/wake.rs | 41 | 80 |
tokio-rs/tokio:tokio/src/util/wake.rs:1 | use crate::loom::sync::Arc;
use std::marker::PhantomData;
use std::mem::ManuallyDrop;
use std::ops::Deref;
use std::task::{RawWaker, RawWakerVTable, Waker};
/// Simplified waking interface based on Arcs.
pub(crate) trait Wake: Send + Sync + Sized + 'static {
/// Wake by value.
fn wake(arc_self: Arc<Self>);
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/wake.rs | MIT | 1bb4d2316232a77d048e8797ba04d796911ffe30 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1bb4d2316232a77d048e8797ba04d796911ffe30/tokio/src/util/wake.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/util/wake.rs:1 | use std::marker::PhantomData;
use std::mem::ManuallyDrop;
use std::ops::Deref;
use std::sync::Arc;
use std::task::{RawWaker, RawWakerVTable, Waker};
/// Simplified waking interface based on Arcs.
pub(crate) trait Wake: Send + Sync {
/// Wake by value.
fn wake(self: Arc<Self>);
/// Wake by reference.
f... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/wake.rs | MIT | 03969cdae7674681d1b10926e6a56fbb8908dbb8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/util/wake.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/util/wake.rs:2 | }
fn waker_vtable<W: Wake>() -> &'static RawWakerVTable {
&RawWakerVTable::new(
clone_arc_raw::<W>,
wake_arc_raw::<W>,
wake_by_ref_arc_raw::<W>,
drop_arc_raw::<W>,
)
}
unsafe fn inc_ref_count<T: Wake>(data: *const ()) {
// Retain Arc, but don't touch refcount by wrapping in... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/wake.rs | MIT | 03969cdae7674681d1b10926e6a56fbb8908dbb8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/util/wake.rs | 41 | 79 |
tokio-rs/tokio:tokio/src/util/wake.rs:1 | use std::marker::PhantomData;
use std::mem::ManuallyDrop;
use std::ops::Deref;
use std::sync::Arc;
use std::task::{RawWaker, RawWakerVTable, Waker};
/// Simplified waking interface based on Arcs
pub(crate) trait Wake: Send + Sync {
/// Wake by value
fn wake(self: Arc<Self>);
/// Wake by reference
fn w... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/wake.rs | MIT | 9d8b37d51a7d0cdf5a0fbf754240c929fb69e9f2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9d8b37d51a7d0cdf5a0fbf754240c929fb69e9f2/tokio/src/util/wake.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/util/wake.rs:1 | use std::marker::PhantomData;
use std::mem::ManuallyDrop;
use std::ops::Deref;
use std::sync::Arc;
use std::task::{RawWaker, RawWakerVTable, Waker};
/// Simplified waking interface based on Arcs
pub(crate) trait Wake: Send + Sync {
/// Wake by value
fn wake(self: Arc<Self>);
/// Wake by reference
fn w... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/wake.rs | MIT | 9a3603fa75ff854e007d372061edf47cf8d02690 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9a3603fa75ff854e007d372061edf47cf8d02690/tokio/src/util/wake.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/util/wake.rs:2 | }
fn waker_vtable<W: Wake>() -> &'static RawWakerVTable {
&RawWakerVTable::new(
clone_arc_raw::<W>,
wake_arc_raw::<W>,
wake_by_ref_arc_raw::<W>,
drop_arc_raw::<W>,
)
}
unsafe fn inc_ref_count<T: Wake>(data: *const ()) {
// Retain Arc, but don't touch refcount by wrapping in... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/wake.rs | MIT | 9a3603fa75ff854e007d372061edf47cf8d02690 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9a3603fa75ff854e007d372061edf47cf8d02690/tokio/src/util/wake.rs | 41 | 83 |
tokio-rs/tokio:tokio/src/util/wake.rs:1 | use std::marker::PhantomData;
use std::mem::ManuallyDrop;
use std::ops::Deref;
use std::sync::Arc;
use std::task::{RawWaker, RawWakerVTable, Waker};
/// Simplfied waking interface based on Arcs
pub(crate) trait Wake: Send + Sync {
/// Wake by value
fn wake(self: Arc<Self>);
/// Wake by reference
fn wa... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/wake.rs | MIT | a78b1c65ccfb9692ca5d3ed8ddde934f40091d83 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a78b1c65ccfb9692ca5d3ed8ddde934f40091d83/tokio/src/util/wake.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/util/wake_list.rs:1 | use core::mem::MaybeUninit;
use core::ptr;
use std::task::Waker;
const NUM_WAKERS: usize = 32;
/// A list of wakers to be woken.
///
/// # Invariants
///
/// The first `curr` elements of `inner` are initialized.
pub(crate) struct WakeList {
inner: [MaybeUninit<Waker>; NUM_WAKERS],
curr: usize,
}
impl WakeLis... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/wake_list.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/util/wake_list.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/util/wake_list.rs:2 | start: *mut Waker,
end: *mut Waker,
}
impl Drop for DropGuard {
fn drop(&mut self) {
// SAFETY: Both pointers are part of the same object, with `start <= end`.
let len = unsafe { self.end.offset_from(self.start) } as usize;
let sli... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/wake_list.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/util/wake_list.rs | 41 | 83 |
tokio-rs/tokio:tokio/src/util/wake_list.rs:1 | use core::mem::MaybeUninit;
use core::ptr;
use std::task::Waker;
const NUM_WAKERS: usize = 32;
/// A list of wakers to be woken.
///
/// # Invariants
///
/// The first `curr` elements of `inner` are initialized.
pub(crate) struct WakeList {
inner: [MaybeUninit<Waker>; NUM_WAKERS],
curr: usize,
}
impl WakeLis... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/wake_list.rs | MIT | c9273f1aee9927b16ee3a789a382c99ad600c8b6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c9273f1aee9927b16ee3a789a382c99ad600c8b6/tokio/src/util/wake_list.rs | 1 | 58 |
tokio-rs/tokio:tokio/src/util/wake_list.rs:1 | use core::mem::MaybeUninit;
use core::ptr;
use std::task::Waker;
const NUM_WAKERS: usize = 32;
pub(crate) struct WakeList {
inner: [MaybeUninit<Waker>; NUM_WAKERS],
curr: usize,
}
impl WakeList {
pub(crate) fn new() -> Self {
Self {
inner: unsafe {
// safety: Create an... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/wake_list.rs | MIT | 8a097d27b5c313632ae08d40a4c3b7775c299432 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a097d27b5c313632ae08d40a4c3b7775c299432/tokio/src/util/wake_list.rs | 1 | 53 |
tokio-rs/tokio:tokio/src/util/wake_list.rs:1 | use core::mem::MaybeUninit;
use core::ptr;
use std::task::Waker;
const NUM_WAKERS: usize = 32;
pub(crate) struct WakeList {
inner: [MaybeUninit<Waker>; NUM_WAKERS],
curr: usize,
}
impl WakeList {
pub(crate) fn new() -> Self {
Self {
inner: unsafe { MaybeUninit::uninit().assume_init() ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/util/wake_list.rs | MIT | 51f4f0594c81fe24919055e0c08be374ee54a14b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/51f4f0594c81fe24919055e0c08be374ee54a14b/tokio/src/util/wake_list.rs | 1 | 47 |
tokio-rs/tokio:tokio/tests/_require_full.rs:1 | #[cfg(not(any(feature = "full", target_family = "wasm")))]
compile_error!("run main Tokio tests with `--features full`");
// CI sets `--cfg tokio_no_parking_lot` when trying to run tests with
// `parking_lot` disabled. This check prevents "silent failure" if `parking_lot`
// accidentally gets enabled.
#[cfg(all(tokio_... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/_require_full.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/_require_full.rs | 1 | 8 |
tokio-rs/tokio:tokio/tests/_require_full.rs:1 | #![allow(unknown_lints, unexpected_cfgs)]
#[cfg(not(any(feature = "full", target_family = "wasm")))]
compile_error!("run main Tokio tests with `--features full`");
// CI sets `--cfg tokio_no_parking_lot` when trying to run tests with
// `parking_lot` disabled. This check prevents "silent failure" if `parking_lot`
// ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/_require_full.rs | MIT | 2a0df5fb05ae1a624fe2f6db756190f41812214b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2a0df5fb05ae1a624fe2f6db756190f41812214b/tokio/tests/_require_full.rs | 1 | 10 |
tokio-rs/tokio:tokio/tests/_require_full.rs:1 | #[cfg(not(any(feature = "full", tokio_wasm)))]
compile_error!("run main Tokio tests with `--features full`");
// CI sets `--cfg tokio_no_parking_lot` when trying to run tests with
// `parking_lot` disabled. This check prevents "silent failure" if `parking_lot`
// accidentally gets enabled.
#[cfg(all(tokio_no_parking_l... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/_require_full.rs | MIT | c693ccd210c7a318957b0701f4a9632b2d545d6a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c693ccd210c7a318957b0701f4a9632b2d545d6a/tokio/tests/_require_full.rs | 1 | 8 |
tokio-rs/tokio:tokio/tests/async_send_sync.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
#![allow(clippy::type_complexity, clippy::diverging_sub_expression)]
use std::cell::Cell;
use std::future::Future;
use std::io::SeekFrom;
use std::net::SocketAddr;
use std::pin::Pin;
use std::rc::Rc;
use tokio::net::TcpStream;
use tokio::time::{Duration, Instant};
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/async_send_sync.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/async_send_sync.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/async_send_sync.rs:2 | #[allow(dead_code)]
type BoxAsyncRead = std::pin::Pin<Box<dyn tokio::io::AsyncBufRead + Send + Sync>>;
#[allow(dead_code)]
type BoxAsyncSeek = std::pin::Pin<Box<dyn tokio::io::AsyncSeek + Send + Sync>>;
#[allow(dead_code)]
type BoxAsyncWrite = std::pin::Pin<Box<dyn tokio::io::AsyncWrite + Send + Sync>>;
#[allow(dead_c... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/async_send_sync.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/async_send_sync.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/async_send_sync.rs:3 | let x: $typ = todo!();
x
}};
}
macro_rules! async_assert_fn_send {
(Send & $(!)?Sync & $(!)?Unpin, $value:expr) => {
require_send(&$value);
};
(!Send & $(!)?Sync & $(!)?Unpin, $value:expr) => {
AmbiguousIfSend::some_item(&$value);
};
}
macro_rules! async_assert_fn_sync {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/async_send_sync.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/async_send_sync.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/async_send_sync.rs:4 | };
}
macro_rules! assert_value {
($type:ty: $($tok:tt)*) => {
#[allow(unreachable_code)]
#[allow(unused_variables)]
const _: fn() = || {
let f: $type = todo!();
async_assert_fn_send!($($tok)*, f);
async_assert_fn_sync!($($tok)*, f);
async_asser... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/async_send_sync.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/async_send_sync.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/async_send_sync.rs:5 | mod fs {
use super::*;
assert_value!(tokio::fs::DirBuilder: Send & Sync & Unpin);
assert_value!(tokio::fs::DirEntry: Send & Sync & Unpin);
assert_value!(tokio::fs::File: Send & Sync & Unpin);
assert_value!(tokio::fs::OpenOptions: Send & Sync & Unpin);
assert_value!(tokio:... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/async_send_sync.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/async_send_sync.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/async_send_sync.rs:6 | );
}
}
cfg_not_wasi! {
assert_value!(tokio::net::TcpSocket: Send & Sync & Unpin);
async_assert_fn!(tokio::net::TcpListener::bind(SocketAddr): Send & Sync & !Unpin);
async_assert_fn!(tokio::net::TcpStream::connect(SocketAddr): Send & Sync & !Unpin);
}
assert_value!(tokio::net::TcpListener: Send & Sync ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/async_send_sync.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/async_send_sync.rs | 201 | 260 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.