Skip to content

Commit

Permalink
Auto merge of #3298 - rust-lang:rustup-2024-02-13, r=RalfJung
Browse files Browse the repository at this point in the history
Automatic Rustup
  • Loading branch information
bors committed Feb 13, 2024
2 parents e8123e5 + a8eea6e commit 3b79869
Show file tree
Hide file tree
Showing 4 changed files with 46 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
40 changes: 40 additions & 0 deletions tests/pass/async-closure.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#![feature(async_closure, noop_waker, async_fn_traits)]

Check failure on line 1 in tests/pass/async-closure.rs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, x86_64-unknown-linux-gnu)

pass test got exit status: 1

no message

Check failure on line 1 in tests/pass/async-closure.rs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, x86_64-unknown-linux-gnu)

test generated output

you likely need to bless the tests with `./miri test --bless`

Check failure on line 1 in tests/pass/async-closure.rs

View workflow job for this annotation

GitHub Actions / build (macos-latest, x86_64-apple-darwin)

pass test got exit status: 1

no message

Check failure on line 1 in tests/pass/async-closure.rs

View workflow job for this annotation

GitHub Actions / build (macos-latest, x86_64-apple-darwin)

test generated output

you likely need to bless the tests with `./miri test --bless`

Check failure on line 1 in tests/pass/async-closure.rs

View workflow job for this annotation

GitHub Actions / build (windows-latest, i686-pc-windows-msvc)

pass test got exit code: 1

no message

Check failure on line 1 in tests/pass/async-closure.rs

View workflow job for this annotation

GitHub Actions / build (windows-latest, i686-pc-windows-msvc)

test generated output

you likely need to bless the tests with `./miri test --bless`

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,
}
}
}

async fn call_once(f: impl FnOnce(DropMe)) {
f(DropMe("world")).await;

Check failure on line 20 in tests/pass/async-closure.rs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, x86_64-unknown-linux-gnu)

Unmatched diagnostics

Error: `()` is not a future

Check failure on line 20 in tests/pass/async-closure.rs

View workflow job for this annotation

GitHub Actions / build (macos-latest, x86_64-apple-darwin)

Unmatched diagnostics

Error: `()` is not a future

Check failure on line 20 in tests/pass/async-closure.rs

View workflow job for this annotation

GitHub Actions / build (windows-latest, i686-pc-windows-msvc)

Unmatched diagnostics

Error: `()` is not a future
}

#[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;

Check failure on line 38 in tests/pass/async-closure.rs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, x86_64-unknown-linux-gnu)

Unmatched diagnostics

Error: expected `{async closure@async-closure.rs:35:29}` to be a closure that returns `()`, but it returns `{async closure body@tests/pass/async-closure.rs:35:52: 37:10}`

Check failure on line 38 in tests/pass/async-closure.rs

View workflow job for this annotation

GitHub Actions / build (macos-latest, x86_64-apple-darwin)

Unmatched diagnostics

Error: expected `{async closure@async-closure.rs:35:29}` to be a closure that returns `()`, but it returns `{async closure body@tests/pass/async-closure.rs:35:52: 37:10}`

Check failure on line 38 in tests/pass/async-closure.rs

View workflow job for this annotation

GitHub Actions / build (windows-latest, i686-pc-windows-msvc)

Unmatched diagnostics

Error: expected `{async closure@async-closure.rs:35:29}` to be a closure that returns `()`, but it returns `{async closure body@tests/pass\async-closure.rs:35:52: 37:10}`
});
}
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

Check failure on line 2 in tests/pass/async-closure.stdout

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest, x86_64-unknown-linux-gnu)

extraneous lines in output

remove this line and possibly later ones by blessing the test

Check failure on line 2 in tests/pass/async-closure.stdout

View workflow job for this annotation

GitHub Actions / build (macos-latest, x86_64-apple-darwin)

extraneous lines in output

remove this line and possibly later ones by blessing the test

Check failure on line 2 in tests/pass/async-closure.stdout

View workflow job for this annotation

GitHub Actions / build (windows-latest, i686-pc-windows-msvc)

extraneous lines in output

remove this line and possibly later ones by blessing the test
hello

0 comments on commit 3b79869

Please sign in to comment.