Skip to content

Commit 4fc6f31

Browse files
committed
Auto merge of #3298 - rust-lang:rustup-2024-02-13, r=oli-obk
Automatic Rustup
2 parents e8123e5 + 2345943 commit 4fc6f31

File tree

4 files changed

+47
-1
lines changed

4 files changed

+47
-1
lines changed

rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
b17491c8f6d555386104dfd82004c01bfef09c95
1+
d26b41711282042c4ea0c5733e7332b07cfa4933

tests/fail/unaligned_pointers/unaligned_ref_addr_of.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// This should fail even without Stacked Borrows.
22
//@compile-flags: -Zmiri-disable-stacked-borrows -Cdebug-assertions=no
33

4+
#![allow(invalid_reference_casting)] // for u16 -> u32
5+
46
fn main() {
57
// Try many times as this might work by chance.
68
for _ in 0..20 {

tests/pass/async-closure.rs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#![feature(async_closure, noop_waker, async_fn_traits)]
2+
3+
use std::future::Future;
4+
use std::pin::pin;
5+
use std::task::*;
6+
7+
pub fn block_on<T>(fut: impl Future<Output = T>) -> T {
8+
let mut fut = pin!(fut);
9+
let ctx = &mut Context::from_waker(Waker::noop());
10+
11+
loop {
12+
match fut.as_mut().poll(ctx) {
13+
Poll::Pending => {}
14+
Poll::Ready(t) => break t,
15+
}
16+
}
17+
}
18+
19+
#[rustfmt::skip]
20+
async fn call_once(f: impl async FnOnce(DropMe)) {
21+
f(DropMe("world")).await;
22+
}
23+
24+
#[derive(Debug)]
25+
struct DropMe(&'static str);
26+
27+
impl Drop for DropMe {
28+
fn drop(&mut self) {
29+
println!("{}", self.0);
30+
}
31+
}
32+
33+
pub fn main() {
34+
block_on(async {
35+
let b = DropMe("hello");
36+
let async_closure = async move |a: DropMe| {
37+
println!("{a:?} {b:?}");
38+
};
39+
call_once(async_closure).await;
40+
});
41+
}

tests/pass/async-closure.stdout

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
DropMe("world") DropMe("hello")
2+
world
3+
hello

0 commit comments

Comments
 (0)