| 1 | // Type for a syntax tree node that is reserved for future use. |
| 2 | // |
| 3 | // For example ExprReference contains a field `raw` of type Reserved. If `&raw |
| 4 | // place` syntax becomes a thing as per https://github.com/rust-lang/rfcs/pull/2582, |
| 5 | // we can backward compatibly change `raw`'s type to Option<Token![raw]> without |
| 6 | // the possibility of breaking any code. |
| 7 | |
| 8 | use proc_macro2::Span; |
| 9 | use std::marker::PhantomData; |
| 10 | |
| 11 | #[cfg (feature = "extra-traits" )] |
| 12 | use std::fmt::{self, Debug}; |
| 13 | |
| 14 | ast_struct! { |
| 15 | pub struct Reserved { |
| 16 | _private: PhantomData<Span>, |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | impl Default for Reserved { |
| 21 | fn default() -> Self { |
| 22 | Reserved { |
| 23 | _private: PhantomData, |
| 24 | } |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | #[cfg (feature = "clone-impls" )] |
| 29 | #[cfg_attr (doc_cfg, doc(cfg(feature = "clone-impls" )))] |
| 30 | impl Clone for Reserved { |
| 31 | fn clone(&self) -> Self { |
| 32 | Reserved { |
| 33 | _private: self._private, |
| 34 | } |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | #[cfg (feature = "extra-traits" )] |
| 39 | #[cfg_attr (doc_cfg, doc(cfg(feature = "extra-traits" )))] |
| 40 | impl Debug for Reserved { |
| 41 | fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { |
| 42 | formatter.debug_struct(name:"Reserved" ).finish() |
| 43 | } |
| 44 | } |
| 45 | |