Rollup merge of #136114 - compiler-errors:more-idents, r=jieyouxu
Use identifiers more in diagnostics code This should make the diagnostics code slightly more correct when rendering idents in mixed crate edition situations. Kinda a no-op, but a cleanup regardless. r? oli-obk or reassign
This commit is contained in:
commit
03fdcffa1e
31 changed files with 97 additions and 90 deletions
|
@ -5,7 +5,7 @@ use rustc_middle::mir::AssertKind;
|
|||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_session::lint::{self, Lint};
|
||||
use rustc_span::def_id::DefId;
|
||||
use rustc_span::{Span, Symbol};
|
||||
use rustc_span::{Ident, Span, Symbol};
|
||||
|
||||
use crate::fluent_generated as fluent;
|
||||
|
||||
|
@ -114,7 +114,7 @@ pub(crate) struct FnItemRef {
|
|||
#[suggestion(code = "{sugg}", applicability = "unspecified")]
|
||||
pub span: Span,
|
||||
pub sugg: String,
|
||||
pub ident: String,
|
||||
pub ident: Ident,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
|
|
|
@ -168,7 +168,7 @@ impl<'tcx> FunctionItemRefChecker<'_, 'tcx> {
|
|||
s
|
||||
}
|
||||
};
|
||||
let ident = self.tcx.item_name(fn_id).to_ident_string();
|
||||
let ident = self.tcx.item_ident(fn_id);
|
||||
let ty_params = fn_args.types().map(|ty| format!("{ty}"));
|
||||
let const_params = fn_args.consts().map(|c| format!("{c}"));
|
||||
let params = ty_params.chain(const_params).join(", ");
|
||||
|
@ -177,7 +177,7 @@ impl<'tcx> FunctionItemRefChecker<'_, 'tcx> {
|
|||
let ret = if fn_sig.output().skip_binder().is_unit() { "" } else { " -> _" };
|
||||
let sugg = format!(
|
||||
"{} as {}{}fn({}{}){}",
|
||||
if params.is_empty() { ident.clone() } else { format!("{ident}::<{params}>") },
|
||||
if params.is_empty() { ident.to_string() } else { format!("{ident}::<{params}>") },
|
||||
unsafety,
|
||||
abi,
|
||||
vec!["_"; num_args].join(", "),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue