-
Notifications
You must be signed in to change notification settings - Fork 349
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #2071 - RalfJung:provenance, r=RalfJung
adjust for provenance cleanup This is the Miri side of rust-lang/rust#96165
- Loading branch information
Showing
9 changed files
with
92 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
c8422403f775126c40d558838d321c063554c822 | ||
27af5175497936ea3413bef5816e7c0172514b9c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#![feature(pin_macro)] | ||
|
||
use core::future::Future; | ||
use core::pin::Pin; | ||
use core::task::{Context, Poll}; | ||
|
||
use std::sync::Arc; | ||
|
||
struct NopWaker; | ||
|
||
impl std::task::Wake for NopWaker { | ||
fn wake(self: Arc<Self>) {} | ||
} | ||
|
||
pub fn fuzzing_block_on<O, F: Future<Output = O>>(fut: F) -> O { | ||
let mut fut = std::pin::pin!(fut); | ||
let waker = std::task::Waker::from(Arc::new(NopWaker)); | ||
let mut context = std::task::Context::from_waker(&waker); | ||
loop { | ||
match fut.as_mut().poll(&mut context) { | ||
Poll::Ready(v) => return v, | ||
Poll::Pending => {} | ||
} | ||
} | ||
} | ||
|
||
pub struct LastFuture<S> { | ||
last: S, | ||
} | ||
|
||
impl<S> Future for LastFuture<S> | ||
where | ||
Self: Unpin, | ||
S: Unpin + Copy, | ||
{ | ||
type Output = S; | ||
|
||
fn poll(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll<Self::Output> { | ||
return Poll::Ready(self.last); | ||
} | ||
} | ||
|
||
fn main() { | ||
fuzzing_block_on(async { | ||
LastFuture { last: &0u32 }.await; | ||
LastFuture { last: Option::<u32>::None }.await; | ||
}); | ||
} |