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

@ -9,7 +9,7 @@ use rustc_ast::{
};
use rustc_errors::{Applicability, PResult};
use rustc_span::symbol::{Ident, kw, sym};
use rustc_span::{ErrorGuaranteed, Span, Symbol};
use rustc_span::{ErrorGuaranteed, Span};
use thin_vec::{ThinVec, thin_vec};
use super::{Parser, PathStyle, SeqSep, TokenType, Trailing};
@ -1136,7 +1136,7 @@ impl<'a> Parser<'a> {
Some(ast::Path {
span: fn_token_span.to(self.prev_token.span),
segments: thin_vec![ast::PathSegment {
ident: Ident::new(Symbol::intern("Fn"), fn_token_span),
ident: Ident::new(sym::Fn, fn_token_span),
id: DUMMY_NODE_ID,
args: Some(P(ast::GenericArgs::Parenthesized(ast::ParenthesizedArgs {
span: args_lo.to(self.prev_token.span),