mirror of
https://github.com/Noratrieb/evaluate_obligation-fingerprints.git
synced 2026-01-15 10:45:01 +01:00
integrate repro from cyrgani
https://github.com/rust-lang/rust/issues/147825#issuecomment-3417158512
This commit is contained in:
parent
5ce26e9089
commit
ee9a455919
1 changed files with 24 additions and 82 deletions
106
src/main.rs
106
src/main.rs
|
|
@ -1,108 +1,50 @@
|
|||
use std::pin::Pin;
|
||||
use std::{
|
||||
pin::Pin,
|
||||
task::{Context, Poll},
|
||||
};
|
||||
|
||||
pub trait FnOnce1<A> {
|
||||
trait FnOnce1 {
|
||||
type Output;
|
||||
fn call_once(self, arg: A) -> Self::Output;
|
||||
}
|
||||
|
||||
impl<T, A, R> FnOnce1<A> for T
|
||||
impl<T, R> FnOnce1 for T
|
||||
where
|
||||
T: FnOnce(A) -> R,
|
||||
T: FnOnce() -> R,
|
||||
{
|
||||
type Output = R;
|
||||
fn call_once(self, arg: A) -> R {
|
||||
self(arg)
|
||||
}
|
||||
}
|
||||
struct Map<F>(F);
|
||||
|
||||
pub struct MapOkFn<F>(F);
|
||||
|
||||
impl<F, T, E> FnOnce1<Result<T, E>> for MapOkFn<F>
|
||||
impl<F, T> Future for Map<F>
|
||||
where
|
||||
F: FnOnce1<T>,
|
||||
{
|
||||
type Output = Result<F::Output, E>;
|
||||
fn call_once(self, arg: Result<T, E>) -> Self::Output {
|
||||
arg.map(|x| self.0.call_once(x))
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Map<Fut, F> {
|
||||
inner: (Fut, F),
|
||||
}
|
||||
|
||||
impl<Fut, F, T> Future for Map<Fut, F>
|
||||
where
|
||||
Fut: Future,
|
||||
F: FnOnce1<Fut::Output, Output = T>,
|
||||
F: FnOnce1<Output = T>,
|
||||
{
|
||||
type Output = T;
|
||||
fn poll(
|
||||
self: core::pin::Pin<&mut Self>,
|
||||
cx: &mut core::task::Context<'_>,
|
||||
) -> core::task::Poll<Self::Output> {
|
||||
|
||||
fn poll(self: Pin<&mut Self>, _: &mut Context<'_>) -> Poll<T> {
|
||||
loop {}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct MapOk<Fut, F> {
|
||||
inner: Map<Fut, MapOkFn<F>>,
|
||||
}
|
||||
|
||||
impl<Fut, F> Future for MapOk<Fut, F>
|
||||
where
|
||||
Map<Fut, MapOkFn<F>>: Future,
|
||||
{
|
||||
type Output = <Map<Fut, MapOkFn<F>> as Future>::Output;
|
||||
fn poll(
|
||||
self: core::pin::Pin<&mut Self>,
|
||||
cx: &mut core::task::Context<'_>,
|
||||
) -> core::task::Poll<Self::Output> {
|
||||
loop {}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct MaybeDone<Fut: Future>(Fut);
|
||||
|
||||
pub fn take_output<Fut: Future>(x: Pin<&mut MaybeDone<Fut>>) -> Fut::Output {
|
||||
fn take_output<Fut: Future>(_: Pin<&mut Fut>) -> Fut::Output {
|
||||
loop {}
|
||||
}
|
||||
|
||||
struct AndThen<Fut1, F>(Fut1, F);
|
||||
impl<Fut1, F> Future for AndThen<Fut1, F>
|
||||
where
|
||||
MapOk<Fut1, F>: Future,
|
||||
{
|
||||
type Output = ();
|
||||
fn poll(
|
||||
self: Pin<&mut Self>,
|
||||
cx: &mut std::task::Context<'_>,
|
||||
) -> std::task::Poll<Self::Output> {
|
||||
loop {}
|
||||
}
|
||||
}
|
||||
fn main() {
|
||||
let mut bazz = Map(async || ());
|
||||
let mut barr = async { Bazz {} };
|
||||
|
||||
fn and_then<This, F>(s: This, f: F) -> AndThen<This, F> {
|
||||
loop {}
|
||||
}
|
||||
|
||||
pub async fn bar_baz() {
|
||||
let bazz = and_then(async { Ok::<(), ()>(()) }, async |_| Ok::<(), ()>(()));
|
||||
let barr = async { Bazz {} };
|
||||
|
||||
let mut _fut0 = MaybeDone(bazz);
|
||||
let mut _fut0 = unsafe { std::pin::Pin::new_unchecked(&mut _fut0) };
|
||||
let mut _fut1 = MaybeDone(barr);
|
||||
let mut _fut1 = unsafe { std::pin::Pin::new_unchecked(&mut _fut1) };
|
||||
std::future::poll_fn(move |__cx: &mut std::task::Context<'_>| {
|
||||
std::task::Poll::Ready((take_output(_fut0.as_mut()), take_output(_fut1.as_mut())))
|
||||
});
|
||||
let mut _fut0 = unsafe { Pin::new_unchecked(&mut bazz) };
|
||||
let mut _fut1 = unsafe { Pin::new_unchecked(&mut barr) };
|
||||
|| {
|
||||
take_output(_fut0.as_mut());
|
||||
take_output(_fut1.as_mut());
|
||||
};
|
||||
}
|
||||
|
||||
// 1
|
||||
// 2
|
||||
|
||||
#[derive(proc_macro_thing::MyMacro)]
|
||||
#[helper]
|
||||
pub struct Bazz {}
|
||||
|
||||
fn main() {}
|
||||
struct Bazz {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue