Skip to content

Instantly share code, notes, and snippets.

@tmandry
Created May 13, 2019 22:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmandry/7e6dcf47d64529befdd8a7ffd7788191 to your computer and use it in GitHub Desktop.
Save tmandry/7e6dcf47d64529befdd8a7ffd7788191 to your computer and use it in GitHub Desktop.
// edition:2018
// aux-build:arc_wake.rs
#![feature(async_await, await_macro)]
extern crate arc_wake;
use std::pin::Pin;
use std::future::Future;
use std::sync::{
Arc,
atomic::{self, AtomicUsize},
};
use std::task::{Context, Poll};
use arc_wake::ArcWake;
struct Counter {
wakes: AtomicUsize,
}
impl ArcWake for Counter {
fn wake(self: Arc<Self>) {
Self::wake_by_ref(&self)
}
fn wake_by_ref(arc_self: &Arc<Self>) {
arc_self.wakes.fetch_add(1, atomic::Ordering::SeqCst);
}
}
struct WakeOnceThenComplete(bool, u8);
impl Future for WakeOnceThenComplete {
type Output = u8;
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<u8> {
if self.0 {
Poll::Ready(self.1)
} else {
cx.waker().wake_by_ref();
self.0 = true;
Poll::Pending
}
}
}
fn wait(fut: impl Future<Output = u8>) -> u8 {
let mut fut = Box::pin(fut);
let counter = Arc::new(Counter { wakes: AtomicUsize::new(0) });
let waker = ArcWake::into_waker(counter.clone());
let mut cx = Context::from_waker(&waker);
loop {
match fut.as_mut().poll(&mut cx) {
Poll::Ready(out) => return out,
Poll::Pending => (),
}
}
}
fn base() -> WakeOnceThenComplete { WakeOnceThenComplete(false, 1) }
async fn foo() -> u8 {
await!(base()) + await!(base()) + await!(base())
}
fn main() {
dbg!(12, std::mem::size_of_val(&foo()));
assert_eq!(3, wait(foo()));
}
// MIR for `foo::{{closure}}#0`
// source = MirSource { instance: Item(DefId(0:41 ~ async_fn_size[317d]::foo[0]::{{closure}}[0])), promoted: None }
// pass_name = StateTransform
// disambiguator = before
| User Type Annotations
| 0: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }, CanonicalVarInfo { kind: Ty(General(U0)) }], value: TypeOf(DefId(2:2793 ~ core[9129]::pin[0]::{{impl}}[3]::new_unchecked[0]), UserSubsts { substs: [^0], user_self_ty: Some(UserSelfTy { impl_def_id: DefId(2:2791 ~ core[9129]::pin[0]::{{impl}}[3]), self_ty: std::pin::Pin<^1> }) }) } at playground/async-fn-size.rs:61:5: 61:10
| 1: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }, CanonicalVarInfo { kind: Ty(General(U0)) }], value: TypeOf(DefId(2:2793 ~ core[9129]::pin[0]::{{impl}}[3]::new_unchecked[0]), UserSubsts { substs: [^0], user_self_ty: Some(UserSelfTy { impl_def_id: DefId(2:2791 ~ core[9129]::pin[0]::{{impl}}[3]), self_ty: std::pin::Pin<^1> }) }) } at playground/async-fn-size.rs:61:22: 61:27
| 2: Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Ty(General(U0)) }, CanonicalVarInfo { kind: Ty(General(U0)) }], value: TypeOf(DefId(2:2793 ~ core[9129]::pin[0]::{{impl}}[3]::new_unchecked[0]), UserSubsts { substs: [^0], user_self_ty: Some(UserSelfTy { impl_def_id: DefId(2:2791 ~ core[9129]::pin[0]::{{impl}}[3]), self_ty: std::pin::Pin<^1> }) }) } at playground/async-fn-size.rs:61:39: 61:44
|
fn foo::{{closure}}#0(_1: [static generator@playground/async-fn-size.rs:60:22: 62:2 {WakeOnceThenComplete, (), u8}]) -> u8
yields ()
{
let mut _0: u8; // return place in scope 0 at playground/async-fn-size.rs:60:22: 62:2
let mut _2: u8; // in scope 0 at playground/async-fn-size.rs:61:5: 61:27
let mut _3: u8; // in scope 0 at playground/async-fn-size.rs:61:5: 61:10
let mut _5: (); // in scope 0 at playground/async-fn-size.rs:60:22: 62:2
let mut _6: (); // in scope 0 at playground/async-fn-size.rs:61:5: 61:10
let mut _7: std::task::Poll<u8>; // in scope 0 at playground/async-fn-size.rs:61:5: 61:10
let mut _8: std::pin::Pin<&mut WakeOnceThenComplete>; // in scope 0 at playground/async-fn-size.rs:61:5: 61:10
let mut _9: &mut WakeOnceThenComplete; // in scope 0 at playground/async-fn-size.rs:61:5: 61:10
let mut _10: &mut WakeOnceThenComplete; // in scope 0 at playground/async-fn-size.rs:61:5: 61:10
let mut _11: isize; // in scope 0 at playground/async-fn-size.rs:61:5: 61:10
let mut _13: !; // in scope 0 at playground/async-fn-size.rs:61:5: 61:10
let mut _14: (); // in scope 0 at playground/async-fn-size.rs:61:5: 61:10
let mut _15: (); // in scope 0 at playground/async-fn-size.rs:61:5: 61:10
let mut _16: u8; // in scope 0 at playground/async-fn-size.rs:61:22: 61:27
let mut _18: (); // in scope 0 at playground/async-fn-size.rs:61:22: 61:27
let mut _19: std::task::Poll<u8>; // in scope 0 at playground/async-fn-size.rs:61:22: 61:27
let mut _20: std::pin::Pin<&mut WakeOnceThenComplete>; // in scope 0 at playground/async-fn-size.rs:61:22: 61:27
let mut _21: &mut WakeOnceThenComplete; // in scope 0 at playground/async-fn-size.rs:61:22: 61:27
let mut _22: &mut WakeOnceThenComplete; // in scope 0 at playground/async-fn-size.rs:61:22: 61:27
let mut _23: isize; // in scope 0 at playground/async-fn-size.rs:61:22: 61:27
let mut _25: !; // in scope 0 at playground/async-fn-size.rs:61:22: 61:27
let mut _26: (); // in scope 0 at playground/async-fn-size.rs:61:22: 61:27
let mut _27: (); // in scope 0 at playground/async-fn-size.rs:61:22: 61:27
let mut _28: (u8, bool); // in scope 0 at playground/async-fn-size.rs:61:5: 61:27
let mut _29: u8; // in scope 0 at playground/async-fn-size.rs:61:39: 61:44
let mut _31: (); // in scope 0 at playground/async-fn-size.rs:61:39: 61:44
let mut _32: std::task::Poll<u8>; // in scope 0 at playground/async-fn-size.rs:61:39: 61:44
let mut _33: std::pin::Pin<&mut WakeOnceThenComplete>; // in scope 0 at playground/async-fn-size.rs:61:39: 61:44
let mut _34: &mut WakeOnceThenComplete; // in scope 0 at playground/async-fn-size.rs:61:39: 61:44
let mut _35: &mut WakeOnceThenComplete; // in scope 0 at playground/async-fn-size.rs:61:39: 61:44
let mut _36: isize; // in scope 0 at playground/async-fn-size.rs:61:39: 61:44
let mut _38: !; // in scope 0 at playground/async-fn-size.rs:61:39: 61:44
let mut _39: (); // in scope 0 at playground/async-fn-size.rs:61:39: 61:44
let mut _40: (); // in scope 0 at playground/async-fn-size.rs:61:39: 61:44
let mut _41: (u8, bool); // in scope 0 at playground/async-fn-size.rs:61:5: 61:44
scope 1 {
let mut _4: WakeOnceThenComplete; // "pinned" in scope 1 at playground/async-fn-size.rs:61:5: 61:10
}
scope 2 {
let _12: u8; // "x" in scope 2 at playground/async-fn-size.rs:61:5: 61:10
scope 3 {
}
scope 4 {
}
}
scope 5 {
let mut _17: WakeOnceThenComplete; // "pinned" in scope 5 at playground/async-fn-size.rs:61:22: 61:27
}
scope 6 {
let _24: u8; // "x" in scope 6 at playground/async-fn-size.rs:61:22: 61:27
scope 7 {
}
scope 8 {
}
}
scope 9 {
let mut _30: WakeOnceThenComplete; // "pinned" in scope 9 at playground/async-fn-size.rs:61:39: 61:44
}
scope 10 {
let _37: u8; // "x" in scope 10 at playground/async-fn-size.rs:61:39: 61:44
scope 11 {
}
scope 12 {
}
}
bb0: {
StorageLive(_2); // bb0[0]: scope 0 at playground/async-fn-size.rs:61:5: 61:27
StorageLive(_3); // bb0[1]: scope 0 at playground/async-fn-size.rs:61:5: 61:10
StorageLive(_4); // bb0[2]: scope 0 at playground/async-fn-size.rs:61:5: 61:10
_4 = const base() -> [return: bb4, unwind: bb3]; // bb0[3]: scope 0 at playground/async-fn-size.rs:61:12: 61:18
// ty::Const
// + ty: fn() -> WakeOnceThenComplete {base}
// + val: Scalar(Bits { size: 0, bits: 0 })
// mir::Constant
// + span: playground/async-fn-size.rs:61:12: 61:16
// + ty: fn() -> WakeOnceThenComplete {base}
// + literal: Const { ty: fn() -> WakeOnceThenComplete {base}, val: Scalar(Bits { size: 0, bits: 0 }) }
}
bb1 (cleanup): {
resume; // bb1[0]: scope 0 at playground/async-fn-size.rs:60:22: 62:2
}
bb2 (cleanup): {
drop(_1) -> bb1; // bb2[0]: scope 0 at playground/async-fn-size.rs:62:1: 62:2
}
bb3 (cleanup): {
StorageDead(_4); // bb3[0]: scope 0 at playground/async-fn-size.rs:61:9: 61:10
goto -> bb2; // bb3[1]: scope 0 at playground/async-fn-size.rs:1:1: 1:1
}
bb4: {
StorageLive(_7); // bb4[0]: scope 2 at playground/async-fn-size.rs:61:5: 61:10
StorageLive(_8); // bb4[1]: scope 2 at playground/async-fn-size.rs:61:5: 61:10
StorageLive(_9); // bb4[2]: scope 3 at playground/async-fn-size.rs:61:5: 61:10
StorageLive(_10); // bb4[3]: scope 3 at playground/async-fn-size.rs:61:5: 61:10
_10 = &mut _4; // bb4[4]: scope 3 at playground/async-fn-size.rs:61:5: 61:10
_9 = &mut (*_10); // bb4[5]: scope 3 at playground/async-fn-size.rs:61:5: 61:10
_8 = const std::pin::Pin::<P>::new_unchecked(move _9) -> [return: bb5, unwind: bb7]; // bb4[6]: scope 3 at playground/async-fn-size.rs:61:5: 61:10
// ty::Const
// + ty: unsafe fn(&mut WakeOnceThenComplete) -> std::pin::Pin<&mut WakeOnceThenComplete> {std::pin::Pin::<&mut WakeOnceThenComplete>::new_unchecked}
// + val: Scalar(Bits { size: 0, bits: 0 })
// mir::Constant
// + span: playground/async-fn-size.rs:61:5: 61:10
// + ty: unsafe fn(&mut WakeOnceThenComplete) -> std::pin::Pin<&mut WakeOnceThenComplete> {std::pin::Pin::<&mut WakeOnceThenComplete>::new_unchecked}
// + user_ty: UserType(0)
// + literal: Const { ty: unsafe fn(&mut WakeOnceThenComplete) -> std::pin::Pin<&mut WakeOnceThenComplete> {std::pin::Pin::<&mut WakeOnceThenComplete>::new_unchecked}, val: Scalar(Bits { size: 0, bits: 0 }) }
}
bb5: {
StorageDead(_9); // bb5[0]: scope 3 at playground/async-fn-size.rs:61:9: 61:10
_7 = const std::future::poll_with_tls_context(move _8) -> [return: bb8, unwind: bb6]; // bb5[1]: scope 2 at playground/async-fn-size.rs:61:5: 61:10
// ty::Const
// + ty: for<'r> fn(std::pin::Pin<&'r mut WakeOnceThenComplete>) -> std::task::Poll<<WakeOnceThenComplete as std::future::Future>::Output> {std::future::poll_with_tls_context::<WakeOnceThenComplete>}
// + val: Scalar(Bits { size: 0, bits: 0 })
// mir::Constant
// + span: playground/async-fn-size.rs:61:5: 61:10
// + ty: for<'r> fn(std::pin::Pin<&'r mut WakeOnceThenComplete>) -> std::task::Poll<<WakeOnceThenComplete as std::future::Future>::Output> {std::future::poll_with_tls_context::<WakeOnceThenComplete>}
// + literal: Const { ty: for<'r> fn(std::pin::Pin<&'r mut WakeOnceThenComplete>) -> std::task::Poll<<WakeOnceThenComplete as std::future::Future>::Output> {std::future::poll_with_tls_context::<WakeOnceThenComplete>}, val: Scalar(Bits { size: 0, bits: 0 }) }
}
bb6 (cleanup): {
StorageDead(_10); // bb6[0]: scope 2 at playground/async-fn-size.rs:61:9: 61:10
goto -> bb3; // bb6[1]: scope 2 at playground/async-fn-size.rs:1:1: 1:1
}
bb7 (cleanup): {
StorageDead(_9); // bb7[0]: scope 3 at playground/async-fn-size.rs:61:9: 61:10
goto -> bb6; // bb7[1]: scope 3 at playground/async-fn-size.rs:1:1: 1:1
}
bb8: {
StorageDead(_8); // bb8[0]: scope 2 at playground/async-fn-size.rs:61:9: 61:10
_11 = discriminant(_7); // bb8[1]: scope 2 at playground/async-fn-size.rs:61:5: 61:10
switchInt(move _11) -> [0isize: bb10, 1isize: bb11, otherwise: bb9]; // bb8[2]: scope 2 at playground/async-fn-size.rs:61:5: 61:10
}
bb9: {
unreachable; // bb9[0]: scope 0 at playground/async-fn-size.rs:62:2: 62:2
}
bb10: {
StorageLive(_12); // bb10[0]: scope 2 at playground/async-fn-size.rs:61:5: 61:10
_12 = ((_7 as Ready).0: u8); // bb10[1]: scope 2 at playground/async-fn-size.rs:61:5: 61:10
_3 = _12; // bb10[2]: scope 4 at playground/async-fn-size.rs:61:5: 61:10
StorageDead(_12); // bb10[3]: scope 2 at playground/async-fn-size.rs:61:9: 61:10
StorageDead(_7); // bb10[4]: scope 2 at playground/async-fn-size.rs:61:9: 61:10
StorageDead(_10); // bb10[5]: scope 2 at playground/async-fn-size.rs:61:9: 61:10
StorageDead(_4); // bb10[6]: scope 0 at playground/async-fn-size.rs:61:9: 61:10
StorageLive(_16); // bb10[7]: scope 0 at playground/async-fn-size.rs:61:22: 61:27
StorageLive(_17); // bb10[8]: scope 0 at playground/async-fn-size.rs:61:22: 61:27
_17 = const base() -> [return: bb17, unwind: bb16]; // bb10[9]: scope 0 at playground/async-fn-size.rs:61:29: 61:35
// ty::Const
// + ty: fn() -> WakeOnceThenComplete {base}
// + val: Scalar(Bits { size: 0, bits: 0 })
// mir::Constant
// + span: playground/async-fn-size.rs:61:29: 61:33
// + ty: fn() -> WakeOnceThenComplete {base}
// + literal: Const { ty: fn() -> WakeOnceThenComplete {base}, val: Scalar(Bits { size: 0, bits: 0 }) }
}
bb11: {
_6 = (); // bb11[0]: scope 4 at playground/async-fn-size.rs:61:5: 61:10
StorageDead(_12); // bb11[1]: scope 2 at playground/async-fn-size.rs:61:9: 61:10
StorageDead(_7); // bb11[2]: scope 2 at playground/async-fn-size.rs:61:9: 61:10
StorageDead(_10); // bb11[3]: scope 2 at playground/async-fn-size.rs:61:9: 61:10
StorageLive(_15); // bb11[4]: scope 2 at playground/async-fn-size.rs:61:5: 61:10
_15 = (); // bb11[5]: scope 2 at playground/async-fn-size.rs:61:5: 61:10
_1 = suspend(move _15) -> [resume: bb12, drop: bb13]; // bb11[6]: scope 2 at playground/async-fn-size.rs:61:5: 61:10
}
bb12: {
_14 = (); // bb12[0]: scope 2 at playground/async-fn-size.rs:61:5: 61:10
StorageDead(_15); // bb12[1]: scope 2 at playground/async-fn-size.rs:61:9: 61:10
_5 = (); // bb12[2]: scope 2 at playground/async-fn-size.rs:61:5: 61:10
goto -> bb4; // bb12[3]: scope 2 at playground/async-fn-size.rs:61:5: 61:10
}
bb13: {
StorageDead(_15); // bb13[0]: scope 2 at playground/async-fn-size.rs:61:9: 61:10
StorageDead(_4); // bb13[1]: scope 0 at playground/async-fn-size.rs:61:9: 61:10
goto -> bb14; // bb13[2]: scope 0 at playground/async-fn-size.rs:60:22: 62:2
}
bb14: {
drop(_1) -> [return: bb15, unwind: bb1]; // bb14[0]: scope 0 at playground/async-fn-size.rs:62:1: 62:2
}
bb15: {
generator_drop; // bb15[0]: scope 0 at playground/async-fn-size.rs:60:22: 62:2
}
bb16 (cleanup): {
StorageDead(_17); // bb16[0]: scope 0 at playground/async-fn-size.rs:61:26: 61:27
goto -> bb2; // bb16[1]: scope 0 at playground/async-fn-size.rs:1:1: 1:1
}
bb17: {
StorageLive(_19); // bb17[0]: scope 6 at playground/async-fn-size.rs:61:22: 61:27
StorageLive(_20); // bb17[1]: scope 6 at playground/async-fn-size.rs:61:22: 61:27
StorageLive(_21); // bb17[2]: scope 7 at playground/async-fn-size.rs:61:22: 61:27
StorageLive(_22); // bb17[3]: scope 7 at playground/async-fn-size.rs:61:22: 61:27
_22 = &mut _17; // bb17[4]: scope 7 at playground/async-fn-size.rs:61:22: 61:27
_21 = &mut (*_22); // bb17[5]: scope 7 at playground/async-fn-size.rs:61:22: 61:27
_20 = const std::pin::Pin::<P>::new_unchecked(move _21) -> [return: bb18, unwind: bb20]; // bb17[6]: scope 7 at playground/async-fn-size.rs:61:22: 61:27
// ty::Const
// + ty: unsafe fn(&mut WakeOnceThenComplete) -> std::pin::Pin<&mut WakeOnceThenComplete> {std::pin::Pin::<&mut WakeOnceThenComplete>::new_unchecked}
// + val: Scalar(Bits { size: 0, bits: 0 })
// mir::Constant
// + span: playground/async-fn-size.rs:61:22: 61:27
// + ty: unsafe fn(&mut WakeOnceThenComplete) -> std::pin::Pin<&mut WakeOnceThenComplete> {std::pin::Pin::<&mut WakeOnceThenComplete>::new_unchecked}
// + user_ty: UserType(1)
// + literal: Const { ty: unsafe fn(&mut WakeOnceThenComplete) -> std::pin::Pin<&mut WakeOnceThenComplete> {std::pin::Pin::<&mut WakeOnceThenComplete>::new_unchecked}, val: Scalar(Bits { size: 0, bits: 0 }) }
}
bb18: {
StorageDead(_21); // bb18[0]: scope 7 at playground/async-fn-size.rs:61:26: 61:27
_19 = const std::future::poll_with_tls_context(move _20) -> [return: bb21, unwind: bb19]; // bb18[1]: scope 6 at playground/async-fn-size.rs:61:22: 61:27
// ty::Const
// + ty: for<'r> fn(std::pin::Pin<&'r mut WakeOnceThenComplete>) -> std::task::Poll<<WakeOnceThenComplete as std::future::Future>::Output> {std::future::poll_with_tls_context::<WakeOnceThenComplete>}
// + val: Scalar(Bits { size: 0, bits: 0 })
// mir::Constant
// + span: playground/async-fn-size.rs:61:22: 61:27
// + ty: for<'r> fn(std::pin::Pin<&'r mut WakeOnceThenComplete>) -> std::task::Poll<<WakeOnceThenComplete as std::future::Future>::Output> {std::future::poll_with_tls_context::<WakeOnceThenComplete>}
// + literal: Const { ty: for<'r> fn(std::pin::Pin<&'r mut WakeOnceThenComplete>) -> std::task::Poll<<WakeOnceThenComplete as std::future::Future>::Output> {std::future::poll_with_tls_context::<WakeOnceThenComplete>}, val: Scalar(Bits { size: 0, bits: 0 }) }
}
bb19 (cleanup): {
StorageDead(_22); // bb19[0]: scope 6 at playground/async-fn-size.rs:61:26: 61:27
goto -> bb16; // bb19[1]: scope 6 at playground/async-fn-size.rs:1:1: 1:1
}
bb20 (cleanup): {
StorageDead(_21); // bb20[0]: scope 7 at playground/async-fn-size.rs:61:26: 61:27
goto -> bb19; // bb20[1]: scope 7 at playground/async-fn-size.rs:1:1: 1:1
}
bb21: {
StorageDead(_20); // bb21[0]: scope 6 at playground/async-fn-size.rs:61:26: 61:27
_23 = discriminant(_19); // bb21[1]: scope 6 at playground/async-fn-size.rs:61:22: 61:27
switchInt(move _23) -> [0isize: bb22, 1isize: bb23, otherwise: bb9]; // bb21[2]: scope 6 at playground/async-fn-size.rs:61:22: 61:27
}
bb22: {
StorageLive(_24); // bb22[0]: scope 6 at playground/async-fn-size.rs:61:22: 61:27
_24 = ((_19 as Ready).0: u8); // bb22[1]: scope 6 at playground/async-fn-size.rs:61:22: 61:27
_16 = _24; // bb22[2]: scope 8 at playground/async-fn-size.rs:61:22: 61:27
StorageDead(_24); // bb22[3]: scope 6 at playground/async-fn-size.rs:61:26: 61:27
StorageDead(_19); // bb22[4]: scope 6 at playground/async-fn-size.rs:61:26: 61:27
StorageDead(_22); // bb22[5]: scope 6 at playground/async-fn-size.rs:61:26: 61:27
StorageDead(_17); // bb22[6]: scope 0 at playground/async-fn-size.rs:61:26: 61:27
_28 = CheckedAdd(move _3, move _16); // bb22[7]: scope 0 at playground/async-fn-size.rs:61:5: 61:27
assert(!move (_28.1: bool), "attempt to add with overflow") -> [success: bb26, unwind: bb2]; // bb22[8]: scope 0 at playground/async-fn-size.rs:61:5: 61:27
}
bb23: {
_18 = (); // bb23[0]: scope 8 at playground/async-fn-size.rs:61:22: 61:27
StorageDead(_24); // bb23[1]: scope 6 at playground/async-fn-size.rs:61:26: 61:27
StorageDead(_19); // bb23[2]: scope 6 at playground/async-fn-size.rs:61:26: 61:27
StorageDead(_22); // bb23[3]: scope 6 at playground/async-fn-size.rs:61:26: 61:27
StorageLive(_27); // bb23[4]: scope 6 at playground/async-fn-size.rs:61:22: 61:27
_27 = (); // bb23[5]: scope 6 at playground/async-fn-size.rs:61:22: 61:27
_1 = suspend(move _27) -> [resume: bb24, drop: bb25]; // bb23[6]: scope 6 at playground/async-fn-size.rs:61:22: 61:27
}
bb24: {
_26 = (); // bb24[0]: scope 6 at playground/async-fn-size.rs:61:22: 61:27
StorageDead(_27); // bb24[1]: scope 6 at playground/async-fn-size.rs:61:26: 61:27
_5 = (); // bb24[2]: scope 6 at playground/async-fn-size.rs:61:22: 61:27
goto -> bb17; // bb24[3]: scope 6 at playground/async-fn-size.rs:61:22: 61:27
}
bb25: {
StorageDead(_27); // bb25[0]: scope 6 at playground/async-fn-size.rs:61:26: 61:27
StorageDead(_17); // bb25[1]: scope 0 at playground/async-fn-size.rs:61:26: 61:27
goto -> bb14; // bb25[2]: scope 0 at playground/async-fn-size.rs:60:22: 62:2
}
bb26: {
_2 = move (_28.0: u8); // bb26[0]: scope 0 at playground/async-fn-size.rs:61:5: 61:27
StorageDead(_16); // bb26[1]: scope 0 at playground/async-fn-size.rs:61:26: 61:27
StorageDead(_3); // bb26[2]: scope 0 at playground/async-fn-size.rs:61:26: 61:27
StorageLive(_29); // bb26[3]: scope 0 at playground/async-fn-size.rs:61:39: 61:44
StorageLive(_30); // bb26[4]: scope 0 at playground/async-fn-size.rs:61:39: 61:44
_30 = const base() -> [return: bb28, unwind: bb27]; // bb26[5]: scope 0 at playground/async-fn-size.rs:61:46: 61:52
// ty::Const
// + ty: fn() -> WakeOnceThenComplete {base}
// + val: Scalar(Bits { size: 0, bits: 0 })
// mir::Constant
// + span: playground/async-fn-size.rs:61:46: 61:50
// + ty: fn() -> WakeOnceThenComplete {base}
// + literal: Const { ty: fn() -> WakeOnceThenComplete {base}, val: Scalar(Bits { size: 0, bits: 0 }) }
}
bb27 (cleanup): {
StorageDead(_30); // bb27[0]: scope 0 at playground/async-fn-size.rs:61:43: 61:44
goto -> bb2; // bb27[1]: scope 0 at playground/async-fn-size.rs:1:1: 1:1
}
bb28: {
StorageLive(_32); // bb28[0]: scope 10 at playground/async-fn-size.rs:61:39: 61:44
StorageLive(_33); // bb28[1]: scope 10 at playground/async-fn-size.rs:61:39: 61:44
StorageLive(_34); // bb28[2]: scope 11 at playground/async-fn-size.rs:61:39: 61:44
StorageLive(_35); // bb28[3]: scope 11 at playground/async-fn-size.rs:61:39: 61:44
_35 = &mut _30; // bb28[4]: scope 11 at playground/async-fn-size.rs:61:39: 61:44
_34 = &mut (*_35); // bb28[5]: scope 11 at playground/async-fn-size.rs:61:39: 61:44
_33 = const std::pin::Pin::<P>::new_unchecked(move _34) -> [return: bb29, unwind: bb31]; // bb28[6]: scope 11 at playground/async-fn-size.rs:61:39: 61:44
// ty::Const
// + ty: unsafe fn(&mut WakeOnceThenComplete) -> std::pin::Pin<&mut WakeOnceThenComplete> {std::pin::Pin::<&mut WakeOnceThenComplete>::new_unchecked}
// + val: Scalar(Bits { size: 0, bits: 0 })
// mir::Constant
// + span: playground/async-fn-size.rs:61:39: 61:44
// + ty: unsafe fn(&mut WakeOnceThenComplete) -> std::pin::Pin<&mut WakeOnceThenComplete> {std::pin::Pin::<&mut WakeOnceThenComplete>::new_unchecked}
// + user_ty: UserType(2)
// + literal: Const { ty: unsafe fn(&mut WakeOnceThenComplete) -> std::pin::Pin<&mut WakeOnceThenComplete> {std::pin::Pin::<&mut WakeOnceThenComplete>::new_unchecked}, val: Scalar(Bits { size: 0, bits: 0 }) }
}
bb29: {
StorageDead(_34); // bb29[0]: scope 11 at playground/async-fn-size.rs:61:43: 61:44
_32 = const std::future::poll_with_tls_context(move _33) -> [return: bb32, unwind: bb30]; // bb29[1]: scope 10 at playground/async-fn-size.rs:61:39: 61:44
// ty::Const
// + ty: for<'r> fn(std::pin::Pin<&'r mut WakeOnceThenComplete>) -> std::task::Poll<<WakeOnceThenComplete as std::future::Future>::Output> {std::future::poll_with_tls_context::<WakeOnceThenComplete>}
// + val: Scalar(Bits { size: 0, bits: 0 })
// mir::Constant
// + span: playground/async-fn-size.rs:61:39: 61:44
// + ty: for<'r> fn(std::pin::Pin<&'r mut WakeOnceThenComplete>) -> std::task::Poll<<WakeOnceThenComplete as std::future::Future>::Output> {std::future::poll_with_tls_context::<WakeOnceThenComplete>}
// + literal: Const { ty: for<'r> fn(std::pin::Pin<&'r mut WakeOnceThenComplete>) -> std::task::Poll<<WakeOnceThenComplete as std::future::Future>::Output> {std::future::poll_with_tls_context::<WakeOnceThenComplete>}, val: Scalar(Bits { size: 0, bits: 0 }) }
}
bb30 (cleanup): {
StorageDead(_35); // bb30[0]: scope 10 at playground/async-fn-size.rs:61:43: 61:44
goto -> bb27; // bb30[1]: scope 10 at playground/async-fn-size.rs:1:1: 1:1
}
bb31 (cleanup): {
StorageDead(_34); // bb31[0]: scope 11 at playground/async-fn-size.rs:61:43: 61:44
goto -> bb30; // bb31[1]: scope 11 at playground/async-fn-size.rs:1:1: 1:1
}
bb32: {
StorageDead(_33); // bb32[0]: scope 10 at playground/async-fn-size.rs:61:43: 61:44
_36 = discriminant(_32); // bb32[1]: scope 10 at playground/async-fn-size.rs:61:39: 61:44
switchInt(move _36) -> [0isize: bb33, 1isize: bb34, otherwise: bb9]; // bb32[2]: scope 10 at playground/async-fn-size.rs:61:39: 61:44
}
bb33: {
StorageLive(_37); // bb33[0]: scope 10 at playground/async-fn-size.rs:61:39: 61:44
_37 = ((_32 as Ready).0: u8); // bb33[1]: scope 10 at playground/async-fn-size.rs:61:39: 61:44
_29 = _37; // bb33[2]: scope 12 at playground/async-fn-size.rs:61:39: 61:44
StorageDead(_37); // bb33[3]: scope 10 at playground/async-fn-size.rs:61:43: 61:44
StorageDead(_32); // bb33[4]: scope 10 at playground/async-fn-size.rs:61:43: 61:44
StorageDead(_35); // bb33[5]: scope 10 at playground/async-fn-size.rs:61:43: 61:44
StorageDead(_30); // bb33[6]: scope 0 at playground/async-fn-size.rs:61:43: 61:44
_41 = CheckedAdd(move _2, move _29); // bb33[7]: scope 0 at playground/async-fn-size.rs:61:5: 61:44
assert(!move (_41.1: bool), "attempt to add with overflow") -> [success: bb37, unwind: bb2]; // bb33[8]: scope 0 at playground/async-fn-size.rs:61:5: 61:44
}
bb34: {
_31 = (); // bb34[0]: scope 12 at playground/async-fn-size.rs:61:39: 61:44
StorageDead(_37); // bb34[1]: scope 10 at playground/async-fn-size.rs:61:43: 61:44
StorageDead(_32); // bb34[2]: scope 10 at playground/async-fn-size.rs:61:43: 61:44
StorageDead(_35); // bb34[3]: scope 10 at playground/async-fn-size.rs:61:43: 61:44
StorageLive(_40); // bb34[4]: scope 10 at playground/async-fn-size.rs:61:39: 61:44
_40 = (); // bb34[5]: scope 10 at playground/async-fn-size.rs:61:39: 61:44
_1 = suspend(move _40) -> [resume: bb35, drop: bb36]; // bb34[6]: scope 10 at playground/async-fn-size.rs:61:39: 61:44
}
bb35: {
_39 = (); // bb35[0]: scope 10 at playground/async-fn-size.rs:61:39: 61:44
StorageDead(_40); // bb35[1]: scope 10 at playground/async-fn-size.rs:61:43: 61:44
_5 = (); // bb35[2]: scope 10 at playground/async-fn-size.rs:61:39: 61:44
goto -> bb28; // bb35[3]: scope 10 at playground/async-fn-size.rs:61:39: 61:44
}
bb36: {
StorageDead(_40); // bb36[0]: scope 10 at playground/async-fn-size.rs:61:43: 61:44
StorageDead(_30); // bb36[1]: scope 0 at playground/async-fn-size.rs:61:43: 61:44
goto -> bb14; // bb36[2]: scope 0 at playground/async-fn-size.rs:60:22: 62:2
}
bb37: {
_0 = move (_41.0: u8); // bb37[0]: scope 0 at playground/async-fn-size.rs:61:5: 61:44
StorageDead(_29); // bb37[1]: scope 0 at playground/async-fn-size.rs:61:43: 61:44
StorageDead(_2); // bb37[2]: scope 0 at playground/async-fn-size.rs:61:43: 61:44
drop(_1) -> [return: bb38, unwind: bb1]; // bb37[3]: scope 0 at playground/async-fn-size.rs:62:1: 62:2
}
bb38: {
return; // bb38[0]: scope 0 at playground/async-fn-size.rs:62:2: 62:2
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment