1
Fork 0

Rollup merge of #133545 - clubby789:symbol-intern-lit, r=jieyouxu

Lint against Symbol::intern on a string literal

Disabled in tests where this doesn't make much sense
This commit is contained in:
Matthias Krüger 2024-12-03 17:27:06 +01:00 committed by GitHub
commit 453a1a8b7f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
20 changed files with 94 additions and 37 deletions

View file

@ -298,6 +298,7 @@ symbols! {
Return,
Right,
Rust,
RustaceansAreAwesome,
RustcDecodable,
RustcEncodable,
RwLock,
@ -316,6 +317,7 @@ symbols! {
StructuralPartialEq,
SubdiagMessage,
Subdiagnostic,
SymbolIntern,
Sync,
SyncUnsafeCell,
T,
@ -377,6 +379,7 @@ symbols! {
adt_const_params,
advanced_slice_patterns,
adx_target_feature,
aes,
aggregate_raw_ptr,
alias,
align,
@ -440,6 +443,7 @@ symbols! {
associated_types,
assume,
assume_init,
asterisk: "*",
async_await,
async_call,
async_call_mut,
@ -521,6 +525,7 @@ symbols! {
btreeset_iter,
builtin_syntax,
c,
c_dash_variadic,
c_str,
c_str_literals,
c_unwind,
@ -651,6 +656,7 @@ symbols! {
const_trait_bound_opt_out,
const_trait_impl,
const_try,
const_ty_placeholder: "<const_ty>",
constant,
constructor,
convert_identity,
@ -780,6 +786,7 @@ symbols! {
drop_types_in_const,
dropck_eyepatch,
dropck_parametricity,
dummy_cgu_name,
dylib,
dyn_compatible_for_dispatch,
dyn_metadata,
@ -923,6 +930,7 @@ symbols! {
fmuladdf32,
fmuladdf64,
fn_align,
fn_body,
fn_delegation,
fn_must_use,
fn_mut,
@ -963,6 +971,7 @@ symbols! {
fs_create_dir,
fsub_algebraic,
fsub_fast,
fsxr,
full,
fundamental,
fused_iterator,
@ -1386,6 +1395,7 @@ symbols! {
on,
on_unimplemented,
opaque,
opaque_module_name_placeholder: "<opaque>",
open_options_new,
ops,
opt_out_copy,
@ -1655,6 +1665,7 @@ symbols! {
rust_eh_catch_typeinfo,
rust_eh_personality,
rust_logo,
rust_out,
rustc,
rustc_abi,
rustc_allocator,
@ -1777,6 +1788,8 @@ symbols! {
self_in_typedefs,
self_struct_ctor,
semitransparent,
sha2,
sha3,
sha512_sm_x86,
shadow_call_stack,
shallow,
@ -1891,6 +1904,7 @@ symbols! {
sreg,
sreg_low16,
sse,
sse2,
sse4a_target_feature,
stable,
staged_api,
@ -2178,6 +2192,7 @@ symbols! {
wrapping_sub,
wreg,
write_bytes,
write_fmt,
write_macro,
write_str,
write_via_move,
@ -2407,6 +2422,7 @@ impl Symbol {
}
/// Maps a string to its interned representation.
#[rustc_diagnostic_item = "SymbolIntern"]
pub fn intern(string: &str) -> Self {
with_session_globals(|session_globals| session_globals.symbol_interner.intern(string))
}