#![allow(clippy::let_underscore_untyped)] mod first { use ghost::phantom; #[phantom] struct MyPhantom; #[test] fn test() { // Proof that MyPhantom behaves like PhantomData. let _: MyPhantom = MyPhantom::; assert_eq!(0, std::mem::size_of::>()); } // Proof that MyPhantom is not just a re-export of PhantomData. // If it were a re-export, these would be conflicting impls. trait Trait {} impl Trait for std::marker::PhantomData {} impl Trait for MyPhantom {} // Proof that MyPhantom is local to the current crate. impl MyPhantom {} } mod second { use ghost::phantom; #[phantom] #[derive(Copy, Clone, Default, Hash, PartialOrd, Ord, PartialEq, Eq, Debug)] struct Crazy<'a, V: 'a, T> where &'a V: IntoIterator; #[test] fn test() { let _ = Crazy::<'static, Vec, &'static String>; // Lifetime elision. let crazy = Crazy::, &String>; println!("{:?}", crazy); } }