1 #![feature(proc_macro_diagnostic)]
2 #![feature(allow_internal_unstable)]
3 #![allow(rustc::default_hash_types)]
4 #![recursion_limit = "128"]
6 use synstructure::decl_derive;
8 use proc_macro::TokenStream;
15 mod session_diagnostic;
20 pub fn rustc_queries(input: TokenStream) -> TokenStream {
21 query::rustc_queries(input)
25 pub fn symbols(input: TokenStream) -> TokenStream {
26 symbols::symbols(input.into()).into()
29 /// Creates a struct type `S` that can be used as an index with
30 /// `IndexVec` and so on.
32 /// There are two ways of interacting with these indices:
34 /// - The `From` impls are the preferred way. So you can do
35 /// `S::from(v)` with a `usize` or `u32`. And you can convert back
36 /// to an integer with `u32::from(s)`.
38 /// - Alternatively, you can use the methods `S::new(v)` and `s.index()`
39 /// to create/return a value.
41 /// Internally, the index uses a u32, so the index must not exceed
42 /// `u32::MAX`. You can also customize things like the `Debug` impl,
43 /// what traits are derived, and so forth via the macro.
45 #[allow_internal_unstable(step_trait, rustc_attrs, trusted_step)]
46 pub fn newtype_index(input: TokenStream) -> TokenStream {
47 newtype::newtype(input)
50 decl_derive!([HashStable, attributes(stable_hasher)] => hash_stable::hash_stable_derive);
52 [HashStable_Generic, attributes(stable_hasher)] =>
53 hash_stable::hash_stable_generic_derive
56 decl_derive!([Decodable] => serialize::decodable_derive);
57 decl_derive!([Encodable] => serialize::encodable_derive);
58 decl_derive!([TyDecodable] => serialize::type_decodable_derive);
59 decl_derive!([TyEncodable] => serialize::type_encodable_derive);
60 decl_derive!([MetadataDecodable] => serialize::meta_decodable_derive);
61 decl_derive!([MetadataEncodable] => serialize::meta_encodable_derive);
62 decl_derive!([TypeFoldable, attributes(type_foldable)] => type_foldable::type_foldable_derive);
63 decl_derive!([Lift, attributes(lift)] => lift::lift_derive);
65 [SessionDiagnostic, attributes(
78 suggestion_verbose)] => session_diagnostic::session_diagnostic_derive