]> git.lizzy.rs Git - rust.git/blob - src/test/ui/drop/drop-foreign-fundamental.rs
Auto merge of #103600 - compiler-errors:early-binder-nits, r=spastorino
[rust.git] / src / test / ui / drop / drop-foreign-fundamental.rs
1 use std::ops::Deref;
2 use std::pin::Pin;
3
4 struct Whatever<T>(T);
5
6 impl<T> Deref for Whatever<T> {
7     type Target = T;
8
9     fn deref(&self) -> &T {
10         &self.0
11     }
12 }
13
14 struct A;
15
16 impl Drop for Pin<Whatever<A>> {
17     //~^ ERROR  the `Drop` trait may only be implemented for local structs, enums, and unions
18     fn drop(&mut self) {}
19 }
20
21 fn main() {
22     let x = Pin::new(Whatever(1.0f32));
23 }