mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
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:
@@ -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) {}
|
||||
}
|
||||
|
||||
@@ -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) {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user