1#![allow(non_upper_case_globals)]
3
4use std::hash::{BuildHasher, BuildHasherDefault};
5
6use dashmap::{DashMap, SharedValue};
7use rustc_hash::FxHasher;
8
9use crate::{Symbol, symbol::TaggedArcPtr};
10
11macro_rules! define_symbols {
12 (@WITH_NAME: $($alias:ident = $value:literal,)* @PLAIN: $($name:ident,)*) => {
13 $(
15 pub const $name: Symbol = {
16 static SYMBOL_STR: &str = stringify!($name);
17 Symbol { repr: TaggedArcPtr::non_arc(&SYMBOL_STR) }
18 };
19 )*
20 $(
21 pub const $alias: Symbol = {
22 static SYMBOL_STR: &str = $value;
23 Symbol { repr: TaggedArcPtr::non_arc(&SYMBOL_STR) }
24 };
25 )*
26
27
28 pub(super) fn prefill() -> DashMap<Symbol, (), BuildHasherDefault<FxHasher>> {
29 let mut dashmap_ = <DashMap<Symbol, (), BuildHasherDefault<FxHasher>>>::with_hasher(BuildHasherDefault::default());
30
31 let hasher_ = dashmap_.hasher().clone();
32 let hash_one = |it_: &str| hasher_.hash_one(it_);
33 {
34 $(
35 let s = stringify!($name);
36 let hash_ = hash_one(s);
37 let shard_idx_ = dashmap_.determine_shard(hash_ as usize);
38 dashmap_.shards_mut()[shard_idx_].get_mut().insert(hash_, ($name, SharedValue::new(())), |(x, _)| hash_one(x.as_str()));
39 )*
40 $(
41 let s = $value;
42 let hash_ = hash_one(s);
43 let shard_idx_ = dashmap_.determine_shard(hash_ as usize);
44 dashmap_.shards_mut()[shard_idx_].get_mut().insert(hash_, ($alias, SharedValue::new(())), |(x, _)| hash_one(x.as_str()));
45 )*
46 }
47 dashmap_
48 }
49 };
50}
51define_symbols! {
52 @WITH_NAME:
53
54 dotdotdot = "...",
55 INTEGER_0 = "0",
56 INTEGER_1 = "1",
57 INTEGER_2 = "2",
58 INTEGER_3 = "3",
59 INTEGER_4 = "4",
60 INTEGER_5 = "5",
61 INTEGER_6 = "6",
62 INTEGER_7 = "7",
63 INTEGER_8 = "8",
64 INTEGER_9 = "9",
65 INTEGER_10 = "10",
66 INTEGER_11 = "11",
67 INTEGER_12 = "12",
68 INTEGER_13 = "13",
69 INTEGER_14 = "14",
70 INTEGER_15 = "15",
71 __empty = "",
72 unsafe_ = "unsafe",
73 in_ = "in",
74 super_ = "super",
75 self_ = "self",
76 Self_ = "Self",
77 tick_static = "'static",
78 tick_underscore = "'_",
79 dollar_crate = "$crate",
80 MISSING_NAME = "[missing name]",
81 fn_ = "fn",
82 crate_ = "crate",
83 underscore = "_",
84 true_ = "true",
85 false_ = "false",
86 let_ = "let",
87 const_ = "const",
88 kw_impl = "impl",
89 proc_dash_macro = "proc-macro",
90 aapcs_dash_unwind = "aapcs-unwind",
91 avr_dash_interrupt = "avr-interrupt",
92 avr_dash_non_dash_blocking_dash_interrupt = "avr-non-blocking-interrupt",
93 C_dash_cmse_dash_nonsecure_dash_call = "C-cmse-nonsecure-call",
94 C_dash_cmse_dash_nonsecure_dash_entry = "C-cmse-nonsecure-entry",
95 C_dash_unwind = "C-unwind",
96 cdecl_dash_unwind = "cdecl-unwind",
97 fastcall_dash_unwind = "fastcall-unwind",
98 msp430_dash_interrupt = "msp430-interrupt",
99 ptx_dash_kernel = "ptx-kernel",
100 riscv_dash_interrupt_dash_m = "riscv-interrupt-m",
101 riscv_dash_interrupt_dash_s = "riscv-interrupt-s",
102 rust_dash_call = "rust-call",
103 rust_dash_cold = "rust-cold",
104 rust_dash_intrinsic = "rust-intrinsic",
105 stdcall_dash_unwind = "stdcall-unwind",
106 system_dash_unwind = "system-unwind",
107 sysv64_dash_unwind = "sysv64-unwind",
108 thiscall_dash_unwind = "thiscall-unwind",
109 vectorcall_dash_unwind = "vectorcall-unwind",
110 win64_dash_unwind = "win64-unwind",
111 x86_dash_interrupt = "x86-interrupt",
112
113 @PLAIN:
114 __ra_fixup,
115 aapcs,
116 add_assign,
117 add,
118 alias,
119 align_offset,
120 align,
121 all,
122 alloc_layout,
123 alloc,
124 allow_internal_unsafe,
125 allow,
126 any,
127 as_str,
128 asm,
129 assert,
130 attributes,
131 begin_panic,
132 bench,
133 bitand_assign,
134 bitand,
135 bitor_assign,
136 bitor,
137 bitxor_assign,
138 bitxor,
139 bool,
140 bootstrap,
141 box_free,
142 Box,
143 boxed,
144 branch,
145 Break,
146 c_void,
147 C,
148 call_mut,
149 call_once,
150 async_call_once,
151 async_call_mut,
152 async_call,
153 call,
154 cdecl,
155 Center,
156 cfg_accessible,
157 cfg_attr,
158 cfg_eval,
159 cfg,
160 cfg_select,
161 char,
162 clone,
163 Clone,
164 coerce_unsized,
165 column,
166 completion,
167 compile_error,
168 concat_bytes,
169 concat,
170 const_format_args,
171 const_panic_fmt,
172 const_param_ty,
173 Context,
174 Continue,
175 convert,
176 copy,
177 Copy,
178 core_panic,
179 core,
180 coroutine_state,
181 coroutine,
182 coroutine_return,
183 coroutine_yield,
184 count,
185 crate_type,
186 CStr,
187 debug_assertions,
188 Debug,
189 default,
190 Default,
191 deprecated,
192 deref_mut,
193 deref_target,
194 deref,
195 derive_const,
196 derive,
197 discriminant_kind,
198 discriminant_type,
199 dispatch_from_dyn,destruct,
200 div_assign,
201 div,
202 doc,
203 drop_in_place,
204 drop,
205 dyn_metadata,
206 efiapi,
207 eh_catch_typeinfo,
208 eh_personality,
209 env,
210 eq,
211 Eq,
212 Err,
213 exchange_malloc,
214 exhaustive_patterns,
215 export_name,
216 f128,
217 f16,
218 f32,
219 f64,
220 fastcall,
221 feature,
222 file,
223 filter_map,
224 fmt,
225 fn_mut,
226 fn_once_output,
227 fn_once,
228 async_fn_once,
229 async_fn_once_output,
230 async_fn_mut,
231 async_fn,
232 call_ref_future,
233 call_once_future,
234 fn_ptr_addr,
235 fn_ptr_trait,
236 format_alignment,
237 format_args_nl,
238 format_args,
239 format_argument,
240 format_arguments,
241 format_count,
242 format_placeholder,
243 format_unsafe_arg,
244 format,
245 freeze,
246 from,
247 From,
248 FromStr,
249 from_str,
250 from_output,
251 from_residual,
252 from_usize,
253 from_yeet,
254 fundamental,
255 future_trait,
256 future,
257 future_output,
258 Future,
259 ge,
260 generic_associated_type_extended,
261 get_context,
262 global_allocator,
263 global_asm,
264 gt,
265 Hash,
266 hidden,
267 html_root_url,
268 i128,
269 i16,
270 i32,
271 i64,
272 i8,
273 ignore,
274 Implied,
275 include_bytes,
276 include_str,
277 include,
278 index_mut,
279 index,
280 Index,
281 into,
282 Into,
283 into_future,
284 into_iter,
285 IntoFuture,
286 IntoIter,
287 IntoIterator,
288 is_empty,
289 Is,
290 isize,
291 Item,
292 iter_mut,
293 iter,
294 Iterator,
295 iterator,
296 keyword,
297 lang,
298 le,
299 Left,
300 len,
301 line,
302 llvm_asm,
303 local_inner_macros,
304 log_syntax,
305 lt,
306 macro_export,
307 macro_rules,
308 macro_use,
309 main,
310 manually_drop,
311 may_dangle,
312 maybe_uninit,
313 metadata_type,
314 min_exhaustive_patterns,
315 miri,
316 missing,
317 module_path,
318 mul_assign,
319 mul,
320 naked_asm,
321 ne,
322 neg,
323 Neg,
324 new_binary,
325 new_debug,
326 new_display,
327 new_lower_exp,
328 new_lower_hex,
329 new_octal,
330 new_pointer,
331 new_unchecked,
332 new_upper_exp,
333 new_upper_hex,
334 new_v1_formatted,
335 new,
336 next,
337 no_core,
338 no_mangle,
339 no_std,
340 non_exhaustive,
341 none,
342 None,
343 not,
344 Not,
345 notable_trait,
346 Ok,
347 opaque,
348 ops,
349 option_env,
350 option,
351 Option,
352 Ord,
353 Ordering,
354 Output,
355 CallRefFuture,
356 CallOnceFuture,
357 owned_box,
358 packed,
359 panic_2015,
360 panic_2021,
361 panic_bounds_check,
362 panic_cannot_unwind,
363 panic_display,
364 panic_fmt,
365 panic_impl,
366 panic_info,
367 panic_location,
368 panic_misaligned_pointer_dereference,
369 panic_nounwind,
370 panic_null_pointer_dereference,
371 panic,
372 Param,
373 parse,
374 partial_ord,
375 PartialEq,
376 PartialOrd,
377 CoercePointee,
378 path,
379 Pending,
380 phantom_data,
381 pieces,
382 pin,
383 pointee_trait,
384 pointer_like,
385 poll,
386 Poll,
387 prelude_import,
388 prelude,
389 proc_macro_attribute,
390 proc_macro_derive,
391 proc_macro,
392 quote,
393 range_inclusive_new,
394 Range,
395 RangeFrom,
396 RangeFull,
397 RangeInclusive,
398 RangeTo,
399 RangeToInclusive,
400 Ready,
401 receiver,
402 receiver_target,
403 recursion_limit,
404 register_attr,
405 register_tool,
406 rem_assign,
407 rem,
408 repr,
409 result,
410 Result,
411 ResumeTy,
412 Right,
413 rust_2015,
414 rust_2018,
415 rust_2021,
416 rust_2024,
417 rust_analyzer,
418 Rust,
419 rustc_allocator_zeroed,
420 rustc_allocator,
421 rustc_allow_incoherent_impl,
422 rustc_builtin_macro,
423 rustc_coherence_is_core,
424 rustc_coinductive,
425 rustc_const_panic_str,
426 rustc_deallocator,
427 rustc_deprecated_safe_2024,
428 rustc_has_incoherent_inherent_impls,
429 rustc_intrinsic_must_be_overridden,
430 rustc_intrinsic,
431 rustc_layout_scalar_valid_range_end,
432 rustc_layout_scalar_valid_range_start,
433 rustc_legacy_const_generics,
434 rustc_macro_transparency,
435 rustc_paren_sugar,
436 rustc_reallocator,
437 rustc_reservation_impl,
438 rustc_safe_intrinsic,
439 rustc_skip_array_during_method_dispatch,
440 rustc_skip_during_method_dispatch,
441 rustc_force_inline,
442 semitransparent,
443 shl_assign,
444 shl,
445 shr_assign,
446 shr,
447 simd,
448 sized,
449 meta_sized,
450 pointee_sized,
451 skip,
452 slice_len_fn,
453 Some,
454 start,
455 std_panic,
456 std,
457 stdcall,
458 str,
459 string,
460 String,
461 stringify,
462 structural_peq,
463 structural_teq,
464 sub_assign,
465 sub,
466 sync,
467 system,
468 sysv64,
469 Target,
470 target_feature,
471 enable,
472 termination,
473 test_case,
474 test,
475 then,
476 thiscall,
477 to_string,
478 trace_macros,
479 transmute_opts,
480 transmute_trait,
481 transparent,
482 try_into,
483 Try,
484 TryFrom,
485 try_from,
486 tuple_trait,
487 u128,
488 u16,
489 u32,
490 u64,
491 u8,
492 unadjusted,
493 unknown,
494 Unknown,
495 unpin,
496 unreachable_2015,
497 unreachable_2021,
498 unreachable,
499 unsafe_cell,
500 unsafe_pinned,
501 unsize,
502 unstable,
503 usize,
504 v1,
505 va_list,
506 vectorcall,
507 wasm,
508 win64,
509 args,
510 array,
511 boxed_slice,
512 completions,
513 ignore_flyimport,
514 ignore_flyimport_methods,
515 ignore_methods,
516 position,
517 flags,
518 precision,
519 width,
520 never_type_fallback,
521 specialization,
522 min_specialization,
523 arbitrary_self_types,
524 arbitrary_self_types_pointers,
525 supertrait_item_shadowing,
526}