1 #![feature(allow_internal_unstable)]
3 #![feature(proc_macro_diagnostic)]
4 #![allow(rustc::default_hash_types)]
5 #![recursion_limit = "128"]
7 use synstructure::decl_derive;
9 use proc_macro::TokenStream;
21 pub fn rustc_queries(input: TokenStream) -> TokenStream {
22 query::rustc_queries(input)
26 pub fn symbols(input: TokenStream) -> TokenStream {
27 symbols::symbols(input.into()).into()
30 /// Creates a struct type `S` that can be used as an index with
31 /// `IndexVec` and so on.
33 /// There are two ways of interacting with these indices:
35 /// - The `From` impls are the preferred way. So you can do
36 /// `S::from(v)` with a `usize` or `u32`. And you can convert back
37 /// to an integer with `u32::from(s)`.
39 /// - Alternatively, you can use the methods `S::new(v)` and `s.index()`
40 /// to create/return a value.
42 /// Internally, the index uses a u32, so the index must not exceed
43 /// `u32::MAX`. You can also customize things like the `Debug` impl,
44 /// what traits are derived, and so forth via the macro.
46 #[allow_internal_unstable(step_trait, rustc_attrs, trusted_step)]
47 pub fn newtype_index(input: TokenStream) -> TokenStream {
48 newtype::newtype(input)
51 decl_derive!([HashStable, attributes(stable_hasher)] => hash_stable::hash_stable_derive);
53 [HashStable_Generic, attributes(stable_hasher)] =>
54 hash_stable::hash_stable_generic_derive
57 decl_derive!([Decodable] => serialize::decodable_derive);
58 decl_derive!([Encodable] => serialize::encodable_derive);
59 decl_derive!([TyDecodable] => serialize::type_decodable_derive);
60 decl_derive!([TyEncodable] => serialize::type_encodable_derive);
61 decl_derive!([MetadataDecodable] => serialize::meta_decodable_derive);
62 decl_derive!([MetadataEncodable] => serialize::meta_encodable_derive);
63 decl_derive!([TypeFoldable, attributes(type_foldable)] => type_foldable::type_foldable_derive);
64 decl_derive!([Lift, attributes(lift)] => lift::lift_derive);
66 [SessionDiagnostic, attributes(
79 suggestion_verbose)] => diagnostics::session_diagnostic_derive
82 [SessionSubdiagnostic, attributes(
83 // struct/variant attributes
94 applicability)] => diagnostics::session_subdiagnostic_derive