chore: checkpoint before Python removal

This commit is contained in:
2026-03-26 22:33:59 +00:00
parent 683cec9307
commit e568ddf82a
29972 changed files with 11269302 additions and 2 deletions

View File

@@ -0,0 +1,30 @@
use async_stream::stream;
use futures_util::StreamExt;
use std::pin::pin;
macro_rules! asynk {
($e:expr) => {
async { $e }
};
}
#[tokio::main]
async fn main() {
pin!(stream! {
let yield_42 = asynk!(yield 42_usize);
let s = stream! {
yield Box::new(12345);
yield_42.await; // yield 42 -- wait that's not a Box!?
};
for await (n, i) in s.enumerate() {
println!("Item at index {n}:\n {i}");
// Item at index 0:
// 12345
// Item at index 1:
// Segmentation fault
}
})
.next()
.await;
}

View File

@@ -0,0 +1,36 @@
error[E0767]: use of unreachable label `'__async_stream_private_check_scope`
--> tests/ui/unsoundness_issue_106.rs:14:10
|
14 | pin!(stream! {
| __________^
15 | | let yield_42 = asynk!(yield 42_usize);
16 | | let s = stream! {
17 | | yield Box::new(12345);
... |
26 | | }
27 | | })
| | ^
| | |
| |_____unreachable label `'__async_stream_private_check_scope`
| unreachable label defined here
|
= note: labels are unreachable through functions, closures, async blocks and modules
= note: this error originates in the macro `$crate::__private::stream_inner` which comes from the expansion of the macro `stream` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0267]: `break` inside `async` block
--> tests/ui/unsoundness_issue_106.rs:14:10
|
8 | async { $e }
| ----- enclosing `async` block
...
14 | pin!(stream! {
| __________^
15 | | let yield_42 = asynk!(yield 42_usize);
16 | | let s = stream! {
17 | | yield Box::new(12345);
... |
26 | | }
27 | | })
| |_____^ cannot `break` inside `async` block
|
= note: this error originates in the macro `$crate::__private::stream_inner` which comes from the expansion of the macro `stream` (in Nightly builds, run with -Z macro-backtrace for more info)

View File

@@ -0,0 +1,23 @@
use async_stream::stream;
use futures_util::StreamExt;
use std::pin::pin;
#[tokio::main]
async fn main() {
let mut outer = vec![];
{
let v = vec![0; 10];
let v_ref = &v;
let mut s = pin!(stream! {
for x in v_ref {
yield x
}
});
while let Some(x) = s.next().await {
outer.push(x);
}
};
// use-after-free
println!("{outer:?}"); // […garbage allocator internals…, 0, 0, 0]
}

View File

@@ -0,0 +1,13 @@
error[E0597]: `v` does not live long enough
--> tests/ui/unsoundness_issue_107.rs:11:21
|
10 | let v = vec![0; 10];
| - binding `v` declared here
11 | let v_ref = &v;
| ^^ borrowed value does not live long enough
...
20 | };
| - `v` dropped here while still borrowed
21 | // use-after-free
22 | println!("{outer:?}"); // […garbage allocator internals…, 0, 0, 0]
| --------- borrow later used here

View File

@@ -0,0 +1,11 @@
use async_stream::stream;
fn main() {
async fn work() {}
stream! {
tokio::select! {
_ = work() => yield fn f() {},
}
};
}

View File

@@ -0,0 +1,5 @@
error: expected an expression
--> tests/ui/yield_bad_expr_in_macro.rs:8:33
|
8 | _ = work() => yield fn f() {},
| ^^

View File

@@ -0,0 +1,11 @@
use async_stream::stream;
fn main() {
stream! {
let f = async {
yield 123;
};
let v = f.await;
};
}

View File

@@ -0,0 +1,13 @@
error[E0658]: yield syntax is experimental
--> tests/ui/yield_in_async.rs:6:13
|
6 | yield 123;
| ^^^^^^^^^
|
= note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
error[E0727]: `async` coroutines are not yet supported
--> tests/ui/yield_in_async.rs:6:13
|
6 | yield 123;
| ^^^^^^^^^

View File

@@ -0,0 +1,11 @@
use async_stream::stream;
fn main() {
stream! {
Ok("value")
.and_then(|v| {
yield v;
Ok(())
});
};
}

View File

@@ -0,0 +1,37 @@
error[E0658]: yield syntax is experimental
--> tests/ui/yield_in_closure.rs:7:17
|
7 | yield v;
| ^^^^^^^
|
= note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
error: `yield` can only be used in `#[coroutine]` closures, or `gen` blocks
--> tests/ui/yield_in_closure.rs:7:17
|
7 | yield v;
| ^^^^^^^
|
help: use `#[coroutine]` to make this closure a coroutine
|
6 | .and_then(#[coroutine] |v| {
| ++++++++++++
error[E0277]: expected a `FnOnce(&str)` closure, found `{coroutine@$DIR/tests/ui/yield_in_closure.rs:6:23: 6:26}`
--> tests/ui/yield_in_closure.rs:6:23
|
6 | .and_then(|v| {
| ______________--------_^
| | |
| | required by a bound introduced by this call
7 | | yield v;
8 | | Ok(())
9 | | });
| |_____________^ expected an `FnOnce(&str)` closure, found `{coroutine@$DIR/tests/ui/yield_in_closure.rs:6:23: 6:26}`
|
= help: the trait `FnOnce(&str)` is not implemented for `{coroutine@$DIR/tests/ui/yield_in_closure.rs:6:23: 6:26}`
note: required by a bound in `Result::<T, E>::and_then`
--> $RUST/core/src/result.rs
|
| pub fn and_then<U, F: FnOnce(T) -> Result<U, E>>(self, op: F) -> Result<U, E> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Result::<T, E>::and_then`

View File

@@ -0,0 +1,9 @@
use async_stream::stream;
fn main() {
stream! {
fn foo() {
yield "hello";
}
};
}

View File

@@ -0,0 +1,24 @@
error[E0658]: yield syntax is experimental
--> tests/ui/yield_in_nested_fn.rs:6:13
|
6 | yield "hello";
| ^^^^^^^^^^^^^
|
= note: see issue #43122 <https://github.com/rust-lang/rust/issues/43122> for more information
error: `yield` can only be used in `#[coroutine]` closures, or `gen` blocks
--> tests/ui/yield_in_nested_fn.rs:6:13
|
6 | yield "hello";
| ^^^^^^^^^^^^^
|
help: use `#[coroutine]` to make this closure a coroutine
|
5 | #[coroutine] fn foo() {
| ++++++++++++
error[E0627]: yield expression outside of coroutine literal
--> tests/ui/yield_in_nested_fn.rs:6:13
|
6 | yield "hello";
| ^^^^^^^^^^^^^