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

@ -3113,6 +3113,7 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
}
}
#[cfg_attr(not(bootstrap), allow(rustc::symbol_intern_string_literal))]
let existing_name = match &in_scope_lifetimes[..] {
[] => Symbol::intern("'a"),
[(existing, _)] => existing.name,

View file

@ -2257,7 +2257,7 @@ fn module_to_string(module: Module<'_>) -> Option<String> {
collect_mod(names, parent);
}
} else {
names.push(Symbol::intern("<opaque>"));
names.push(sym::opaque_module_name_placeholder);
collect_mod(names, module.parent.unwrap());
}
}