pessimize/marker.rs
1//! Implementations of Pessimize for core::marker
2
3use crate::pessimize_zsts;
4use core::marker::{PhantomData, PhantomPinned};
5
6pessimize_zsts!(
7 allow(missing_docs)
8 {
9 |T| PhantomData<T> : PhantomData,
10 PhantomPinned : PhantomPinned
11 }
12);
13
14#[cfg(test)]
15mod tests {
16 use super::*;
17 use crate::tests::{test_pinned_value, test_value};
18
19 #[test]
20 fn phantom_data() {
21 test_value::<PhantomData<isize>>(PhantomData);
22 }
23
24 #[test]
25 fn phantom_pinned() {
26 test_pinned_value(PhantomPinned);
27 }
28
29 // There are no phantom_data_optim and phantom_pinned_optim tests because
30 // Pessimize does not act as an optimization barrier for stateless ZSTs like
31 // phantom types.
32}