Auto merge of #139114 - m-ou-se:super-let-pin, r=davidtwco

Implement `pin!()` using `super let`

Tracking issue for super let: https://github.com/rust-lang/rust/issues/139076

This uses `super let` to implement `pin!()`.

This means we can remove [the hack](https://github.com/rust-lang/rust/pull/138717) we had to put in to fix https://github.com/rust-lang/rust/issues/138596.

It also means we can remove the original hack to make `pin!()` work, which used a questionable public-but-unstable field rather than a proper private field.

While `super let` is still unstable and subject to change, it seems safe to assume that future Rust will always have a way to express `pin!()` in a compatible way, considering `pin!()` is already stable.

It'd help [the experiment](https://github.com/rust-lang/rust/issues/139076) to have `pin!()` use `super let`, so we can get some more experience with it.
This commit is contained in:
bors 2025-04-19 08:01:53 +00:00
commit a7c39b6861
20 changed files with 78 additions and 192 deletions

View file

@ -2,7 +2,8 @@
//@ edition: 2024
//@ pp-exact
#![feature(gen_blocks, coroutines, coroutine_trait, yield_expr)]
#![feature(gen_blocks, coroutines, coroutine_trait, yield_expr,
stmt_expr_attributes)]
use std::ops::{Coroutine, CoroutineState};
use std::pin::pin;