1
Fork 0

avoid some Symbol to String conversions

This commit is contained in:
Takayuki Maeda 2022-07-17 04:09:20 +09:00
parent 95e77648e4
commit c54d4ada26
18 changed files with 50 additions and 59 deletions

View file

@ -19,8 +19,7 @@ use rustc_middle::ty::subst::InternalSubsts;
use rustc_middle::ty::Region;
use rustc_middle::ty::TypeVisitor;
use rustc_middle::ty::{self, RegionVid, Ty};
use rustc_span::symbol::sym;
use rustc_span::symbol::Ident;
use rustc_span::symbol::{kw, sym, Ident};
use rustc_span::Span;
use crate::borrowck_errors;
@ -758,7 +757,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
return;
};
let lifetime = if f.has_name() { fr_name.to_string() } else { "'_".to_string() };
let lifetime = if f.has_name() { fr_name.name } else { kw::UnderscoreLifetime };
let arg = match param.param.pat.simple_ident() {
Some(simple_ident) => format!("argument `{}`", simple_ident),
@ -770,7 +769,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
self.infcx.tcx,
diag,
fn_returns,
lifetime,
lifetime.to_string(),
Some(arg),
captures,
Some((param.param_ty_span, param.param_ty.to_string())),