Skip to content

Commit 3b79869

Browse files
committed
Auto merge of #3298 - rust-lang:rustup-2024-02-13, r=RalfJung
Automatic Rustup
2 parents e8123e5 + a8eea6e commit 3b79869

File tree

4 files changed

+46
-1
lines changed

4 files changed

+46
-1
lines changed

rust-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
b17491c8f6d555386104dfd82004c01bfef09c95
1+
d26b41711282042c4ea0c5733e7332b07cfa4933

tests/fail/unaligned_pointers/unaligned_ref_addr_of.rs

+2
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

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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+
async fn call_once(f: impl FnOnce(DropMe)) {
20+
f(DropMe("world")).await;
21+
}
22+
23+
#[derive(Debug)]
24+
struct DropMe(&'static str);
25+
26+
impl Drop for DropMe {
27+
fn drop(&mut self) {
28+
println!("{}", self.0);
29+
}
30+
}
31+
32+
pub fn main() {
33+
block_on(async {
34+
let b = DropMe("hello");
35+
let async_closure = async move |a: DropMe| {
36+
println!("{a:?} {b:?}");
37+
};
38+
call_once(async_closure).await;
39+
});
40+
}

tests/pass/async-closure.stdout

+3
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)