rust/compiler/rustc_ast/src
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 add debug assertion for max attr_id 2022-09-14 08:49:12 +08:00
expand Make allocator_kind a query. 2021-06-20 11:52:51 +02:00
util Rollup merge of #100767 - kadiwa4:escape_ascii, r=jackh726 2022-09-12 15:21:30 +05:30
ast_traits.rs Rename {Create,Lazy}TokenStream as {To,Lazy}AttrTokenStream. 2022-09-09 17:25:38 +10:00
ast.rs Auto merge of #101313 - SparrowLii:mk_attr_id, r=cjgillot 2022-09-14 20:52:18 +00:00
entry.rs Fixup missing renames from #[main] to #[rustc_main] 2022-06-22 18:24:09 +02:00
lib.rs Inline and remove TokenStream::opt_from_ast. 2022-09-09 16:53:17 +10:00
mut_visit.rs Rename {Create,Lazy}TokenStream as {To,Lazy}AttrTokenStream. 2022-09-09 17:25:38 +10:00
node_id.rs rustc_error, rustc_private, rustc_ast: Switch to stable hash containers 2022-09-10 11:49:12 +02:00
ptr.rs Use delayed error handling for Encodable and Encoder infallible. 2022-06-08 07:01:26 +10:00
token.rs fix #101626, suggest pub instead of public for const type item 2022-09-11 08:29:38 +08:00
tokenstream.rs Rename {Create,Lazy}TokenStream as {To,Lazy}AttrTokenStream. 2022-09-09 17:25:38 +10:00
visit.rs Remove unused span argument from walk_fn. 2022-09-12 13:24:27 +10:00