Skip to content

Commit

Permalink
Auto merge of #3298 - rust-lang:rustup-2024-02-13, r=oli-obk
Browse files Browse the repository at this point in the history
Automatic Rustup
  • Loading branch information
bors committed Feb 13, 2024
2 parents e8123e5 + 2345943 commit 4fc6f31
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 1 deletion.
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
b17491c8f6d555386104dfd82004c01bfef09c95
d26b41711282042c4ea0c5733e7332b07cfa4933
2 changes: 2 additions & 0 deletions tests/fail/unaligned_pointers/unaligned_ref_addr_of.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// This should fail even without Stacked Borrows.
//@compile-flags: -Zmiri-disable-stacked-borrows -Cdebug-assertions=no

#![allow(invalid_reference_casting)] // for u16 -> u32

fn main() {
// Try many times as this might work by chance.
for _ in 0..20 {
Expand Down
41 changes: 41 additions & 0 deletions tests/pass/async-closure.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#![feature(async_closure, noop_waker, async_fn_traits)]

use std::future::Future;
use std::pin::pin;
use std::task::*;

pub fn block_on<T>(fut: impl Future<Output = T>) -> T {
let mut fut = pin!(fut);
let ctx = &mut Context::from_waker(Waker::noop());

loop {
match fut.as_mut().poll(ctx) {
Poll::Pending => {}
Poll::Ready(t) => break t,
}
}
}

#[rustfmt::skip]
async fn call_once(f: impl async FnOnce(DropMe)) {
f(DropMe("world")).await;
}

#[derive(Debug)]
struct DropMe(&'static str);

impl Drop for DropMe {
fn drop(&mut self) {
println!("{}", self.0);
}
}

pub fn main() {
block_on(async {
let b = DropMe("hello");
let async_closure = async move |a: DropMe| {
println!("{a:?} {b:?}");
};
call_once(async_closure).await;
});
}
3 changes: 3 additions & 0 deletions tests/pass/async-closure.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
DropMe("world") DropMe("hello")
world
hello

0 comments on commit 4fc6f31

Please sign in to comment.