rust/compiler/rustc_parse/src/parser
bors 750bd1a7ff Auto merge of #101313 - SparrowLii:mk_attr_id, r=cjgillot
make `mk_attr_id` part of `ParseSess`

Updates #48685

The current `mk_attr_id` uses the `AtomicU32` type, which is not very efficient and adds a lot of lock contention in a parallel environment.

This PR refers to the task list in #48685, uses `mk_attr_id` as a method of the `AttrIdGenerator` struct, and adds a new field `attr_id_generator` to `ParseSess`.

`AttrIdGenerator` uses the `WorkerLocal`, which has two advantages: 1. `Cell` is more efficient than `AtomicU32`, and does not increase any lock contention. 2. We put the index of the work thread in the first few bits of the generated `AttrId`, so that the `AttrId` generated in different threads can be easily guaranteed to be unique.

cc `@cjgillot`
2022-09-14 20:52:18 +00:00
..
attr_wrapper.rs Rename {Create,Lazy}TokenStream as {To,Lazy}AttrTokenStream. 2022-09-09 17:25:38 +10:00
attr.rs make mk_attr_id part of ParseSess 2022-09-14 08:49:10 +08:00
diagnostics.rs fixes #101477: Recover from typo where == is used in place of = 2022-09-08 15:14:18 +08:00
expr.rs Rollup merge of #101502 - TaKO8Ki:do-not-suggest-semicolon-for-macro-without-exclamation-mark, r=wesleywiser 2022-09-07 21:48:15 +02:00
generics.rs Use AttrVec in more places. 2022-08-22 07:35:33 +10:00
item.rs Rollup merge of #101457 - ChayimFriedman2:struct-field-semi, r=fee1-dead 2022-09-06 17:00:28 +02:00
mod.rs Rename {Create,Lazy}TokenStream as {To,Lazy}AttrTokenStream. 2022-09-09 17:25:38 +10:00
nonterminal.rs ast: Introduce some traits to get AST node properties generically 2022-05-11 12:43:27 +03:00
pat.rs Auto merge of #101362 - compiler-errors:unnecessary-let, r=cjgillot 2022-09-06 08:49:54 +00:00
path.rs Always import all tracing macros for the entire crate instead of piecemeal by module 2022-09-01 14:54:27 +00:00
stmt.rs Use AttrVec in more places. 2022-08-22 07:35:33 +10:00
ty.rs Address code review comments 2022-09-13 14:50:12 -07:00