1use std::hash::{Hash, Hasher};
6use std::ops::Deref;
7use std::{fmt, str};
8
9use rustc_arena::DroplessArena;
10use rustc_data_structures::fx::FxIndexSet;
11use rustc_data_structures::stable_hasher::{
12 HashStable, StableCompare, StableHasher, ToStableHashKey,
13};
14use rustc_data_structures::sync::Lock;
15use rustc_macros::{Decodable, Encodable, HashStable_Generic, symbols};
16
17use crate::{DUMMY_SP, Edition, Span, with_session_globals};
18
19#[cfg(test)]
20mod tests;
21
22symbols! {
24 Keywords {
34 DollarCrate: "$crate",
40 PathRoot: "{{root}}",
41 Underscore: "_",
42 As: "as",
48 Break: "break",
49 Const: "const",
50 Continue: "continue",
51 Crate: "crate",
52 Else: "else",
53 Enum: "enum",
54 Extern: "extern",
55 False: "false",
56 Fn: "fn",
57 For: "for",
58 If: "if",
59 Impl: "impl",
60 In: "in",
61 Let: "let",
62 Loop: "loop",
63 Match: "match",
64 Mod: "mod",
65 Move: "move",
66 Mut: "mut",
67 Pub: "pub",
68 Ref: "ref",
69 Return: "return",
70 SelfLower: "self",
71 SelfUpper: "Self",
72 Static: "static",
73 Struct: "struct",
74 Super: "super",
75 Trait: "trait",
76 True: "true",
77 Type: "type",
78 Unsafe: "unsafe",
79 Use: "use",
80 Where: "where",
81 While: "while",
82 Abstract: "abstract",
88 Become: "become",
89 Box: "box",
90 Do: "do",
91 Final: "final",
92 Macro: "macro",
93 Override: "override",
94 Priv: "priv",
95 Typeof: "typeof",
96 Unsized: "unsized",
97 Virtual: "virtual",
98 Yield: "yield",
99 Async: "async", Await: "await", Dyn: "dyn", Gen: "gen", Try: "try", StaticLifetime: "'static",
122 UnderscoreLifetime: "'_",
123 Auto: "auto",
129 Builtin: "builtin",
130 Catch: "catch",
131 ContractEnsures: "contract_ensures",
132 ContractRequires: "contract_requires",
133 Default: "default",
134 MacroRules: "macro_rules",
135 Raw: "raw",
136 Reuse: "reuse",
137 Safe: "safe",
138 Union: "union",
139 Yeet: "yeet",
140 }
142
143 Symbols {
157 Abi,
159 AcqRel,
160 Acquire,
161 Any,
162 Arc,
163 ArcWeak,
164 Argument,
165 ArrayIntoIter,
166 AsMut,
167 AsRef,
168 AssertParamIsClone,
169 AssertParamIsCopy,
170 AssertParamIsEq,
171 AsyncGenFinished,
172 AsyncGenPending,
173 AsyncGenReady,
174 AtomicBool,
175 AtomicI8,
176 AtomicI16,
177 AtomicI32,
178 AtomicI64,
179 AtomicI128,
180 AtomicIsize,
181 AtomicPtr,
182 AtomicU8,
183 AtomicU16,
184 AtomicU32,
185 AtomicU64,
186 AtomicU128,
187 AtomicUsize,
188 BTreeEntry,
189 BTreeMap,
190 BTreeSet,
191 BinaryHeap,
192 Borrow,
193 BorrowMut,
194 Break,
195 C,
196 CStr,
197 C_dash_unwind: "C-unwind",
198 CallOnceFuture,
199 CallRefFuture,
200 Capture,
201 Cell,
202 Center,
203 Child,
204 Cleanup,
205 Clone,
206 CoercePointee,
207 CoercePointeeValidated,
208 CoerceUnsized,
209 Command,
210 ConstParamTy,
211 ConstParamTy_,
212 Context,
213 Continue,
214 ControlFlow,
215 Copy,
216 Cow,
217 Debug,
218 DebugStruct,
219 Decodable,
220 Decoder,
221 Default,
222 Deref,
223 DiagMessage,
224 Diagnostic,
225 DirBuilder,
226 DispatchFromDyn,
227 Display,
228 DoubleEndedIterator,
229 Duration,
230 Encodable,
231 Encoder,
232 Enumerate,
233 Eq,
234 Equal,
235 Err,
236 Error,
237 File,
238 FileType,
239 FmtArgumentsNew,
240 Fn,
241 FnMut,
242 FnOnce,
243 Formatter,
244 Forward,
245 From,
246 FromIterator,
247 FromResidual,
248 FsOpenOptions,
249 FsPermissions,
250 FusedIterator,
251 Future,
252 GlobalAlloc,
253 Hash,
254 HashMap,
255 HashMapEntry,
256 HashSet,
257 Hasher,
258 Implied,
259 InCleanup,
260 IndexOutput,
261 Input,
262 Instant,
263 Into,
264 IntoFuture,
265 IntoIterator,
266 IoBufRead,
267 IoLines,
268 IoRead,
269 IoSeek,
270 IoWrite,
271 IpAddr,
272 Ipv4Addr,
273 Ipv6Addr,
274 IrTyKind,
275 Is,
276 Item,
277 ItemContext,
278 IterEmpty,
279 IterOnce,
280 IterPeekable,
281 Iterator,
282 IteratorItem,
283 IteratorMap,
284 Layout,
285 Left,
286 LinkedList,
287 LintDiagnostic,
288 LintPass,
289 LocalKey,
290 Mutex,
291 MutexGuard,
292 N,
293 NonNull,
294 NonZero,
295 None,
296 Normal,
297 Ok,
298 Option,
299 Ord,
300 Ordering,
301 OsStr,
302 OsString,
303 Output,
304 Param,
305 ParamSet,
306 PartialEq,
307 PartialOrd,
308 Path,
309 PathBuf,
310 Pending,
311 PinCoerceUnsized,
312 Pointer,
313 Poll,
314 ProcMacro,
315 ProceduralMasqueradeDummyType,
316 Range,
317 RangeBounds,
318 RangeCopy,
319 RangeFrom,
320 RangeFromCopy,
321 RangeFull,
322 RangeInclusive,
323 RangeInclusiveCopy,
324 RangeMax,
325 RangeMin,
326 RangeSub,
327 RangeTo,
328 RangeToInclusive,
329 Rc,
330 RcWeak,
331 Ready,
332 Receiver,
333 RefCell,
334 RefCellRef,
335 RefCellRefMut,
336 Relaxed,
337 Release,
338 Result,
339 ResumeTy,
340 Return,
341 Reverse,
342 Right,
343 Rust,
344 RustaceansAreAwesome,
345 RwLock,
346 RwLockReadGuard,
347 RwLockWriteGuard,
348 Saturating,
349 SeekFrom,
350 SelfTy,
351 Send,
352 SeqCst,
353 Sized,
354 SliceIndex,
355 SliceIter,
356 Some,
357 SpanCtxt,
358 Stdin,
359 String,
360 StructuralPartialEq,
361 SubdiagMessage,
362 Subdiagnostic,
363 SymbolIntern,
364 Sync,
365 SyncUnsafeCell,
366 T,
367 Target,
368 This,
369 ToOwned,
370 ToString,
371 TokenStream,
372 Trait,
373 Try,
374 TryCaptureGeneric,
375 TryCapturePrintable,
376 TryFrom,
377 TryInto,
378 Ty,
379 TyCtxt,
380 TyKind,
381 Unknown,
382 Unsize,
383 UnsizedConstParamTy,
384 Upvars,
385 Vec,
386 VecDeque,
387 Waker,
388 Wrapper,
389 Wrapping,
390 Yield,
391 _DECLS,
392 __D,
393 __H,
394 __S,
395 __T,
396 __awaitee,
397 __try_var,
398 _t,
399 _task_context,
400 a32,
401 aarch64_target_feature,
402 aarch64_unstable_target_feature,
403 aarch64_ver_target_feature,
404 abi,
405 abi_amdgpu_kernel,
406 abi_avr_interrupt,
407 abi_c_cmse_nonsecure_call,
408 abi_cmse_nonsecure_call,
409 abi_custom,
410 abi_efiapi,
411 abi_gpu_kernel,
412 abi_msp430_interrupt,
413 abi_ptx,
414 abi_riscv_interrupt,
415 abi_sysv64,
416 abi_thiscall,
417 abi_unadjusted,
418 abi_vectorcall,
419 abi_x86_interrupt,
420 abort,
421 add,
422 add_assign,
423 add_with_overflow,
424 address,
425 adt_const_params,
426 advanced_slice_patterns,
427 adx_target_feature,
428 aes,
429 aggregate_raw_ptr,
430 alias,
431 align,
432 align_of,
433 align_of_val,
434 alignment,
435 all,
436 alloc,
437 alloc_error_handler,
438 alloc_layout,
439 alloc_zeroed,
440 allocator,
441 allocator_api,
442 allocator_internals,
443 allow,
444 allow_fail,
445 allow_internal_unsafe,
446 allow_internal_unstable,
447 altivec,
448 alu32,
449 always,
450 analysis,
451 and,
452 and_then,
453 anon,
454 anon_adt,
455 anon_assoc,
456 anonymous_lifetime_in_impl_trait,
457 any,
458 append_const_msg,
459 apx_target_feature,
460 arbitrary_enum_discriminant,
461 arbitrary_self_types,
462 arbitrary_self_types_pointers,
463 areg,
464 args,
465 arith_offset,
466 arm,
467 arm_target_feature,
468 array,
469 as_ptr,
470 as_ref,
471 as_str,
472 asm,
473 asm_cfg,
474 asm_const,
475 asm_experimental_arch,
476 asm_experimental_reg,
477 asm_goto,
478 asm_goto_with_outputs,
479 asm_sym,
480 asm_unwind,
481 assert,
482 assert_eq,
483 assert_eq_macro,
484 assert_inhabited,
485 assert_macro,
486 assert_mem_uninitialized_valid,
487 assert_ne_macro,
488 assert_receiver_is_total_eq,
489 assert_zero_valid,
490 asserting,
491 associated_const_equality,
492 associated_consts,
493 associated_type_bounds,
494 associated_type_defaults,
495 associated_types,
496 assume,
497 assume_init,
498 asterisk: "*",
499 async_await,
500 async_call,
501 async_call_mut,
502 async_call_once,
503 async_closure,
504 async_drop,
505 async_drop_in_place,
506 async_fn,
507 async_fn_in_dyn_trait,
508 async_fn_in_trait,
509 async_fn_kind_helper,
510 async_fn_kind_upvars,
511 async_fn_mut,
512 async_fn_once,
513 async_fn_once_output,
514 async_fn_track_caller,
515 async_fn_traits,
516 async_for_loop,
517 async_iterator,
518 async_iterator_poll_next,
519 async_trait_bounds,
520 atomic,
521 atomic_and,
522 atomic_cxchg,
523 atomic_cxchgweak,
524 atomic_fence,
525 atomic_load,
526 atomic_max,
527 atomic_min,
528 atomic_mod,
529 atomic_nand,
530 atomic_or,
531 atomic_singlethreadfence,
532 atomic_store,
533 atomic_umax,
534 atomic_umin,
535 atomic_xadd,
536 atomic_xchg,
537 atomic_xor,
538 atomic_xsub,
539 atomics,
540 att_syntax,
541 attr,
542 attr_literals,
543 attributes,
544 audit_that,
545 augmented_assignments,
546 auto_traits,
547 autodiff,
548 autodiff_forward,
549 autodiff_reverse,
550 automatically_derived,
551 available_externally,
552 avx,
553 avx10_target_feature,
554 avx512_target_feature,
555 avx512bw,
556 avx512f,
557 await_macro,
558 bang,
559 begin_panic,
560 bench,
561 bevy_ecs,
562 bikeshed_guaranteed_no_drop,
563 bin,
564 binaryheap_iter,
565 bind_by_move_pattern_guards,
566 bindings_after_at,
567 bitand,
568 bitand_assign,
569 bitor,
570 bitor_assign,
571 bitreverse,
572 bitxor,
573 bitxor_assign,
574 black_box,
575 block,
576 bool,
577 bool_then,
578 borrowck_graphviz_format,
579 borrowck_graphviz_postflow,
580 box_new,
581 box_patterns,
582 box_syntax,
583 boxed_slice,
584 bpf_target_feature,
585 braced_empty_structs,
586 branch,
587 breakpoint,
588 bridge,
589 bswap,
590 btreemap_contains_key,
591 btreemap_insert,
592 btreeset_iter,
593 built,
594 builtin_syntax,
595 c,
596 c_dash_variadic,
597 c_str,
598 c_str_literals,
599 c_unwind,
600 c_variadic,
601 c_void,
602 call,
603 call_mut,
604 call_once,
605 call_once_future,
606 call_ref_future,
607 caller_location,
608 capture_disjoint_fields,
609 carrying_mul_add,
610 catch_unwind,
611 cause,
612 cdylib,
613 ceilf16,
614 ceilf32,
615 ceilf64,
616 ceilf128,
617 cfg,
618 cfg_accessible,
619 cfg_attr,
620 cfg_attr_multi,
621 cfg_attr_trace: "<cfg_attr>", cfg_boolean_literals,
623 cfg_contract_checks,
624 cfg_doctest,
625 cfg_emscripten_wasm_eh,
626 cfg_eval,
627 cfg_fmt_debug,
628 cfg_hide,
629 cfg_overflow_checks,
630 cfg_panic,
631 cfg_relocation_model,
632 cfg_sanitize,
633 cfg_sanitizer_cfi,
634 cfg_select,
635 cfg_target_abi,
636 cfg_target_compact,
637 cfg_target_feature,
638 cfg_target_has_atomic,
639 cfg_target_has_atomic_equal_alignment,
640 cfg_target_has_reliable_f16_f128,
641 cfg_target_thread_local,
642 cfg_target_vendor,
643 cfg_trace: "<cfg>", cfg_ub_checks,
645 cfg_version,
646 cfi,
647 cfi_encoding,
648 char,
649 char_is_ascii,
650 char_to_digit,
651 child_id,
652 child_kill,
653 client,
654 clippy,
655 clobber_abi,
656 clone,
657 clone_closures,
658 clone_fn,
659 clone_from,
660 closure,
661 closure_lifetime_binder,
662 closure_to_fn_coercion,
663 closure_track_caller,
664 cmp,
665 cmp_max,
666 cmp_min,
667 cmp_ord_max,
668 cmp_ord_min,
669 cmp_partialeq_eq,
670 cmp_partialeq_ne,
671 cmp_partialord_cmp,
672 cmp_partialord_ge,
673 cmp_partialord_gt,
674 cmp_partialord_le,
675 cmp_partialord_lt,
676 cmpxchg16b_target_feature,
677 cmse_nonsecure_entry,
678 coerce_pointee_validated,
679 coerce_unsized,
680 cold,
681 cold_path,
682 collapse_debuginfo,
683 column,
684 common,
685 compare_bytes,
686 compare_exchange,
687 compare_exchange_weak,
688 compile_error,
689 compiler,
690 compiler_builtins,
691 compiler_fence,
692 concat,
693 concat_bytes,
694 concat_idents,
695 conservative_impl_trait,
696 console,
697 const_allocate,
698 const_async_blocks,
699 const_closures,
700 const_compare_raw_pointers,
701 const_constructor,
702 const_continue,
703 const_deallocate,
704 const_destruct,
705 const_eval_limit,
706 const_eval_select,
707 const_evaluatable_checked,
708 const_extern_fn,
709 const_fn,
710 const_fn_floating_point_arithmetic,
711 const_fn_fn_ptr_basics,
712 const_fn_trait_bound,
713 const_fn_transmute,
714 const_fn_union,
715 const_fn_unsize,
716 const_for,
717 const_format_args,
718 const_generics,
719 const_generics_defaults,
720 const_if_match,
721 const_impl_trait,
722 const_in_array_repeat_expressions,
723 const_indexing,
724 const_let,
725 const_loop,
726 const_make_global,
727 const_mut_refs,
728 const_panic,
729 const_panic_fmt,
730 const_param_ty,
731 const_precise_live_drops,
732 const_ptr_cast,
733 const_raw_ptr_deref,
734 const_raw_ptr_to_usize_cast,
735 const_refs_to_cell,
736 const_refs_to_static,
737 const_trait,
738 const_trait_bound_opt_out,
739 const_trait_impl,
740 const_try,
741 const_ty_placeholder: "<const_ty>",
742 constant,
743 constructor,
744 contract_build_check_ensures,
745 contract_check_ensures,
746 contract_check_requires,
747 contract_checks,
748 contracts,
749 contracts_ensures,
750 contracts_internals,
751 contracts_requires,
752 convert,
753 convert_identity,
754 copy,
755 copy_closures,
756 copy_nonoverlapping,
757 copysignf16,
758 copysignf32,
759 copysignf64,
760 copysignf128,
761 core,
762 core_panic,
763 core_panic_2015_macro,
764 core_panic_2021_macro,
765 core_panic_macro,
766 coroutine,
767 coroutine_clone,
768 coroutine_resume,
769 coroutine_return,
770 coroutine_state,
771 coroutine_yield,
772 coroutines,
773 cosf16,
774 cosf32,
775 cosf64,
776 cosf128,
777 count,
778 coverage,
779 coverage_attribute,
780 cr,
781 crate_in_paths,
782 crate_local,
783 crate_name,
784 crate_type,
785 crate_visibility_modifier,
786 crt_dash_static: "crt-static",
787 csky_target_feature,
788 cstr_type,
789 cstring_as_c_str,
790 cstring_type,
791 ctlz,
792 ctlz_nonzero,
793 ctpop,
794 cttz,
795 cttz_nonzero,
796 custom_attribute,
797 custom_code_classes_in_docs,
798 custom_derive,
799 custom_inner_attributes,
800 custom_mir,
801 custom_test_frameworks,
802 d,
803 d32,
804 dbg_macro,
805 dead_code,
806 dealloc,
807 debug,
808 debug_assert_eq_macro,
809 debug_assert_macro,
810 debug_assert_ne_macro,
811 debug_assertions,
812 debug_struct,
813 debug_struct_fields_finish,
814 debug_tuple,
815 debug_tuple_fields_finish,
816 debugger_visualizer,
817 decl_macro,
818 declare_lint_pass,
819 decode,
820 default_alloc_error_handler,
821 default_field_values,
822 default_fn,
823 default_lib_allocator,
824 default_method_body_is_const,
825 default_trait1,
830 default_trait2,
831 default_trait3,
832 default_trait4,
833 default_type_parameter_fallback,
835 default_type_params,
836 define_opaque,
837 delayed_bug_from_inside_query,
838 deny,
839 deprecated,
840 deprecated_safe,
841 deprecated_suggestion,
842 deref,
843 deref_method,
844 deref_mut,
845 deref_mut_method,
846 deref_patterns,
847 deref_pure,
848 deref_target,
849 derive,
850 derive_coerce_pointee,
851 derive_const,
852 derive_const_issue: "118304",
853 derive_default_enum,
854 derive_from,
855 derive_smart_pointer,
856 destruct,
857 destructuring_assignment,
858 diagnostic,
859 diagnostic_namespace,
860 dialect,
861 direct,
862 discriminant_kind,
863 discriminant_type,
864 discriminant_value,
865 disjoint_bitor,
866 dispatch_from_dyn,
867 div,
868 div_assign,
869 diverging_block_default,
870 do_not_recommend,
871 doc,
872 doc_alias,
873 doc_auto_cfg,
874 doc_cfg,
875 doc_cfg_hide,
876 doc_keyword,
877 doc_masked,
878 doc_notable_trait,
879 doc_primitive,
880 doc_spotlight,
881 doctest,
882 document_private_items,
883 dotdot: "..",
884 dotdot_in_tuple_patterns,
885 dotdoteq_in_patterns,
886 dreg,
887 dreg_low8,
888 dreg_low16,
889 drop,
890 drop_in_place,
891 drop_types_in_const,
892 dropck_eyepatch,
893 dropck_parametricity,
894 dummy: "<!dummy!>", dummy_cgu_name,
896 dylib,
897 dyn_compatible_for_dispatch,
898 dyn_metadata,
899 dyn_star,
900 dyn_trait,
901 dynamic_no_pic: "dynamic-no-pic",
902 e,
903 edition_panic,
904 effects,
905 eh_catch_typeinfo,
906 eh_personality,
907 emit,
908 emit_enum,
909 emit_enum_variant,
910 emit_enum_variant_arg,
911 emit_struct,
912 emit_struct_field,
913 empty: "",
921 emscripten_wasm_eh,
922 enable,
923 encode,
924 end,
925 entry_nops,
926 enumerate_method,
927 env,
928 env_CFG_RELEASE: env!("CFG_RELEASE"),
929 eprint_macro,
930 eprintln_macro,
931 eq,
932 ergonomic_clones,
933 ermsb_target_feature,
934 exact_div,
935 except,
936 exchange_malloc,
937 exclusive_range_pattern,
938 exhaustive_integer_patterns,
939 exhaustive_patterns,
940 existential_type,
941 exp2f16,
942 exp2f32,
943 exp2f64,
944 exp2f128,
945 expect,
946 expected,
947 expf16,
948 expf32,
949 expf64,
950 expf128,
951 explicit_extern_abis,
952 explicit_generic_args_with_impl_trait,
953 explicit_tail_calls,
954 export_name,
955 export_stable,
956 expr,
957 expr_2021,
958 expr_fragment_specifier_2024,
959 extended_key_value_attributes,
960 extended_varargs_abi_support,
961 extern_absolute_paths,
962 extern_crate_item_prelude,
963 extern_crate_self,
964 extern_in_paths,
965 extern_prelude,
966 extern_system_varargs,
967 extern_types,
968 extern_weak,
969 external,
970 external_doc,
971 f,
972 f16,
973 f16_epsilon,
974 f16_nan,
975 f16c_target_feature,
976 f32,
977 f32_epsilon,
978 f32_legacy_const_digits,
979 f32_legacy_const_epsilon,
980 f32_legacy_const_infinity,
981 f32_legacy_const_mantissa_dig,
982 f32_legacy_const_max,
983 f32_legacy_const_max_10_exp,
984 f32_legacy_const_max_exp,
985 f32_legacy_const_min,
986 f32_legacy_const_min_10_exp,
987 f32_legacy_const_min_exp,
988 f32_legacy_const_min_positive,
989 f32_legacy_const_nan,
990 f32_legacy_const_neg_infinity,
991 f32_legacy_const_radix,
992 f32_nan,
993 f64,
994 f64_epsilon,
995 f64_legacy_const_digits,
996 f64_legacy_const_epsilon,
997 f64_legacy_const_infinity,
998 f64_legacy_const_mantissa_dig,
999 f64_legacy_const_max,
1000 f64_legacy_const_max_10_exp,
1001 f64_legacy_const_max_exp,
1002 f64_legacy_const_min,
1003 f64_legacy_const_min_10_exp,
1004 f64_legacy_const_min_exp,
1005 f64_legacy_const_min_positive,
1006 f64_legacy_const_nan,
1007 f64_legacy_const_neg_infinity,
1008 f64_legacy_const_radix,
1009 f64_nan,
1010 f128,
1011 f128_epsilon,
1012 f128_nan,
1013 fabsf16,
1014 fabsf32,
1015 fabsf64,
1016 fabsf128,
1017 fadd_algebraic,
1018 fadd_fast,
1019 fake_variadic,
1020 fallback,
1021 fdiv_algebraic,
1022 fdiv_fast,
1023 feature,
1024 fence,
1025 ferris: "🦀",
1026 fetch_update,
1027 ffi,
1028 ffi_const,
1029 ffi_pure,
1030 ffi_returns_twice,
1031 field,
1032 field_init_shorthand,
1033 file,
1034 file_options,
1035 flags,
1036 float,
1037 float_to_int_unchecked,
1038 floorf16,
1039 floorf32,
1040 floorf64,
1041 floorf128,
1042 fmaf16,
1043 fmaf32,
1044 fmaf64,
1045 fmaf128,
1046 fmt,
1047 fmt_debug,
1048 fmul_algebraic,
1049 fmul_fast,
1050 fmuladdf16,
1051 fmuladdf32,
1052 fmuladdf64,
1053 fmuladdf128,
1054 fn_align,
1055 fn_body,
1056 fn_delegation,
1057 fn_must_use,
1058 fn_mut,
1059 fn_once,
1060 fn_once_output,
1061 fn_ptr_addr,
1062 fn_ptr_trait,
1063 forbid,
1064 forget,
1065 format,
1066 format_args,
1067 format_args_capture,
1068 format_args_macro,
1069 format_args_nl,
1070 format_argument,
1071 format_arguments,
1072 format_count,
1073 format_macro,
1074 format_placeholder,
1075 format_unsafe_arg,
1076 freeze,
1077 freeze_impls,
1078 freg,
1079 frem_algebraic,
1080 frem_fast,
1081 from,
1082 from_desugaring,
1083 from_fn,
1084 from_iter,
1085 from_iter_fn,
1086 from_output,
1087 from_residual,
1088 from_size_align_unchecked,
1089 from_str_method,
1090 from_u16,
1091 from_usize,
1092 from_yeet,
1093 frontmatter,
1094 fs_create_dir,
1095 fsub_algebraic,
1096 fsub_fast,
1097 full,
1098 fundamental,
1099 fused_iterator,
1100 future,
1101 future_drop_poll,
1102 future_output,
1103 future_trait,
1104 fxsr,
1105 gdb_script_file,
1106 ge,
1107 gen_blocks,
1108 gen_future,
1109 generator_clone,
1110 generators,
1111 generic_arg_infer,
1112 generic_assert,
1113 generic_associated_types,
1114 generic_associated_types_extended,
1115 generic_const_exprs,
1116 generic_const_items,
1117 generic_const_parameter_types,
1118 generic_param_attrs,
1119 generic_pattern_types,
1120 get_context,
1121 global_alloc_ty,
1122 global_allocator,
1123 global_asm,
1124 global_registration,
1125 globs,
1126 gt,
1127 guard_patterns,
1128 half_open_range_patterns,
1129 half_open_range_patterns_in_slices,
1130 hash,
1131 hashmap_contains_key,
1132 hashmap_drain_ty,
1133 hashmap_insert,
1134 hashmap_iter_mut_ty,
1135 hashmap_iter_ty,
1136 hashmap_keys_ty,
1137 hashmap_values_mut_ty,
1138 hashmap_values_ty,
1139 hashset_drain_ty,
1140 hashset_iter,
1141 hashset_iter_ty,
1142 hexagon_target_feature,
1143 hidden,
1144 hint,
1145 homogeneous_aggregate,
1146 host,
1147 html_favicon_url,
1148 html_logo_url,
1149 html_no_source,
1150 html_playground_url,
1151 html_root_url,
1152 hwaddress,
1153 i,
1154 i8,
1155 i8_legacy_const_max,
1156 i8_legacy_const_min,
1157 i8_legacy_fn_max_value,
1158 i8_legacy_fn_min_value,
1159 i8_legacy_mod,
1160 i16,
1161 i16_legacy_const_max,
1162 i16_legacy_const_min,
1163 i16_legacy_fn_max_value,
1164 i16_legacy_fn_min_value,
1165 i16_legacy_mod,
1166 i32,
1167 i32_legacy_const_max,
1168 i32_legacy_const_min,
1169 i32_legacy_fn_max_value,
1170 i32_legacy_fn_min_value,
1171 i32_legacy_mod,
1172 i64,
1173 i64_legacy_const_max,
1174 i64_legacy_const_min,
1175 i64_legacy_fn_max_value,
1176 i64_legacy_fn_min_value,
1177 i64_legacy_mod,
1178 i128,
1179 i128_legacy_const_max,
1180 i128_legacy_const_min,
1181 i128_legacy_fn_max_value,
1182 i128_legacy_fn_min_value,
1183 i128_legacy_mod,
1184 i128_type,
1185 ident,
1186 if_let,
1187 if_let_guard,
1188 if_let_rescope,
1189 if_while_or_patterns,
1190 ignore,
1191 impl_header_lifetime_elision,
1192 impl_lint_pass,
1193 impl_trait_in_assoc_type,
1194 impl_trait_in_bindings,
1195 impl_trait_in_fn_trait_return,
1196 impl_trait_projections,
1197 implement_via_object,
1198 implied_by,
1199 import,
1200 import_name_type,
1201 import_shadowing,
1202 import_trait_associated_functions,
1203 imported_main,
1204 in_band_lifetimes,
1205 include,
1206 include_bytes,
1207 include_bytes_macro,
1208 include_str,
1209 include_str_macro,
1210 inclusive_range_syntax,
1211 index,
1212 index_mut,
1213 infer_outlives_requirements,
1214 infer_static_outlives_requirements,
1215 inherent_associated_types,
1216 inherit,
1217 initial,
1218 inlateout,
1219 inline,
1220 inline_const,
1221 inline_const_pat,
1222 inout,
1223 instant_now,
1224 instruction_set,
1225 integer_: "integer", integral,
1227 internal,
1228 internal_features,
1229 into_async_iter_into_iter,
1230 into_future,
1231 into_iter,
1232 intra_doc_pointers,
1233 intrinsics,
1234 intrinsics_unaligned_volatile_load,
1235 intrinsics_unaligned_volatile_store,
1236 io_error_new,
1237 io_errorkind,
1238 io_stderr,
1239 io_stdout,
1240 irrefutable_let_patterns,
1241 is,
1242 is_val_statically_known,
1243 isa_attribute,
1244 isize,
1245 isize_legacy_const_max,
1246 isize_legacy_const_min,
1247 isize_legacy_fn_max_value,
1248 isize_legacy_fn_min_value,
1249 isize_legacy_mod,
1250 issue,
1251 issue_5723_bootstrap,
1252 issue_tracker_base_url,
1253 item,
1254 item_like_imports,
1255 iter,
1256 iter_cloned,
1257 iter_copied,
1258 iter_filter,
1259 iter_mut,
1260 iter_repeat,
1261 iterator,
1262 iterator_collect_fn,
1263 kcfi,
1264 keylocker_x86,
1265 keyword,
1266 kind,
1267 kreg,
1268 kreg0,
1269 label,
1270 label_break_value,
1271 lahfsahf_target_feature,
1272 lang,
1273 lang_items,
1274 large_assignments,
1275 lateout,
1276 lazy_normalization_consts,
1277 lazy_type_alias,
1278 le,
1279 legacy_receiver,
1280 len,
1281 let_chains,
1282 let_else,
1283 lhs,
1284 lib,
1285 libc,
1286 lifetime,
1287 lifetime_capture_rules_2024,
1288 lifetimes,
1289 likely,
1290 line,
1291 link,
1292 link_arg_attribute,
1293 link_args,
1294 link_cfg,
1295 link_llvm_intrinsics,
1296 link_name,
1297 link_ordinal,
1298 link_section,
1299 linkage,
1300 linker,
1301 linker_messages,
1302 linkonce,
1303 linkonce_odr,
1304 lint_reasons,
1305 literal,
1306 load,
1307 loaded_from_disk,
1308 local,
1309 local_inner_macros,
1310 log2f16,
1311 log2f32,
1312 log2f64,
1313 log2f128,
1314 log10f16,
1315 log10f32,
1316 log10f64,
1317 log10f128,
1318 log_syntax,
1319 logf16,
1320 logf32,
1321 logf64,
1322 logf128,
1323 loongarch_target_feature,
1324 loop_break_value,
1325 loop_match,
1326 lt,
1327 m68k_target_feature,
1328 macro_at_most_once_rep,
1329 macro_attr,
1330 macro_attributes_in_derive_output,
1331 macro_concat,
1332 macro_derive,
1333 macro_escape,
1334 macro_export,
1335 macro_lifetime_matcher,
1336 macro_literal_matcher,
1337 macro_metavar_expr,
1338 macro_metavar_expr_concat,
1339 macro_reexport,
1340 macro_use,
1341 macro_vis_matcher,
1342 macros_in_extern,
1343 main,
1344 managed_boxes,
1345 manually_drop,
1346 map,
1347 map_err,
1348 marker,
1349 marker_trait_attr,
1350 masked,
1351 match_beginning_vert,
1352 match_default_bindings,
1353 matches_macro,
1354 maximumf16,
1355 maximumf32,
1356 maximumf64,
1357 maximumf128,
1358 maxnumf16,
1359 maxnumf32,
1360 maxnumf64,
1361 maxnumf128,
1362 may_dangle,
1363 may_unwind,
1364 maybe_uninit,
1365 maybe_uninit_uninit,
1366 maybe_uninit_zeroed,
1367 mem_align_of,
1368 mem_discriminant,
1369 mem_drop,
1370 mem_forget,
1371 mem_replace,
1372 mem_size_of,
1373 mem_size_of_val,
1374 mem_swap,
1375 mem_uninitialized,
1376 mem_variant_count,
1377 mem_zeroed,
1378 member_constraints,
1379 memory,
1380 memtag,
1381 message,
1382 meta,
1383 meta_sized,
1384 metadata_type,
1385 min_const_fn,
1386 min_const_generics,
1387 min_const_unsafe_fn,
1388 min_exhaustive_patterns,
1389 min_generic_const_args,
1390 min_specialization,
1391 min_type_alias_impl_trait,
1392 minimumf16,
1393 minimumf32,
1394 minimumf64,
1395 minimumf128,
1396 minnumf16,
1397 minnumf32,
1398 minnumf64,
1399 minnumf128,
1400 mips_target_feature,
1401 mir_assume,
1402 mir_basic_block,
1403 mir_call,
1404 mir_cast_ptr_to_ptr,
1405 mir_cast_transmute,
1406 mir_checked,
1407 mir_copy_for_deref,
1408 mir_debuginfo,
1409 mir_deinit,
1410 mir_discriminant,
1411 mir_drop,
1412 mir_field,
1413 mir_goto,
1414 mir_len,
1415 mir_make_place,
1416 mir_move,
1417 mir_offset,
1418 mir_ptr_metadata,
1419 mir_retag,
1420 mir_return,
1421 mir_return_to,
1422 mir_set_discriminant,
1423 mir_static,
1424 mir_static_mut,
1425 mir_storage_dead,
1426 mir_storage_live,
1427 mir_tail_call,
1428 mir_unreachable,
1429 mir_unwind_cleanup,
1430 mir_unwind_continue,
1431 mir_unwind_resume,
1432 mir_unwind_terminate,
1433 mir_unwind_terminate_reason,
1434 mir_unwind_unreachable,
1435 mir_variant,
1436 miri,
1437 mmx_reg,
1438 modifiers,
1439 module,
1440 module_path,
1441 more_maybe_bounds,
1442 more_qualified_paths,
1443 more_struct_aliases,
1444 movbe_target_feature,
1445 move_ref_pattern,
1446 move_size_limit,
1447 movrs_target_feature,
1448 mul,
1449 mul_assign,
1450 mul_with_overflow,
1451 multiple_supertrait_upcastable,
1452 must_not_suspend,
1453 must_use,
1454 mut_preserve_binding_mode_2024,
1455 mut_ref,
1456 naked,
1457 naked_asm,
1458 naked_functions,
1459 naked_functions_rustic_abi,
1460 naked_functions_target_feature,
1461 name,
1462 names,
1463 native_link_modifiers,
1464 native_link_modifiers_as_needed,
1465 native_link_modifiers_bundle,
1466 native_link_modifiers_verbatim,
1467 native_link_modifiers_whole_archive,
1468 natvis_file,
1469 ne,
1470 needs_allocator,
1471 needs_drop,
1472 needs_panic_runtime,
1473 neg,
1474 negate_unsigned,
1475 negative_bounds,
1476 negative_impls,
1477 neon,
1478 nested,
1479 never,
1480 never_patterns,
1481 never_type,
1482 never_type_fallback,
1483 new,
1484 new_binary,
1485 new_const,
1486 new_debug,
1487 new_debug_noop,
1488 new_display,
1489 new_lower_exp,
1490 new_lower_hex,
1491 new_octal,
1492 new_pointer,
1493 new_range,
1494 new_unchecked,
1495 new_upper_exp,
1496 new_upper_hex,
1497 new_v1,
1498 new_v1_formatted,
1499 next,
1500 niko,
1501 nll,
1502 no,
1503 no_builtins,
1504 no_core,
1505 no_coverage,
1506 no_crate_inject,
1507 no_debug,
1508 no_default_passes,
1509 no_implicit_prelude,
1510 no_inline,
1511 no_link,
1512 no_main,
1513 no_mangle,
1514 no_sanitize,
1515 no_stack_check,
1516 no_std,
1517 nomem,
1518 non_ascii_idents,
1519 non_exhaustive,
1520 non_exhaustive_omitted_patterns_lint,
1521 non_lifetime_binders,
1522 non_modrs_mods,
1523 none,
1524 nontemporal_store,
1525 noop_method_borrow,
1526 noop_method_clone,
1527 noop_method_deref,
1528 noreturn,
1529 nostack,
1530 not,
1531 notable_trait,
1532 note,
1533 nvptx_target_feature,
1534 object_safe_for_dispatch,
1535 of,
1536 off,
1537 offset,
1538 offset_of,
1539 offset_of_enum,
1540 offset_of_nested,
1541 offset_of_slice,
1542 ok_or_else,
1543 old_name,
1544 omit_gdb_pretty_printer_section,
1545 on,
1546 on_unimplemented,
1547 opaque,
1548 opaque_module_name_placeholder: "<opaque>",
1549 open_options_new,
1550 ops,
1551 opt_out_copy,
1552 optimize,
1553 optimize_attribute,
1554 optimized,
1555 optin_builtin_traits,
1556 option,
1557 option_env,
1558 option_expect,
1559 option_unwrap,
1560 options,
1561 or,
1562 or_patterns,
1563 ord_cmp_method,
1564 os_str_to_os_string,
1565 os_string_as_os_str,
1566 other,
1567 out,
1568 overflow_checks,
1569 overlapping_marker_traits,
1570 owned_box,
1571 packed,
1572 packed_bundled_libs,
1573 panic,
1574 panic_2015,
1575 panic_2021,
1576 panic_abort,
1577 panic_any,
1578 panic_bounds_check,
1579 panic_cannot_unwind,
1580 panic_const_add_overflow,
1581 panic_const_async_fn_resumed,
1582 panic_const_async_fn_resumed_drop,
1583 panic_const_async_fn_resumed_panic,
1584 panic_const_async_gen_fn_resumed,
1585 panic_const_async_gen_fn_resumed_drop,
1586 panic_const_async_gen_fn_resumed_panic,
1587 panic_const_coroutine_resumed,
1588 panic_const_coroutine_resumed_drop,
1589 panic_const_coroutine_resumed_panic,
1590 panic_const_div_by_zero,
1591 panic_const_div_overflow,
1592 panic_const_gen_fn_none,
1593 panic_const_gen_fn_none_drop,
1594 panic_const_gen_fn_none_panic,
1595 panic_const_mul_overflow,
1596 panic_const_neg_overflow,
1597 panic_const_rem_by_zero,
1598 panic_const_rem_overflow,
1599 panic_const_shl_overflow,
1600 panic_const_shr_overflow,
1601 panic_const_sub_overflow,
1602 panic_display,
1603 panic_fmt,
1604 panic_handler,
1605 panic_impl,
1606 panic_implementation,
1607 panic_in_cleanup,
1608 panic_info,
1609 panic_invalid_enum_construction,
1610 panic_location,
1611 panic_misaligned_pointer_dereference,
1612 panic_nounwind,
1613 panic_null_pointer_dereference,
1614 panic_runtime,
1615 panic_str_2015,
1616 panic_unwind,
1617 panicking,
1618 param_attrs,
1619 parent_label,
1620 partial_cmp,
1621 partial_ord,
1622 passes,
1623 pat,
1624 pat_param,
1625 patchable_function_entry,
1626 path,
1627 path_main_separator,
1628 path_to_pathbuf,
1629 pathbuf_as_path,
1630 pattern_complexity_limit,
1631 pattern_parentheses,
1632 pattern_type,
1633 pattern_type_range_trait,
1634 pattern_types,
1635 permissions_from_mode,
1636 phantom_data,
1637 phase,
1638 pic,
1639 pie,
1640 pin,
1641 pin_ergonomics,
1642 pin_macro,
1643 platform_intrinsics,
1644 plugin,
1645 plugin_registrar,
1646 plugins,
1647 pointee,
1648 pointee_sized,
1649 pointee_trait,
1650 pointer,
1651 poll,
1652 poll_next,
1653 position,
1654 post_cleanup: "post-cleanup",
1655 post_dash_lto: "post-lto",
1656 postfix_match,
1657 powerpc_target_feature,
1658 powf16,
1659 powf32,
1660 powf64,
1661 powf128,
1662 powif16,
1663 powif32,
1664 powif64,
1665 powif128,
1666 pre_dash_lto: "pre-lto",
1667 precise_capturing,
1668 precise_capturing_in_traits,
1669 precise_pointer_size_matching,
1670 precision,
1671 pref_align_of,
1672 prefetch_read_data,
1673 prefetch_read_instruction,
1674 prefetch_write_data,
1675 prefetch_write_instruction,
1676 prefix_nops,
1677 preg,
1678 prelude,
1679 prelude_import,
1680 preserves_flags,
1681 prfchw_target_feature,
1682 print_macro,
1683 println_macro,
1684 proc_dash_macro: "proc-macro",
1685 proc_macro,
1686 proc_macro_attribute,
1687 proc_macro_derive,
1688 proc_macro_expr,
1689 proc_macro_gen,
1690 proc_macro_hygiene,
1691 proc_macro_internals,
1692 proc_macro_mod,
1693 proc_macro_non_items,
1694 proc_macro_path_invoc,
1695 process_abort,
1696 process_exit,
1697 profiler_builtins,
1698 profiler_runtime,
1699 ptr,
1700 ptr_cast,
1701 ptr_cast_const,
1702 ptr_cast_mut,
1703 ptr_const_is_null,
1704 ptr_copy,
1705 ptr_copy_nonoverlapping,
1706 ptr_eq,
1707 ptr_from_ref,
1708 ptr_guaranteed_cmp,
1709 ptr_is_null,
1710 ptr_mask,
1711 ptr_metadata,
1712 ptr_null,
1713 ptr_null_mut,
1714 ptr_offset_from,
1715 ptr_offset_from_unsigned,
1716 ptr_read,
1717 ptr_read_unaligned,
1718 ptr_read_volatile,
1719 ptr_replace,
1720 ptr_slice_from_raw_parts,
1721 ptr_slice_from_raw_parts_mut,
1722 ptr_swap,
1723 ptr_swap_nonoverlapping,
1724 ptr_write,
1725 ptr_write_bytes,
1726 ptr_write_unaligned,
1727 ptr_write_volatile,
1728 pub_macro_rules,
1729 pub_restricted,
1730 public,
1731 pure,
1732 pushpop_unsafe,
1733 qreg,
1734 qreg_low4,
1735 qreg_low8,
1736 quad_precision_float,
1737 question_mark,
1738 quote,
1739 range_inclusive_new,
1740 range_step,
1741 raw_dylib,
1742 raw_dylib_elf,
1743 raw_eq,
1744 raw_identifiers,
1745 raw_ref_op,
1746 re_rebalance_coherence,
1747 read_enum,
1748 read_enum_variant,
1749 read_enum_variant_arg,
1750 read_struct,
1751 read_struct_field,
1752 read_via_copy,
1753 readonly,
1754 realloc,
1755 reason,
1756 receiver,
1757 receiver_target,
1758 recursion_limit,
1759 reexport_test_harness_main,
1760 ref_pat_eat_one_layer_2024,
1761 ref_pat_eat_one_layer_2024_structural,
1762 ref_pat_everywhere,
1763 ref_unwind_safe_trait,
1764 reference,
1765 reflect,
1766 reg,
1767 reg16,
1768 reg32,
1769 reg64,
1770 reg_abcd,
1771 reg_addr,
1772 reg_byte,
1773 reg_data,
1774 reg_iw,
1775 reg_nonzero,
1776 reg_pair,
1777 reg_ptr,
1778 reg_upper,
1779 register_attr,
1780 register_tool,
1781 relaxed_adts,
1782 relaxed_struct_unsize,
1783 relocation_model,
1784 rem,
1785 rem_assign,
1786 repr,
1787 repr128,
1788 repr_align,
1789 repr_align_enum,
1790 repr_packed,
1791 repr_simd,
1792 repr_transparent,
1793 require,
1794 reserve_x18: "reserve-x18",
1795 residual,
1796 result,
1797 result_ffi_guarantees,
1798 result_ok_method,
1799 resume,
1800 return_position_impl_trait_in_trait,
1801 return_type_notation,
1802 riscv_target_feature,
1803 rlib,
1804 ropi,
1805 ropi_rwpi: "ropi-rwpi",
1806 rotate_left,
1807 rotate_right,
1808 round_ties_even_f16,
1809 round_ties_even_f32,
1810 round_ties_even_f64,
1811 round_ties_even_f128,
1812 roundf16,
1813 roundf32,
1814 roundf64,
1815 roundf128,
1816 rt,
1817 rtm_target_feature,
1818 runtime,
1819 rust,
1820 rust_2015,
1821 rust_2018,
1822 rust_2018_preview,
1823 rust_2021,
1824 rust_2024,
1825 rust_analyzer,
1826 rust_begin_unwind,
1827 rust_cold_cc,
1828 rust_eh_catch_typeinfo,
1829 rust_eh_personality,
1830 rust_future,
1831 rust_logo,
1832 rust_out,
1833 rustc,
1834 rustc_abi,
1835 rustc_align,
1837 rustc_allocator,
1838 rustc_allocator_zeroed,
1839 rustc_allow_const_fn_unstable,
1840 rustc_allow_incoherent_impl,
1841 rustc_allowed_through_unstable_modules,
1842 rustc_as_ptr,
1843 rustc_attrs,
1844 rustc_autodiff,
1845 rustc_builtin_macro,
1846 rustc_capture_analysis,
1847 rustc_clean,
1848 rustc_coherence_is_core,
1849 rustc_coinductive,
1850 rustc_confusables,
1851 rustc_const_stable,
1852 rustc_const_stable_indirect,
1853 rustc_const_unstable,
1854 rustc_conversion_suggestion,
1855 rustc_deallocator,
1856 rustc_def_path,
1857 rustc_default_body_unstable,
1858 rustc_delayed_bug_from_inside_query,
1859 rustc_deny_explicit_impl,
1860 rustc_deprecated_safe_2024,
1861 rustc_diagnostic_item,
1862 rustc_diagnostic_macros,
1863 rustc_dirty,
1864 rustc_do_not_const_check,
1865 rustc_do_not_implement_via_object,
1866 rustc_doc_primitive,
1867 rustc_driver,
1868 rustc_dummy,
1869 rustc_dump_def_parents,
1870 rustc_dump_item_bounds,
1871 rustc_dump_predicates,
1872 rustc_dump_user_args,
1873 rustc_dump_vtable,
1874 rustc_effective_visibility,
1875 rustc_evaluate_where_clauses,
1876 rustc_expected_cgu_reuse,
1877 rustc_force_inline,
1878 rustc_has_incoherent_inherent_impls,
1879 rustc_hidden_type_of_opaques,
1880 rustc_if_this_changed,
1881 rustc_inherit_overflow_checks,
1882 rustc_insignificant_dtor,
1883 rustc_intrinsic,
1884 rustc_intrinsic_const_stable_indirect,
1885 rustc_layout,
1886 rustc_layout_scalar_valid_range_end,
1887 rustc_layout_scalar_valid_range_start,
1888 rustc_legacy_const_generics,
1889 rustc_lint_diagnostics,
1890 rustc_lint_opt_deny_field_access,
1891 rustc_lint_opt_ty,
1892 rustc_lint_query_instability,
1893 rustc_lint_untracked_query_information,
1894 rustc_macro_transparency,
1895 rustc_main,
1896 rustc_mir,
1897 rustc_must_implement_one_of,
1898 rustc_never_returns_null_ptr,
1899 rustc_never_type_options,
1900 rustc_no_implicit_autorefs,
1901 rustc_no_implicit_bounds,
1902 rustc_no_mir_inline,
1903 rustc_nonnull_optimization_guaranteed,
1904 rustc_nounwind,
1905 rustc_object_lifetime_default,
1906 rustc_on_unimplemented,
1907 rustc_outlives,
1908 rustc_paren_sugar,
1909 rustc_partition_codegened,
1910 rustc_partition_reused,
1911 rustc_pass_by_value,
1912 rustc_peek,
1913 rustc_peek_liveness,
1914 rustc_peek_maybe_init,
1915 rustc_peek_maybe_uninit,
1916 rustc_preserve_ub_checks,
1917 rustc_private,
1918 rustc_proc_macro_decls,
1919 rustc_promotable,
1920 rustc_pub_transparent,
1921 rustc_reallocator,
1922 rustc_regions,
1923 rustc_reservation_impl,
1924 rustc_serialize,
1925 rustc_skip_during_method_dispatch,
1926 rustc_specialization_trait,
1927 rustc_std_internal_symbol,
1928 rustc_strict_coherence,
1929 rustc_symbol_name,
1930 rustc_test_marker,
1931 rustc_then_this_would_need,
1932 rustc_trivial_field_reads,
1933 rustc_unsafe_specialization_marker,
1934 rustc_variance,
1935 rustc_variance_of_opaques,
1936 rustdoc,
1937 rustdoc_internals,
1938 rustdoc_missing_doc_code_examples,
1939 rustfmt,
1940 rvalue_static_promotion,
1941 rwpi,
1942 s,
1943 s390x_target_feature,
1944 safety,
1945 sanitize,
1946 sanitizer_cfi_generalize_pointers,
1947 sanitizer_cfi_normalize_integers,
1948 sanitizer_runtime,
1949 saturating_add,
1950 saturating_div,
1951 saturating_sub,
1952 sdylib,
1953 search_unbox,
1954 select_unpredictable,
1955 self_in_typedefs,
1956 self_struct_ctor,
1957 semiopaque,
1958 semitransparent,
1959 sha2,
1960 sha3,
1961 sha512_sm_x86,
1962 shadow_call_stack,
1963 shallow,
1964 shl,
1965 shl_assign,
1966 shorter_tail_lifetimes,
1967 should_panic,
1968 shr,
1969 shr_assign,
1970 sig_dfl,
1971 sig_ign,
1972 simd,
1973 simd_add,
1974 simd_and,
1975 simd_arith_offset,
1976 simd_as,
1977 simd_bitmask,
1978 simd_bitreverse,
1979 simd_bswap,
1980 simd_cast,
1981 simd_cast_ptr,
1982 simd_ceil,
1983 simd_ctlz,
1984 simd_ctpop,
1985 simd_cttz,
1986 simd_div,
1987 simd_eq,
1988 simd_expose_provenance,
1989 simd_extract,
1990 simd_extract_dyn,
1991 simd_fabs,
1992 simd_fcos,
1993 simd_fexp,
1994 simd_fexp2,
1995 simd_ffi,
1996 simd_flog,
1997 simd_flog2,
1998 simd_flog10,
1999 simd_floor,
2000 simd_fma,
2001 simd_fmax,
2002 simd_fmin,
2003 simd_fsin,
2004 simd_fsqrt,
2005 simd_funnel_shl,
2006 simd_funnel_shr,
2007 simd_gather,
2008 simd_ge,
2009 simd_gt,
2010 simd_insert,
2011 simd_insert_dyn,
2012 simd_le,
2013 simd_lt,
2014 simd_masked_load,
2015 simd_masked_store,
2016 simd_mul,
2017 simd_ne,
2018 simd_neg,
2019 simd_or,
2020 simd_reduce_add_ordered,
2021 simd_reduce_add_unordered,
2022 simd_reduce_all,
2023 simd_reduce_and,
2024 simd_reduce_any,
2025 simd_reduce_max,
2026 simd_reduce_min,
2027 simd_reduce_mul_ordered,
2028 simd_reduce_mul_unordered,
2029 simd_reduce_or,
2030 simd_reduce_xor,
2031 simd_relaxed_fma,
2032 simd_rem,
2033 simd_round,
2034 simd_round_ties_even,
2035 simd_saturating_add,
2036 simd_saturating_sub,
2037 simd_scatter,
2038 simd_select,
2039 simd_select_bitmask,
2040 simd_shl,
2041 simd_shr,
2042 simd_shuffle,
2043 simd_shuffle_const_generic,
2044 simd_sub,
2045 simd_trunc,
2046 simd_with_exposed_provenance,
2047 simd_xor,
2048 since,
2049 sinf16,
2050 sinf32,
2051 sinf64,
2052 sinf128,
2053 size,
2054 size_of,
2055 size_of_val,
2056 sized,
2057 sized_hierarchy,
2058 skip,
2059 slice,
2060 slice_from_raw_parts,
2061 slice_from_raw_parts_mut,
2062 slice_from_ref,
2063 slice_get_unchecked,
2064 slice_into_vec,
2065 slice_iter,
2066 slice_len_fn,
2067 slice_patterns,
2068 slicing_syntax,
2069 soft,
2070 sparc_target_feature,
2071 specialization,
2072 speed,
2073 spotlight,
2074 sqrtf16,
2075 sqrtf32,
2076 sqrtf64,
2077 sqrtf128,
2078 sreg,
2079 sreg_low16,
2080 sse,
2081 sse2,
2082 sse4a_target_feature,
2083 stable,
2084 staged_api,
2085 start,
2086 state,
2087 static_in_const,
2088 static_nobundle,
2089 static_recursion,
2090 staticlib,
2091 std,
2092 std_lib_injection,
2093 std_panic,
2094 std_panic_2015_macro,
2095 std_panic_macro,
2096 stmt,
2097 stmt_expr_attributes,
2098 stop_after_dataflow,
2099 store,
2100 str,
2101 str_chars,
2102 str_ends_with,
2103 str_from_utf8,
2104 str_from_utf8_mut,
2105 str_from_utf8_unchecked,
2106 str_from_utf8_unchecked_mut,
2107 str_inherent_from_utf8,
2108 str_inherent_from_utf8_mut,
2109 str_inherent_from_utf8_unchecked,
2110 str_inherent_from_utf8_unchecked_mut,
2111 str_len,
2112 str_split_whitespace,
2113 str_starts_with,
2114 str_trim,
2115 str_trim_end,
2116 str_trim_start,
2117 strict_provenance_lints,
2118 string_as_mut_str,
2119 string_as_str,
2120 string_deref_patterns,
2121 string_from_utf8,
2122 string_insert_str,
2123 string_new,
2124 string_push_str,
2125 stringify,
2126 struct_field_attributes,
2127 struct_inherit,
2128 struct_variant,
2129 structural_match,
2130 structural_peq,
2131 sub,
2132 sub_assign,
2133 sub_with_overflow,
2134 suggestion,
2135 super_let,
2136 supertrait_item_shadowing,
2137 sym,
2138 sync,
2139 synthetic,
2140 sys_mutex_lock,
2141 sys_mutex_try_lock,
2142 sys_mutex_unlock,
2143 t32,
2144 target,
2145 target_abi,
2146 target_arch,
2147 target_endian,
2148 target_env,
2149 target_family,
2150 target_feature,
2151 target_feature_11,
2152 target_has_atomic,
2153 target_has_atomic_equal_alignment,
2154 target_has_atomic_load_store,
2155 target_has_reliable_f16,
2156 target_has_reliable_f16_math,
2157 target_has_reliable_f128,
2158 target_has_reliable_f128_math,
2159 target_os,
2160 target_pointer_width,
2161 target_thread_local,
2162 target_vendor,
2163 tbm_target_feature,
2164 termination,
2165 termination_trait,
2166 termination_trait_test,
2167 test,
2168 test_2018_feature,
2169 test_accepted_feature,
2170 test_case,
2171 test_removed_feature,
2172 test_runner,
2173 test_unstable_lint,
2174 thread,
2175 thread_local,
2176 thread_local_macro,
2177 three_way_compare,
2178 thumb2,
2179 thumb_mode: "thumb-mode",
2180 tmm_reg,
2181 to_owned_method,
2182 to_string,
2183 to_string_method,
2184 to_vec,
2185 todo_macro,
2186 tool_attributes,
2187 tool_lints,
2188 trace_macros,
2189 track_caller,
2190 trait_alias,
2191 trait_upcasting,
2192 transmute,
2193 transmute_generic_consts,
2194 transmute_opts,
2195 transmute_trait,
2196 transmute_unchecked,
2197 transparent,
2198 transparent_enums,
2199 transparent_unions,
2200 trivial_bounds,
2201 truncf16,
2202 truncf32,
2203 truncf64,
2204 truncf128,
2205 try_blocks,
2206 try_capture,
2207 try_from,
2208 try_from_fn,
2209 try_into,
2210 try_trait_v2,
2211 tt,
2212 tuple,
2213 tuple_indexing,
2214 tuple_trait,
2215 two_phase,
2216 ty,
2217 type_alias_enum_variants,
2218 type_alias_impl_trait,
2219 type_ascribe,
2220 type_ascription,
2221 type_changing_struct_update,
2222 type_const,
2223 type_id,
2224 type_id_eq,
2225 type_ir,
2226 type_ir_infer_ctxt_like,
2227 type_ir_inherent,
2228 type_ir_interner,
2229 type_length_limit,
2230 type_macros,
2231 type_name,
2232 type_privacy_lints,
2233 typed_swap_nonoverlapping,
2234 u8,
2235 u8_legacy_const_max,
2236 u8_legacy_const_min,
2237 u8_legacy_fn_max_value,
2238 u8_legacy_fn_min_value,
2239 u8_legacy_mod,
2240 u16,
2241 u16_legacy_const_max,
2242 u16_legacy_const_min,
2243 u16_legacy_fn_max_value,
2244 u16_legacy_fn_min_value,
2245 u16_legacy_mod,
2246 u32,
2247 u32_legacy_const_max,
2248 u32_legacy_const_min,
2249 u32_legacy_fn_max_value,
2250 u32_legacy_fn_min_value,
2251 u32_legacy_mod,
2252 u64,
2253 u64_legacy_const_max,
2254 u64_legacy_const_min,
2255 u64_legacy_fn_max_value,
2256 u64_legacy_fn_min_value,
2257 u64_legacy_mod,
2258 u128,
2259 u128_legacy_const_max,
2260 u128_legacy_const_min,
2261 u128_legacy_fn_max_value,
2262 u128_legacy_fn_min_value,
2263 u128_legacy_mod,
2264 ub_checks,
2265 unaligned_volatile_load,
2266 unaligned_volatile_store,
2267 unboxed_closures,
2268 unchecked_add,
2269 unchecked_div,
2270 unchecked_mul,
2271 unchecked_rem,
2272 unchecked_shl,
2273 unchecked_shr,
2274 unchecked_sub,
2275 underscore_const_names,
2276 underscore_imports,
2277 underscore_lifetimes,
2278 uniform_paths,
2279 unimplemented_macro,
2280 unit,
2281 universal_impl_trait,
2282 unix,
2283 unlikely,
2284 unmarked_api,
2285 unnamed_fields,
2286 unpin,
2287 unqualified_local_imports,
2288 unreachable,
2289 unreachable_2015,
2290 unreachable_2015_macro,
2291 unreachable_2021,
2292 unreachable_code,
2293 unreachable_display,
2294 unreachable_macro,
2295 unrestricted_attribute_tokens,
2296 unsafe_attributes,
2297 unsafe_binders,
2298 unsafe_block_in_unsafe_fn,
2299 unsafe_cell,
2300 unsafe_cell_raw_get,
2301 unsafe_extern_blocks,
2302 unsafe_fields,
2303 unsafe_no_drop_flag,
2304 unsafe_pinned,
2305 unsafe_unpin,
2306 unsize,
2307 unsized_const_param_ty,
2308 unsized_const_params,
2309 unsized_fn_params,
2310 unsized_locals,
2311 unsized_tuple_coercion,
2312 unstable,
2313 unstable_feature_bound,
2314 unstable_location_reason_default: "this crate is being loaded from the sysroot, an \
2315 unstable location; did you mean to load this crate \
2316 from crates.io via `Cargo.toml` instead?",
2317 untagged_unions,
2318 unused_imports,
2319 unwind,
2320 unwind_attributes,
2321 unwind_safe_trait,
2322 unwrap,
2323 unwrap_binder,
2324 unwrap_or,
2325 use_cloned,
2326 use_extern_macros,
2327 use_nested_groups,
2328 used,
2329 used_with_arg,
2330 using,
2331 usize,
2332 usize_legacy_const_max,
2333 usize_legacy_const_min,
2334 usize_legacy_fn_max_value,
2335 usize_legacy_fn_min_value,
2336 usize_legacy_mod,
2337 v1,
2338 v8plus,
2339 va_arg,
2340 va_copy,
2341 va_end,
2342 va_list,
2343 va_start,
2344 val,
2345 validity,
2346 value,
2347 values,
2348 var,
2349 variant_count,
2350 vec,
2351 vec_as_mut_slice,
2352 vec_as_slice,
2353 vec_from_elem,
2354 vec_is_empty,
2355 vec_macro,
2356 vec_new,
2357 vec_pop,
2358 vec_reserve,
2359 vec_with_capacity,
2360 vecdeque_iter,
2361 vecdeque_reserve,
2362 vector,
2363 version,
2364 vfp2,
2365 vis,
2366 visible_private_types,
2367 volatile,
2368 volatile_copy_memory,
2369 volatile_copy_nonoverlapping_memory,
2370 volatile_load,
2371 volatile_set_memory,
2372 volatile_store,
2373 vreg,
2374 vreg_low16,
2375 vsx,
2376 vtable_align,
2377 vtable_size,
2378 warn,
2379 wasip2,
2380 wasm_abi,
2381 wasm_import_module,
2382 wasm_target_feature,
2383 weak,
2384 weak_odr,
2385 where_clause_attrs,
2386 while_let,
2387 width,
2388 windows,
2389 windows_subsystem,
2390 with_negative_coherence,
2391 wrap_binder,
2392 wrapping_add,
2393 wrapping_div,
2394 wrapping_mul,
2395 wrapping_rem,
2396 wrapping_rem_euclid,
2397 wrapping_sub,
2398 wreg,
2399 write_bytes,
2400 write_fmt,
2401 write_macro,
2402 write_str,
2403 write_via_move,
2404 writeln_macro,
2405 x86_amx_intrinsics,
2406 x87_reg,
2407 x87_target_feature,
2408 xer,
2409 xmm_reg,
2410 xop_target_feature,
2411 yeet_desugar_details,
2412 yeet_expr,
2413 yes,
2414 yield_expr,
2415 ymm_reg,
2416 yreg,
2417 zfh,
2418 zfhmin,
2419 zmm_reg,
2420 }
2422}
2423
2424pub const STDLIB_STABLE_CRATES: &[Symbol] = &[sym::std, sym::core, sym::alloc, sym::proc_macro];
2427
2428#[derive(Copy, Clone, Eq, HashStable_Generic, Encodable, Decodable)]
2429pub struct Ident {
2430 pub name: Symbol,
2434 pub span: Span,
2435}
2436
2437impl Ident {
2438 #[inline]
2439 pub fn new(name: Symbol, span: Span) -> Ident {
2441 debug_assert_ne!(name, sym::empty);
2442 Ident { name, span }
2443 }
2444
2445 #[inline]
2447 pub fn with_dummy_span(name: Symbol) -> Ident {
2448 Ident::new(name, DUMMY_SP)
2449 }
2450
2451 #[inline]
2456 pub fn dummy() -> Ident {
2457 Ident::with_dummy_span(sym::dummy)
2458 }
2459
2460 pub fn from_str(string: &str) -> Ident {
2462 Ident::with_dummy_span(Symbol::intern(string))
2463 }
2464
2465 pub fn from_str_and_span(string: &str, span: Span) -> Ident {
2467 Ident::new(Symbol::intern(string), span)
2468 }
2469
2470 pub fn with_span_pos(self, span: Span) -> Ident {
2472 Ident::new(self.name, span.with_ctxt(self.span.ctxt()))
2473 }
2474
2475 pub fn without_first_quote(self) -> Ident {
2476 Ident::new(Symbol::intern(self.as_str().trim_start_matches('\'')), self.span)
2477 }
2478
2479 pub fn normalize_to_macros_2_0(self) -> Ident {
2485 Ident::new(self.name, self.span.normalize_to_macros_2_0())
2486 }
2487
2488 #[inline]
2494 pub fn normalize_to_macro_rules(self) -> Ident {
2495 Ident::new(self.name, self.span.normalize_to_macro_rules())
2496 }
2497
2498 pub fn as_str(&self) -> &str {
2504 self.name.as_str()
2505 }
2506}
2507
2508impl PartialEq for Ident {
2509 #[inline]
2510 fn eq(&self, rhs: &Self) -> bool {
2511 self.name == rhs.name && self.span.eq_ctxt(rhs.span)
2512 }
2513}
2514
2515impl Hash for Ident {
2516 fn hash<H: Hasher>(&self, state: &mut H) {
2517 self.name.hash(state);
2518 self.span.ctxt().hash(state);
2519 }
2520}
2521
2522impl fmt::Debug for Ident {
2523 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2524 fmt::Display::fmt(self, f)?;
2525 fmt::Debug::fmt(&self.span.ctxt(), f)
2526 }
2527}
2528
2529impl fmt::Display for Ident {
2533 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2534 fmt::Display::fmt(&IdentPrinter::new(self.name, self.is_raw_guess(), None), f)
2535 }
2536}
2537
2538pub struct IdentPrinter {
2552 symbol: Symbol,
2553 is_raw: bool,
2554 convert_dollar_crate: Option<Span>,
2557}
2558
2559impl IdentPrinter {
2560 pub fn new(symbol: Symbol, is_raw: bool, convert_dollar_crate: Option<Span>) -> IdentPrinter {
2562 IdentPrinter { symbol, is_raw, convert_dollar_crate }
2563 }
2564
2565 pub fn for_ast_ident(ident: Ident, is_raw: bool) -> IdentPrinter {
2569 IdentPrinter::new(ident.name, is_raw, Some(ident.span))
2570 }
2571}
2572
2573impl fmt::Display for IdentPrinter {
2574 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2575 if self.is_raw {
2576 f.write_str("r#")?;
2577 } else if self.symbol == kw::DollarCrate {
2578 if let Some(span) = self.convert_dollar_crate {
2579 let converted = span.ctxt().dollar_crate_name();
2580 if !converted.is_path_segment_keyword() {
2581 f.write_str("::")?;
2582 }
2583 return fmt::Display::fmt(&converted, f);
2584 }
2585 }
2586 fmt::Display::fmt(&self.symbol, f)
2587 }
2588}
2589
2590#[derive(Copy, Clone, Eq, PartialEq, Hash)]
2596pub struct MacroRulesNormalizedIdent(Ident);
2597
2598impl MacroRulesNormalizedIdent {
2599 #[inline]
2600 pub fn new(ident: Ident) -> Self {
2601 MacroRulesNormalizedIdent(ident.normalize_to_macro_rules())
2602 }
2603}
2604
2605impl fmt::Debug for MacroRulesNormalizedIdent {
2606 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2607 fmt::Debug::fmt(&self.0, f)
2608 }
2609}
2610
2611impl fmt::Display for MacroRulesNormalizedIdent {
2612 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2613 fmt::Display::fmt(&self.0, f)
2614 }
2615}
2616
2617#[derive(Copy, Clone, Eq, PartialEq, Hash)]
2624pub struct Macros20NormalizedIdent(pub Ident);
2625
2626impl Macros20NormalizedIdent {
2627 #[inline]
2628 pub fn new(ident: Ident) -> Self {
2629 Macros20NormalizedIdent(ident.normalize_to_macros_2_0())
2630 }
2631
2632 pub fn with_dummy_span(name: Symbol) -> Self {
2634 Macros20NormalizedIdent(Ident::with_dummy_span(name))
2635 }
2636}
2637
2638impl fmt::Debug for Macros20NormalizedIdent {
2639 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2640 fmt::Debug::fmt(&self.0, f)
2641 }
2642}
2643
2644impl fmt::Display for Macros20NormalizedIdent {
2645 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2646 fmt::Display::fmt(&self.0, f)
2647 }
2648}
2649
2650impl Deref for Macros20NormalizedIdent {
2653 type Target = Ident;
2654 fn deref(&self) -> &Self::Target {
2655 &self.0
2656 }
2657}
2658
2659#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
2669pub struct Symbol(SymbolIndex);
2670
2671rustc_index::newtype_index! {
2673 #[orderable]
2674 struct SymbolIndex {}
2675}
2676
2677impl Symbol {
2678 pub const fn new(n: u32) -> Self {
2681 Symbol(SymbolIndex::from_u32(n))
2682 }
2683
2684 #[rustc_diagnostic_item = "SymbolIntern"]
2686 pub fn intern(str: &str) -> Self {
2687 with_session_globals(|session_globals| session_globals.symbol_interner.intern_str(str))
2688 }
2689
2690 pub fn as_str(&self) -> &str {
2699 with_session_globals(|session_globals| unsafe {
2700 std::mem::transmute::<&str, &str>(session_globals.symbol_interner.get_str(*self))
2701 })
2702 }
2703
2704 pub fn as_u32(self) -> u32 {
2705 self.0.as_u32()
2706 }
2707
2708 pub fn is_empty(self) -> bool {
2709 self == sym::empty
2710 }
2711
2712 pub fn to_ident_string(self) -> String {
2717 if self == sym::empty { String::new() } else { Ident::with_dummy_span(self).to_string() }
2719 }
2720}
2721
2722impl fmt::Debug for Symbol {
2723 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2724 fmt::Debug::fmt(self.as_str(), f)
2725 }
2726}
2727
2728impl fmt::Display for Symbol {
2729 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2730 fmt::Display::fmt(self.as_str(), f)
2731 }
2732}
2733
2734impl<CTX> HashStable<CTX> for Symbol {
2735 #[inline]
2736 fn hash_stable(&self, hcx: &mut CTX, hasher: &mut StableHasher) {
2737 self.as_str().hash_stable(hcx, hasher);
2738 }
2739}
2740
2741impl<CTX> ToStableHashKey<CTX> for Symbol {
2742 type KeyType = String;
2743 #[inline]
2744 fn to_stable_hash_key(&self, _: &CTX) -> String {
2745 self.as_str().to_string()
2746 }
2747}
2748
2749impl StableCompare for Symbol {
2750 const CAN_USE_UNSTABLE_SORT: bool = true;
2751
2752 fn stable_cmp(&self, other: &Self) -> std::cmp::Ordering {
2753 self.as_str().cmp(other.as_str())
2754 }
2755}
2756
2757#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
2760pub struct ByteSymbol(SymbolIndex);
2761
2762impl ByteSymbol {
2763 pub const fn new(n: u32) -> Self {
2766 ByteSymbol(SymbolIndex::from_u32(n))
2767 }
2768
2769 pub fn intern(byte_str: &[u8]) -> Self {
2771 with_session_globals(|session_globals| {
2772 session_globals.symbol_interner.intern_byte_str(byte_str)
2773 })
2774 }
2775
2776 pub fn as_byte_str(&self) -> &[u8] {
2778 with_session_globals(|session_globals| unsafe {
2779 std::mem::transmute::<&[u8], &[u8]>(session_globals.symbol_interner.get_byte_str(*self))
2780 })
2781 }
2782
2783 pub fn as_u32(self) -> u32 {
2784 self.0.as_u32()
2785 }
2786}
2787
2788impl fmt::Debug for ByteSymbol {
2789 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2790 fmt::Debug::fmt(self.as_byte_str(), f)
2791 }
2792}
2793
2794impl<CTX> HashStable<CTX> for ByteSymbol {
2795 #[inline]
2796 fn hash_stable(&self, hcx: &mut CTX, hasher: &mut StableHasher) {
2797 self.as_byte_str().hash_stable(hcx, hasher);
2798 }
2799}
2800
2801pub(crate) struct Interner(Lock<InternerInner>);
2806
2807struct InternerInner {
2813 arena: DroplessArena,
2814 byte_strs: FxIndexSet<&'static [u8]>,
2815}
2816
2817impl Interner {
2818 fn prefill(init: &[&'static str], extra: &[&'static str]) -> Self {
2822 let byte_strs = FxIndexSet::from_iter(
2823 init.iter().copied().chain(extra.iter().copied()).map(|str| str.as_bytes()),
2824 );
2825 assert_eq!(
2826 byte_strs.len(),
2827 init.len() + extra.len(),
2828 "duplicate symbols in the rustc symbol list and the extra symbols added by the driver",
2829 );
2830 Interner(Lock::new(InternerInner { arena: Default::default(), byte_strs }))
2831 }
2832
2833 fn intern_str(&self, str: &str) -> Symbol {
2834 Symbol::new(self.intern_inner(str.as_bytes()))
2835 }
2836
2837 fn intern_byte_str(&self, byte_str: &[u8]) -> ByteSymbol {
2838 ByteSymbol::new(self.intern_inner(byte_str))
2839 }
2840
2841 #[inline]
2842 fn intern_inner(&self, byte_str: &[u8]) -> u32 {
2843 let mut inner = self.0.lock();
2844 if let Some(idx) = inner.byte_strs.get_index_of(byte_str) {
2845 return idx as u32;
2846 }
2847
2848 let byte_str: &[u8] = inner.arena.alloc_slice(byte_str);
2849
2850 let byte_str: &'static [u8] = unsafe { &*(byte_str as *const [u8]) };
2853
2854 let (idx, is_new) = inner.byte_strs.insert_full(byte_str);
2858 debug_assert!(is_new); idx as u32
2861 }
2862
2863 fn get_str(&self, symbol: Symbol) -> &str {
2867 let byte_str = self.get_inner(symbol.0.as_usize());
2868 unsafe { str::from_utf8_unchecked(byte_str) }
2870 }
2871
2872 fn get_byte_str(&self, symbol: ByteSymbol) -> &[u8] {
2876 self.get_inner(symbol.0.as_usize())
2877 }
2878
2879 fn get_inner(&self, index: usize) -> &[u8] {
2880 self.0.lock().byte_strs.get_index(index).unwrap()
2881 }
2882}
2883
2884pub mod kw {
2890 pub use super::kw_generated::*;
2891}
2892
2893pub mod sym {
2899 use super::Symbol;
2901 pub use super::kw::MacroRules as macro_rules;
2902 #[doc(inline)]
2903 pub use super::sym_generated::*;
2904
2905 pub fn integer<N: TryInto<usize> + Copy + itoa::Integer>(n: N) -> Symbol {
2910 if let Result::Ok(idx) = n.try_into() {
2911 if idx < 10 {
2912 return Symbol::new(super::SYMBOL_DIGITS_BASE + idx as u32);
2913 }
2914 }
2915 let mut buffer = itoa::Buffer::new();
2916 let printed = buffer.format(n);
2917 Symbol::intern(printed)
2918 }
2919}
2920
2921impl Symbol {
2922 fn is_special(self) -> bool {
2923 self <= kw::Underscore
2924 }
2925
2926 fn is_used_keyword_always(self) -> bool {
2927 self >= kw::As && self <= kw::While
2928 }
2929
2930 fn is_unused_keyword_always(self) -> bool {
2931 self >= kw::Abstract && self <= kw::Yield
2932 }
2933
2934 fn is_used_keyword_conditional(self, edition: impl FnOnce() -> Edition) -> bool {
2935 (self >= kw::Async && self <= kw::Dyn) && edition() >= Edition::Edition2018
2936 }
2937
2938 fn is_unused_keyword_conditional(self, edition: impl Copy + FnOnce() -> Edition) -> bool {
2939 self == kw::Gen && edition().at_least_rust_2024()
2940 || self == kw::Try && edition().at_least_rust_2018()
2941 }
2942
2943 pub fn is_reserved(self, edition: impl Copy + FnOnce() -> Edition) -> bool {
2944 self.is_special()
2945 || self.is_used_keyword_always()
2946 || self.is_unused_keyword_always()
2947 || self.is_used_keyword_conditional(edition)
2948 || self.is_unused_keyword_conditional(edition)
2949 }
2950
2951 pub fn is_weak(self) -> bool {
2952 self >= kw::Auto && self <= kw::Yeet
2953 }
2954
2955 pub fn is_path_segment_keyword(self) -> bool {
2957 self == kw::Super
2958 || self == kw::SelfLower
2959 || self == kw::SelfUpper
2960 || self == kw::Crate
2961 || self == kw::PathRoot
2962 || self == kw::DollarCrate
2963 }
2964
2965 pub fn is_bool_lit(self) -> bool {
2967 self == kw::True || self == kw::False
2968 }
2969
2970 pub fn can_be_raw(self) -> bool {
2972 self != sym::empty && self != kw::Underscore && !self.is_path_segment_keyword()
2973 }
2974
2975 pub fn is_predefined(index: u32) -> bool {
2979 index < PREDEFINED_SYMBOLS_COUNT
2980 }
2981}
2982
2983impl Ident {
2984 pub fn is_special(self) -> bool {
2987 self.name.is_special()
2988 }
2989
2990 pub fn is_used_keyword(self) -> bool {
2992 self.name.is_used_keyword_always()
2994 || self.name.is_used_keyword_conditional(|| self.span.edition())
2995 }
2996
2997 pub fn is_unused_keyword(self) -> bool {
2999 self.name.is_unused_keyword_always()
3001 || self.name.is_unused_keyword_conditional(|| self.span.edition())
3002 }
3003
3004 pub fn is_reserved(self) -> bool {
3006 self.name.is_reserved(|| self.span.edition())
3008 }
3009
3010 pub fn is_path_segment_keyword(self) -> bool {
3012 self.name.is_path_segment_keyword()
3013 }
3014
3015 pub fn is_raw_guess(self) -> bool {
3018 self.name.can_be_raw() && self.is_reserved()
3019 }
3020
3021 pub fn is_numeric(self) -> bool {
3024 self.as_str().bytes().all(|b| b.is_ascii_digit())
3025 }
3026}
3027
3028pub fn used_keywords(edition: impl Copy + FnOnce() -> Edition) -> Vec<Symbol> {
3033 (kw::DollarCrate.as_u32()..kw::Yeet.as_u32())
3034 .filter_map(|kw| {
3035 let kw = Symbol::new(kw);
3036 if kw.is_used_keyword_always() || kw.is_used_keyword_conditional(edition) {
3037 Some(kw)
3038 } else {
3039 None
3040 }
3041 })
3042 .collect()
3043}