diff options
Diffstat (limited to 'compiler/rustc_span/src/symbol.rs')
-rw-r--r-- | compiler/rustc_span/src/symbol.rs | 51 |
1 files changed, 44 insertions, 7 deletions
diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 791160ff6..ae4d1a463 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -157,6 +157,7 @@ symbols! { BTreeSet, BinaryHeap, Borrow, + BorrowMut, Break, C, CStr, @@ -213,6 +214,7 @@ symbols! { IntoIterator, IoRead, IoWrite, + IpAddr, IrTyKind, Is, ItemContext, @@ -222,6 +224,7 @@ symbols! { LinkedList, LintPass, Mutex, + MutexGuard, N, NonZeroI128, NonZeroI16, @@ -270,6 +273,8 @@ symbols! { Rust, RustcDecodable, RustcEncodable, + RwLockReadGuard, + RwLockWriteGuard, Send, SeqCst, SessionDiagnostic, @@ -280,6 +285,7 @@ symbols! { StructuralPartialEq, SubdiagnosticMessage, Sync, + T, Target, ToOwned, ToString, @@ -334,6 +340,7 @@ symbols! { alias, align, align_offset, + alignment, alignstack, all, alloc, @@ -481,6 +488,7 @@ symbols! { cmse_nonsecure_entry, coerce_unsized, cold, + collapse_debuginfo, column, column_macro, compare_and_swap, @@ -504,7 +512,6 @@ symbols! { const_deallocate, const_eval_limit, const_eval_select, - const_eval_select_ct, const_evaluatable_checked, const_extern_fn, const_fn, @@ -644,6 +651,7 @@ symbols! { dropck_parametricity, dylib, dyn_metadata, + dyn_star, dyn_trait, e, edition_macro_pats, @@ -656,7 +664,6 @@ symbols! { emit_struct, emit_struct_field, enable, - enclosing_scope, encode, end, env, @@ -759,7 +766,7 @@ symbols! { gen_future, gen_kill, generator, - generator_return, + generator_clone, generator_state, generators, generic_arg_infer, @@ -802,6 +809,7 @@ symbols! { impl_trait_in_bindings, implied_by, import, + import_name_type, import_shadowing, imported_main, in_band_lifetimes, @@ -817,6 +825,7 @@ symbols! { infer_outlives_requirements, infer_static_outlives_requirements, inherent_associated_types, + inherit, inlateout, inline, inline_const, @@ -859,6 +868,7 @@ symbols! { lib, libc, lifetime, + lifetimes, likely, line, line_macro, @@ -1056,6 +1066,7 @@ symbols! { panic_unwind, panicking, param_attrs, + parent_label, partial_cmp, partial_ord, passes, @@ -1110,14 +1121,15 @@ symbols! { profiler_builtins, profiler_runtime, ptr, - ptr_guaranteed_eq, - ptr_guaranteed_ne, + ptr_guaranteed_cmp, + ptr_mask, ptr_null, ptr_null_mut, ptr_offset_from, ptr_offset_from_unsigned, pub_macro_rules, pub_restricted, + public, pure, pushpop_unsafe, qreg, @@ -1170,8 +1182,10 @@ symbols! { repr_packed, repr_simd, repr_transparent, + require, residual, result, + return_position_impl_trait_in_trait, rhs, rintf32, rintf64, @@ -1200,6 +1214,7 @@ symbols! { rust_eh_unregister_frames, rust_oom, rustc, + rustc_access_level, rustc_allocator, rustc_allocator_nounwind, rustc_allocator_zeroed, @@ -1217,6 +1232,7 @@ symbols! { rustc_conversion_suggestion, rustc_deallocator, rustc_def_path, + rustc_default_body_unstable, rustc_diagnostic_item, rustc_diagnostic_macros, rustc_dirty, @@ -1279,9 +1295,11 @@ symbols! { rustc_variance, rustdoc, rustdoc_internals, + rustdoc_missing_doc_code_examples, rustfmt, rvalue_static_promotion, s, + safety, sanitize, sanitizer_runtime, saturating_add, @@ -1295,6 +1313,8 @@ symbols! { should_panic, shr, shr_assign, + sig_dfl, + sig_ign, simd, simd_add, simd_and, @@ -1302,9 +1322,11 @@ symbols! { simd_as, simd_bitmask, simd_cast, + simd_cast_ptr, simd_ceil, simd_div, simd_eq, + simd_expose_addr, simd_extract, simd_fabs, simd_fcos, @@ -1320,6 +1342,7 @@ symbols! { simd_fmin, simd_fpow, simd_fpowi, + simd_from_exposed_addr, simd_fsin, simd_fsqrt, simd_gather, @@ -1464,6 +1487,7 @@ symbols! { trait_alias, trait_upcasting, transmute, + transmute_opts, transmute_trait, transparent, transparent_enums, @@ -1480,6 +1504,7 @@ symbols! { tuple, tuple_from_req, tuple_indexing, + tuple_trait, two_phase, ty, type_alias_enum_variants, @@ -1513,6 +1538,7 @@ symbols! { unit, universal_impl_trait, unix, + unix_sigpipe, unlikely, unmarked_api, unpin, @@ -1558,6 +1584,7 @@ symbols! { va_list, va_start, val, + validity, values, var, variant_count, @@ -1801,6 +1828,11 @@ impl Symbol { Symbol(SymbolIndex::from_u32(n)) } + /// for use in Decoder only + pub fn new_from_decoded(n: u32) -> Self { + Self::new(n) + } + /// Maps a string to its interned representation. pub fn intern(string: &str) -> Self { with_session_globals(|session_globals| session_globals.symbol_interner.intern(string)) @@ -1850,14 +1882,14 @@ impl fmt::Display for Symbol { } impl<S: Encoder> Encodable<S> for Symbol { - fn encode(&self, s: &mut S) { + default fn encode(&self, s: &mut S) { s.emit_str(self.as_str()); } } impl<D: Decoder> Decodable<D> for Symbol { #[inline] - fn decode(d: &mut D) -> Symbol { + default fn decode(d: &mut D) -> Symbol { Symbol::intern(&d.read_str()) } } @@ -2025,6 +2057,11 @@ impl Symbol { pub fn can_be_raw(self) -> bool { self != kw::Empty && self != kw::Underscore && !self.is_path_segment_keyword() } + + /// Is this symbol was interned in compiler's `symbols!` macro + pub fn is_preinterned(self) -> bool { + self.as_u32() < PREINTERNED_SYMBOLS_COUNT + } } impl Ident { |