mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
Make BoundRegion have a kind of BoungRegionKind
This commit is contained in:
parent
6340607aca
commit
328fcee4af
@ -64,7 +64,7 @@ pub(crate) fn fn_sig_for_fn_abi<'tcx>(tcx: TyCtxt<'tcx>, instance: Instance<'tcx
|
||||
ty::Generator(_, substs, _) => {
|
||||
let sig = substs.as_generator().poly_sig();
|
||||
|
||||
let env_region = ty::ReLateBound(ty::INNERMOST, ty::BrEnv);
|
||||
let env_region = ty::ReLateBound(ty::INNERMOST, ty::BoundRegion { kind: ty::BrEnv });
|
||||
let env_ty = tcx.mk_mut_ref(tcx.mk_region(env_region), ty);
|
||||
|
||||
let pin_did = tcx.require_lang_item(rustc_hir::LangItem::Pin, None);
|
||||
|
@ -625,7 +625,8 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> {
|
||||
r: ty::Region<'tcx>,
|
||||
) -> ty::Region<'tcx> {
|
||||
let var = self.canonical_var(info, r.into());
|
||||
let region = ty::ReLateBound(self.binder_index, ty::BoundRegion::BrAnon(var.as_u32()));
|
||||
let br = ty::BoundRegion { kind: ty::BrAnon(var.as_u32()) };
|
||||
let region = ty::ReLateBound(self.binder_index, br);
|
||||
self.tcx().mk_region(region)
|
||||
}
|
||||
|
||||
|
@ -87,6 +87,6 @@ where
|
||||
c => bug!("{:?} is a const but value is {:?}", bound_ct, c),
|
||||
};
|
||||
|
||||
tcx.replace_escaping_bound_vars(value, fld_r, fld_t, fld_c).0
|
||||
tcx.replace_escaping_bound_vars(value, fld_r, fld_t, fld_c)
|
||||
}
|
||||
}
|
||||
|
@ -165,7 +165,9 @@ fn msg_span_from_early_bound_and_free_regions(
|
||||
}
|
||||
(format!("the lifetime `{}` as defined on", br.name), sp)
|
||||
}
|
||||
ty::ReFree(ty::FreeRegion { bound_region: ty::BoundRegion::BrNamed(_, name), .. }) => {
|
||||
ty::ReFree(ty::FreeRegion {
|
||||
bound_region: ty::BoundRegionKind::BrNamed(_, name), ..
|
||||
}) => {
|
||||
let mut sp = sm.guess_head_span(tcx.hir().span(node));
|
||||
if let Some(param) =
|
||||
tcx.hir().get_generics(scope).and_then(|generics| generics.get_named(name))
|
||||
@ -2279,7 +2281,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
&self,
|
||||
var_origin: RegionVariableOrigin,
|
||||
) -> DiagnosticBuilder<'tcx> {
|
||||
let br_string = |br: ty::BoundRegion| {
|
||||
let br_string = |br: ty::BoundRegionKind| {
|
||||
let mut s = match br {
|
||||
ty::BrNamed(_, name) => name.to_string(),
|
||||
_ => String::new(),
|
||||
|
@ -25,7 +25,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
|
||||
pub(super) fn find_anon_type(
|
||||
&self,
|
||||
region: Region<'tcx>,
|
||||
br: &ty::BoundRegion,
|
||||
br: &ty::BoundRegionKind,
|
||||
) -> Option<(&hir::Ty<'tcx>, &hir::FnDecl<'tcx>)> {
|
||||
if let Some(anon_reg) = self.tcx().is_suitable_region(region) {
|
||||
let hir_id = self.tcx().hir().local_def_id_to_hir_id(anon_reg.def_id);
|
||||
@ -56,7 +56,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
|
||||
fn find_component_for_bound_region(
|
||||
&self,
|
||||
arg: &'tcx hir::Ty<'tcx>,
|
||||
br: &ty::BoundRegion,
|
||||
br: &ty::BoundRegionKind,
|
||||
) -> Option<&'tcx hir::Ty<'tcx>> {
|
||||
let mut nested_visitor = FindNestedTypeVisitor {
|
||||
tcx: self.tcx(),
|
||||
@ -80,7 +80,7 @@ struct FindNestedTypeVisitor<'tcx> {
|
||||
tcx: TyCtxt<'tcx>,
|
||||
// The bound_region corresponding to the Refree(freeregion)
|
||||
// associated with the anonymous region we are looking for.
|
||||
bound_region: ty::BoundRegion,
|
||||
bound_region: ty::BoundRegionKind,
|
||||
// The type where the anonymous lifetime appears
|
||||
// for e.g., Vec<`&u8`> and <`&u8`>
|
||||
found_type: Option<&'tcx hir::Ty<'tcx>>,
|
||||
@ -207,7 +207,7 @@ impl Visitor<'tcx> for FindNestedTypeVisitor<'tcx> {
|
||||
struct TyPathVisitor<'tcx> {
|
||||
tcx: TyCtxt<'tcx>,
|
||||
found_it: bool,
|
||||
bound_region: ty::BoundRegion,
|
||||
bound_region: ty::BoundRegionKind,
|
||||
current_index: ty::DebruijnIndex,
|
||||
}
|
||||
|
||||
|
@ -14,8 +14,8 @@ pub(super) struct AnonymousParamInfo<'tcx> {
|
||||
pub param: &'tcx hir::Param<'tcx>,
|
||||
/// The type corresponding to the anonymous region parameter.
|
||||
pub param_ty: Ty<'tcx>,
|
||||
/// The ty::BoundRegion corresponding to the anonymous region.
|
||||
pub bound_region: ty::BoundRegion,
|
||||
/// The ty::BoundRegionKind corresponding to the anonymous region.
|
||||
pub bound_region: ty::BoundRegionKind,
|
||||
/// The `Span` of the parameter type.
|
||||
pub param_ty_span: Span,
|
||||
/// Signals that the argument is the first parameter in the declaration.
|
||||
@ -43,7 +43,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
|
||||
ty::ReFree(ref free_region) => (free_region.scope, free_region.bound_region),
|
||||
ty::ReEarlyBound(ebr) => (
|
||||
self.tcx().parent(ebr.def_id).unwrap(),
|
||||
ty::BoundRegion::BrNamed(ebr.def_id, ebr.name),
|
||||
ty::BoundRegionKind::BrNamed(ebr.def_id, ebr.name),
|
||||
),
|
||||
_ => return None, // not a free region
|
||||
};
|
||||
@ -145,7 +145,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
|
||||
pub(super) fn is_return_type_anon(
|
||||
&self,
|
||||
scope_def_id: LocalDefId,
|
||||
br: ty::BoundRegion,
|
||||
br: ty::BoundRegionKind,
|
||||
decl: &hir::FnDecl<'_>,
|
||||
) -> Option<Span> {
|
||||
let ret_ty = self.tcx().type_of(scope_def_id);
|
||||
|
@ -77,10 +77,10 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
// (i.e., if there are no placeholders).
|
||||
let next_universe = self.universe().next_universe();
|
||||
|
||||
let fld_r = |br| {
|
||||
let fld_r = |br: ty::BoundRegion| {
|
||||
self.tcx.mk_region(ty::RePlaceholder(ty::PlaceholderRegion {
|
||||
universe: next_universe,
|
||||
name: br,
|
||||
name: br.kind,
|
||||
}))
|
||||
};
|
||||
|
||||
|
@ -450,7 +450,7 @@ pub enum RegionVariableOrigin {
|
||||
|
||||
/// Region variables created for bound regions
|
||||
/// in a function or method that is called
|
||||
LateBoundRegion(Span, ty::BoundRegion, LateBoundRegionConversionTime),
|
||||
LateBoundRegion(Span, ty::BoundRegionKind, LateBoundRegionConversionTime),
|
||||
|
||||
UpvarRegion(ty::UpvarId, Span),
|
||||
|
||||
@ -1421,7 +1421,8 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
where
|
||||
T: TypeFoldable<'tcx>,
|
||||
{
|
||||
let fld_r = |br| self.next_region_var(LateBoundRegion(span, br, lbrct));
|
||||
let fld_r =
|
||||
|br: ty::BoundRegion| self.next_region_var(LateBoundRegion(span, br.kind, lbrct));
|
||||
let fld_t = |_| {
|
||||
self.next_ty_var(TypeVariableOrigin {
|
||||
kind: TypeVariableOriginKind::MiscVariable,
|
||||
|
@ -176,7 +176,7 @@ where
|
||||
universe
|
||||
});
|
||||
|
||||
let placeholder = ty::PlaceholderRegion { universe, name: br };
|
||||
let placeholder = ty::PlaceholderRegion { universe, name: br.kind };
|
||||
delegate.next_placeholder_region(placeholder)
|
||||
} else {
|
||||
delegate.next_existential_region_var(true)
|
||||
|
@ -70,16 +70,16 @@ impl<'a> HashStable<StableHashingContext<'a>> for ty::RegionKind {
|
||||
ty::ReEmpty(universe) => {
|
||||
universe.hash_stable(hcx, hasher);
|
||||
}
|
||||
ty::ReLateBound(db, ty::BrAnon(i)) => {
|
||||
ty::ReLateBound(db, ty::BoundRegion { kind: ty::BrAnon(i) }) => {
|
||||
db.hash_stable(hcx, hasher);
|
||||
i.hash_stable(hcx, hasher);
|
||||
}
|
||||
ty::ReLateBound(db, ty::BrNamed(def_id, name)) => {
|
||||
ty::ReLateBound(db, ty::BoundRegion { kind: ty::BrNamed(def_id, name) }) => {
|
||||
db.hash_stable(hcx, hasher);
|
||||
def_id.hash_stable(hcx, hasher);
|
||||
name.hash_stable(hcx, hasher);
|
||||
}
|
||||
ty::ReLateBound(db, ty::BrEnv) => {
|
||||
ty::ReLateBound(db, ty::BoundRegion { kind: ty::BrEnv }) => {
|
||||
db.hash_stable(hcx, hasher);
|
||||
}
|
||||
ty::ReEarlyBound(ty::EarlyBoundRegion { def_id, index, name }) => {
|
||||
|
@ -323,9 +323,10 @@ impl<'tcx> CanonicalVarValues<'tcx> {
|
||||
GenericArgKind::Type(..) => {
|
||||
tcx.mk_ty(ty::Bound(ty::INNERMOST, ty::BoundVar::from_u32(i).into())).into()
|
||||
}
|
||||
GenericArgKind::Lifetime(..) => tcx
|
||||
.mk_region(ty::ReLateBound(ty::INNERMOST, ty::BoundRegion::BrAnon(i)))
|
||||
.into(),
|
||||
GenericArgKind::Lifetime(..) => {
|
||||
let br = ty::BoundRegion { kind: ty::BrAnon(i) };
|
||||
tcx.mk_region(ty::ReLateBound(ty::INNERMOST, br)).into()
|
||||
}
|
||||
GenericArgKind::Const(ct) => tcx
|
||||
.mk_const(ty::Const {
|
||||
ty: ct.ty,
|
||||
|
@ -889,7 +889,7 @@ pub struct FreeRegionInfo {
|
||||
// `LocalDefId` corresponding to FreeRegion
|
||||
pub def_id: LocalDefId,
|
||||
// the bound region corresponding to FreeRegion
|
||||
pub boundregion: ty::BoundRegion,
|
||||
pub boundregion: ty::BoundRegionKind,
|
||||
// checks if bound region is in Impl Item
|
||||
pub is_impl_item: bool,
|
||||
}
|
||||
@ -1411,7 +1411,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
})
|
||||
}
|
||||
|
||||
// Returns the `DefId` and the `BoundRegion` corresponding to the given region.
|
||||
// Returns the `DefId` and the `BoundRegionKind` corresponding to the given region.
|
||||
pub fn is_suitable_region(self, region: Region<'tcx>) -> Option<FreeRegionInfo> {
|
||||
let (suitable_region_binding_scope, bound_region) = match *region {
|
||||
ty::ReFree(ref free_region) => {
|
||||
@ -1419,7 +1419,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
}
|
||||
ty::ReEarlyBound(ref ebr) => (
|
||||
self.parent(ebr.def_id).unwrap().expect_local(),
|
||||
ty::BoundRegion::BrNamed(ebr.def_id, ebr.name),
|
||||
ty::BoundRegionKind::BrNamed(ebr.def_id, ebr.name),
|
||||
),
|
||||
_ => return None, // not a free region
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::traits::{ObligationCause, ObligationCauseCode};
|
||||
use crate::ty::diagnostics::suggest_constraining_type_param;
|
||||
use crate::ty::{self, BoundRegion, Region, Ty, TyCtxt};
|
||||
use crate::ty::{self, BoundRegionKind, Region, Ty, TyCtxt};
|
||||
use rustc_ast as ast;
|
||||
use rustc_errors::Applicability::{MachineApplicable, MaybeIncorrect};
|
||||
use rustc_errors::{pluralize, DiagnosticBuilder};
|
||||
@ -42,8 +42,8 @@ pub enum TypeError<'tcx> {
|
||||
ArgCount,
|
||||
|
||||
RegionsDoesNotOutlive(Region<'tcx>, Region<'tcx>),
|
||||
RegionsInsufficientlyPolymorphic(BoundRegion, Region<'tcx>),
|
||||
RegionsOverlyPolymorphic(BoundRegion, Region<'tcx>),
|
||||
RegionsInsufficientlyPolymorphic(BoundRegionKind, Region<'tcx>),
|
||||
RegionsOverlyPolymorphic(BoundRegionKind, Region<'tcx>),
|
||||
RegionsPlaceholderMismatch,
|
||||
|
||||
Sorts(ExpectedFound<Ty<'tcx>>),
|
||||
@ -94,7 +94,7 @@ impl<'tcx> fmt::Display for TypeError<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
let br_string = |br: ty::BoundRegion| match br {
|
||||
let br_string = |br: ty::BoundRegionKind| match br {
|
||||
ty::BrNamed(_, name) => format!(" {}", name),
|
||||
_ => String::new(),
|
||||
};
|
||||
|
@ -534,8 +534,8 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
/// results returned by the closure; the closure is expected to
|
||||
/// return a free region (relative to this binder), and hence the
|
||||
/// binder is removed in the return type. The closure is invoked
|
||||
/// once for each unique `BoundRegion`; multiple references to the
|
||||
/// same `BoundRegion` will reuse the previous result. A map is
|
||||
/// once for each unique `BoundRegionKind`; multiple references to the
|
||||
/// same `BoundRegionKind` will reuse the previous result. A map is
|
||||
/// returned at the end with each bound region and the free region
|
||||
/// that replaced it.
|
||||
///
|
||||
@ -544,7 +544,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
pub fn replace_late_bound_regions<T, F>(
|
||||
self,
|
||||
value: Binder<T>,
|
||||
fld_r: F,
|
||||
mut fld_r: F,
|
||||
) -> (T, BTreeMap<ty::BoundRegion, ty::Region<'tcx>>)
|
||||
where
|
||||
F: FnMut(ty::BoundRegion) -> ty::Region<'tcx>,
|
||||
@ -555,7 +555,10 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
let fld_c = |bound_ct, ty| {
|
||||
self.mk_const(ty::Const { val: ty::ConstKind::Bound(ty::INNERMOST, bound_ct), ty })
|
||||
};
|
||||
self.replace_escaping_bound_vars(value.skip_binder(), fld_r, fld_t, fld_c)
|
||||
let mut region_map = BTreeMap::new();
|
||||
let real_fld_r = |br: ty::BoundRegion| *region_map.entry(br).or_insert_with(|| fld_r(br));
|
||||
let value = self.replace_escaping_bound_vars(value.skip_binder(), real_fld_r, fld_t, fld_c);
|
||||
(value, region_map)
|
||||
}
|
||||
|
||||
/// Replaces all escaping bound vars. The `fld_r` closure replaces escaping
|
||||
@ -567,34 +570,18 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
mut fld_r: F,
|
||||
mut fld_t: G,
|
||||
mut fld_c: H,
|
||||
) -> (T, BTreeMap<ty::BoundRegion, ty::Region<'tcx>>)
|
||||
) -> T
|
||||
where
|
||||
F: FnMut(ty::BoundRegion) -> ty::Region<'tcx>,
|
||||
G: FnMut(ty::BoundTy) -> Ty<'tcx>,
|
||||
H: FnMut(ty::BoundVar, Ty<'tcx>) -> &'tcx ty::Const<'tcx>,
|
||||
T: TypeFoldable<'tcx>,
|
||||
{
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
|
||||
let mut region_map = BTreeMap::new();
|
||||
let mut type_map = FxHashMap::default();
|
||||
let mut const_map = FxHashMap::default();
|
||||
|
||||
if !value.has_escaping_bound_vars() {
|
||||
(value, region_map)
|
||||
value
|
||||
} else {
|
||||
let mut real_fld_r = |br| *region_map.entry(br).or_insert_with(|| fld_r(br));
|
||||
|
||||
let mut real_fld_t =
|
||||
|bound_ty| *type_map.entry(bound_ty).or_insert_with(|| fld_t(bound_ty));
|
||||
|
||||
let mut real_fld_c =
|
||||
|bound_ct, ty| *const_map.entry(bound_ct).or_insert_with(|| fld_c(bound_ct, ty));
|
||||
|
||||
let mut replacer =
|
||||
BoundVarReplacer::new(self, &mut real_fld_r, &mut real_fld_t, &mut real_fld_c);
|
||||
let result = value.fold_with(&mut replacer);
|
||||
(result, region_map)
|
||||
let mut replacer = BoundVarReplacer::new(self, &mut fld_r, &mut fld_t, &mut fld_c);
|
||||
value.fold_with(&mut replacer)
|
||||
}
|
||||
}
|
||||
|
||||
@ -604,7 +591,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
pub fn replace_bound_vars<T, F, G, H>(
|
||||
self,
|
||||
value: Binder<T>,
|
||||
fld_r: F,
|
||||
mut fld_r: F,
|
||||
fld_t: G,
|
||||
fld_c: H,
|
||||
) -> (T, BTreeMap<ty::BoundRegion, ty::Region<'tcx>>)
|
||||
@ -614,7 +601,10 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
H: FnMut(ty::BoundVar, Ty<'tcx>) -> &'tcx ty::Const<'tcx>,
|
||||
T: TypeFoldable<'tcx>,
|
||||
{
|
||||
self.replace_escaping_bound_vars(value.skip_binder(), fld_r, fld_t, fld_c)
|
||||
let mut region_map = BTreeMap::new();
|
||||
let real_fld_r = |br: ty::BoundRegion| *region_map.entry(br).or_insert_with(|| fld_r(br));
|
||||
let value = self.replace_escaping_bound_vars(value.skip_binder(), real_fld_r, fld_t, fld_c);
|
||||
(value, region_map)
|
||||
}
|
||||
|
||||
/// Replaces any late-bound regions bound in `value` with
|
||||
@ -626,7 +616,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
self.replace_late_bound_regions(value, |br| {
|
||||
self.mk_region(ty::ReFree(ty::FreeRegion {
|
||||
scope: all_outlive_scope,
|
||||
bound_region: br,
|
||||
bound_region: br.kind,
|
||||
}))
|
||||
})
|
||||
.0
|
||||
@ -639,7 +629,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
pub fn collect_constrained_late_bound_regions<T>(
|
||||
self,
|
||||
value: &Binder<T>,
|
||||
) -> FxHashSet<ty::BoundRegion>
|
||||
) -> FxHashSet<ty::BoundRegionKind>
|
||||
where
|
||||
T: TypeFoldable<'tcx>,
|
||||
{
|
||||
@ -650,7 +640,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
pub fn collect_referenced_late_bound_regions<T>(
|
||||
self,
|
||||
value: &Binder<T>,
|
||||
) -> FxHashSet<ty::BoundRegion>
|
||||
) -> FxHashSet<ty::BoundRegionKind>
|
||||
where
|
||||
T: TypeFoldable<'tcx>,
|
||||
{
|
||||
@ -661,7 +651,7 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
self,
|
||||
value: &Binder<T>,
|
||||
just_constraint: bool,
|
||||
) -> FxHashSet<ty::BoundRegion>
|
||||
) -> FxHashSet<ty::BoundRegionKind>
|
||||
where
|
||||
T: TypeFoldable<'tcx>,
|
||||
{
|
||||
@ -695,7 +685,8 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
let mut counter = 0;
|
||||
Binder::bind(
|
||||
self.replace_late_bound_regions(sig, |_| {
|
||||
let r = self.mk_region(ty::ReLateBound(ty::INNERMOST, ty::BrAnon(counter)));
|
||||
let br = ty::BoundRegion { kind: ty::BrAnon(counter) };
|
||||
let r = self.mk_region(ty::ReLateBound(ty::INNERMOST, br));
|
||||
counter += 1;
|
||||
r
|
||||
})
|
||||
@ -955,7 +946,7 @@ impl<'tcx> TypeVisitor<'tcx> for HasTypeFlagsVisitor {
|
||||
/// into a hash set.
|
||||
struct LateBoundRegionsCollector {
|
||||
current_index: ty::DebruijnIndex,
|
||||
regions: FxHashSet<ty::BoundRegion>,
|
||||
regions: FxHashSet<ty::BoundRegionKind>,
|
||||
|
||||
/// `true` if we only want regions that are known to be
|
||||
/// "constrained" when you equate this type with another type. In
|
||||
@ -1014,7 +1005,7 @@ impl<'tcx> TypeVisitor<'tcx> for LateBoundRegionsCollector {
|
||||
fn visit_region(&mut self, r: ty::Region<'tcx>) -> ControlFlow<Self::BreakTy> {
|
||||
if let ty::ReLateBound(debruijn, br) = *r {
|
||||
if debruijn == self.current_index {
|
||||
self.regions.insert(br);
|
||||
self.regions.insert(br.kind);
|
||||
}
|
||||
}
|
||||
ControlFlow::CONTINUE
|
||||
|
@ -2455,7 +2455,8 @@ impl<'tcx> ty::Instance<'tcx> {
|
||||
ty::Generator(_, substs, _) => {
|
||||
let sig = substs.as_generator().poly_sig();
|
||||
|
||||
let env_region = ty::ReLateBound(ty::INNERMOST, ty::BrEnv);
|
||||
let br = ty::BoundRegion { kind: ty::BrEnv };
|
||||
let env_region = ty::ReLateBound(ty::INNERMOST, br);
|
||||
let env_ty = tcx.mk_mut_ref(tcx.mk_region(env_region), ty);
|
||||
|
||||
let pin_did = tcx.require_lang_item(LangItem::Pin, None);
|
||||
|
@ -51,13 +51,13 @@ use std::ops::{ControlFlow, Range};
|
||||
use std::ptr;
|
||||
use std::str;
|
||||
|
||||
pub use self::sty::BoundRegion::*;
|
||||
pub use self::sty::BoundRegionKind::*;
|
||||
pub use self::sty::InferTy::*;
|
||||
pub use self::sty::RegionKind;
|
||||
pub use self::sty::RegionKind::*;
|
||||
pub use self::sty::TyKind::*;
|
||||
pub use self::sty::{Binder, BoundTy, BoundTyKind, BoundVar};
|
||||
pub use self::sty::{BoundRegion, EarlyBoundRegion, FreeRegion, Region};
|
||||
pub use self::sty::{BoundRegion, BoundRegionKind, EarlyBoundRegion, FreeRegion, Region};
|
||||
pub use self::sty::{CanonicalPolyFnSig, FnSig, GenSig, PolyFnSig, PolyGenSig};
|
||||
pub use self::sty::{ClosureSubsts, GeneratorSubsts, TypeAndMut, UpvarSubsts};
|
||||
pub use self::sty::{ClosureSubstsParts, GeneratorSubstsParts};
|
||||
@ -1597,7 +1597,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
pub type PlaceholderRegion = Placeholder<BoundRegion>;
|
||||
pub type PlaceholderRegion = Placeholder<BoundRegionKind>;
|
||||
|
||||
pub type PlaceholderType = Placeholder<BoundVar>;
|
||||
|
||||
|
@ -125,13 +125,13 @@ pub struct RegionHighlightMode {
|
||||
highlight_regions: [Option<(ty::RegionKind, usize)>; 3],
|
||||
|
||||
/// If enabled, when printing a "free region" that originated from
|
||||
/// the given `ty::BoundRegion`, print it as "`'1`". Free regions that would ordinarily
|
||||
/// the given `ty::BoundRegionKind`, print it as "`'1`". Free regions that would ordinarily
|
||||
/// have names print as normal.
|
||||
///
|
||||
/// This is used when you have a signature like `fn foo(x: &u32,
|
||||
/// y: &'a u32)` and we want to give a name to the region of the
|
||||
/// reference `x`.
|
||||
highlight_bound_region: Option<(ty::BoundRegion, usize)>,
|
||||
highlight_bound_region: Option<(ty::BoundRegionKind, usize)>,
|
||||
}
|
||||
|
||||
impl RegionHighlightMode {
|
||||
@ -175,7 +175,7 @@ impl RegionHighlightMode {
|
||||
/// Highlight the given bound region.
|
||||
/// We can only highlight one bound region at a time. See
|
||||
/// the field `highlight_bound_region` for more detailed notes.
|
||||
pub fn highlighting_bound_region(&mut self, br: ty::BoundRegion, number: usize) {
|
||||
pub fn highlighting_bound_region(&mut self, br: ty::BoundRegionKind, number: usize) {
|
||||
assert!(self.highlight_bound_region.is_none());
|
||||
self.highlight_bound_region = Some((br, number));
|
||||
}
|
||||
@ -1611,7 +1611,7 @@ impl<F: fmt::Write> PrettyPrinter<'tcx> for FmtPrinter<'_, 'tcx, F> {
|
||||
data.name != kw::Invalid && data.name != kw::UnderscoreLifetime
|
||||
}
|
||||
|
||||
ty::ReLateBound(_, br)
|
||||
ty::ReLateBound(_, ty::BoundRegion { kind: br })
|
||||
| ty::ReFree(ty::FreeRegion { bound_region: br, .. })
|
||||
| ty::RePlaceholder(ty::Placeholder { name: br, .. }) => {
|
||||
if let ty::BrNamed(_, name) = br {
|
||||
@ -1690,7 +1690,7 @@ impl<F: fmt::Write> FmtPrinter<'_, '_, F> {
|
||||
return Ok(self);
|
||||
}
|
||||
}
|
||||
ty::ReLateBound(_, br)
|
||||
ty::ReLateBound(_, ty::BoundRegion { kind: br })
|
||||
| ty::ReFree(ty::FreeRegion { bound_region: br, .. })
|
||||
| ty::RePlaceholder(ty::Placeholder { name: br, .. }) => {
|
||||
if let ty::BrNamed(_, name) = br {
|
||||
@ -1779,10 +1779,10 @@ impl<F: fmt::Write> FmtPrinter<'_, 'tcx, F> {
|
||||
let mut region_index = self.region_index;
|
||||
let new_value = self.tcx.replace_late_bound_regions(value.clone(), |br| {
|
||||
let _ = start_or_continue(&mut self, "for<", ", ");
|
||||
let br = match br {
|
||||
let kind = match br.kind {
|
||||
ty::BrNamed(_, name) => {
|
||||
let _ = write!(self, "{}", name);
|
||||
br
|
||||
br.kind
|
||||
}
|
||||
ty::BrAnon(_) | ty::BrEnv => {
|
||||
let name = loop {
|
||||
@ -1796,7 +1796,7 @@ impl<F: fmt::Write> FmtPrinter<'_, 'tcx, F> {
|
||||
ty::BrNamed(DefId::local(CRATE_DEF_INDEX), name)
|
||||
}
|
||||
};
|
||||
self.tcx.mk_region(ty::ReLateBound(ty::INNERMOST, br))
|
||||
self.tcx.mk_region(ty::ReLateBound(ty::INNERMOST, ty::BoundRegion { kind }))
|
||||
});
|
||||
start_or_continue(&mut self, "", "> ")?;
|
||||
|
||||
@ -1840,7 +1840,7 @@ impl<F: fmt::Write> FmtPrinter<'_, 'tcx, F> {
|
||||
struct LateBoundRegionNameCollector<'a>(&'a mut FxHashSet<Symbol>);
|
||||
impl<'tcx> ty::fold::TypeVisitor<'tcx> for LateBoundRegionNameCollector<'_> {
|
||||
fn visit_region(&mut self, r: ty::Region<'tcx>) -> ControlFlow<Self::BreakTy> {
|
||||
if let ty::ReLateBound(_, ty::BrNamed(_, name)) = *r {
|
||||
if let ty::ReLateBound(_, ty::BoundRegion { kind: ty::BrNamed(_, name) }) = *r {
|
||||
self.0.insert(name);
|
||||
}
|
||||
r.super_visit_with(self)
|
||||
|
@ -65,7 +65,7 @@ impl fmt::Debug for ty::adjustment::Adjustment<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for ty::BoundRegion {
|
||||
impl fmt::Debug for ty::BoundRegionKind {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match *self {
|
||||
ty::BrAnon(n) => write!(f, "BrAnon({:?})", n),
|
||||
@ -308,13 +308,13 @@ TrivialTypeFoldableAndLiftImpls! {
|
||||
crate::traits::Reveal,
|
||||
crate::ty::adjustment::AutoBorrowMutability,
|
||||
crate::ty::AdtKind,
|
||||
// Including `BoundRegion` is a *bit* dubious, but direct
|
||||
// Including `BoundRegionKind` is a *bit* dubious, but direct
|
||||
// references to bound region appear in `ty::Error`, and aren't
|
||||
// really meant to be folded. In general, we can only fold a fully
|
||||
// general `Region`.
|
||||
crate::ty::BoundRegion,
|
||||
crate::ty::BoundRegionKind,
|
||||
crate::ty::AssocItem,
|
||||
crate::ty::Placeholder<crate::ty::BoundRegion>,
|
||||
crate::ty::Placeholder<crate::ty::BoundRegionKind>,
|
||||
crate::ty::ClosureKind,
|
||||
crate::ty::FreeRegion,
|
||||
crate::ty::InferTy,
|
||||
|
@ -40,12 +40,12 @@ pub struct TypeAndMut<'tcx> {
|
||||
/// at least as big as the scope `fr.scope`".
|
||||
pub struct FreeRegion {
|
||||
pub scope: DefId,
|
||||
pub bound_region: BoundRegion,
|
||||
pub bound_region: BoundRegionKind,
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, PartialOrd, Eq, Ord, Hash, TyEncodable, TyDecodable, Copy)]
|
||||
#[derive(HashStable)]
|
||||
pub enum BoundRegion {
|
||||
pub enum BoundRegionKind {
|
||||
/// An anonymous region parameter for a given fn (&T)
|
||||
BrAnon(u32),
|
||||
|
||||
@ -60,26 +60,34 @@ pub enum BoundRegion {
|
||||
BrEnv,
|
||||
}
|
||||
|
||||
impl BoundRegion {
|
||||
pub fn is_named(&self) -> bool {
|
||||
match *self {
|
||||
BoundRegion::BrNamed(_, name) => name != kw::UnderscoreLifetime,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Hash, TyEncodable, TyDecodable, Debug, PartialOrd, Ord)]
|
||||
#[derive(HashStable)]
|
||||
pub struct BoundRegion {
|
||||
pub kind: BoundRegionKind,
|
||||
}
|
||||
|
||||
impl BoundRegion {
|
||||
/// When canonicalizing, we replace unbound inference variables and free
|
||||
/// regions with anonymous late bound regions. This method asserts that
|
||||
/// we have an anonymous late bound region, which hence may refer to
|
||||
/// a canonical variable.
|
||||
pub fn assert_bound_var(&self) -> BoundVar {
|
||||
match *self {
|
||||
BoundRegion::BrAnon(var) => BoundVar::from_u32(var),
|
||||
match self.kind {
|
||||
BoundRegionKind::BrAnon(var) => BoundVar::from_u32(var),
|
||||
_ => bug!("bound region is not anonymous"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl BoundRegionKind {
|
||||
pub fn is_named(&self) -> bool {
|
||||
match *self {
|
||||
BoundRegionKind::BrNamed(_, name) => name != kw::UnderscoreLifetime,
|
||||
_ => false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// N.B., if you change this, you'll probably want to change the corresponding
|
||||
/// AST structure in `librustc_ast/ast.rs` as well.
|
||||
#[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash, TyEncodable, TyDecodable, Debug)]
|
||||
@ -1551,7 +1559,7 @@ impl RegionKind {
|
||||
pub fn has_name(&self) -> bool {
|
||||
match *self {
|
||||
RegionKind::ReEarlyBound(ebr) => ebr.has_name(),
|
||||
RegionKind::ReLateBound(_, br) => br.is_named(),
|
||||
RegionKind::ReLateBound(_, br) => br.kind.is_named(),
|
||||
RegionKind::ReFree(fr) => fr.bound_region.is_named(),
|
||||
RegionKind::ReStatic => true,
|
||||
RegionKind::ReVar(..) => false,
|
||||
|
@ -503,7 +503,8 @@ impl<'tcx> TyCtxt<'tcx> {
|
||||
closure_substs: SubstsRef<'tcx>,
|
||||
) -> Option<ty::Binder<Ty<'tcx>>> {
|
||||
let closure_ty = self.mk_closure(closure_def_id, closure_substs);
|
||||
let env_region = ty::ReLateBound(ty::INNERMOST, ty::BrEnv);
|
||||
let br = ty::BoundRegion { kind: ty::BrEnv };
|
||||
let env_region = ty::ReLateBound(ty::INNERMOST, br);
|
||||
let closure_kind_ty = closure_substs.as_closure().kind_ty();
|
||||
let closure_kind = closure_kind_ty.to_opt_closure_kind()?;
|
||||
let env_ty = match closure_kind {
|
||||
|
@ -496,7 +496,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||
// lifetimes without names with the value `'0`.
|
||||
match ty.kind() {
|
||||
ty::Ref(
|
||||
ty::RegionKind::ReLateBound(_, br)
|
||||
ty::RegionKind::ReLateBound(_, ty::BoundRegion { kind: br })
|
||||
| ty::RegionKind::RePlaceholder(ty::PlaceholderRegion { name: br, .. }),
|
||||
_,
|
||||
_,
|
||||
@ -517,7 +517,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||
let region = match ty.kind() {
|
||||
ty::Ref(region, _, _) => {
|
||||
match region {
|
||||
ty::RegionKind::ReLateBound(_, br)
|
||||
ty::RegionKind::ReLateBound(_, ty::BoundRegion { kind: br })
|
||||
| ty::RegionKind::RePlaceholder(ty::PlaceholderRegion { name: br, .. }) => {
|
||||
printer.region_highlight_mode.highlighting_bound_region(*br, counter)
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
|
||||
/// Returns `true` if a closure is inferred to be an `FnMut` closure.
|
||||
fn is_closure_fn_mut(&self, fr: RegionVid) -> bool {
|
||||
if let Some(ty::ReFree(free_region)) = self.to_error_region(fr) {
|
||||
if let ty::BoundRegion::BrEnv = free_region.bound_region {
|
||||
if let ty::BoundRegionKind::BrEnv = free_region.bound_region {
|
||||
if let DefiningTy::Closure(_, substs) =
|
||||
self.regioncx.universal_regions().defining_ty
|
||||
{
|
||||
|
@ -281,7 +281,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
|
||||
}
|
||||
|
||||
ty::ReFree(free_region) => match free_region.bound_region {
|
||||
ty::BoundRegion::BrNamed(region_def_id, name) => {
|
||||
ty::BoundRegionKind::BrNamed(region_def_id, name) => {
|
||||
// Get the span to point to, even if we don't use the name.
|
||||
let span = tcx.hir().span_if_local(region_def_id).unwrap_or(DUMMY_SP);
|
||||
debug!(
|
||||
@ -307,7 +307,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
ty::BoundRegion::BrEnv => {
|
||||
ty::BoundRegionKind::BrEnv => {
|
||||
let def_ty = self.regioncx.universal_regions().defining_ty;
|
||||
|
||||
if let DefiningTy::Closure(_, substs) = def_ty {
|
||||
@ -349,7 +349,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
ty::BoundRegion::BrAnon(_) => None,
|
||||
ty::BoundRegionKind::BrAnon(_) => None,
|
||||
},
|
||||
|
||||
ty::ReLateBound(..)
|
||||
|
@ -700,7 +700,7 @@ impl<'cx, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'cx, 'tcx> {
|
||||
debug!("replace_bound_regions_with_nll_infer_vars: br={:?}", br);
|
||||
let liberated_region = self.tcx.mk_region(ty::ReFree(ty::FreeRegion {
|
||||
scope: all_outlive_scope.to_def_id(),
|
||||
bound_region: br,
|
||||
bound_region: br.kind,
|
||||
}));
|
||||
let region_vid = self.next_nll_region_var(origin);
|
||||
indices.insert_late_bound_region(liberated_region, region_vid.to_region_vid());
|
||||
@ -795,7 +795,7 @@ fn for_each_late_bound_region_defined_on<'tcx>(
|
||||
let region_def_id = tcx.hir().local_def_id(hir_id);
|
||||
let liberated_region = tcx.mk_region(ty::ReFree(ty::FreeRegion {
|
||||
scope: fn_def_id,
|
||||
bound_region: ty::BoundRegion::BrNamed(region_def_id.to_def_id(), name),
|
||||
bound_region: ty::BoundRegionKind::BrNamed(region_def_id.to_def_id(), name),
|
||||
}));
|
||||
f(liberated_region);
|
||||
}
|
||||
|
@ -319,7 +319,7 @@ impl Printer<'tcx> for SymbolMangler<'tcx> {
|
||||
|
||||
// Late-bound lifetimes use indices starting at 1,
|
||||
// see `BinderLevel` for more details.
|
||||
ty::ReLateBound(debruijn, ty::BrAnon(i)) => {
|
||||
ty::ReLateBound(debruijn, ty::BoundRegion { kind: ty::BrAnon(i) }) => {
|
||||
let binder = &self.binders[self.binders.len() - 1 - debruijn.index()];
|
||||
let depth = binder.lifetime_depths.start + i;
|
||||
|
||||
|
@ -648,7 +648,7 @@ impl<'tcx> chalk_solve::RustIrDatabase<RustInterner<'tcx>> for RustIrDatabase<'t
|
||||
|
||||
/// Creates a `InternalSubsts` that maps each generic parameter to a higher-ranked
|
||||
/// var bound at index `0`. For types, we use a `BoundVar` index equal to
|
||||
/// the type parameter index. For regions, we use the `BoundRegion::BrNamed`
|
||||
/// the type parameter index. For regions, we use the `BoundRegionKind::BrNamed`
|
||||
/// variant (which has a `DefId`).
|
||||
fn bound_vars_for_item(tcx: TyCtxt<'tcx>, def_id: DefId) -> SubstsRef<'tcx> {
|
||||
InternalSubsts::for_item(tcx, def_id, |param, substs| match param.kind {
|
||||
@ -662,12 +662,10 @@ fn bound_vars_for_item(tcx: TyCtxt<'tcx>, def_id: DefId) -> SubstsRef<'tcx> {
|
||||
))
|
||||
.into(),
|
||||
|
||||
ty::GenericParamDefKind::Lifetime => tcx
|
||||
.mk_region(ty::RegionKind::ReLateBound(
|
||||
ty::INNERMOST,
|
||||
ty::BoundRegion::BrAnon(substs.len() as u32),
|
||||
))
|
||||
.into(),
|
||||
ty::GenericParamDefKind::Lifetime => {
|
||||
let br = ty::BoundRegion { kind: ty::BrAnon(substs.len() as u32) };
|
||||
tcx.mk_region(ty::RegionKind::ReLateBound(ty::INNERMOST, br)).into()
|
||||
}
|
||||
|
||||
ty::GenericParamDefKind::Const => tcx
|
||||
.mk_const(ty::Const {
|
||||
|
@ -35,9 +35,7 @@ use rustc_ast::ast;
|
||||
use rustc_middle::traits::{ChalkEnvironmentAndGoal, ChalkRustInterner as RustInterner};
|
||||
use rustc_middle::ty::fold::TypeFolder;
|
||||
use rustc_middle::ty::subst::{GenericArg, GenericArgKind, SubstsRef};
|
||||
use rustc_middle::ty::{
|
||||
self, Binder, BoundRegion, Region, RegionKind, Ty, TyCtxt, TypeFoldable, TypeVisitor,
|
||||
};
|
||||
use rustc_middle::ty::{self, Binder, Region, RegionKind, Ty, TyCtxt, TypeFoldable, TypeVisitor};
|
||||
use rustc_span::def_id::DefId;
|
||||
|
||||
use chalk_ir::{FnSig, ForeignDefId};
|
||||
@ -444,15 +442,15 @@ impl<'tcx> LowerInto<'tcx, chalk_ir::Lifetime<RustInterner<'tcx>>> for Region<'t
|
||||
ReEarlyBound(_) => {
|
||||
panic!("Should have already been substituted.");
|
||||
}
|
||||
ReLateBound(db, br) => match br {
|
||||
ty::BoundRegion::BrAnon(var) => {
|
||||
ReLateBound(db, br) => match br.kind {
|
||||
ty::BoundRegionKind::BrAnon(var) => {
|
||||
chalk_ir::LifetimeData::BoundVar(chalk_ir::BoundVar::new(
|
||||
chalk_ir::DebruijnIndex::new(db.as_u32()),
|
||||
*var as usize,
|
||||
var as usize,
|
||||
))
|
||||
.intern(interner)
|
||||
}
|
||||
ty::BoundRegion::BrNamed(_def_id, _name) => unimplemented!(),
|
||||
ty::BoundRegionKind::BrNamed(_def_id, _name) => unimplemented!(),
|
||||
ty::BrEnv => unimplemented!(),
|
||||
},
|
||||
ReFree(_) => unimplemented!(),
|
||||
@ -477,13 +475,13 @@ impl<'tcx> LowerInto<'tcx, Region<'tcx>> for &chalk_ir::Lifetime<RustInterner<'t
|
||||
let kind = match self.data(interner) {
|
||||
chalk_ir::LifetimeData::BoundVar(var) => ty::RegionKind::ReLateBound(
|
||||
ty::DebruijnIndex::from_u32(var.debruijn.depth()),
|
||||
ty::BoundRegion::BrAnon(var.index as u32),
|
||||
ty::BoundRegion { kind: ty::BrAnon(var.index as u32) },
|
||||
),
|
||||
chalk_ir::LifetimeData::InferenceVar(_var) => unimplemented!(),
|
||||
chalk_ir::LifetimeData::Placeholder(p) => {
|
||||
ty::RegionKind::RePlaceholder(ty::Placeholder {
|
||||
universe: ty::UniverseIndex::from_usize(p.ui.counter),
|
||||
name: ty::BoundRegion::BrAnon(p.idx as u32),
|
||||
name: ty::BoundRegionKind::BrAnon(p.idx as u32),
|
||||
})
|
||||
}
|
||||
chalk_ir::LifetimeData::Static => ty::RegionKind::ReStatic,
|
||||
@ -805,7 +803,7 @@ impl<'tcx> LowerInto<'tcx, chalk_solve::rust_ir::AliasEqBound<RustInterner<'tcx>
|
||||
}
|
||||
|
||||
/// To collect bound vars, we have to do two passes. In the first pass, we
|
||||
/// collect all `BoundRegion`s and `ty::Bound`s. In the second pass, we then
|
||||
/// collect all `BoundRegionKind`s and `ty::Bound`s. In the second pass, we then
|
||||
/// replace `BrNamed` into `BrAnon`. The two separate passes are important,
|
||||
/// since we can only replace `BrNamed` with `BrAnon`s with indices *after* all
|
||||
/// "real" `BrAnon`s.
|
||||
@ -893,14 +891,14 @@ impl<'tcx> TypeVisitor<'tcx> for BoundVarsCollector<'tcx> {
|
||||
|
||||
fn visit_region(&mut self, r: Region<'tcx>) -> ControlFlow<Self::BreakTy> {
|
||||
match r {
|
||||
ty::ReLateBound(index, br) if *index == self.binder_index => match br {
|
||||
ty::BoundRegion::BrNamed(def_id, _name) => {
|
||||
if self.named_parameters.iter().find(|d| *d == def_id).is_none() {
|
||||
self.named_parameters.push(*def_id);
|
||||
ty::ReLateBound(index, br) if *index == self.binder_index => match br.kind {
|
||||
ty::BoundRegionKind::BrNamed(def_id, _name) => {
|
||||
if self.named_parameters.iter().find(|d| **d == def_id).is_none() {
|
||||
self.named_parameters.push(def_id);
|
||||
}
|
||||
}
|
||||
|
||||
ty::BoundRegion::BrAnon(var) => match self.parameters.entry(*var) {
|
||||
ty::BoundRegionKind::BrAnon(var) => match self.parameters.entry(var) {
|
||||
Entry::Vacant(entry) => {
|
||||
entry.insert(chalk_ir::VariableKind::Lifetime);
|
||||
}
|
||||
@ -926,7 +924,7 @@ impl<'tcx> TypeVisitor<'tcx> for BoundVarsCollector<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
/// This is used to replace `BoundRegion::BrNamed` with `BoundRegion::BrAnon`.
|
||||
/// This is used to replace `BoundRegionKind::BrNamed` with `BoundRegionKind::BrAnon`.
|
||||
/// Note: we assume that we will always have room for more bound vars. (i.e. we
|
||||
/// won't ever hit the `u32` limit in `BrAnon`s).
|
||||
struct NamedBoundVarSubstitutor<'a, 'tcx> {
|
||||
@ -955,20 +953,16 @@ impl<'a, 'tcx> TypeFolder<'tcx> for NamedBoundVarSubstitutor<'a, 'tcx> {
|
||||
|
||||
fn fold_region(&mut self, r: Region<'tcx>) -> Region<'tcx> {
|
||||
match r {
|
||||
ty::ReLateBound(index, br) if *index == self.binder_index => match br {
|
||||
ty::BoundRegion::BrNamed(def_id, _name) => {
|
||||
match self.named_parameters.get(def_id) {
|
||||
ty::ReLateBound(index, br) if *index == self.binder_index => match br.kind {
|
||||
ty::BrNamed(def_id, _name) => match self.named_parameters.get(&def_id) {
|
||||
Some(idx) => {
|
||||
return self.tcx.mk_region(RegionKind::ReLateBound(
|
||||
*index,
|
||||
BoundRegion::BrAnon(*idx),
|
||||
));
|
||||
let new_br = ty::BoundRegion { kind: ty::BrAnon(*idx) };
|
||||
return self.tcx.mk_region(RegionKind::ReLateBound(*index, new_br));
|
||||
}
|
||||
None => panic!("Missing `BrNamed`."),
|
||||
}
|
||||
}
|
||||
},
|
||||
ty::BrEnv => unimplemented!(),
|
||||
ty::BoundRegion::BrAnon(_) => {}
|
||||
ty::BrAnon(_) => {}
|
||||
},
|
||||
_ => (),
|
||||
};
|
||||
@ -1044,17 +1038,15 @@ impl<'tcx> TypeFolder<'tcx> for ParamsSubstitutor<'tcx> {
|
||||
// FIXME(chalk) - jackh726 - this currently isn't hit in any tests.
|
||||
// This covers any region variables in a goal, right?
|
||||
ty::ReEarlyBound(_re) => match self.named_regions.get(&_re.def_id) {
|
||||
Some(idx) => self.tcx.mk_region(RegionKind::ReLateBound(
|
||||
self.binder_index,
|
||||
BoundRegion::BrAnon(*idx),
|
||||
)),
|
||||
Some(idx) => {
|
||||
let br = ty::BoundRegion { kind: ty::BrAnon(*idx) };
|
||||
self.tcx.mk_region(RegionKind::ReLateBound(self.binder_index, br))
|
||||
}
|
||||
None => {
|
||||
let idx = self.named_regions.len() as u32;
|
||||
let br = ty::BoundRegion { kind: ty::BrAnon(idx) };
|
||||
self.named_regions.insert(_re.def_id, idx);
|
||||
self.tcx.mk_region(RegionKind::ReLateBound(
|
||||
self.binder_index,
|
||||
BoundRegion::BrAnon(idx),
|
||||
))
|
||||
self.tcx.mk_region(RegionKind::ReLateBound(self.binder_index, br))
|
||||
}
|
||||
},
|
||||
|
||||
@ -1096,7 +1088,7 @@ impl<'tcx> TypeVisitor<'tcx> for PlaceholdersCollector {
|
||||
fn visit_region(&mut self, r: Region<'tcx>) -> ControlFlow<Self::BreakTy> {
|
||||
match r {
|
||||
ty::RePlaceholder(p) if p.universe == self.universe_index => {
|
||||
if let ty::BoundRegion::BrAnon(anon) = p.name {
|
||||
if let ty::BoundRegionKind::BrAnon(anon) = p.name {
|
||||
self.next_anon_region_placeholder = self.next_anon_region_placeholder.max(anon);
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ crate fn evaluate_goal<'tcx>(
|
||||
|
||||
let reempty_placeholder = tcx.mk_region(ty::RegionKind::RePlaceholder(ty::Placeholder {
|
||||
universe: ty::UniverseIndex::ROOT,
|
||||
name: ty::BoundRegion::BrAnon(placeholders_collector.next_anon_region_placeholder + 1),
|
||||
name: ty::BoundRegionKind::BrAnon(placeholders_collector.next_anon_region_placeholder + 1),
|
||||
}));
|
||||
|
||||
let mut params_substitutor =
|
||||
|
@ -196,11 +196,13 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
|
||||
Some(rl::Region::LateBound(debruijn, id, _)) => {
|
||||
let name = lifetime_name(id.expect_local());
|
||||
tcx.mk_region(ty::ReLateBound(debruijn, ty::BrNamed(id, name)))
|
||||
let br = ty::BoundRegion { kind: ty::BrNamed(id, name) };
|
||||
tcx.mk_region(ty::ReLateBound(debruijn, br))
|
||||
}
|
||||
|
||||
Some(rl::Region::LateBoundAnon(debruijn, index)) => {
|
||||
tcx.mk_region(ty::ReLateBound(debruijn, ty::BrAnon(index)))
|
||||
let br = ty::BoundRegion { kind: ty::BrAnon(index) };
|
||||
tcx.mk_region(ty::ReLateBound(debruijn, br))
|
||||
}
|
||||
|
||||
Some(rl::Region::EarlyBound(index, id, _)) => {
|
||||
@ -2295,8 +2297,8 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
|
||||
fn validate_late_bound_regions(
|
||||
&self,
|
||||
constrained_regions: FxHashSet<ty::BoundRegion>,
|
||||
referenced_regions: FxHashSet<ty::BoundRegion>,
|
||||
constrained_regions: FxHashSet<ty::BoundRegionKind>,
|
||||
referenced_regions: FxHashSet<ty::BoundRegionKind>,
|
||||
generate_err: impl Fn(&str) -> rustc_errors::DiagnosticBuilder<'tcx>,
|
||||
) {
|
||||
for br in referenced_regions.difference(&constrained_regions) {
|
||||
|
@ -186,7 +186,8 @@ pub fn resolve_interior<'a, 'tcx>(
|
||||
// which means that none of the regions inside relate to any other, even if
|
||||
// typeck had previously found constraints that would cause them to be related.
|
||||
let folded = fcx.tcx.fold_regions(erased, &mut false, |_, current_depth| {
|
||||
let r = fcx.tcx.mk_region(ty::ReLateBound(current_depth, ty::BrAnon(counter)));
|
||||
let br = ty::BoundRegion { kind: ty::BrAnon(counter) };
|
||||
let r = fcx.tcx.mk_region(ty::ReLateBound(current_depth, br));
|
||||
counter += 1;
|
||||
r
|
||||
});
|
||||
|
@ -116,13 +116,12 @@ pub fn check_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem<'_>) {
|
||||
|
||||
let mk_va_list_ty = |mutbl| {
|
||||
tcx.lang_items().va_list().map(|did| {
|
||||
let region = tcx.mk_region(ty::ReLateBound(ty::INNERMOST, ty::BrAnon(0)));
|
||||
let env_region = ty::ReLateBound(ty::INNERMOST, ty::BrEnv);
|
||||
let region = tcx
|
||||
.mk_region(ty::ReLateBound(ty::INNERMOST, ty::BoundRegion { kind: ty::BrAnon(0) }));
|
||||
let env_region =
|
||||
tcx.mk_region(ty::ReLateBound(ty::INNERMOST, ty::BoundRegion { kind: ty::BrEnv }));
|
||||
let va_list_ty = tcx.type_of(did).subst(tcx, &[region.into()]);
|
||||
(
|
||||
tcx.mk_ref(tcx.mk_region(env_region), ty::TypeAndMut { ty: va_list_ty, mutbl }),
|
||||
va_list_ty,
|
||||
)
|
||||
(tcx.mk_ref(env_region, ty::TypeAndMut { ty: va_list_ty, mutbl }), va_list_ty)
|
||||
})
|
||||
};
|
||||
|
||||
@ -320,12 +319,12 @@ pub fn check_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem<'_>) {
|
||||
tcx.associated_items(tcx.lang_items().discriminant_kind_trait().unwrap());
|
||||
let discriminant_def_id = assoc_items.in_definition_order().next().unwrap().def_id;
|
||||
|
||||
let br = ty::BoundRegion { kind: ty::BrAnon(0) };
|
||||
(
|
||||
1,
|
||||
vec![tcx.mk_imm_ref(
|
||||
tcx.mk_region(ty::ReLateBound(ty::INNERMOST, ty::BrAnon(0))),
|
||||
param(0),
|
||||
)],
|
||||
vec![
|
||||
tcx.mk_imm_ref(tcx.mk_region(ty::ReLateBound(ty::INNERMOST, br)), param(0)),
|
||||
],
|
||||
tcx.mk_projection(discriminant_def_id, tcx.mk_substs([param(0).into()].iter())),
|
||||
)
|
||||
}
|
||||
|
@ -461,7 +461,7 @@ fn get_new_lifetime_name<'tcx>(
|
||||
.collect_referenced_late_bound_regions(&poly_trait_ref)
|
||||
.into_iter()
|
||||
.filter_map(|lt| {
|
||||
if let ty::BoundRegion::BrNamed(_, name) = lt {
|
||||
if let ty::BoundRegionKind::BrNamed(_, name) = lt {
|
||||
Some(name.as_str().to_string())
|
||||
} else {
|
||||
None
|
||||
|
@ -431,7 +431,9 @@ impl Clean<Option<Lifetime>> for ty::RegionKind {
|
||||
fn clean(&self, _cx: &DocContext<'_>) -> Option<Lifetime> {
|
||||
match *self {
|
||||
ty::ReStatic => Some(Lifetime::statik()),
|
||||
ty::ReLateBound(_, ty::BrNamed(_, name)) => Some(Lifetime(name)),
|
||||
ty::ReLateBound(_, ty::BoundRegion { kind: ty::BrNamed(_, name) }) => {
|
||||
Some(Lifetime(name))
|
||||
}
|
||||
ty::ReEarlyBound(ref data) => Some(Lifetime(data.name)),
|
||||
|
||||
ty::ReLateBound(..)
|
||||
|
@ -104,7 +104,9 @@ fn external_generic_args(
|
||||
.iter()
|
||||
.filter_map(|kind| match kind.unpack() {
|
||||
GenericArgKind::Lifetime(lt) => match lt {
|
||||
ty::ReLateBound(_, ty::BrAnon(_)) => Some(GenericArg::Lifetime(Lifetime::elided())),
|
||||
ty::ReLateBound(_, ty::BoundRegion { kind: ty::BrAnon(_) }) => {
|
||||
Some(GenericArg::Lifetime(Lifetime::elided()))
|
||||
}
|
||||
_ => lt.clean(cx).map(GenericArg::Lifetime),
|
||||
},
|
||||
GenericArgKind::Type(_) if skip_self => {
|
||||
|
@ -6,7 +6,7 @@ LL | let mut closure = expect_sig(|p, y| *p = y);
|
||||
|
|
||||
= note: defining type: test::{closure#0} with closure substs [
|
||||
i16,
|
||||
for<'r, 's, 't0> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed('r)) mut &ReLateBound(DebruijnIndex(0), BrNamed('s)) i32, &ReLateBound(DebruijnIndex(0), BrNamed('t0)) i32)),
|
||||
for<'r, 's, 't0> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('r) }) mut &ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('s) }) i32, &ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('t0) }) i32)),
|
||||
(),
|
||||
]
|
||||
|
||||
|
@ -6,7 +6,7 @@ LL | let mut closure = expect_sig(|p, y| *p = y);
|
||||
|
|
||||
= note: defining type: test::{closure#0} with closure substs [
|
||||
i16,
|
||||
for<'r, 's> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed('r)) mut &ReLateBound(DebruijnIndex(0), BrNamed('s)) i32, &ReLateBound(DebruijnIndex(0), BrNamed('s)) i32)),
|
||||
for<'r, 's> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('r) }) mut &ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('s) }) i32, &ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('s) }) i32)),
|
||||
(),
|
||||
]
|
||||
|
||||
|
@ -10,7 +10,7 @@ LL | | },
|
||||
|
|
||||
= note: defining type: supply::{closure#0} with closure substs [
|
||||
i16,
|
||||
for<'r, 's> extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed('r)) u32>, std::cell::Cell<&'_#2r &ReLateBound(DebruijnIndex(0), BrNamed('r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('s)) &'_#3r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('s)) u32>)),
|
||||
for<'r, 's> extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('r) }) u32>, std::cell::Cell<&'_#2r &ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('r) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('s) }) &'_#3r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('r) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('s) }) u32>)),
|
||||
(),
|
||||
]
|
||||
= note: late-bound region is '_#4r
|
||||
|
@ -11,7 +11,7 @@ LL | | });
|
||||
|
|
||||
= note: defining type: supply::{closure#0} with closure substs [
|
||||
i16,
|
||||
for<'r, 's, 't0, 't1, 't2, 't3> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed('r)) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed('s)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed('t0)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('t1)) &'_#2r u32>, &ReLateBound(DebruijnIndex(0), BrNamed('t2)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('s)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed('t3)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('t1)) u32>)),
|
||||
for<'r, 's, 't0, 't1, 't2, 't3> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('r) }) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('s) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('t0) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('t1) }) &'_#2r u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('t2) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('s) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('t3) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('t1) }) u32>)),
|
||||
(),
|
||||
]
|
||||
= note: late-bound region is '_#3r
|
||||
|
@ -10,7 +10,7 @@ LL | | })
|
||||
|
|
||||
= note: defining type: case1::{closure#0} with closure substs [
|
||||
i32,
|
||||
for<'r> extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('r)) u32>)),
|
||||
for<'r> extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('r) }) u32>)),
|
||||
(),
|
||||
]
|
||||
|
||||
@ -49,7 +49,7 @@ LL | | })
|
||||
|
|
||||
= note: defining type: case2::{closure#0} with closure substs [
|
||||
i32,
|
||||
for<'r> extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('r)) u32>)),
|
||||
for<'r> extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('r) }) u32>)),
|
||||
(),
|
||||
]
|
||||
= note: number of external vids: 2
|
||||
|
@ -12,7 +12,7 @@ LL | | });
|
||||
|
|
||||
= note: defining type: supply::{closure#0} with closure substs [
|
||||
i16,
|
||||
for<'r, 's, 't0, 't1, 't2> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed('r)) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed('s)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed('t0)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('s)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed('t1)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('t2)) u32>)),
|
||||
for<'r, 's, 't0, 't1, 't2> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('r) }) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('s) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('t0) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('s) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('t1) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('t2) }) u32>)),
|
||||
(),
|
||||
]
|
||||
= note: late-bound region is '_#2r
|
||||
|
@ -12,7 +12,7 @@ LL | | });
|
||||
|
|
||||
= note: defining type: supply::{closure#0} with closure substs [
|
||||
i16,
|
||||
for<'r, 's, 't0, 't1, 't2, 't3> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed('r)) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed('s)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed('t0)) std::cell::Cell<&'_#2r &ReLateBound(DebruijnIndex(0), BrNamed('t1)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed('t2)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('s)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed('t3)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('t1)) u32>)),
|
||||
for<'r, 's, 't0, 't1, 't2, 't3> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('r) }) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('s) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('t0) }) std::cell::Cell<&'_#2r &ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('t1) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('t2) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('s) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('t3) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('t1) }) u32>)),
|
||||
(),
|
||||
]
|
||||
= note: late-bound region is '_#3r
|
||||
|
@ -11,7 +11,7 @@ LL | | });
|
||||
|
|
||||
= note: defining type: test::{closure#0} with closure substs [
|
||||
i16,
|
||||
for<'r, 's> extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed('r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('s)) &'_#2r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('s)) u32>)),
|
||||
for<'r, 's> extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('r) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('s) }) &'_#2r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('r) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('s) }) u32>)),
|
||||
(),
|
||||
]
|
||||
= note: late-bound region is '_#3r
|
||||
|
@ -10,7 +10,7 @@ LL | | },
|
||||
|
|
||||
= note: defining type: supply::{closure#0} with closure substs [
|
||||
i16,
|
||||
for<'r, 's> extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed('r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('s)) &'_#2r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('r)) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('s)) u32>)),
|
||||
for<'r, 's> extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('r) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('s) }) &'_#2r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('r) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('s) }) u32>)),
|
||||
(),
|
||||
]
|
||||
= note: late-bound region is '_#3r
|
||||
|
@ -11,7 +11,7 @@ LL | | });
|
||||
|
|
||||
= note: defining type: supply::{closure#0} with closure substs [
|
||||
i16,
|
||||
for<'r, 's, 't0, 't1, 't2> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed('r)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('s)) &'_#1r u32>, &ReLateBound(DebruijnIndex(0), BrNamed('t0)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('t1)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed('t2)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('s)) u32>)),
|
||||
for<'r, 's, 't0, 't1, 't2> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('r) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('s) }) &'_#1r u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('t0) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('t1) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('t2) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('s) }) u32>)),
|
||||
(),
|
||||
]
|
||||
= note: late-bound region is '_#2r
|
||||
|
@ -11,7 +11,7 @@ LL | | });
|
||||
|
|
||||
= note: defining type: supply::{closure#0} with closure substs [
|
||||
i16,
|
||||
for<'r, 's, 't0, 't1, 't2, 't3> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed('r)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('s)) &'_#1r u32>, &ReLateBound(DebruijnIndex(0), BrNamed('t0)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('t1)) &'_#2r u32>, &ReLateBound(DebruijnIndex(0), BrNamed('t2)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('s)) u32>, &ReLateBound(DebruijnIndex(0), BrNamed('t3)) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('t1)) u32>)),
|
||||
for<'r, 's, 't0, 't1, 't2, 't3> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('r) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('s) }) &'_#1r u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('t0) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('t1) }) &'_#2r u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('t2) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('s) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('t3) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('t1) }) u32>)),
|
||||
(),
|
||||
]
|
||||
= note: late-bound region is '_#3r
|
||||
|
@ -6,7 +6,7 @@ LL | expect_sig(|a, b| b); // ought to return `a`
|
||||
|
|
||||
= note: defining type: test::{closure#0} with closure substs [
|
||||
i16,
|
||||
for<'r, 's> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BrNamed('r)) i32, &ReLateBound(DebruijnIndex(0), BrNamed('s)) i32)) -> &ReLateBound(DebruijnIndex(0), BrNamed('r)) i32,
|
||||
for<'r, 's> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('r) }) i32, &ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('s) }) i32)) -> &ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('r) }) i32,
|
||||
(),
|
||||
]
|
||||
|
||||
|
@ -6,7 +6,7 @@ LL | twice(cell, value, |a, b| invoke(a, b));
|
||||
|
|
||||
= note: defining type: generic::<T>::{closure#0} with closure substs [
|
||||
i16,
|
||||
for<'r, 's> extern "rust-call" fn((std::option::Option<std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed('r)) ()>>, &ReLateBound(DebruijnIndex(0), BrNamed('s)) T)),
|
||||
for<'r, 's> extern "rust-call" fn((std::option::Option<std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('r) }) ()>>, &ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('s) }) T)),
|
||||
(),
|
||||
]
|
||||
= note: number of external vids: 2
|
||||
@ -31,7 +31,7 @@ LL | twice(cell, value, |a, b| invoke(a, b));
|
||||
|
|
||||
= note: defining type: generic_fail::<T>::{closure#0} with closure substs [
|
||||
i16,
|
||||
for<'r, 's> extern "rust-call" fn((std::option::Option<std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BrNamed('r)) ()>>, &ReLateBound(DebruijnIndex(0), BrNamed('s)) T)),
|
||||
for<'r, 's> extern "rust-call" fn((std::option::Option<std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('r) }) ()>>, &ReLateBound(DebruijnIndex(0), BoundRegion { kind: BrNamed('s) }) T)),
|
||||
(),
|
||||
]
|
||||
= note: late-bound region is '_#2r
|
||||
|
Loading…
Reference in New Issue
Block a user