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
2 changed files with 17 additions and 14 deletions
-14
View File
@@ -34,9 +34,6 @@ const fn pin_mut_const() {
}
pin_mut_const();
// Check that we accept a Rust 2024 $expr.
std::pin::pin!(const { 1 });
}
#[allow(unused)]
@@ -84,14 +81,3 @@ pub fn nesting_pins(arg: Pin<Pin<&String>>) -> Pin<Pin<&dyn MyTrait>> {
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) {}
}
+17
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) {}
}