1
Fork 0

Add sym::anon.

This commit is contained in:
Nicholas Nethercote 2023-04-11 14:24:59 +10:00
parent bd7f301b20
commit 7975779918
5 changed files with 6 additions and 8 deletions

View file

@ -1339,14 +1339,11 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
};
let (sig, map) = tcx.replace_late_bound_regions(sig, |br| {
use crate::renumber::{BoundRegionInfo, RegionCtxt};
use rustc_span::Symbol;
let region_ctxt_fn = || {
let reg_info = match br.kind {
ty::BoundRegionKind::BrAnon(Some(span)) => BoundRegionInfo::Span(span),
ty::BoundRegionKind::BrAnon(..) => {
BoundRegionInfo::Name(Symbol::intern("anon"))
}
ty::BoundRegionKind::BrAnon(..) => BoundRegionInfo::Name(sym::anon),
ty::BoundRegionKind::BrNamed(_, name) => BoundRegionInfo::Name(name),
ty::BoundRegionKind::BrEnv => BoundRegionInfo::Name(sym::env),
};

View file

@ -126,7 +126,7 @@ impl<'tcx> TypeRelatingDelegate<'tcx> for NllTypeRelatingDelegate<'_, '_, 'tcx>
let reg_info = match placeholder.bound.kind {
ty::BoundRegionKind::BrAnon(Some(span)) => BoundRegionInfo::Span(span),
ty::BoundRegionKind::BrAnon(..) => BoundRegionInfo::Name(Symbol::intern("anon")),
ty::BoundRegionKind::BrAnon(..) => BoundRegionInfo::Name(sym::anon),
ty::BoundRegionKind::BrNamed(_, name) => BoundRegionInfo::Name(name),
ty::BoundRegionKind::BrEnv => BoundRegionInfo::Name(sym::env),
};

View file

@ -24,7 +24,7 @@ use rustc_infer::infer::NllRegionVariableOrigin;
use rustc_middle::ty::fold::TypeFoldable;
use rustc_middle::ty::{self, InlineConstSubsts, InlineConstSubstsParts, RegionVid, Ty, TyCtxt};
use rustc_middle::ty::{InternalSubsts, SubstsRef};
use rustc_span::symbol::kw;
use rustc_span::symbol::{kw, sym};
use rustc_span::Symbol;
use std::iter;
@ -783,7 +783,7 @@ impl<'cx, 'tcx> InferCtxtExt<'tcx> for BorrowckInferCtxt<'cx, 'tcx> {
let region_vid = {
let name = match br.kind.get_name() {
Some(name) => name,
_ => Symbol::intern("anon"),
_ => sym::anon,
};
self.next_nll_region_var(origin, || RegionCtxt::Bound(BoundRegionInfo::Name(name)))

View file

@ -1637,7 +1637,7 @@ impl<'tcx> Region<'tcx> {
pub fn get_name_or_anon(self) -> Symbol {
match self.get_name() {
Some(name) => name,
None => Symbol::intern("anon"),
None => sym::anon,
}
}

View file

@ -357,6 +357,7 @@ symbols! {
always,
and,
and_then,
anon,
anonymous_lifetime_in_impl_trait,
any,
append_const_msg,