syn/
reserved.rs

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
8use proc_macro2::Span;
9use std::marker::PhantomData;
10
11#[cfg(feature = "extra-traits")]
12use std::fmt::{self, Debug};
13
14ast_struct! {
15    pub struct Reserved {
16        _private: PhantomData<Span>,
17    }
18}
19
20impl 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")))]
30impl 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")))]
40impl Debug for Reserved {
41    fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
42        formatter.debug_struct("Reserved").finish()
43    }
44}