Use the existing static
and env
symbols instead of interning.
This commit is contained in:
parent
1eb53902f3
commit
bd7f301b20
3 changed files with 7 additions and 8 deletions
|
@ -35,6 +35,7 @@ use rustc_middle::ty::{
|
|||
OpaqueHiddenType, OpaqueTypeKey, RegionVid, Ty, TyCtxt, UserType, UserTypeAnnotationIndex,
|
||||
};
|
||||
use rustc_span::def_id::CRATE_DEF_ID;
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
use rustc_target::abi::{FieldIdx, FIRST_VARIANT};
|
||||
use rustc_trait_selection::traits::query::type_op::custom::scrape_region_constraints;
|
||||
|
@ -1347,9 +1348,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
|||
BoundRegionInfo::Name(Symbol::intern("anon"))
|
||||
}
|
||||
ty::BoundRegionKind::BrNamed(_, name) => BoundRegionInfo::Name(name),
|
||||
ty::BoundRegionKind::BrEnv => {
|
||||
BoundRegionInfo::Name(Symbol::intern("env"))
|
||||
}
|
||||
ty::BoundRegionKind::BrEnv => BoundRegionInfo::Name(sym::env),
|
||||
};
|
||||
|
||||
RegionCtxt::LateBound(reg_info)
|
||||
|
|
|
@ -4,6 +4,7 @@ use rustc_infer::traits::PredicateObligations;
|
|||
use rustc_middle::mir::ConstraintCategory;
|
||||
use rustc_middle::ty::relate::TypeRelation;
|
||||
use rustc_middle::ty::{self, Ty};
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::{Span, Symbol};
|
||||
use rustc_trait_selection::traits::query::Fallible;
|
||||
|
||||
|
@ -127,7 +128,7 @@ impl<'tcx> TypeRelatingDelegate<'tcx> for NllTypeRelatingDelegate<'_, '_, 'tcx>
|
|||
ty::BoundRegionKind::BrAnon(Some(span)) => BoundRegionInfo::Span(span),
|
||||
ty::BoundRegionKind::BrAnon(..) => BoundRegionInfo::Name(Symbol::intern("anon")),
|
||||
ty::BoundRegionKind::BrNamed(_, name) => BoundRegionInfo::Name(name),
|
||||
ty::BoundRegionKind::BrEnv => BoundRegionInfo::Name(Symbol::intern("env")),
|
||||
ty::BoundRegionKind::BrEnv => BoundRegionInfo::Name(sym::env),
|
||||
};
|
||||
|
||||
let reg_var =
|
||||
|
|
|
@ -24,6 +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;
|
||||
use std::iter;
|
||||
|
||||
|
@ -404,10 +405,8 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
|
|||
assert_eq!(FIRST_GLOBAL_INDEX, self.infcx.num_region_vars());
|
||||
|
||||
// Create the "global" region that is always free in all contexts: 'static.
|
||||
let fr_static = self
|
||||
.infcx
|
||||
.next_nll_region_var(FR, || RegionCtxt::Free(Symbol::intern("static")))
|
||||
.to_region_vid();
|
||||
let fr_static =
|
||||
self.infcx.next_nll_region_var(FR, || RegionCtxt::Free(kw::Static)).to_region_vid();
|
||||
|
||||
// We've now added all the global regions. The next ones we
|
||||
// add will be external.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue