| 1 | mod firstrust-analyzer cargo ghost 0.1.5 first/ { |
| 2 | use ghostrust-analyzer cargo ghost 0.1.5 crate/::phantomrust-analyzer cargo ghost 0.1.5 phantom:; |
| 3 | |
| 4 | #[phantomrust-analyzer cargo ghost 0.1.5 phantom:] |
| 5 | struct MyPhantomrust-analyzer cargo ghost 0.1.5 first/__void_MyPhantom/MyPhantom#<T: ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#>; |
| 6 | |
| 7 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 8 | fn testrust-analyzer cargo ghost 0.1.5 first/test().() { |
| 9 | // Proof that MyPhantom behaves like PhantomData. |
| 10 | let _: MyPhantomrust-analyzer cargo ghost 0.1.5 first/MyPhantom#<u8> = MyPhantomrust-analyzer cargo ghost 0.1.5 first/MyPhantom#MyPhantom#::<u8>; |
| 11 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(0, stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().::<MyPhantomrust-analyzer cargo ghost 0.1.5 first/MyPhantom#<u8>>()); |
| 12 | } |
| 13 | |
| 14 | // Proof that MyPhantom is not just a re-export of PhantomData. |
| 15 | // If it were a re-export, these would be conflicting impls. |
| 16 | trait Traitrust-analyzer cargo ghost 0.1.5 first/Trait# {} |
| 17 | impl<T> Traitrust-analyzer cargo ghost 0.1.5 first/Trait# for stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::markerrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/::PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#<T> {} |
| 18 | impl<T> Traitrust-analyzer cargo ghost 0.1.5 first/Trait# for MyPhantomrust-analyzer cargo ghost 0.1.5 first/MyPhantom#<T> {} |
| 19 | |
| 20 | // Proof that MyPhantom is local to the current crate. |
| 21 | impl<T> MyPhantomrust-analyzer cargo ghost 0.1.5 first/MyPhantom#<T> {} |
| 22 | } |
| 23 | |
| 24 | mod secondrust-analyzer cargo ghost 0.1.5 second/ { |
| 25 | use ghostrust-analyzer cargo ghost 0.1.5 crate/::phantomrust-analyzer cargo ghost 0.1.5 phantom:; |
| 26 | |
| 27 | #[phantomrust-analyzer cargo ghost 0.1.5 phantom:] |
| 28 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Copy, Clone, Default, Hash, PartialOrd, Ord, PartialEq, Eq, Debug)] |
| 29 | struct Crazyrust-analyzer cargo ghost 0.1.5 second/__void_Crazy/Crazy#<'a, V: 'a, T> |
| 30 | where |
| 31 | &'a V: IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#Item# = T>; |
| 32 | |
| 33 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 34 | fn testrust-analyzer cargo ghost 0.1.5 second/test().() { |
| 35 | let _ = Crazyrust-analyzer cargo ghost 0.1.5 second/Crazy#Crazy#::<'static, Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>, &'static Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>; |
| 36 | |
| 37 | // Lifetime elision. |
| 38 | let crazy = Crazyrust-analyzer cargo ghost 0.1.5 second/Crazy#Crazy#::<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>, &Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>; |
| 39 | printlnrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/println!!("{:?}", crazy); |
| 40 | } |
| 41 | } |