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 60a0782 commit 967ebb9Copy full SHA for 967ebb9
tests/ui/drop/dropck-eyepatch-manuallydrop.rs
@@ -0,0 +1,22 @@
1
+// check-pass
2
+//! This test checks that dropck knows that ManuallyDrop does not drop its field.
3
+#![feature(dropck_eyepatch)]
4
+
5
+use std::mem::ManuallyDrop;
6
7
+struct S<T>(ManuallyDrop<T>);
8
9
+unsafe impl<#[may_dangle] T> Drop for S<T> {
10
+ fn drop(&mut self) {}
11
+}
12
13
+struct NonTrivialDrop<'a>(&'a str);
14
+impl<'a> Drop for NonTrivialDrop<'a> {
15
16
17
18
+fn main() {
19
+ let s = String::from("string");
20
+ let _t = S(ManuallyDrop::new(NonTrivialDrop(&s)));
21
+ drop(s);
22
0 commit comments