We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 64b72a1 commit e0f239aCopy full SHA for e0f239a
1 file changed
tests/ui/pin/dont-deref-coerce-pinned-value.rs
@@ -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