Rollup merge of #139052 - m-ou-se:pin-macro-tests, r=joboet

Put pin!() tests in the right file.

In #138717, these tests were put in `tests/pin.rs`, but they should go in `tests/pin_macro.rs`.

r? `@jdonszelmann`
This commit is contained in:
Matthias Krüger 2025-03-28 21:18:28 +01:00 committed by GitHub
commit 3060c77815
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 14 deletions

View file

@ -34,9 +34,6 @@ fn pin_const() {
}
pin_mut_const();
// Check that we accept a Rust 2024 $expr.
std::pin::pin!(const { 1 });
}
#[allow(unused)]
@ -84,14 +81,3 @@ mod pin_coerce_unsized {
arg
}
}
#[test]
#[cfg(not(bootstrap))]
fn temp_lifetime() {
// Check that temporary lifetimes work as in Rust 2021.
// Regression test for https://github.com/rust-lang/rust/issues/138596
match std::pin::pin!(foo(&mut 0)) {
_ => {}
}
async fn foo(_: &mut usize) {}
}

View file

@ -30,3 +30,20 @@ fn unsize_coercion() {
let dyn_obj: Pin<&mut dyn Send> = pin!([PhantomPinned; 2]);
stuff(dyn_obj);
}
#[test]
fn rust_2024_expr() {
// Check that we accept a Rust 2024 $expr.
std::pin::pin!(const { 1 });
}
#[test]
#[cfg(not(bootstrap))]
fn temp_lifetime() {
// Check that temporary lifetimes work as in Rust 2021.
// Regression test for https://github.com/rust-lang/rust/issues/138596
match std::pin::pin!(foo(&mut 0)) {
_ => {}
}
async fn foo(_: &mut usize) {}
}