fix lints in miri
This commit is contained in:
1 parent
b0586843b2
commit
c48788270e
2 files changed
+26
-26
No files matched your search
@@ -98,7 +98,7 @@ impl Runtime {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A gaurd for a new runtime. This must be used to override the current runtime when importing components from a dynamic library that has it's own runtime.
|
/// A guard for a new runtime. This must be used to override the current runtime when importing components from a dynamic library that has it's own runtime.
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// use dioxus::prelude::*;
|
/// use dioxus::prelude::*;
|
||||||
|
|||||||
+25
-25
@@ -1,13 +1,33 @@
|
|||||||
//! Verify that tasks get polled by the virtualdom properly, and that we escape wait_for_work safely
|
//! Verify that tasks get polled by the virtualdom properly, and that we escape wait_for_work safely
|
||||||
|
|
||||||
use dioxus::prelude::*;
|
|
||||||
use std::{sync::atomic::AtomicUsize, time::Duration};
|
|
||||||
|
|
||||||
static POLL_COUNT: AtomicUsize = AtomicUsize::new(0);
|
|
||||||
|
|
||||||
#[cfg(not(miri))]
|
#[cfg(not(miri))]
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn it_works() {
|
async fn it_works() {
|
||||||
|
use dioxus::prelude::*;
|
||||||
|
use std::{sync::atomic::AtomicUsize, time::Duration};
|
||||||
|
|
||||||
|
static POLL_COUNT: AtomicUsize = AtomicUsize::new(0);
|
||||||
|
|
||||||
|
fn app(cx: Scope) -> Element {
|
||||||
|
cx.use_hook(|| {
|
||||||
|
cx.spawn(async {
|
||||||
|
for x in 0..10 {
|
||||||
|
tokio::time::sleep(Duration::from_micros(50)).await;
|
||||||
|
POLL_COUNT.fetch_add(x, std::sync::atomic::Ordering::Relaxed);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
cx.spawn(async {
|
||||||
|
for x in 0..10 {
|
||||||
|
tokio::time::sleep(Duration::from_micros(25)).await;
|
||||||
|
POLL_COUNT.fetch_add(x * 2, std::sync::atomic::Ordering::Relaxed);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
cx.render(rsx!(()))
|
||||||
|
}
|
||||||
|
|
||||||
let mut dom = VirtualDom::new(app);
|
let mut dom = VirtualDom::new(app);
|
||||||
|
|
||||||
let _ = dom.rebuild();
|
let _ = dom.rebuild();
|
||||||
@@ -24,23 +44,3 @@ async fn it_works() {
|
|||||||
135
|
135
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn app(cx: Scope) -> Element {
|
|
||||||
cx.use_hook(|| {
|
|
||||||
cx.spawn(async {
|
|
||||||
for x in 0..10 {
|
|
||||||
tokio::time::sleep(Duration::from_micros(50)).await;
|
|
||||||
POLL_COUNT.fetch_add(x, std::sync::atomic::Ordering::Relaxed);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
cx.spawn(async {
|
|
||||||
for x in 0..10 {
|
|
||||||
tokio::time::sleep(Duration::from_micros(25)).await;
|
|
||||||
POLL_COUNT.fetch_add(x * 2, std::sync::atomic::Ordering::Relaxed);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
cx.render(rsx!(()))
|
|
||||||
}
|
|
||||||
Reference in new issue
Block a user