summaryrefslogtreecommitdiffstats
path: root/src/test/ui/drop/drop-foreign-fundamental.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/drop/drop-foreign-fundamental.rs')
-rw-r--r--src/test/ui/drop/drop-foreign-fundamental.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/test/ui/drop/drop-foreign-fundamental.rs b/src/test/ui/drop/drop-foreign-fundamental.rs
new file mode 100644
index 000000000..c43df40d6
--- /dev/null
+++ b/src/test/ui/drop/drop-foreign-fundamental.rs
@@ -0,0 +1,23 @@
+use std::ops::Deref;
+use std::pin::Pin;
+
+struct Whatever<T>(T);
+
+impl<T> Deref for Whatever<T> {
+ type Target = T;
+
+ fn deref(&self) -> &T {
+ &self.0
+ }
+}
+
+struct A;
+
+impl Drop for Pin<Whatever<A>> {
+ //~^ ERROR the `Drop` trait may only be implemented for local structs, enums, and unions
+ fn drop(&mut self) {}
+}
+
+fn main() {
+ let x = Pin::new(Whatever(1.0f32));
+}