]>
Commit | Line | Data |
---|---|---|
476ff2be | 1 | //! An "interner" is a data structure that associates values with usize tags and |
0731742a | 2 | //! allows bidirectional lookup; i.e., given a value, one can easily find the |
476ff2be SL |
3 | //! type, and vice versa. |
4 | ||
f035d41b | 5 | use rustc_arena::DroplessArena; |
0731742a | 6 | use rustc_data_structures::fx::FxHashMap; |
dfeec247 | 7 | use rustc_data_structures::stable_hasher::{HashStable, StableHasher, ToStableHashKey}; |
c295e0f8 | 8 | use rustc_data_structures::sync::Lock; |
3dfed10e | 9 | use rustc_macros::HashStable_Generic; |
416331ca | 10 | use rustc_serialize::{Decodable, Decoder, Encodable, Encoder}; |
0731742a | 11 | |
dc9dc135 | 12 | use std::fmt; |
83c7162d | 13 | use std::hash::{Hash, Hasher}; |
dc9dc135 | 14 | use std::str; |
476ff2be | 15 | |
136023e0 | 16 | use crate::{with_session_globals, Edition, Span, DUMMY_SP}; |
0731742a | 17 | |
416331ca XL |
18 | #[cfg(test)] |
19 | mod tests; | |
20 | ||
6a06907d | 21 | // The proc macro code for this is in `compiler/rustc_macros/src/symbols.rs`. |
48663c56 XL |
22 | symbols! { |
23 | // After modifying this list adjust `is_special`, `is_used_keyword`/`is_unused_keyword`, | |
24 | // this should be rarely necessary though if the keywords are kept in alphabetic order. | |
25 | Keywords { | |
26 | // Special reserved identifiers used internally for elided lifetimes, | |
27 | // unnamed method parameters, crate root module, error recovery etc. | |
5869c6ff | 28 | Empty: "", |
48663c56 XL |
29 | PathRoot: "{{root}}", |
30 | DollarCrate: "$crate", | |
31 | Underscore: "_", | |
32 | ||
33 | // Keywords that are used in stable Rust. | |
34 | As: "as", | |
35 | Break: "break", | |
36 | Const: "const", | |
37 | Continue: "continue", | |
38 | Crate: "crate", | |
39 | Else: "else", | |
40 | Enum: "enum", | |
41 | Extern: "extern", | |
42 | False: "false", | |
43 | Fn: "fn", | |
44 | For: "for", | |
45 | If: "if", | |
46 | Impl: "impl", | |
47 | In: "in", | |
48 | Let: "let", | |
49 | Loop: "loop", | |
50 | Match: "match", | |
51 | Mod: "mod", | |
52 | Move: "move", | |
53 | Mut: "mut", | |
54 | Pub: "pub", | |
55 | Ref: "ref", | |
56 | Return: "return", | |
57 | SelfLower: "self", | |
58 | SelfUpper: "Self", | |
59 | Static: "static", | |
60 | Struct: "struct", | |
61 | Super: "super", | |
62 | Trait: "trait", | |
63 | True: "true", | |
64 | Type: "type", | |
65 | Unsafe: "unsafe", | |
66 | Use: "use", | |
67 | Where: "where", | |
68 | While: "while", | |
69 | ||
70 | // Keywords that are used in unstable Rust or reserved for future use. | |
71 | Abstract: "abstract", | |
72 | Become: "become", | |
73 | Box: "box", | |
74 | Do: "do", | |
75 | Final: "final", | |
76 | Macro: "macro", | |
77 | Override: "override", | |
78 | Priv: "priv", | |
79 | Typeof: "typeof", | |
80 | Unsized: "unsized", | |
81 | Virtual: "virtual", | |
82 | Yield: "yield", | |
83 | ||
84 | // Edition-specific keywords that are used in stable Rust. | |
e1599b0c XL |
85 | Async: "async", // >= 2018 Edition only |
86 | Await: "await", // >= 2018 Edition only | |
48663c56 XL |
87 | Dyn: "dyn", // >= 2018 Edition only |
88 | ||
89 | // Edition-specific keywords that are used in unstable Rust or reserved for future use. | |
48663c56 XL |
90 | Try: "try", // >= 2018 Edition only |
91 | ||
92 | // Special lifetime names | |
93 | UnderscoreLifetime: "'_", | |
94 | StaticLifetime: "'static", | |
95 | ||
96 | // Weak keywords, have special meaning only in specific contexts. | |
97 | Auto: "auto", | |
98 | Catch: "catch", | |
99 | Default: "default", | |
74b04a01 | 100 | MacroRules: "macro_rules", |
60c5eb7d | 101 | Raw: "raw", |
48663c56 | 102 | Union: "union", |
04454e1e | 103 | Yeet: "yeet", |
48663c56 XL |
104 | } |
105 | ||
3dfed10e XL |
106 | // Pre-interned symbols that can be referred to with `rustc_span::sym::*`. |
107 | // | |
108 | // The symbol is the stringified identifier unless otherwise specified, in | |
109 | // which case the name should mention the non-identifier punctuation. | |
110 | // E.g. `sym::proc_dash_macro` represents "proc-macro", and it shouldn't be | |
111 | // called `sym::proc_macro` because then it's easy to mistakenly think it | |
112 | // represents "proc_macro". | |
dc9dc135 | 113 | // |
1b1a35ee | 114 | // As well as the symbols listed, there are symbols for the strings |
dc9dc135 | 115 | // "0", "1", ..., "9", which are accessible via `sym::integer`. |
3dfed10e XL |
116 | // |
117 | // The proc macro will abort if symbols are not in alphabetical order (as | |
118 | // defined by `impl Ord for str`) or if any symbols are duplicated. Vim | |
119 | // users can sort the list by selecting it and executing the command | |
120 | // `:'<,'>!LC_ALL=C sort`. | |
121 | // | |
122 | // There is currently no checking that all symbols are used; that would be | |
123 | // nice to have. | |
48663c56 | 124 | Symbols { |
94222f64 XL |
125 | AcqRel, |
126 | Acquire, | |
2b03887a | 127 | AddToDiagnostic, |
3dfed10e | 128 | Alignment, |
136023e0 | 129 | Any, |
3dfed10e XL |
130 | Arc, |
131 | Argument, | |
132 | ArgumentV1, | |
923072b8 | 133 | ArgumentV1Methods, |
3dfed10e | 134 | Arguments, |
136023e0 XL |
135 | AsMut, |
136 | AsRef, | |
064997fb FG |
137 | AssertParamIsClone, |
138 | AssertParamIsCopy, | |
139 | AssertParamIsEq, | |
94222f64 XL |
140 | AtomicBool, |
141 | AtomicI128, | |
142 | AtomicI16, | |
143 | AtomicI32, | |
144 | AtomicI64, | |
145 | AtomicI8, | |
146 | AtomicIsize, | |
147 | AtomicPtr, | |
148 | AtomicU128, | |
149 | AtomicU16, | |
150 | AtomicU32, | |
151 | AtomicU64, | |
152 | AtomicU8, | |
153 | AtomicUsize, | |
136023e0 | 154 | BTreeEntry, |
6a06907d XL |
155 | BTreeMap, |
156 | BTreeSet, | |
157 | BinaryHeap, | |
158 | Borrow, | |
f2b60f7d | 159 | BorrowMut, |
17df50a5 | 160 | Break, |
3dfed10e | 161 | C, |
17df50a5 | 162 | CStr, |
29967ef6 | 163 | CString, |
923072b8 | 164 | Capture, |
3dfed10e XL |
165 | Center, |
166 | Clone, | |
9c376795 | 167 | Context, |
17df50a5 | 168 | Continue, |
3dfed10e XL |
169 | Copy, |
170 | Count, | |
136023e0 | 171 | Cow, |
3dfed10e XL |
172 | Debug, |
173 | Decodable, | |
174 | Decoder, | |
064997fb | 175 | DecorateLint, |
3dfed10e | 176 | Default, |
6a06907d | 177 | Deref, |
923072b8 | 178 | DiagnosticMessage, |
136023e0 | 179 | DirBuilder, |
c295e0f8 | 180 | Display, |
136023e0 XL |
181 | DoubleEndedIterator, |
182 | Duration, | |
3dfed10e XL |
183 | Encodable, |
184 | Encoder, | |
185 | Eq, | |
186 | Equal, | |
187 | Err, | |
188 | Error, | |
136023e0 XL |
189 | File, |
190 | FileType, | |
3dfed10e XL |
191 | FormatSpec, |
192 | Formatter, | |
193 | From, | |
136023e0 | 194 | FromIterator, |
5099ac24 | 195 | FromResidual, |
3dfed10e | 196 | Future, |
9c376795 | 197 | FutureOutput, |
3dfed10e XL |
198 | FxHashMap, |
199 | FxHashSet, | |
200 | GlobalAlloc, | |
201 | Hash, | |
202 | HashMap, | |
136023e0 | 203 | HashMapEntry, |
3dfed10e XL |
204 | HashSet, |
205 | Hasher, | |
206 | Implied, | |
207 | Input, | |
c295e0f8 | 208 | Into, |
2b03887a | 209 | IntoDiagnostic, |
3dfed10e | 210 | IntoIterator, |
136023e0 XL |
211 | IoRead, |
212 | IoWrite, | |
f2b60f7d | 213 | IpAddr, |
923072b8 | 214 | IrTyKind, |
3dfed10e XL |
215 | Is, |
216 | ItemContext, | |
217 | Iterator, | |
9c376795 | 218 | IteratorItem, |
3dfed10e XL |
219 | Layout, |
220 | Left, | |
6a06907d | 221 | LinkedList, |
3dfed10e | 222 | LintPass, |
2b03887a | 223 | LocalKey, |
c295e0f8 | 224 | Mutex, |
f2b60f7d | 225 | MutexGuard, |
5099ac24 | 226 | N, |
064997fb FG |
227 | NonZeroI128, |
228 | NonZeroI16, | |
229 | NonZeroI32, | |
230 | NonZeroI64, | |
231 | NonZeroI8, | |
232 | NonZeroU128, | |
233 | NonZeroU16, | |
234 | NonZeroU32, | |
235 | NonZeroU64, | |
236 | NonZeroU8, | |
3dfed10e XL |
237 | None, |
238 | Ok, | |
239 | Option, | |
240 | Ord, | |
241 | Ordering, | |
6a06907d XL |
242 | OsStr, |
243 | OsString, | |
3dfed10e XL |
244 | Output, |
245 | Param, | |
246 | PartialEq, | |
247 | PartialOrd, | |
6a06907d XL |
248 | Path, |
249 | PathBuf, | |
3dfed10e XL |
250 | Pending, |
251 | Pin, | |
c295e0f8 | 252 | Pointer, |
3dfed10e XL |
253 | Poll, |
254 | ProcMacro, | |
3dfed10e XL |
255 | ProceduralMasqueradeDummyType, |
256 | Range, | |
257 | RangeFrom, | |
258 | RangeFull, | |
259 | RangeInclusive, | |
260 | RangeTo, | |
261 | RangeToInclusive, | |
262 | Rc, | |
263 | Ready, | |
6a06907d | 264 | Receiver, |
2b03887a | 265 | RefCell, |
94222f64 XL |
266 | Relaxed, |
267 | Release, | |
3dfed10e | 268 | Result, |
487cf647 | 269 | ResumeTy, |
3dfed10e XL |
270 | Return, |
271 | Right, | |
064997fb | 272 | Rust, |
3dfed10e XL |
273 | RustcDecodable, |
274 | RustcEncodable, | |
2b03887a | 275 | RwLock, |
f2b60f7d FG |
276 | RwLockReadGuard, |
277 | RwLockWriteGuard, | |
3dfed10e | 278 | Send, |
94222f64 | 279 | SeqCst, |
04454e1e | 280 | SliceIndex, |
3dfed10e | 281 | Some, |
c295e0f8 | 282 | String, |
3dfed10e XL |
283 | StructuralEq, |
284 | StructuralPartialEq, | |
923072b8 | 285 | SubdiagnosticMessage, |
3dfed10e | 286 | Sync, |
f2b60f7d | 287 | T, |
3dfed10e | 288 | Target, |
6a06907d XL |
289 | ToOwned, |
290 | ToString, | |
9ffffee4 | 291 | TokenStream, |
3dfed10e | 292 | Try, |
923072b8 FG |
293 | TryCaptureGeneric, |
294 | TryCapturePrintable, | |
c295e0f8 XL |
295 | TryFrom, |
296 | TryInto, | |
3dfed10e XL |
297 | Ty, |
298 | TyCtxt, | |
299 | TyKind, | |
300 | Unknown, | |
c295e0f8 | 301 | UnsafeArg, |
3dfed10e | 302 | Vec, |
c295e0f8 | 303 | VecDeque, |
923072b8 | 304 | Wrapper, |
3dfed10e XL |
305 | Yield, |
306 | _DECLS, | |
307 | _Self, | |
308 | __D, | |
309 | __H, | |
310 | __S, | |
5e7ed085 | 311 | __awaitee, |
3dfed10e XL |
312 | __try_var, |
313 | _d, | |
314 | _e, | |
315 | _task_context, | |
29967ef6 | 316 | a32, |
48663c56 | 317 | aarch64_target_feature, |
5e7ed085 | 318 | aarch64_ver_target_feature, |
48663c56 XL |
319 | abi, |
320 | abi_amdgpu_kernel, | |
3dfed10e | 321 | abi_avr_interrupt, |
5869c6ff | 322 | abi_c_cmse_nonsecure_call, |
e74abb32 | 323 | abi_efiapi, |
48663c56 XL |
324 | abi_msp430_interrupt, |
325 | abi_ptx, | |
326 | abi_sysv64, | |
327 | abi_thiscall, | |
328 | abi_unadjusted, | |
329 | abi_vectorcall, | |
330 | abi_x86_interrupt, | |
ba9703b0 | 331 | abort, |
3dfed10e XL |
332 | add, |
333 | add_assign, | |
60c5eb7d | 334 | add_with_overflow, |
3dfed10e | 335 | address, |
94222f64 | 336 | adt_const_params, |
48663c56 XL |
337 | advanced_slice_patterns, |
338 | adx_target_feature, | |
339 | alias, | |
340 | align, | |
3dfed10e | 341 | align_offset, |
f2b60f7d | 342 | alignment, |
48663c56 | 343 | all, |
3dfed10e XL |
344 | alloc, |
345 | alloc_error_handler, | |
346 | alloc_layout, | |
347 | alloc_zeroed, | |
48663c56 | 348 | allocator, |
3c0e092e | 349 | allocator_api, |
48663c56 | 350 | allocator_internals, |
48663c56 | 351 | allow, |
48663c56 XL |
352 | allow_fail, |
353 | allow_internal_unsafe, | |
354 | allow_internal_unstable, | |
3dfed10e | 355 | allowed, |
5099ac24 | 356 | alu32, |
48663c56 | 357 | always, |
dc9dc135 | 358 | and, |
3dfed10e | 359 | and_then, |
353b0b11 | 360 | anon, |
064997fb | 361 | anonymous_lifetime_in_impl_trait, |
48663c56 | 362 | any, |
5099ac24 | 363 | append_const_msg, |
dc9dc135 | 364 | arbitrary_enum_discriminant, |
48663c56 | 365 | arbitrary_self_types, |
5099ac24 | 366 | args, |
f9f354fc | 367 | arith_offset, |
29967ef6 | 368 | arm, |
48663c56 | 369 | arm_target_feature, |
3dfed10e XL |
370 | array, |
371 | arrays, | |
29967ef6 | 372 | as_ptr, |
5099ac24 | 373 | as_ref, |
3dfed10e | 374 | as_str, |
48663c56 | 375 | asm, |
3c0e092e XL |
376 | asm_const, |
377 | asm_experimental_arch, | |
378 | asm_sym, | |
a2a8927a | 379 | asm_unwind, |
416331ca | 380 | assert, |
5099ac24 | 381 | assert_eq_macro, |
f035d41b | 382 | assert_inhabited, |
fc512014 | 383 | assert_macro, |
9c376795 | 384 | assert_mem_uninitialized_valid, |
5099ac24 | 385 | assert_ne_macro, |
3dfed10e | 386 | assert_receiver_is_total_eq, |
f035d41b | 387 | assert_zero_valid, |
923072b8 | 388 | asserting, |
5099ac24 | 389 | associated_const_equality, |
48663c56 | 390 | associated_consts, |
dc9dc135 | 391 | associated_type_bounds, |
48663c56 XL |
392 | associated_type_defaults, |
393 | associated_types, | |
f035d41b | 394 | assume, |
60c5eb7d | 395 | assume_init, |
48663c56 | 396 | async_await, |
416331ca | 397 | async_closure, |
2b03887a | 398 | async_fn_in_trait, |
94222f64 XL |
399 | atomic, |
400 | atomic_mod, | |
f035d41b | 401 | atomics, |
3dfed10e | 402 | att_syntax, |
48663c56 | 403 | attr, |
48663c56 | 404 | attr_literals, |
3dfed10e | 405 | attributes, |
48663c56 | 406 | augmented_assignments, |
fc512014 | 407 | auto_traits, |
48663c56 | 408 | automatically_derived, |
5099ac24 | 409 | avx, |
48663c56 | 410 | avx512_target_feature, |
5099ac24 FG |
411 | avx512bw, |
412 | avx512f, | |
48663c56 | 413 | await_macro, |
3dfed10e | 414 | bang, |
dc9dc135 XL |
415 | begin_panic, |
416 | bench, | |
48663c56 XL |
417 | bin, |
418 | bind_by_move_pattern_guards, | |
dfeec247 | 419 | bindings_after_at, |
3dfed10e XL |
420 | bitand, |
421 | bitand_assign, | |
422 | bitor, | |
423 | bitor_assign, | |
424 | bitreverse, | |
425 | bitxor, | |
426 | bitxor_assign, | |
94222f64 | 427 | black_box, |
48663c56 | 428 | block, |
dc9dc135 | 429 | bool, |
dfeec247 | 430 | borrowck_graphviz_format, |
48663c56 | 431 | borrowck_graphviz_postflow, |
3dfed10e | 432 | box_free, |
353b0b11 | 433 | box_new, |
48663c56 XL |
434 | box_patterns, |
435 | box_syntax, | |
17df50a5 | 436 | bpf_target_feature, |
48663c56 | 437 | braced_empty_structs, |
17df50a5 | 438 | branch, |
f035d41b | 439 | breakpoint, |
3dfed10e | 440 | bridge, |
60c5eb7d | 441 | bswap, |
29967ef6 | 442 | c_str, |
6a06907d | 443 | c_unwind, |
3dfed10e XL |
444 | c_variadic, |
445 | call, | |
446 | call_mut, | |
447 | call_once, | |
60c5eb7d | 448 | caller_location, |
fc512014 | 449 | capture_disjoint_fields, |
2b03887a | 450 | cause, |
48663c56 | 451 | cdylib, |
f035d41b XL |
452 | ceilf32, |
453 | ceilf64, | |
48663c56 | 454 | cfg, |
ba9703b0 | 455 | cfg_accessible, |
48663c56 XL |
456 | cfg_attr, |
457 | cfg_attr_multi, | |
416331ca | 458 | cfg_doctest, |
6a06907d | 459 | cfg_eval, |
c295e0f8 | 460 | cfg_hide, |
29967ef6 | 461 | cfg_panic, |
60c5eb7d | 462 | cfg_sanitize, |
136023e0 | 463 | cfg_target_abi, |
923072b8 | 464 | cfg_target_compact, |
48663c56 XL |
465 | cfg_target_feature, |
466 | cfg_target_has_atomic, | |
5099ac24 | 467 | cfg_target_has_atomic_equal_alignment, |
48663c56 XL |
468 | cfg_target_thread_local, |
469 | cfg_target_vendor, | |
f9f354fc | 470 | cfg_version, |
3c0e092e | 471 | cfi, |
dc9dc135 | 472 | char, |
3dfed10e | 473 | client, |
416331ca | 474 | clippy, |
94222f64 | 475 | clobber_abi, |
48663c56 XL |
476 | clone, |
477 | clone_closures, | |
478 | clone_from, | |
1b1a35ee | 479 | closure, |
064997fb | 480 | closure_lifetime_binder, |
48663c56 | 481 | closure_to_fn_coercion, |
c295e0f8 | 482 | closure_track_caller, |
dc9dc135 | 483 | cmp, |
136023e0 XL |
484 | cmp_max, |
485 | cmp_min, | |
48663c56 | 486 | cmpxchg16b_target_feature, |
1b1a35ee | 487 | cmse_nonsecure_entry, |
3dfed10e | 488 | coerce_unsized, |
48663c56 | 489 | cold, |
f2b60f7d | 490 | collapse_debuginfo, |
416331ca | 491 | column, |
94222f64 XL |
492 | compare_exchange, |
493 | compare_exchange_weak, | |
48663c56 | 494 | compile_error, |
5099ac24 | 495 | compiler, |
48663c56 | 496 | compiler_builtins, |
94222f64 | 497 | compiler_fence, |
416331ca | 498 | concat, |
a2a8927a | 499 | concat_bytes, |
48663c56 XL |
500 | concat_idents, |
501 | conservative_impl_trait, | |
502 | console, | |
fc512014 | 503 | const_allocate, |
17df50a5 | 504 | const_async_blocks, |
9c376795 | 505 | const_closures, |
48663c56 | 506 | const_compare_raw_pointers, |
dc9dc135 | 507 | const_constructor, |
5099ac24 | 508 | const_deallocate, |
74b04a01 | 509 | const_eval_limit, |
c295e0f8 | 510 | const_eval_select, |
1b1a35ee | 511 | const_evaluatable_checked, |
e74abb32 | 512 | const_extern_fn, |
48663c56 | 513 | const_fn, |
1b1a35ee XL |
514 | const_fn_floating_point_arithmetic, |
515 | const_fn_fn_ptr_basics, | |
cdc7bbd5 | 516 | const_fn_trait_bound, |
f035d41b | 517 | const_fn_transmute, |
48663c56 | 518 | const_fn_union, |
cdc7bbd5 | 519 | const_fn_unsize, |
94222f64 XL |
520 | const_for, |
521 | const_format_args, | |
48663c56 | 522 | const_generics, |
5869c6ff | 523 | const_generics_defaults, |
60c5eb7d | 524 | const_if_match, |
29967ef6 | 525 | const_impl_trait, |
416331ca | 526 | const_in_array_repeat_expressions, |
3dfed10e | 527 | const_indexing, |
48663c56 | 528 | const_let, |
60c5eb7d XL |
529 | const_loop, |
530 | const_mut_refs, | |
48663c56 | 531 | const_panic, |
94222f64 | 532 | const_panic_fmt, |
f035d41b | 533 | const_precise_live_drops, |
48663c56 XL |
534 | const_raw_ptr_deref, |
535 | const_raw_ptr_to_usize_cast, | |
5869c6ff | 536 | const_refs_to_cell, |
923072b8 | 537 | const_trait, |
dfeec247 XL |
538 | const_trait_bound_opt_out, |
539 | const_trait_impl, | |
94222f64 | 540 | const_try, |
1b1a35ee XL |
541 | constant, |
542 | constructor, | |
dc9dc135 | 543 | context, |
f035d41b | 544 | copy, |
3dfed10e | 545 | copy_closures, |
f035d41b XL |
546 | copy_nonoverlapping, |
547 | copysignf32, | |
548 | copysignf64, | |
48663c56 | 549 | core, |
5869c6ff XL |
550 | core_panic, |
551 | core_panic_2015_macro, | |
487cf647 | 552 | core_panic_2021_macro, |
fc512014 | 553 | core_panic_macro, |
f035d41b XL |
554 | cosf32, |
555 | cosf64, | |
a2a8927a | 556 | count, |
94222f64 | 557 | cr, |
48663c56 XL |
558 | crate_id, |
559 | crate_in_paths, | |
dc9dc135 | 560 | crate_local, |
48663c56 XL |
561 | crate_name, |
562 | crate_type, | |
563 | crate_visibility_modifier, | |
3dfed10e | 564 | crt_dash_static: "crt-static", |
29967ef6 | 565 | cstring_type, |
3dfed10e XL |
566 | ctlz, |
567 | ctlz_nonzero, | |
60c5eb7d XL |
568 | ctpop, |
569 | cttz, | |
570 | cttz_nonzero, | |
48663c56 XL |
571 | custom_attribute, |
572 | custom_derive, | |
573 | custom_inner_attributes, | |
487cf647 | 574 | custom_mir, |
48663c56 | 575 | custom_test_frameworks, |
3dfed10e | 576 | d, |
5e7ed085 | 577 | d32, |
5099ac24 | 578 | dbg_macro, |
3dfed10e XL |
579 | dead_code, |
580 | dealloc, | |
581 | debug, | |
5099ac24 | 582 | debug_assert_eq_macro, |
fc512014 | 583 | debug_assert_macro, |
5099ac24 | 584 | debug_assert_ne_macro, |
3dfed10e XL |
585 | debug_assertions, |
586 | debug_struct, | |
064997fb | 587 | debug_struct_fields_finish, |
3dfed10e | 588 | debug_tuple, |
064997fb | 589 | debug_tuple_fields_finish, |
04454e1e | 590 | debugger_visualizer, |
48663c56 | 591 | decl_macro, |
3dfed10e XL |
592 | declare_lint_pass, |
593 | decode, | |
29967ef6 | 594 | default_alloc_error_handler, |
48663c56 | 595 | default_lib_allocator, |
136023e0 | 596 | default_method_body_is_const, |
48663c56 XL |
597 | default_type_parameter_fallback, |
598 | default_type_params, | |
60c5eb7d | 599 | delay_span_bug_from_inside_query, |
48663c56 XL |
600 | deny, |
601 | deprecated, | |
5e7ed085 FG |
602 | deprecated_safe, |
603 | deprecated_suggestion, | |
dc9dc135 | 604 | deref, |
1b1a35ee | 605 | deref_method, |
dc9dc135 | 606 | deref_mut, |
1b1a35ee | 607 | deref_target, |
48663c56 | 608 | derive, |
487cf647 | 609 | derive_const, |
94222f64 | 610 | derive_default_enum, |
5e7ed085 | 611 | destruct, |
29967ef6 | 612 | destructuring_assignment, |
e1599b0c | 613 | diagnostic, |
dc9dc135 | 614 | direct, |
3dfed10e XL |
615 | discriminant_kind, |
616 | discriminant_type, | |
ba9703b0 | 617 | discriminant_value, |
3dfed10e XL |
618 | dispatch_from_dyn, |
619 | div, | |
620 | div_assign, | |
9c376795 | 621 | do_not_recommend, |
48663c56 XL |
622 | doc, |
623 | doc_alias, | |
c295e0f8 | 624 | doc_auto_cfg, |
48663c56 | 625 | doc_cfg, |
c295e0f8 | 626 | doc_cfg_hide, |
48663c56 XL |
627 | doc_keyword, |
628 | doc_masked, | |
cdc7bbd5 | 629 | doc_notable_trait, |
94222f64 | 630 | doc_primitive, |
3dfed10e | 631 | doc_spotlight, |
416331ca | 632 | doctest, |
48663c56 | 633 | document_private_items, |
5099ac24 | 634 | dotdot: "..", |
48663c56 | 635 | dotdot_in_tuple_patterns, |
3dfed10e | 636 | dotdoteq_in_patterns, |
fc512014 XL |
637 | dreg, |
638 | dreg_low16, | |
639 | dreg_low8, | |
3dfed10e XL |
640 | drop, |
641 | drop_in_place, | |
642 | drop_types_in_const, | |
48663c56 XL |
643 | dropck_eyepatch, |
644 | dropck_parametricity, | |
48663c56 | 645 | dylib, |
6a06907d | 646 | dyn_metadata, |
f2b60f7d | 647 | dyn_star, |
48663c56 | 648 | dyn_trait, |
5099ac24 | 649 | e, |
dc3f5686 | 650 | edition_panic, |
3dfed10e | 651 | eh_catch_typeinfo, |
48663c56 | 652 | eh_personality, |
3dfed10e XL |
653 | emit_enum, |
654 | emit_enum_variant, | |
655 | emit_enum_variant_arg, | |
656 | emit_struct, | |
657 | emit_struct_field, | |
48663c56 | 658 | enable, |
3dfed10e | 659 | encode, |
5099ac24 | 660 | end, |
416331ca | 661 | env, |
5099ac24 FG |
662 | eprint_macro, |
663 | eprintln_macro, | |
dc9dc135 | 664 | eq, |
29967ef6 | 665 | ermsb_target_feature, |
f035d41b | 666 | exact_div, |
48663c56 | 667 | except, |
3dfed10e | 668 | exchange_malloc, |
48663c56 XL |
669 | exclusive_range_pattern, |
670 | exhaustive_integer_patterns, | |
671 | exhaustive_patterns, | |
672 | existential_type, | |
f035d41b XL |
673 | exp2f32, |
674 | exp2f64, | |
29967ef6 | 675 | expect, |
48663c56 | 676 | expected, |
3dfed10e XL |
677 | expf32, |
678 | expf64, | |
94222f64 | 679 | explicit_generic_args_with_impl_trait, |
48663c56 | 680 | export_name, |
dc9dc135 | 681 | expr, |
fc512014 | 682 | extended_key_value_attributes, |
487cf647 | 683 | extended_varargs_abi_support, |
48663c56 | 684 | extern_absolute_paths, |
48663c56 XL |
685 | extern_crate_item_prelude, |
686 | extern_crate_self, | |
687 | extern_in_paths, | |
688 | extern_prelude, | |
689 | extern_types, | |
3dfed10e XL |
690 | external_doc, |
691 | f, | |
48663c56 | 692 | f16c_target_feature, |
dc9dc135 XL |
693 | f32, |
694 | f64, | |
f035d41b XL |
695 | fabsf32, |
696 | fabsf64, | |
3dfed10e | 697 | fadd_fast, |
064997fb | 698 | fake_variadic, |
f035d41b | 699 | fdiv_fast, |
48663c56 | 700 | feature, |
94222f64 | 701 | fence, |
a2a8927a | 702 | ferris: "🦀", |
94222f64 | 703 | fetch_update, |
29967ef6 | 704 | ffi, |
f9f354fc XL |
705 | ffi_const, |
706 | ffi_pure, | |
48663c56 | 707 | ffi_returns_twice, |
dc9dc135 | 708 | field, |
48663c56 XL |
709 | field_init_shorthand, |
710 | file, | |
3dfed10e | 711 | fill, |
3dfed10e | 712 | flags, |
5099ac24 | 713 | float, |
f035d41b | 714 | float_to_int_unchecked, |
f035d41b | 715 | floorf32, |
3dfed10e | 716 | floorf64, |
f035d41b XL |
717 | fmaf32, |
718 | fmaf64, | |
dc9dc135 | 719 | fmt, |
f035d41b | 720 | fmul_fast, |
136023e0 | 721 | fn_align, |
48663c56 | 722 | fn_must_use, |
3dfed10e XL |
723 | fn_mut, |
724 | fn_once, | |
725 | fn_once_output, | |
353b0b11 FG |
726 | fn_ptr_addr, |
727 | fn_ptr_trait, | |
48663c56 | 728 | forbid, |
f035d41b | 729 | forget, |
3dfed10e | 730 | format, |
9ffffee4 | 731 | format_alignment, |
416331ca | 732 | format_args, |
f035d41b | 733 | format_args_capture, |
5099ac24 | 734 | format_args_macro, |
3dfed10e | 735 | format_args_nl, |
9ffffee4 FG |
736 | format_argument, |
737 | format_arguments, | |
738 | format_count, | |
6a06907d | 739 | format_macro, |
9ffffee4 FG |
740 | format_placeholder, |
741 | format_unsafe_arg, | |
3dfed10e | 742 | freeze, |
fc512014 | 743 | freg, |
f035d41b | 744 | frem_fast, |
48663c56 | 745 | from, |
dc9dc135 | 746 | from_desugaring, |
9ffffee4 | 747 | from_fn, |
136023e0 | 748 | from_iter, |
dc9dc135 | 749 | from_method, |
17df50a5 XL |
750 | from_output, |
751 | from_residual, | |
3dfed10e | 752 | from_size_align_unchecked, |
3dfed10e | 753 | from_usize, |
04454e1e | 754 | from_yeet, |
f035d41b | 755 | fsub_fast, |
48663c56 XL |
756 | fundamental, |
757 | future, | |
3dfed10e | 758 | future_trait, |
923072b8 | 759 | gdb_script_file, |
3dfed10e | 760 | ge, |
48663c56 | 761 | gen_future, |
dfeec247 | 762 | gen_kill, |
3dfed10e | 763 | generator, |
f2b60f7d | 764 | generator_clone, |
3dfed10e | 765 | generator_state, |
48663c56 | 766 | generators, |
94222f64 | 767 | generic_arg_infer, |
923072b8 | 768 | generic_assert, |
48663c56 | 769 | generic_associated_types, |
5e7ed085 | 770 | generic_associated_types_extended, |
94222f64 | 771 | generic_const_exprs, |
48663c56 | 772 | generic_param_attrs, |
ba9703b0 | 773 | get_context, |
48663c56 XL |
774 | global_allocator, |
775 | global_asm, | |
776 | globs, | |
3dfed10e | 777 | gt, |
dfeec247 | 778 | half_open_range_patterns, |
2b03887a | 779 | half_open_range_patterns_in_slices, |
dc9dc135 | 780 | hash, |
48663c56 XL |
781 | hexagon_target_feature, |
782 | hidden, | |
783 | homogeneous_aggregate, | |
784 | html_favicon_url, | |
785 | html_logo_url, | |
786 | html_no_source, | |
787 | html_playground_url, | |
788 | html_root_url, | |
6a06907d | 789 | hwaddress, |
3dfed10e | 790 | i, |
48663c56 XL |
791 | i128, |
792 | i128_type, | |
793 | i16, | |
794 | i32, | |
795 | i64, | |
796 | i8, | |
797 | ident, | |
798 | if_let, | |
3dfed10e | 799 | if_let_guard, |
48663c56 XL |
800 | if_while_or_patterns, |
801 | ignore, | |
802 | impl_header_lifetime_elision, | |
416331ca | 803 | impl_lint_pass, |
353b0b11 | 804 | impl_trait_in_assoc_type, |
48663c56 | 805 | impl_trait_in_bindings, |
487cf647 FG |
806 | impl_trait_in_fn_trait_return, |
807 | impl_trait_projections, | |
064997fb FG |
808 | implied_by, |
809 | import, | |
f2b60f7d | 810 | import_name_type, |
48663c56 | 811 | import_shadowing, |
cdc7bbd5 | 812 | imported_main, |
48663c56 XL |
813 | in_band_lifetimes, |
814 | include, | |
416331ca | 815 | include_bytes, |
5099ac24 | 816 | include_bytes_macro, |
416331ca | 817 | include_str, |
5099ac24 | 818 | include_str_macro, |
48663c56 | 819 | inclusive_range_syntax, |
3dfed10e XL |
820 | index, |
821 | index_mut, | |
48663c56 XL |
822 | infer_outlives_requirements, |
823 | infer_static_outlives_requirements, | |
6a06907d | 824 | inherent_associated_types, |
f2b60f7d | 825 | inherit, |
3dfed10e | 826 | inlateout, |
48663c56 | 827 | inline, |
29967ef6 | 828 | inline_const, |
3c0e092e | 829 | inline_const_pat, |
3dfed10e | 830 | inout, |
29967ef6 | 831 | instruction_set, |
5099ac24 FG |
832 | integer_: "integer", |
833 | integral, | |
a2a8927a | 834 | into_future, |
48663c56 | 835 | into_iter, |
5869c6ff | 836 | intra_doc_pointers, |
48663c56 XL |
837 | intrinsics, |
838 | irrefutable_let_patterns, | |
29967ef6 | 839 | isa_attribute, |
48663c56 XL |
840 | isize, |
841 | issue, | |
842 | issue_5723_bootstrap, | |
843 | issue_tracker_base_url, | |
dc9dc135 | 844 | item, |
48663c56 XL |
845 | item_like_imports, |
846 | iter, | |
136023e0 | 847 | iter_repeat, |
9c376795 FG |
848 | iterator_collect_fn, |
849 | kcfi, | |
48663c56 XL |
850 | keyword, |
851 | kind, | |
fc512014 | 852 | kreg, |
04454e1e | 853 | kreg0, |
48663c56 XL |
854 | label, |
855 | label_break_value, | |
856 | lang, | |
857 | lang_items, | |
cdc7bbd5 | 858 | large_assignments, |
f9f354fc | 859 | lateout, |
3dfed10e XL |
860 | lazy_normalization_consts, |
861 | le, | |
136023e0 | 862 | len, |
dc9dc135 | 863 | let_chains, |
94222f64 | 864 | let_else, |
dc9dc135 | 865 | lhs, |
48663c56 | 866 | lib, |
3dfed10e | 867 | libc, |
dc9dc135 | 868 | lifetime, |
f2b60f7d | 869 | lifetimes, |
f035d41b | 870 | likely, |
416331ca | 871 | line, |
48663c56 | 872 | link, |
48663c56 XL |
873 | link_args, |
874 | link_cfg, | |
875 | link_llvm_intrinsics, | |
876 | link_name, | |
e74abb32 | 877 | link_ordinal, |
48663c56 | 878 | link_section, |
3dfed10e | 879 | linkage, |
5099ac24 | 880 | linker, |
48663c56 | 881 | lint_reasons, |
dc9dc135 | 882 | literal, |
94222f64 | 883 | load, |
a2a8927a | 884 | loaded_from_disk, |
fc512014 | 885 | local, |
48663c56 | 886 | local_inner_macros, |
f035d41b XL |
887 | log10f32, |
888 | log10f64, | |
889 | log2f32, | |
890 | log2f64, | |
3dfed10e XL |
891 | log_syntax, |
892 | logf32, | |
893 | logf64, | |
48663c56 | 894 | loop_break_value, |
3dfed10e | 895 | lt, |
48663c56 | 896 | macro_at_most_once_rep, |
6a06907d | 897 | macro_attributes_in_derive_output, |
48663c56 XL |
898 | macro_escape, |
899 | macro_export, | |
900 | macro_lifetime_matcher, | |
901 | macro_literal_matcher, | |
5e7ed085 | 902 | macro_metavar_expr, |
48663c56 | 903 | macro_reexport, |
48663c56 XL |
904 | macro_use, |
905 | macro_vis_matcher, | |
3dfed10e | 906 | macros_in_extern, |
48663c56 XL |
907 | main, |
908 | managed_boxes, | |
3dfed10e XL |
909 | manually_drop, |
910 | map, | |
48663c56 XL |
911 | marker, |
912 | marker_trait_attr, | |
913 | masked, | |
914 | match_beginning_vert, | |
915 | match_default_bindings, | |
5099ac24 | 916 | matches_macro, |
3dfed10e XL |
917 | maxnumf32, |
918 | maxnumf64, | |
48663c56 | 919 | may_dangle, |
a2a8927a | 920 | may_unwind, |
3dfed10e | 921 | maybe_uninit, |
60c5eb7d XL |
922 | maybe_uninit_uninit, |
923 | maybe_uninit_zeroed, | |
136023e0 XL |
924 | mem_discriminant, |
925 | mem_drop, | |
926 | mem_forget, | |
927 | mem_replace, | |
928 | mem_size_of, | |
929 | mem_size_of_val, | |
60c5eb7d | 930 | mem_uninitialized, |
c295e0f8 | 931 | mem_variant_count, |
60c5eb7d | 932 | mem_zeroed, |
dc9dc135 | 933 | member_constraints, |
74b04a01 | 934 | memory, |
5099ac24 | 935 | memtag, |
48663c56 XL |
936 | message, |
937 | meta, | |
6a06907d | 938 | metadata_type, |
60c5eb7d | 939 | min_align_of, |
f035d41b | 940 | min_align_of_val, |
48663c56 | 941 | min_const_fn, |
3dfed10e | 942 | min_const_generics, |
48663c56 | 943 | min_const_unsafe_fn, |
ba9703b0 | 944 | min_specialization, |
6a06907d | 945 | min_type_alias_impl_trait, |
f035d41b XL |
946 | minnumf32, |
947 | minnumf64, | |
48663c56 | 948 | mips_target_feature, |
5e7ed085 | 949 | miri, |
1b1a35ee | 950 | misc, |
136023e0 | 951 | mmx_reg, |
17df50a5 | 952 | modifiers, |
48663c56 | 953 | module, |
416331ca | 954 | module_path, |
17df50a5 | 955 | more_qualified_paths, |
48663c56 | 956 | more_struct_aliases, |
3dfed10e | 957 | movbe_target_feature, |
74b04a01 | 958 | move_ref_pattern, |
cdc7bbd5 | 959 | move_size_limit, |
3dfed10e XL |
960 | mul, |
961 | mul_assign, | |
60c5eb7d | 962 | mul_with_overflow, |
9ffffee4 | 963 | multiple_supertrait_upcastable, |
c295e0f8 | 964 | must_not_suspend, |
48663c56 XL |
965 | must_use, |
966 | naked, | |
967 | naked_functions, | |
968 | name, | |
5099ac24 | 969 | names, |
17df50a5 XL |
970 | native_link_modifiers, |
971 | native_link_modifiers_as_needed, | |
972 | native_link_modifiers_bundle, | |
973 | native_link_modifiers_verbatim, | |
974 | native_link_modifiers_whole_archive, | |
04454e1e | 975 | natvis_file, |
3dfed10e | 976 | ne, |
f035d41b XL |
977 | nearbyintf32, |
978 | nearbyintf64, | |
48663c56 | 979 | needs_allocator, |
60c5eb7d | 980 | needs_drop, |
48663c56 | 981 | needs_panic_runtime, |
3dfed10e | 982 | neg, |
48663c56 | 983 | negate_unsigned, |
ba9703b0 | 984 | negative_impls, |
5099ac24 | 985 | neon, |
48663c56 XL |
986 | never, |
987 | never_type, | |
60c5eb7d | 988 | never_type_fallback, |
dc9dc135 | 989 | new, |
2b03887a | 990 | new_binary, |
353b0b11 | 991 | new_const, |
2b03887a FG |
992 | new_debug, |
993 | new_display, | |
994 | new_lower_exp, | |
995 | new_lower_hex, | |
996 | new_octal, | |
997 | new_pointer, | |
3dfed10e | 998 | new_unchecked, |
2b03887a FG |
999 | new_upper_exp, |
1000 | new_upper_hex, | |
1001 | new_v1, | |
1002 | new_v1_formatted, | |
48663c56 | 1003 | next, |
48663c56 | 1004 | nll, |
3dfed10e | 1005 | no, |
48663c56 XL |
1006 | no_builtins, |
1007 | no_core, | |
cdc7bbd5 | 1008 | no_coverage, |
48663c56 XL |
1009 | no_crate_inject, |
1010 | no_debug, | |
1011 | no_default_passes, | |
1012 | no_implicit_prelude, | |
1013 | no_inline, | |
1014 | no_link, | |
1015 | no_main, | |
1016 | no_mangle, | |
3dfed10e XL |
1017 | no_sanitize, |
1018 | no_stack_check, | |
1019 | no_start, | |
1020 | no_std, | |
f9f354fc | 1021 | nomem, |
48663c56 | 1022 | non_ascii_idents, |
48663c56 | 1023 | non_exhaustive, |
c295e0f8 | 1024 | non_exhaustive_omitted_patterns_lint, |
9ffffee4 | 1025 | non_lifetime_binders, |
48663c56 | 1026 | non_modrs_mods, |
f035d41b | 1027 | nontemporal_store, |
6a06907d XL |
1028 | noop_method_borrow, |
1029 | noop_method_clone, | |
1030 | noop_method_deref, | |
f9f354fc | 1031 | noreturn, |
f9f354fc | 1032 | nostack, |
48663c56 | 1033 | not, |
cdc7bbd5 | 1034 | notable_trait, |
48663c56 | 1035 | note, |
e74abb32 | 1036 | object_safe_for_dispatch, |
3dfed10e | 1037 | of, |
f9f354fc | 1038 | offset, |
48663c56 XL |
1039 | omit_gdb_pretty_printer_section, |
1040 | on, | |
1041 | on_unimplemented, | |
1042 | oom, | |
3dfed10e | 1043 | opaque, |
48663c56 | 1044 | ops, |
3dfed10e | 1045 | opt_out_copy, |
48663c56 XL |
1046 | optimize, |
1047 | optimize_attribute, | |
1048 | optin_builtin_traits, | |
1049 | option, | |
416331ca | 1050 | option_env, |
353b0b11 | 1051 | option_payload_ptr, |
f9f354fc | 1052 | options, |
dc9dc135 | 1053 | or, |
e1599b0c | 1054 | or_patterns, |
3dfed10e | 1055 | other, |
f9f354fc | 1056 | out, |
48663c56 | 1057 | overlapping_marker_traits, |
3dfed10e | 1058 | owned_box, |
48663c56 | 1059 | packed, |
9ffffee4 | 1060 | packed_bundled_libs, |
dc9dc135 | 1061 | panic, |
5869c6ff XL |
1062 | panic_2015, |
1063 | panic_2021, | |
3dfed10e XL |
1064 | panic_abort, |
1065 | panic_bounds_check, | |
9c376795 | 1066 | panic_cannot_unwind, |
c295e0f8 | 1067 | panic_display, |
94222f64 | 1068 | panic_fmt, |
48663c56 XL |
1069 | panic_handler, |
1070 | panic_impl, | |
1071 | panic_implementation, | |
3dfed10e XL |
1072 | panic_info, |
1073 | panic_location, | |
353b0b11 | 1074 | panic_misaligned_pointer_dereference, |
9c376795 | 1075 | panic_nounwind, |
48663c56 | 1076 | panic_runtime, |
29967ef6 | 1077 | panic_str, |
3dfed10e | 1078 | panic_unwind, |
fc512014 | 1079 | panicking, |
3dfed10e | 1080 | param_attrs, |
f2b60f7d | 1081 | parent_label, |
dc9dc135 | 1082 | partial_cmp, |
3dfed10e | 1083 | partial_ord, |
48663c56 | 1084 | passes, |
dc9dc135 | 1085 | pat, |
cdc7bbd5 | 1086 | pat_param, |
48663c56 XL |
1087 | path, |
1088 | pattern_parentheses, | |
3dfed10e | 1089 | phantom_data, |
48663c56 | 1090 | pin, |
48663c56 XL |
1091 | platform_intrinsics, |
1092 | plugin, | |
1093 | plugin_registrar, | |
1094 | plugins, | |
6a06907d | 1095 | pointee_trait, |
3dfed10e | 1096 | pointer, |
9ffffee4 | 1097 | pointer_like, |
ba9703b0 | 1098 | poll, |
3dfed10e XL |
1099 | position, |
1100 | post_dash_lto: "post-lto", | |
48663c56 | 1101 | powerpc_target_feature, |
f035d41b XL |
1102 | powf32, |
1103 | powf64, | |
1104 | powif32, | |
1105 | powif64, | |
3dfed10e | 1106 | pre_dash_lto: "pre-lto", |
48663c56 | 1107 | precise_pointer_size_matching, |
3dfed10e | 1108 | precision, |
60c5eb7d | 1109 | pref_align_of, |
f035d41b XL |
1110 | prefetch_read_data, |
1111 | prefetch_read_instruction, | |
1112 | prefetch_write_data, | |
1113 | prefetch_write_instruction, | |
136023e0 | 1114 | preg, |
48663c56 XL |
1115 | prelude, |
1116 | prelude_import, | |
f9f354fc | 1117 | preserves_flags, |
48663c56 | 1118 | primitive, |
5099ac24 FG |
1119 | print_macro, |
1120 | println_macro, | |
48663c56 XL |
1121 | proc_dash_macro: "proc-macro", |
1122 | proc_macro, | |
1123 | proc_macro_attribute, | |
1124 | proc_macro_derive, | |
1125 | proc_macro_expr, | |
1126 | proc_macro_gen, | |
1127 | proc_macro_hygiene, | |
416331ca | 1128 | proc_macro_internals, |
48663c56 XL |
1129 | proc_macro_mod, |
1130 | proc_macro_non_items, | |
1131 | proc_macro_path_invoc, | |
f035d41b | 1132 | profiler_builtins, |
48663c56 | 1133 | profiler_runtime, |
5e7ed085 | 1134 | ptr, |
f2b60f7d FG |
1135 | ptr_guaranteed_cmp, |
1136 | ptr_mask, | |
cdc7bbd5 XL |
1137 | ptr_null, |
1138 | ptr_null_mut, | |
60c5eb7d | 1139 | ptr_offset_from, |
04454e1e | 1140 | ptr_offset_from_unsigned, |
6a06907d | 1141 | pub_macro_rules, |
48663c56 | 1142 | pub_restricted, |
f2b60f7d | 1143 | public, |
f9f354fc | 1144 | pure, |
48663c56 | 1145 | pushpop_unsafe, |
fc512014 XL |
1146 | qreg, |
1147 | qreg_low4, | |
1148 | qreg_low8, | |
48663c56 XL |
1149 | quad_precision_float, |
1150 | question_mark, | |
1151 | quote, | |
3dfed10e | 1152 | range_inclusive_new, |
e74abb32 | 1153 | raw_dylib, |
136023e0 | 1154 | raw_eq, |
48663c56 | 1155 | raw_identifiers, |
60c5eb7d | 1156 | raw_ref_op, |
3dfed10e XL |
1157 | re_rebalance_coherence, |
1158 | read_enum, | |
1159 | read_enum_variant, | |
1160 | read_enum_variant_arg, | |
1161 | read_struct, | |
1162 | read_struct_field, | |
353b0b11 | 1163 | read_via_copy, |
f9f354fc | 1164 | readonly, |
3dfed10e | 1165 | realloc, |
48663c56 | 1166 | reason, |
3dfed10e | 1167 | receiver, |
48663c56 XL |
1168 | recursion_limit, |
1169 | reexport_test_harness_main, | |
136023e0 | 1170 | ref_unwind_safe_trait, |
3dfed10e | 1171 | reference, |
48663c56 | 1172 | reflect, |
fc512014 XL |
1173 | reg, |
1174 | reg16, | |
1175 | reg32, | |
1176 | reg64, | |
1177 | reg_abcd, | |
353b0b11 | 1178 | reg_addr, |
fc512014 | 1179 | reg_byte, |
353b0b11 | 1180 | reg_data, |
a2a8927a | 1181 | reg_iw, |
17df50a5 | 1182 | reg_nonzero, |
a2a8927a XL |
1183 | reg_pair, |
1184 | reg_ptr, | |
1185 | reg_upper, | |
60c5eb7d XL |
1186 | register_attr, |
1187 | register_tool, | |
48663c56 | 1188 | relaxed_adts, |
5869c6ff | 1189 | relaxed_struct_unsize, |
3dfed10e XL |
1190 | rem, |
1191 | rem_assign, | |
48663c56 XL |
1192 | repr, |
1193 | repr128, | |
1194 | repr_align, | |
1195 | repr_align_enum, | |
1196 | repr_packed, | |
1197 | repr_simd, | |
1198 | repr_transparent, | |
f2b60f7d | 1199 | require, |
17df50a5 | 1200 | residual, |
48663c56 | 1201 | result, |
f2b60f7d | 1202 | return_position_impl_trait_in_trait, |
353b0b11 | 1203 | return_type_notation, |
dc9dc135 | 1204 | rhs, |
f035d41b XL |
1205 | rintf32, |
1206 | rintf64, | |
f9f354fc | 1207 | riscv_target_feature, |
48663c56 | 1208 | rlib, |
60c5eb7d XL |
1209 | rotate_left, |
1210 | rotate_right, | |
353b0b11 FG |
1211 | roundevenf32, |
1212 | roundevenf64, | |
f035d41b XL |
1213 | roundf32, |
1214 | roundf64, | |
dc9dc135 | 1215 | rt, |
48663c56 XL |
1216 | rtm_target_feature, |
1217 | rust, | |
6a06907d | 1218 | rust_2015, |
48663c56 | 1219 | rust_2015_preview, |
6a06907d | 1220 | rust_2018, |
48663c56 | 1221 | rust_2018_preview, |
6a06907d | 1222 | rust_2021, |
5869c6ff | 1223 | rust_2021_preview, |
04454e1e FG |
1224 | rust_2024, |
1225 | rust_2024_preview, | |
48663c56 | 1226 | rust_begin_unwind, |
923072b8 | 1227 | rust_cold_cc, |
1b1a35ee | 1228 | rust_eh_catch_typeinfo, |
3dfed10e | 1229 | rust_eh_personality, |
dc9dc135 XL |
1230 | rustc, |
1231 | rustc_allocator, | |
064997fb | 1232 | rustc_allocator_zeroed, |
29967ef6 | 1233 | rustc_allow_const_fn_unstable, |
5e7ed085 | 1234 | rustc_allow_incoherent_impl, |
064997fb | 1235 | rustc_allowed_through_unstable_modules, |
48663c56 | 1236 | rustc_attrs, |
923072b8 | 1237 | rustc_box, |
416331ca | 1238 | rustc_builtin_macro, |
fc512014 | 1239 | rustc_capture_analysis, |
48663c56 | 1240 | rustc_clean, |
5e7ed085 | 1241 | rustc_coherence_is_core, |
9ffffee4 | 1242 | rustc_coinductive, |
60c5eb7d | 1243 | rustc_const_stable, |
3dfed10e | 1244 | rustc_const_unstable, |
48663c56 | 1245 | rustc_conversion_suggestion, |
064997fb | 1246 | rustc_deallocator, |
48663c56 | 1247 | rustc_def_path, |
f2b60f7d | 1248 | rustc_default_body_unstable, |
487cf647 | 1249 | rustc_deny_explicit_impl, |
e1599b0c | 1250 | rustc_diagnostic_item, |
48663c56 XL |
1251 | rustc_diagnostic_macros, |
1252 | rustc_dirty, | |
c295e0f8 | 1253 | rustc_do_not_const_check, |
353b0b11 | 1254 | rustc_doc_primitive, |
dc9dc135 | 1255 | rustc_dummy, |
48663c56 XL |
1256 | rustc_dump_env_program_clauses, |
1257 | rustc_dump_program_clauses, | |
1258 | rustc_dump_user_substs, | |
94222f64 | 1259 | rustc_dump_vtable, |
2b03887a | 1260 | rustc_effective_visibility, |
48663c56 | 1261 | rustc_error, |
17df50a5 | 1262 | rustc_evaluate_where_clauses, |
48663c56 | 1263 | rustc_expected_cgu_reuse, |
04454e1e | 1264 | rustc_has_incoherent_inherent_impls, |
48663c56 XL |
1265 | rustc_if_this_changed, |
1266 | rustc_inherit_overflow_checks, | |
17df50a5 | 1267 | rustc_insignificant_dtor, |
48663c56 XL |
1268 | rustc_layout, |
1269 | rustc_layout_scalar_valid_range_end, | |
1270 | rustc_layout_scalar_valid_range_start, | |
6a06907d | 1271 | rustc_legacy_const_generics, |
923072b8 | 1272 | rustc_lint_diagnostics, |
064997fb FG |
1273 | rustc_lint_opt_deny_field_access, |
1274 | rustc_lint_opt_ty, | |
5099ac24 | 1275 | rustc_lint_query_instability, |
416331ca | 1276 | rustc_macro_transparency, |
cdc7bbd5 | 1277 | rustc_main, |
48663c56 | 1278 | rustc_mir, |
5099ac24 | 1279 | rustc_must_implement_one_of, |
dc9dc135 | 1280 | rustc_nonnull_optimization_guaranteed, |
2b03887a | 1281 | rustc_nounwind, |
48663c56 XL |
1282 | rustc_object_lifetime_default, |
1283 | rustc_on_unimplemented, | |
1284 | rustc_outlives, | |
1285 | rustc_paren_sugar, | |
1286 | rustc_partition_codegened, | |
1287 | rustc_partition_reused, | |
5099ac24 | 1288 | rustc_pass_by_value, |
48663c56 XL |
1289 | rustc_peek, |
1290 | rustc_peek_definite_init, | |
f9f354fc | 1291 | rustc_peek_liveness, |
48663c56 XL |
1292 | rustc_peek_maybe_init, |
1293 | rustc_peek_maybe_uninit, | |
3dfed10e | 1294 | rustc_polymorphize_error, |
48663c56 XL |
1295 | rustc_private, |
1296 | rustc_proc_macro_decls, | |
1297 | rustc_promotable, | |
064997fb | 1298 | rustc_reallocator, |
48663c56 | 1299 | rustc_regions, |
3dfed10e | 1300 | rustc_reservation_impl, |
2b03887a | 1301 | rustc_safe_intrinsic, |
3dfed10e | 1302 | rustc_serialize, |
cdc7bbd5 | 1303 | rustc_skip_array_during_method_dispatch, |
ba9703b0 | 1304 | rustc_specialization_trait, |
48663c56 | 1305 | rustc_std_internal_symbol, |
3c0e092e | 1306 | rustc_strict_coherence, |
48663c56 | 1307 | rustc_symbol_name, |
48663c56 XL |
1308 | rustc_test_marker, |
1309 | rustc_then_this_would_need, | |
c295e0f8 | 1310 | rustc_trivial_field_reads, |
3dfed10e | 1311 | rustc_unsafe_specialization_marker, |
48663c56 | 1312 | rustc_variance, |
6a06907d | 1313 | rustdoc, |
3c0e092e | 1314 | rustdoc_internals, |
f2b60f7d | 1315 | rustdoc_missing_doc_code_examples, |
416331ca | 1316 | rustfmt, |
48663c56 | 1317 | rvalue_static_promotion, |
136023e0 | 1318 | s, |
f2b60f7d | 1319 | safety, |
60c5eb7d | 1320 | sanitize, |
48663c56 | 1321 | sanitizer_runtime, |
60c5eb7d XL |
1322 | saturating_add, |
1323 | saturating_sub, | |
48663c56 XL |
1324 | self_in_typedefs, |
1325 | self_struct_ctor, | |
3dfed10e | 1326 | semitransparent, |
064997fb | 1327 | shadow_call_stack, |
3dfed10e XL |
1328 | shl, |
1329 | shl_assign, | |
48663c56 | 1330 | should_panic, |
3dfed10e XL |
1331 | shr, |
1332 | shr_assign, | |
f2b60f7d FG |
1333 | sig_dfl, |
1334 | sig_ign, | |
48663c56 | 1335 | simd, |
3dfed10e XL |
1336 | simd_add, |
1337 | simd_and, | |
04454e1e | 1338 | simd_arith_offset, |
5099ac24 | 1339 | simd_as, |
3dfed10e XL |
1340 | simd_bitmask, |
1341 | simd_cast, | |
f2b60f7d | 1342 | simd_cast_ptr, |
3dfed10e XL |
1343 | simd_ceil, |
1344 | simd_div, | |
1345 | simd_eq, | |
f2b60f7d | 1346 | simd_expose_addr, |
60c5eb7d | 1347 | simd_extract, |
3dfed10e XL |
1348 | simd_fabs, |
1349 | simd_fcos, | |
1350 | simd_fexp, | |
1351 | simd_fexp2, | |
48663c56 | 1352 | simd_ffi, |
3dfed10e XL |
1353 | simd_flog, |
1354 | simd_flog10, | |
1355 | simd_flog2, | |
1356 | simd_floor, | |
1357 | simd_fma, | |
1358 | simd_fmax, | |
1359 | simd_fmin, | |
1360 | simd_fpow, | |
1361 | simd_fpowi, | |
f2b60f7d | 1362 | simd_from_exposed_addr, |
3dfed10e XL |
1363 | simd_fsin, |
1364 | simd_fsqrt, | |
1365 | simd_gather, | |
1366 | simd_ge, | |
1367 | simd_gt, | |
60c5eb7d | 1368 | simd_insert, |
3dfed10e XL |
1369 | simd_le, |
1370 | simd_lt, | |
1371 | simd_mul, | |
1372 | simd_ne, | |
6a06907d | 1373 | simd_neg, |
3dfed10e XL |
1374 | simd_or, |
1375 | simd_reduce_add_ordered, | |
1376 | simd_reduce_add_unordered, | |
1377 | simd_reduce_all, | |
1378 | simd_reduce_and, | |
1379 | simd_reduce_any, | |
1380 | simd_reduce_max, | |
1381 | simd_reduce_max_nanless, | |
1382 | simd_reduce_min, | |
1383 | simd_reduce_min_nanless, | |
1384 | simd_reduce_mul_ordered, | |
1385 | simd_reduce_mul_unordered, | |
1386 | simd_reduce_or, | |
1387 | simd_reduce_xor, | |
1388 | simd_rem, | |
cdc7bbd5 | 1389 | simd_round, |
3dfed10e XL |
1390 | simd_saturating_add, |
1391 | simd_saturating_sub, | |
1392 | simd_scatter, | |
1393 | simd_select, | |
1394 | simd_select_bitmask, | |
1395 | simd_shl, | |
1396 | simd_shr, | |
c295e0f8 | 1397 | simd_shuffle, |
3dfed10e | 1398 | simd_sub, |
cdc7bbd5 | 1399 | simd_trunc, |
3dfed10e | 1400 | simd_xor, |
48663c56 | 1401 | since, |
f035d41b XL |
1402 | sinf32, |
1403 | sinf64, | |
48663c56 | 1404 | size, |
60c5eb7d | 1405 | size_of, |
f035d41b | 1406 | size_of_val, |
3dfed10e | 1407 | sized, |
6a06907d | 1408 | skip, |
3dfed10e | 1409 | slice, |
136023e0 | 1410 | slice_len_fn, |
48663c56 XL |
1411 | slice_patterns, |
1412 | slicing_syntax, | |
416331ca | 1413 | soft, |
48663c56 XL |
1414 | specialization, |
1415 | speed, | |
3dfed10e | 1416 | spotlight, |
f035d41b XL |
1417 | sqrtf32, |
1418 | sqrtf64, | |
fc512014 XL |
1419 | sreg, |
1420 | sreg_low16, | |
5099ac24 | 1421 | sse, |
48663c56 XL |
1422 | sse4a_target_feature, |
1423 | stable, | |
1424 | staged_api, | |
1425 | start, | |
3dfed10e | 1426 | state, |
48663c56 | 1427 | static_in_const, |
48663c56 XL |
1428 | static_nobundle, |
1429 | static_recursion, | |
3dfed10e | 1430 | staticlib, |
48663c56 | 1431 | std, |
5869c6ff XL |
1432 | std_panic, |
1433 | std_panic_2015_macro, | |
fc512014 | 1434 | std_panic_macro, |
dc9dc135 | 1435 | stmt, |
48663c56 XL |
1436 | stmt_expr_attributes, |
1437 | stop_after_dataflow, | |
94222f64 | 1438 | store, |
3dfed10e | 1439 | str, |
5e7ed085 FG |
1440 | str_split_whitespace, |
1441 | str_trim, | |
1442 | str_trim_end, | |
1443 | str_trim_start, | |
04454e1e | 1444 | strict_provenance, |
487cf647 | 1445 | string_deref_patterns, |
3dfed10e | 1446 | stringify, |
48663c56 XL |
1447 | struct_field_attributes, |
1448 | struct_inherit, | |
48663c56 | 1449 | struct_variant, |
3dfed10e XL |
1450 | structural_match, |
1451 | structural_peq, | |
1452 | structural_teq, | |
dc9dc135 | 1453 | sty, |
3dfed10e XL |
1454 | sub, |
1455 | sub_assign, | |
60c5eb7d | 1456 | sub_with_overflow, |
48663c56 | 1457 | suggestion, |
f9f354fc | 1458 | sym, |
3dfed10e | 1459 | sync, |
29967ef6 | 1460 | t32, |
923072b8 | 1461 | target, |
136023e0 | 1462 | target_abi, |
3dfed10e XL |
1463 | target_arch, |
1464 | target_endian, | |
1465 | target_env, | |
1466 | target_family, | |
48663c56 | 1467 | target_feature, |
f9f354fc | 1468 | target_feature_11, |
48663c56 | 1469 | target_has_atomic, |
1b1a35ee | 1470 | target_has_atomic_equal_alignment, |
e74abb32 | 1471 | target_has_atomic_load_store, |
3dfed10e XL |
1472 | target_os, |
1473 | target_pointer_width, | |
48663c56 | 1474 | target_thread_local, |
3dfed10e | 1475 | target_vendor, |
48663c56 | 1476 | tbm_target_feature, |
3dfed10e | 1477 | termination, |
48663c56 XL |
1478 | termination_trait, |
1479 | termination_trait_test, | |
1480 | test, | |
1481 | test_2018_feature, | |
1482 | test_accepted_feature, | |
dc9dc135 | 1483 | test_case, |
48663c56 XL |
1484 | test_removed_feature, |
1485 | test_runner, | |
5e7ed085 | 1486 | test_unstable_lint, |
74b04a01 | 1487 | thread, |
48663c56 | 1488 | thread_local, |
5099ac24 FG |
1489 | thread_local_macro, |
1490 | thumb2, | |
1491 | thumb_mode: "thumb-mode", | |
923072b8 | 1492 | tmm_reg, |
064997fb FG |
1493 | to_string, |
1494 | to_vec, | |
5099ac24 | 1495 | todo_macro, |
48663c56 XL |
1496 | tool_attributes, |
1497 | tool_lints, | |
1498 | trace_macros, | |
e74abb32 | 1499 | track_caller, |
48663c56 | 1500 | trait_alias, |
94222f64 | 1501 | trait_upcasting, |
48663c56 | 1502 | transmute, |
353b0b11 | 1503 | transmute_generic_consts, |
f2b60f7d | 1504 | transmute_opts, |
064997fb | 1505 | transmute_trait, |
48663c56 | 1506 | transparent, |
dc9dc135 XL |
1507 | transparent_enums, |
1508 | transparent_unions, | |
48663c56 | 1509 | trivial_bounds, |
f035d41b XL |
1510 | truncf32, |
1511 | truncf64, | |
48663c56 | 1512 | try_blocks, |
923072b8 | 1513 | try_capture, |
136023e0 | 1514 | try_from, |
136023e0 | 1515 | try_into, |
17df50a5 | 1516 | try_trait_v2, |
dc9dc135 | 1517 | tt, |
3dfed10e | 1518 | tuple, |
48663c56 | 1519 | tuple_indexing, |
f2b60f7d | 1520 | tuple_trait, |
dfeec247 | 1521 | two_phase, |
48663c56 XL |
1522 | ty, |
1523 | type_alias_enum_variants, | |
3dfed10e | 1524 | type_alias_impl_trait, |
487cf647 | 1525 | type_ascribe, |
48663c56 | 1526 | type_ascription, |
3c0e092e | 1527 | type_changing_struct_update, |
3dfed10e | 1528 | type_id, |
48663c56 XL |
1529 | type_length_limit, |
1530 | type_macros, | |
3dfed10e | 1531 | type_name, |
48663c56 XL |
1532 | u128, |
1533 | u16, | |
1534 | u32, | |
1535 | u64, | |
1536 | u8, | |
f035d41b XL |
1537 | unaligned_volatile_load, |
1538 | unaligned_volatile_store, | |
48663c56 | 1539 | unboxed_closures, |
74b04a01 XL |
1540 | unchecked_add, |
1541 | unchecked_div, | |
1542 | unchecked_mul, | |
1543 | unchecked_rem, | |
60c5eb7d XL |
1544 | unchecked_shl, |
1545 | unchecked_shr, | |
74b04a01 | 1546 | unchecked_sub, |
48663c56 XL |
1547 | underscore_const_names, |
1548 | underscore_imports, | |
1549 | underscore_lifetimes, | |
1550 | uniform_paths, | |
5099ac24 | 1551 | unimplemented_macro, |
3dfed10e | 1552 | unit, |
48663c56 | 1553 | universal_impl_trait, |
3dfed10e | 1554 | unix, |
f2b60f7d | 1555 | unix_sigpipe, |
f035d41b | 1556 | unlikely, |
48663c56 | 1557 | unmarked_api, |
3dfed10e | 1558 | unpin, |
f035d41b | 1559 | unreachable, |
a2a8927a XL |
1560 | unreachable_2015, |
1561 | unreachable_2015_macro, | |
1562 | unreachable_2021, | |
48663c56 | 1563 | unreachable_code, |
a2a8927a XL |
1564 | unreachable_display, |
1565 | unreachable_macro, | |
48663c56 | 1566 | unrestricted_attribute_tokens, |
f9f354fc | 1567 | unsafe_block_in_unsafe_fn, |
3dfed10e | 1568 | unsafe_cell, |
48663c56 | 1569 | unsafe_no_drop_flag, |
5099ac24 | 1570 | unsafe_pin_internals, |
3dfed10e | 1571 | unsize, |
29967ef6 | 1572 | unsized_fn_params, |
48663c56 XL |
1573 | unsized_locals, |
1574 | unsized_tuple_coercion, | |
1575 | unstable, | |
064997fb FG |
1576 | unstable_location_reason_default: "this crate is being loaded from the sysroot, an \ |
1577 | unstable location; did you mean to load this crate \ | |
1578 | from crates.io via `Cargo.toml` instead?", | |
48663c56 | 1579 | untagged_unions, |
923072b8 | 1580 | unused_imports, |
48663c56 XL |
1581 | unwind, |
1582 | unwind_attributes, | |
136023e0 | 1583 | unwind_safe_trait, |
29967ef6 | 1584 | unwrap, |
dc9dc135 | 1585 | unwrap_or, |
48663c56 XL |
1586 | use_extern_macros, |
1587 | use_nested_groups, | |
3dfed10e | 1588 | used, |
5099ac24 | 1589 | used_with_arg, |
064997fb | 1590 | using, |
48663c56 XL |
1591 | usize, |
1592 | v1, | |
f035d41b XL |
1593 | va_arg, |
1594 | va_copy, | |
1595 | va_end, | |
3dfed10e | 1596 | va_list, |
f035d41b | 1597 | va_start, |
3dfed10e | 1598 | val, |
f2b60f7d | 1599 | validity, |
5099ac24 | 1600 | values, |
3dfed10e XL |
1601 | var, |
1602 | variant_count, | |
dc9dc135 | 1603 | vec, |
5099ac24 | 1604 | vec_macro, |
f9f354fc | 1605 | version, |
5099ac24 | 1606 | vfp2, |
48663c56 XL |
1607 | vis, |
1608 | visible_private_types, | |
1609 | volatile, | |
f035d41b XL |
1610 | volatile_copy_memory, |
1611 | volatile_copy_nonoverlapping_memory, | |
1612 | volatile_load, | |
1613 | volatile_set_memory, | |
1614 | volatile_store, | |
fc512014 XL |
1615 | vreg, |
1616 | vreg_low16, | |
064997fb FG |
1617 | vtable_align, |
1618 | vtable_size, | |
48663c56 | 1619 | warn, |
cdc7bbd5 | 1620 | wasm_abi, |
48663c56 XL |
1621 | wasm_import_module, |
1622 | wasm_target_feature, | |
1623 | while_let, | |
3dfed10e | 1624 | width, |
48663c56 XL |
1625 | windows, |
1626 | windows_subsystem, | |
5099ac24 | 1627 | with_negative_coherence, |
60c5eb7d | 1628 | wrapping_add, |
60c5eb7d | 1629 | wrapping_mul, |
3dfed10e | 1630 | wrapping_sub, |
17df50a5 | 1631 | wreg, |
f035d41b | 1632 | write_bytes, |
5099ac24 | 1633 | write_macro, |
c295e0f8 | 1634 | write_str, |
5099ac24 | 1635 | writeln_macro, |
136023e0 | 1636 | x87_reg, |
94222f64 | 1637 | xer, |
fc512014 | 1638 | xmm_reg, |
04454e1e FG |
1639 | yeet_desugar_details, |
1640 | yeet_expr, | |
fc512014 XL |
1641 | ymm_reg, |
1642 | zmm_reg, | |
48663c56 XL |
1643 | } |
1644 | } | |
1645 | ||
3dfed10e | 1646 | #[derive(Copy, Clone, Eq, HashStable_Generic, Encodable, Decodable)] |
cc61c64b XL |
1647 | pub struct Ident { |
1648 | pub name: Symbol, | |
83c7162d | 1649 | pub span: Span, |
cc61c64b XL |
1650 | } |
1651 | ||
1652 | impl Ident { | |
83c7162d | 1653 | #[inline] |
dc9dc135 | 1654 | /// Constructs a new identifier from a symbol and a span. |
83c7162d XL |
1655 | pub const fn new(name: Symbol, span: Span) -> Ident { |
1656 | Ident { name, span } | |
1657 | } | |
0731742a | 1658 | |
e1599b0c | 1659 | /// Constructs a new identifier with a dummy span. |
83c7162d | 1660 | #[inline] |
e1599b0c | 1661 | pub const fn with_dummy_span(name: Symbol) -> Ident { |
83c7162d XL |
1662 | Ident::new(name, DUMMY_SP) |
1663 | } | |
1664 | ||
dc9dc135 | 1665 | #[inline] |
3c0e092e | 1666 | pub fn empty() -> Ident { |
5869c6ff | 1667 | Ident::with_dummy_span(kw::Empty) |
dc9dc135 XL |
1668 | } |
1669 | ||
e1599b0c | 1670 | /// Maps a string to an identifier with a dummy span. |
cc61c64b | 1671 | pub fn from_str(string: &str) -> Ident { |
e1599b0c | 1672 | Ident::with_dummy_span(Symbol::intern(string)) |
cc61c64b XL |
1673 | } |
1674 | ||
dc9dc135 XL |
1675 | /// Maps a string and a span to an identifier. |
1676 | pub fn from_str_and_span(string: &str, span: Span) -> Ident { | |
1677 | Ident::new(Symbol::intern(string), span) | |
1678 | } | |
1679 | ||
9fa01778 | 1680 | /// Replaces `lo` and `hi` with those from `span`, but keep hygiene context. |
83c7162d XL |
1681 | pub fn with_span_pos(self, span: Span) -> Ident { |
1682 | Ident::new(self.name, span.with_ctxt(self.span.ctxt())) | |
1683 | } | |
1684 | ||
1685 | pub fn without_first_quote(self) -> Ident { | |
0731742a | 1686 | Ident::new(Symbol::intern(self.as_str().trim_start_matches('\'')), self.span) |
ff7c6d11 XL |
1687 | } |
1688 | ||
8faf50e0 | 1689 | /// "Normalize" ident for use in comparisons using "item hygiene". |
ba9703b0 | 1690 | /// Identifiers with same string value become same if they came from the same macro 2.0 macro |
0731742a | 1691 | /// (e.g., `macro` item, but not `macro_rules` item) and stay different if they came from |
ba9703b0 | 1692 | /// different macro 2.0 macros. |
8faf50e0 | 1693 | /// Technically, this operation strips all non-opaque marks from ident's syntactic context. |
ba9703b0 XL |
1694 | pub fn normalize_to_macros_2_0(self) -> Ident { |
1695 | Ident::new(self.name, self.span.normalize_to_macros_2_0()) | |
83c7162d XL |
1696 | } |
1697 | ||
8faf50e0 XL |
1698 | /// "Normalize" ident for use in comparisons using "local variable hygiene". |
1699 | /// Identifiers with same string value become same if they came from the same non-transparent | |
0731742a | 1700 | /// macro (e.g., `macro` or `macro_rules!` items) and stay different if they came from different |
8faf50e0 XL |
1701 | /// non-transparent macros. |
1702 | /// Technically, this operation strips all transparent marks from ident's syntactic context. | |
2b03887a | 1703 | #[inline] |
ba9703b0 XL |
1704 | pub fn normalize_to_macro_rules(self) -> Ident { |
1705 | Ident::new(self.name, self.span.normalize_to_macro_rules()) | |
8faf50e0 XL |
1706 | } |
1707 | ||
a2a8927a XL |
1708 | /// Access the underlying string. This is a slowish operation because it |
1709 | /// requires locking the symbol interner. | |
1710 | /// | |
1711 | /// Note that the lifetime of the return value is a lie. See | |
1712 | /// `Symbol::as_str()` for details. | |
1713 | pub fn as_str(&self) -> &str { | |
94b46f34 XL |
1714 | self.name.as_str() |
1715 | } | |
83c7162d XL |
1716 | } |
1717 | ||
1718 | impl PartialEq for Ident { | |
2b03887a | 1719 | #[inline] |
83c7162d | 1720 | fn eq(&self, rhs: &Self) -> bool { |
923072b8 | 1721 | self.name == rhs.name && self.span.eq_ctxt(rhs.span) |
83c7162d XL |
1722 | } |
1723 | } | |
1724 | ||
1725 | impl Hash for Ident { | |
1726 | fn hash<H: Hasher>(&self, state: &mut H) { | |
1727 | self.name.hash(state); | |
1728 | self.span.ctxt().hash(state); | |
cc61c64b XL |
1729 | } |
1730 | } | |
1731 | ||
1732 | impl fmt::Debug for Ident { | |
9fa01778 | 1733 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
74b04a01 XL |
1734 | fmt::Display::fmt(self, f)?; |
1735 | fmt::Debug::fmt(&self.span.ctxt(), f) | |
cc61c64b XL |
1736 | } |
1737 | } | |
1738 | ||
74b04a01 XL |
1739 | /// This implementation is supposed to be used in error messages, so it's expected to be identical |
1740 | /// to printing the original identifier token written in source code (`token_to_string`), | |
1741 | /// except that AST identifiers don't keep the rawness flag, so we have to guess it. | |
cc61c64b | 1742 | impl fmt::Display for Ident { |
9fa01778 | 1743 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
74b04a01 | 1744 | fmt::Display::fmt(&IdentPrinter::new(self.name, self.is_raw_guess(), None), f) |
cc61c64b XL |
1745 | } |
1746 | } | |
1747 | ||
9c376795 FG |
1748 | /// The most general type to print identifiers. |
1749 | /// | |
74b04a01 XL |
1750 | /// AST pretty-printer is used as a fallback for turning AST structures into token streams for |
1751 | /// proc macros. Additionally, proc macros may stringify their input and expect it survive the | |
1752 | /// stringification (especially true for proc macro derives written between Rust 1.15 and 1.30). | |
1753 | /// So we need to somehow pretty-print `$crate` in a way preserving at least some of its | |
1754 | /// hygiene data, most importantly name of the crate it refers to. | |
1755 | /// As a result we print `$crate` as `crate` if it refers to the local crate | |
1756 | /// and as `::other_crate_name` if it refers to some other crate. | |
5e7ed085 | 1757 | /// Note, that this is only done if the ident token is printed from inside of AST pretty-printing, |
74b04a01 XL |
1758 | /// but not otherwise. Pretty-printing is the only way for proc macros to discover token contents, |
1759 | /// so we should not perform this lossy conversion if the top level call to the pretty-printer was | |
1760 | /// done for a token stream or a single token. | |
1761 | pub struct IdentPrinter { | |
1762 | symbol: Symbol, | |
1763 | is_raw: bool, | |
1764 | /// Span used for retrieving the crate name to which `$crate` refers to, | |
1765 | /// if this field is `None` then the `$crate` conversion doesn't happen. | |
1766 | convert_dollar_crate: Option<Span>, | |
1767 | } | |
1768 | ||
1769 | impl IdentPrinter { | |
1770 | /// The most general `IdentPrinter` constructor. Do not use this. | |
1771 | pub fn new(symbol: Symbol, is_raw: bool, convert_dollar_crate: Option<Span>) -> IdentPrinter { | |
1772 | IdentPrinter { symbol, is_raw, convert_dollar_crate } | |
1773 | } | |
1774 | ||
1775 | /// This implementation is supposed to be used when printing identifiers | |
1776 | /// as a part of pretty-printing for larger AST pieces. | |
1777 | /// Do not use this either. | |
1778 | pub fn for_ast_ident(ident: Ident, is_raw: bool) -> IdentPrinter { | |
1779 | IdentPrinter::new(ident.name, is_raw, Some(ident.span)) | |
1780 | } | |
1781 | } | |
1782 | ||
1783 | impl fmt::Display for IdentPrinter { | |
1784 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | |
1785 | if self.is_raw { | |
1786 | f.write_str("r#")?; | |
fc512014 XL |
1787 | } else if self.symbol == kw::DollarCrate { |
1788 | if let Some(span) = self.convert_dollar_crate { | |
1789 | let converted = span.ctxt().dollar_crate_name(); | |
1790 | if !converted.is_path_segment_keyword() { | |
1791 | f.write_str("::")?; | |
74b04a01 | 1792 | } |
fc512014 | 1793 | return fmt::Display::fmt(&converted, f); |
74b04a01 XL |
1794 | } |
1795 | } | |
1796 | fmt::Display::fmt(&self.symbol, f) | |
1797 | } | |
1798 | } | |
1799 | ||
ba9703b0 XL |
1800 | /// An newtype around `Ident` that calls [Ident::normalize_to_macro_rules] on |
1801 | /// construction. | |
1802 | // FIXME(matthewj, petrochenkov) Use this more often, add a similar | |
1803 | // `ModernIdent` struct and use that as well. | |
1804 | #[derive(Copy, Clone, Eq, PartialEq, Hash)] | |
1805 | pub struct MacroRulesNormalizedIdent(Ident); | |
1806 | ||
1807 | impl MacroRulesNormalizedIdent { | |
1808 | pub fn new(ident: Ident) -> Self { | |
1809 | Self(ident.normalize_to_macro_rules()) | |
1810 | } | |
1811 | } | |
1812 | ||
1813 | impl fmt::Debug for MacroRulesNormalizedIdent { | |
1814 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | |
1815 | fmt::Debug::fmt(&self.0, f) | |
1816 | } | |
1817 | } | |
1818 | ||
1819 | impl fmt::Display for MacroRulesNormalizedIdent { | |
1820 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { | |
1821 | fmt::Display::fmt(&self.0, f) | |
1822 | } | |
1823 | } | |
1824 | ||
e74abb32 | 1825 | /// An interned string. |
48663c56 | 1826 | /// |
e74abb32 | 1827 | /// Internally, a `Symbol` is implemented as an index, and all operations |
48663c56 | 1828 | /// (including hashing, equality, and ordering) operate on that index. The use |
e74abb32 XL |
1829 | /// of `rustc_index::newtype_index!` means that `Option<Symbol>` only takes up 4 bytes, |
1830 | /// because `rustc_index::newtype_index!` reserves the last 256 values for tagging purposes. | |
0731742a | 1831 | /// |
e74abb32 | 1832 | /// Note that `Symbol` cannot directly be a `rustc_index::newtype_index!` because it |
dc9dc135 | 1833 | /// implements `fmt::Debug`, `Encodable`, and `Decodable` in special ways. |
476ff2be | 1834 | #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] |
0731742a XL |
1835 | pub struct Symbol(SymbolIndex); |
1836 | ||
e74abb32 | 1837 | rustc_index::newtype_index! { |
9c376795 | 1838 | struct SymbolIndex {} |
0731742a | 1839 | } |
476ff2be | 1840 | |
476ff2be | 1841 | impl Symbol { |
0731742a | 1842 | const fn new(n: u32) -> Self { |
ba9703b0 | 1843 | Symbol(SymbolIndex::from_u32(n)) |
0731742a XL |
1844 | } |
1845 | ||
f2b60f7d FG |
1846 | /// for use in Decoder only |
1847 | pub fn new_from_decoded(n: u32) -> Self { | |
1848 | Self::new(n) | |
1849 | } | |
1850 | ||
476ff2be SL |
1851 | /// Maps a string to its interned representation. |
1852 | pub fn intern(string: &str) -> Self { | |
c295e0f8 | 1853 | with_session_globals(|session_globals| session_globals.symbol_interner.intern(string)) |
476ff2be SL |
1854 | } |
1855 | ||
a2a8927a | 1856 | /// Access the underlying string. This is a slowish operation because it |
60c5eb7d | 1857 | /// requires locking the symbol interner. |
a2a8927a XL |
1858 | /// |
1859 | /// Note that the lifetime of the return value is a lie. It's not the same | |
1860 | /// as `&self`, but actually tied to the lifetime of the underlying | |
1861 | /// interner. Interners are long-lived, and there are very few of them, and | |
1862 | /// this function is typically used for short-lived things, so in practice | |
1863 | /// it works out ok. | |
1864 | pub fn as_str(&self) -> &str { | |
1865 | with_session_globals(|session_globals| unsafe { | |
1866 | std::mem::transmute::<&str, &str>(session_globals.symbol_interner.get(*self)) | |
476ff2be SL |
1867 | }) |
1868 | } | |
1869 | ||
83c7162d | 1870 | pub fn as_u32(self) -> u32 { |
0731742a | 1871 | self.0.as_u32() |
ea8adc8c | 1872 | } |
74b04a01 | 1873 | |
fc512014 | 1874 | pub fn is_empty(self) -> bool { |
5869c6ff | 1875 | self == kw::Empty |
fc512014 XL |
1876 | } |
1877 | ||
74b04a01 XL |
1878 | /// This method is supposed to be used in error messages, so it's expected to be |
1879 | /// identical to printing the original identifier token written in source code | |
1880 | /// (`token_to_string`, `Ident::to_string`), except that symbols don't keep the rawness flag | |
1881 | /// or edition, so we have to guess the rawness using the global edition. | |
1882 | pub fn to_ident_string(self) -> String { | |
1883 | Ident::with_dummy_span(self).to_string() | |
1884 | } | |
ea8adc8c XL |
1885 | } |
1886 | ||
476ff2be | 1887 | impl fmt::Debug for Symbol { |
9fa01778 | 1888 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
a2a8927a | 1889 | fmt::Debug::fmt(self.as_str(), f) |
476ff2be SL |
1890 | } |
1891 | } | |
1892 | ||
1893 | impl fmt::Display for Symbol { | |
9fa01778 | 1894 | fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
a2a8927a | 1895 | fmt::Display::fmt(self.as_str(), f) |
476ff2be SL |
1896 | } |
1897 | } | |
1898 | ||
2b03887a FG |
1899 | // takes advantage of `str::to_string` specialization |
1900 | impl ToString for Symbol { | |
1901 | fn to_string(&self) -> String { | |
1902 | self.as_str().to_string() | |
1903 | } | |
1904 | } | |
1905 | ||
3dfed10e | 1906 | impl<S: Encoder> Encodable<S> for Symbol { |
f2b60f7d | 1907 | default fn encode(&self, s: &mut S) { |
923072b8 | 1908 | s.emit_str(self.as_str()); |
476ff2be SL |
1909 | } |
1910 | } | |
1911 | ||
3dfed10e | 1912 | impl<D: Decoder> Decodable<D> for Symbol { |
74b04a01 | 1913 | #[inline] |
f2b60f7d | 1914 | default fn decode(d: &mut D) -> Symbol { |
487cf647 | 1915 | Symbol::intern(d.read_str()) |
476ff2be SL |
1916 | } |
1917 | } | |
1918 | ||
60c5eb7d XL |
1919 | impl<CTX> HashStable<CTX> for Symbol { |
1920 | #[inline] | |
1921 | fn hash_stable(&self, hcx: &mut CTX, hasher: &mut StableHasher) { | |
1922 | self.as_str().hash_stable(hcx, hasher); | |
1923 | } | |
1924 | } | |
1925 | ||
1926 | impl<CTX> ToStableHashKey<CTX> for Symbol { | |
a2a8927a | 1927 | type KeyType = String; |
60c5eb7d | 1928 | #[inline] |
a2a8927a XL |
1929 | fn to_stable_hash_key(&self, _: &CTX) -> String { |
1930 | self.as_str().to_string() | |
60c5eb7d XL |
1931 | } |
1932 | } | |
1933 | ||
c295e0f8 XL |
1934 | #[derive(Default)] |
1935 | pub(crate) struct Interner(Lock<InternerInner>); | |
1936 | ||
0731742a | 1937 | // The `&'static str`s in this type actually point into the arena. |
3dfed10e XL |
1938 | // |
1939 | // The `FxHashMap`+`Vec` pair could be replaced by `FxIndexSet`, but #75278 | |
1940 | // found that to regress performance up to 2% in some cases. This might be | |
1941 | // revisited after further improvements to `indexmap`. | |
c295e0f8 | 1942 | // |
a2a8927a | 1943 | // This type is private to prevent accidentally constructing more than one |
5e7ed085 | 1944 | // `Interner` on the same thread, which makes it easy to mix up `Symbol`s |
a2a8927a | 1945 | // between `Interner`s. |
0bf4aa26 | 1946 | #[derive(Default)] |
c295e0f8 | 1947 | struct InternerInner { |
94b46f34 XL |
1948 | arena: DroplessArena, |
1949 | names: FxHashMap<&'static str, Symbol>, | |
1950 | strings: Vec<&'static str>, | |
476ff2be SL |
1951 | } |
1952 | ||
1953 | impl Interner { | |
dc9dc135 | 1954 | fn prefill(init: &[&'static str]) -> Self { |
c295e0f8 | 1955 | Interner(Lock::new(InternerInner { |
dc9dc135 XL |
1956 | strings: init.into(), |
1957 | names: init.iter().copied().zip((0..).map(Symbol::new)).collect(), | |
1958 | ..Default::default() | |
c295e0f8 | 1959 | })) |
476ff2be SL |
1960 | } |
1961 | ||
74b04a01 | 1962 | #[inline] |
c295e0f8 XL |
1963 | fn intern(&self, string: &str) -> Symbol { |
1964 | let mut inner = self.0.lock(); | |
1965 | if let Some(&name) = inner.names.get(string) { | |
476ff2be SL |
1966 | return name; |
1967 | } | |
1968 | ||
c295e0f8 | 1969 | let name = Symbol::new(inner.strings.len() as u32); |
94b46f34 | 1970 | |
a2a8927a | 1971 | // SAFETY: we convert from `&str` to `&[u8]`, clone it into the arena, |
9ffffee4 | 1972 | // and immediately convert the clone back to `&[u8]`, all because there |
a2a8927a | 1973 | // is no `inner.arena.alloc_str()` method. This is clearly safe. |
dfeec247 | 1974 | let string: &str = |
c295e0f8 | 1975 | unsafe { str::from_utf8_unchecked(inner.arena.alloc_slice(string.as_bytes())) }; |
a2a8927a XL |
1976 | |
1977 | // SAFETY: we can extend the arena allocation to `'static` because we | |
1978 | // only access these while the arena is still alive. | |
dfeec247 | 1979 | let string: &'static str = unsafe { &*(string as *const str) }; |
c295e0f8 | 1980 | inner.strings.push(string); |
a2a8927a XL |
1981 | |
1982 | // This second hash table lookup can be avoided by using `RawEntryMut`, | |
1983 | // but this code path isn't hot enough for it to be worth it. See | |
1984 | // #91445 for details. | |
c295e0f8 | 1985 | inner.names.insert(string, name); |
476ff2be SL |
1986 | name |
1987 | } | |
60c5eb7d | 1988 | |
48663c56 XL |
1989 | // Get the symbol as a string. `Symbol::as_str()` should be used in |
1990 | // preference to this function. | |
c295e0f8 XL |
1991 | fn get(&self, symbol: Symbol) -> &str { |
1992 | self.0.lock().strings[symbol.0.as_usize()] | |
476ff2be SL |
1993 | } |
1994 | } | |
1995 | ||
dc9dc135 | 1996 | // This module has a very short name because it's used a lot. |
ba9703b0 XL |
1997 | /// This module contains all the defined keyword `Symbol`s. |
1998 | /// | |
1999 | /// Given that `kw` is imported, use them like `kw::keyword_name`. | |
2000 | /// For example `kw::Loop` or `kw::Break`. | |
dc9dc135 | 2001 | pub mod kw { |
fc512014 | 2002 | pub use super::kw_generated::*; |
48663c56 XL |
2003 | } |
2004 | ||
2005 | // This module has a very short name because it's used a lot. | |
ba9703b0 XL |
2006 | /// This module contains all the defined non-keyword `Symbol`s. |
2007 | /// | |
2008 | /// Given that `sym` is imported, use them like `sym::symbol_name`. | |
2009 | /// For example `sym::rustfmt` or `sym::u8`. | |
48663c56 XL |
2010 | pub mod sym { |
2011 | use super::Symbol; | |
dc9dc135 | 2012 | |
6a06907d | 2013 | #[doc(inline)] |
fc512014 | 2014 | pub use super::sym_generated::*; |
74b04a01 XL |
2015 | |
2016 | // Used from a macro in `librustc_feature/accepted.rs` | |
2017 | pub use super::kw::MacroRules as macro_rules; | |
dc9dc135 | 2018 | |
fc512014 XL |
2019 | /// Get the symbol for an integer. |
2020 | /// | |
2021 | /// The first few non-negative integers each have a static symbol and therefore | |
2022 | /// are fast. | |
dc9dc135 XL |
2023 | pub fn integer<N: TryInto<usize> + Copy + ToString>(n: N) -> Symbol { |
2024 | if let Result::Ok(idx) = n.try_into() { | |
fc512014 XL |
2025 | if idx < 10 { |
2026 | return Symbol::new(super::SYMBOL_DIGITS_BASE + idx as u32); | |
dc9dc135 XL |
2027 | } |
2028 | } | |
2029 | Symbol::intern(&n.to_string()) | |
2030 | } | |
94b46f34 XL |
2031 | } |
2032 | ||
2033 | impl Symbol { | |
fc512014 XL |
2034 | fn is_special(self) -> bool { |
2035 | self <= kw::Underscore | |
2036 | } | |
2037 | ||
2038 | fn is_used_keyword_always(self) -> bool { | |
2039 | self >= kw::As && self <= kw::While | |
0731742a XL |
2040 | } |
2041 | ||
fc512014 XL |
2042 | fn is_used_keyword_conditional(self, edition: impl FnOnce() -> Edition) -> bool { |
2043 | (self >= kw::Async && self <= kw::Dyn) && edition() >= Edition::Edition2018 | |
dc9dc135 XL |
2044 | } |
2045 | ||
fc512014 XL |
2046 | fn is_unused_keyword_always(self) -> bool { |
2047 | self >= kw::Abstract && self <= kw::Yield | |
2048 | } | |
2049 | ||
2050 | fn is_unused_keyword_conditional(self, edition: impl FnOnce() -> Edition) -> bool { | |
2051 | self == kw::Try && edition() >= Edition::Edition2018 | |
2052 | } | |
2053 | ||
2054 | pub fn is_reserved(self, edition: impl Copy + FnOnce() -> Edition) -> bool { | |
2055 | self.is_special() | |
2056 | || self.is_used_keyword_always() | |
2057 | || self.is_unused_keyword_always() | |
2058 | || self.is_used_keyword_conditional(edition) | |
2059 | || self.is_unused_keyword_conditional(edition) | |
dc9dc135 XL |
2060 | } |
2061 | ||
2062 | /// A keyword or reserved identifier that can be used as a path segment. | |
2063 | pub fn is_path_segment_keyword(self) -> bool { | |
dfeec247 XL |
2064 | self == kw::Super |
2065 | || self == kw::SelfLower | |
2066 | || self == kw::SelfUpper | |
2067 | || self == kw::Crate | |
2068 | || self == kw::PathRoot | |
2069 | || self == kw::DollarCrate | |
dc9dc135 XL |
2070 | } |
2071 | ||
e1599b0c XL |
2072 | /// Returns `true` if the symbol is `true` or `false`. |
2073 | pub fn is_bool_lit(self) -> bool { | |
2074 | self == kw::True || self == kw::False | |
2075 | } | |
2076 | ||
fc512014 | 2077 | /// Returns `true` if this symbol can be a raw identifier. |
dc9dc135 | 2078 | pub fn can_be_raw(self) -> bool { |
5869c6ff | 2079 | self != kw::Empty && self != kw::Underscore && !self.is_path_segment_keyword() |
94b46f34 | 2080 | } |
f2b60f7d FG |
2081 | |
2082 | /// Is this symbol was interned in compiler's `symbols!` macro | |
2083 | pub fn is_preinterned(self) -> bool { | |
2084 | self.as_u32() < PREINTERNED_SYMBOLS_COUNT | |
2085 | } | |
94b46f34 XL |
2086 | } |
2087 | ||
2088 | impl Ident { | |
487cf647 FG |
2089 | /// Returns `true` for reserved identifiers used internally for elided lifetimes, |
2090 | /// unnamed method parameters, crate root module, error recovery etc. | |
94b46f34 | 2091 | pub fn is_special(self) -> bool { |
fc512014 | 2092 | self.name.is_special() |
94b46f34 XL |
2093 | } |
2094 | ||
2095 | /// Returns `true` if the token is a keyword used in the language. | |
2096 | pub fn is_used_keyword(self) -> bool { | |
0731742a | 2097 | // Note: `span.edition()` is relatively expensive, don't call it unless necessary. |
fc512014 XL |
2098 | self.name.is_used_keyword_always() |
2099 | || self.name.is_used_keyword_conditional(|| self.span.edition()) | |
94b46f34 XL |
2100 | } |
2101 | ||
2102 | /// Returns `true` if the token is a keyword reserved for possible future use. | |
2103 | pub fn is_unused_keyword(self) -> bool { | |
2104 | // Note: `span.edition()` is relatively expensive, don't call it unless necessary. | |
fc512014 XL |
2105 | self.name.is_unused_keyword_always() |
2106 | || self.name.is_unused_keyword_conditional(|| self.span.edition()) | |
94b46f34 XL |
2107 | } |
2108 | ||
2109 | /// Returns `true` if the token is either a special identifier or a keyword. | |
2110 | pub fn is_reserved(self) -> bool { | |
fc512014 XL |
2111 | // Note: `span.edition()` is relatively expensive, don't call it unless necessary. |
2112 | self.name.is_reserved(|| self.span.edition()) | |
94b46f34 XL |
2113 | } |
2114 | ||
2115 | /// A keyword or reserved identifier that can be used as a path segment. | |
2116 | pub fn is_path_segment_keyword(self) -> bool { | |
dc9dc135 | 2117 | self.name.is_path_segment_keyword() |
532ac7d7 XL |
2118 | } |
2119 | ||
2120 | /// We see this identifier in a normal identifier position, like variable name or a type. | |
2121 | /// How was it written originally? Did it use the raw form? Let's try to guess. | |
2122 | pub fn is_raw_guess(self) -> bool { | |
dc9dc135 | 2123 | self.name.can_be_raw() && self.is_reserved() |
94b46f34 | 2124 | } |
476ff2be | 2125 | } |