rust/compiler/rustc_macros/src
Arlie Davis 2b2462e8b0 Stop using intermediate macros in definition of symbols
Currently, the rustc_macros::symbols macro generates two
`macro_rules!` macros as its output. These two macros are
used in rustc_span/src/symbol.rs.

This means that each Symbol that we define is represented
in the AST of rustc_symbols twice: once in the definition
of the `define_symbols!` macro (similarly for the
`keywords! macro), and once in the rustc_span::symbols
definition.

That would be OK if there were only a handful of symbols,
but currently we define over 1100 symbols. The definition
of the `define_symbols!` macro contains the expanded definition
of each symbol, so that's a lot of AST storage wasted on a
macro that is used exactly once.

This commit removes the `define_symbols` macro, and simply
allows the proc macro to directly generate the
`rustc_symbols::symbol::sym` module.

The benefit is mainly in reducing memory wasted during
compilation of rustc itself. It should also reduce memory used
by Rust Analyzer.

This commit also reduces the size of the AST for symbol
definitions, by moving two `#[allow(...)]` attributes from
the symbol constants to the `sym` module. This eliminates 2200+
attribute nodes.

This commit also eliminates the need for the `digits_array`
constant. There's no need to store an array of Symbol values
for digits. We can simply define a constant of the base value,
and add to that base value.
2020-12-17 15:20:45 -08:00
..
symbols ./x.py fmt 2020-12-13 13:36:01 -08:00
hash_stable.rs
lib.rs Improve error handling in symbols proc-macro 2020-12-12 15:29:12 -08:00
lift.rs Lift: take self by value 2020-10-21 23:59:35 +02:00
query.rs Only create OnDiskCache in incremental compilation mode 2020-11-19 15:50:55 -05:00
serialize.rs
session_diagnostic.rs Fix non-determinism in generated format string. 2020-09-09 21:23:25 +10:00
symbols.rs Stop using intermediate macros in definition of symbols 2020-12-17 15:20:45 -08:00
type_foldable.rs Auto merge of #78779 - LeSeulArtichaut:ty-visitor-return, r=oli-obk 2020-11-17 12:24:34 +00:00