Skip to content

Commit e0f239a

Browse files
committed
add test
1 parent 64b72a1 commit e0f239a

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//! Regression test for <https://github.com/rust-lang/rust/issues/153438>: when there's a type
2+
//! expectation on `pin!`'s result, make sure we don't deref-coerce the argument to
3+
//! `Pin::new_unchecked` to get its type to match up. That violates the pinning invariant, leading
4+
//! to unsoundness!
5+
//@ check-pass
6+
7+
use std::pin::{Pin, pin};
8+
9+
fn wrong_pin<T>(data: &mut T, callback: impl FnOnce(Pin<&mut T>)) {
10+
callback(pin!(data));
11+
}
12+
13+
fn main() {}

0 commit comments

Comments
 (0)