Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #![feature(extern_types)]
- // This type derives `Copy`.
- #[derive(Debug, PartialEq)]
- struct Ptr<'a, T> {
- pointer: &'a T
- }
- impl<T> Copy for Ptr<'_, T> { }
- impl<T> Clone for Ptr<'_, T> { fn clone(&self) -> Self { *self } }
- extern {
- type OpaqueListContents;
- }
- // This type does not implement `Copy`.
- #[repr(C)]
- pub struct List<T> {
- len: usize,
- data: [T; 0],
- //opaque: OpaqueListContents,
- }
- // This struct derives `Copy`, and compiles ok.
- #[derive(Clone, Copy)]
- struct ParamEnv1 {
- x: i32,
- y: &'static List<u32>,
- }
- #[derive(Copy, Clone)]
- struct ParamEnv2 {
- x: i32,
- z: Ptr<'static, List<u32>>,
- }
- fn main() {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement