Skip to content

Commit 089d160

Browse files
authored
Rollup merge of rust-lang#139097 - m-ou-se:pin-tests, r=WaffleLapkin
Add more tests for pin!(). This adds the tests suggested by `@danielhenrymantilla` in this comment: rust-lang#138717 (comment) by
2 parents bdbe488 + 68ccc34 commit 089d160

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Diff for: coretests/tests/pin_macro.rs

+11
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,14 @@ fn temp_lifetime() {
4747
}
4848
async fn foo(_: &mut usize) {}
4949
}
50+
51+
#[test]
52+
fn transitive_extension() {
53+
async fn temporary() {}
54+
55+
// `pin!` witnessed in the wild being used like this, even if it yields
56+
// a `Pin<&mut &mut impl Unpin>`; it does work because `pin!`
57+
// happens to transitively extend the lifespan of `temporary()`.
58+
let p = pin!(&mut temporary());
59+
let _use = p;
60+
}

0 commit comments

Comments
 (0)