Remove index from BrAnon

This commit is contained in:
Jack Huey 2023-04-06 22:07:21 -04:00
parent e4edf00f12
commit f0edcc8a6f
33 changed files with 68 additions and 88 deletions

View file

@ -1342,9 +1342,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
let region_ctxt_fn = || { let region_ctxt_fn = || {
let reg_info = match br.kind { let reg_info = match br.kind {
ty::BoundRegionKind::BrAnon(_, Some(span)) => { ty::BoundRegionKind::BrAnon(Some(span)) => BoundRegionInfo::Span(span),
BoundRegionInfo::Span(span)
}
ty::BoundRegionKind::BrAnon(..) => { ty::BoundRegionKind::BrAnon(..) => {
BoundRegionInfo::Name(Symbol::intern("anon")) BoundRegionInfo::Name(Symbol::intern("anon"))
} }

View file

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

View file

@ -139,14 +139,14 @@ pub fn check_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem<'_>) {
let name_str = intrinsic_name.as_str(); let name_str = intrinsic_name.as_str();
let bound_vars = tcx.mk_bound_variable_kinds(&[ let bound_vars = tcx.mk_bound_variable_kinds(&[
ty::BoundVariableKind::Region(ty::BrAnon(0, None)), ty::BoundVariableKind::Region(ty::BrAnon(None)),
ty::BoundVariableKind::Region(ty::BrEnv), ty::BoundVariableKind::Region(ty::BrEnv),
]); ]);
let mk_va_list_ty = |mutbl| { let mk_va_list_ty = |mutbl| {
tcx.lang_items().va_list().map(|did| { tcx.lang_items().va_list().map(|did| {
let region = tcx.mk_re_late_bound( let region = tcx.mk_re_late_bound(
ty::INNERMOST, ty::INNERMOST,
ty::BoundRegion { var: ty::BoundVar::from_u32(0), kind: ty::BrAnon(0, None) }, ty::BoundRegion { var: ty::BoundVar::from_u32(0), kind: ty::BrAnon(None) },
); );
let env_region = tcx.mk_re_late_bound( let env_region = tcx.mk_re_late_bound(
ty::INNERMOST, ty::INNERMOST,
@ -387,8 +387,7 @@ pub fn check_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem<'_>) {
); );
let discriminant_def_id = assoc_items[0]; let discriminant_def_id = assoc_items[0];
let br = let br = ty::BoundRegion { var: ty::BoundVar::from_u32(0), kind: ty::BrAnon(None) };
ty::BoundRegion { var: ty::BoundVar::from_u32(0), kind: ty::BrAnon(0, None) };
( (
1, 1,
vec![tcx.mk_imm_ref(tcx.mk_re_late_bound(ty::INNERMOST, br), param(0))], vec![tcx.mk_imm_ref(tcx.mk_re_late_bound(ty::INNERMOST, br), param(0))],
@ -440,8 +439,7 @@ pub fn check_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem<'_>) {
sym::nontemporal_store => (1, vec![tcx.mk_mut_ptr(param(0)), param(0)], tcx.mk_unit()), sym::nontemporal_store => (1, vec![tcx.mk_mut_ptr(param(0)), param(0)], tcx.mk_unit()),
sym::raw_eq => { sym::raw_eq => {
let br = let br = ty::BoundRegion { var: ty::BoundVar::from_u32(0), kind: ty::BrAnon(None) };
ty::BoundRegion { var: ty::BoundVar::from_u32(0), kind: ty::BrAnon(0, None) };
let param_ty = tcx.mk_imm_ref(tcx.mk_re_late_bound(ty::INNERMOST, br), param(0)); let param_ty = tcx.mk_imm_ref(tcx.mk_re_late_bound(ty::INNERMOST, br), param(0));
(1, vec![param_ty; 2], tcx.types.bool) (1, vec![param_ty; 2], tcx.types.bool)
} }

View file

@ -240,7 +240,7 @@ pub fn resolve_interior<'a, 'tcx>(
let mut counter = 0; let mut counter = 0;
let mut mk_bound_region = |span| { let mut mk_bound_region = |span| {
let kind = ty::BrAnon(counter, span); let kind = ty::BrAnon(span);
let var = ty::BoundVar::from_u32(counter); let var = ty::BoundVar::from_u32(counter);
counter += 1; counter += 1;
ty::BoundRegion { var, kind } ty::BoundRegion { var, kind }
@ -263,7 +263,7 @@ pub fn resolve_interior<'a, 'tcx>(
} }
ty::ReLateBound(_, ty::BoundRegion { kind, .. }) ty::ReLateBound(_, ty::BoundRegion { kind, .. })
| ty::ReFree(ty::FreeRegion { bound_region: kind, .. }) => match kind { | ty::ReFree(ty::FreeRegion { bound_region: kind, .. }) => match kind {
ty::BoundRegionKind::BrAnon(_, span) => mk_bound_region(span), ty::BoundRegionKind::BrAnon(span) => mk_bound_region(span),
ty::BoundRegionKind::BrNamed(def_id, _) => { ty::BoundRegionKind::BrNamed(def_id, _) => {
mk_bound_region(Some(fcx.tcx.def_span(def_id))) mk_bound_region(Some(fcx.tcx.def_span(def_id)))
} }
@ -294,7 +294,7 @@ pub fn resolve_interior<'a, 'tcx>(
FnMutDelegate { FnMutDelegate {
regions: &mut |br| { regions: &mut |br| {
let kind = match br.kind { let kind = match br.kind {
ty::BrAnon(_, span) => ty::BrAnon(counter, span), ty::BrAnon(span) => ty::BrAnon(span),
_ => br.kind, _ => br.kind,
}; };
let var = ty::BoundVar::from_usize(bound_vars.len()); let var = ty::BoundVar::from_usize(bound_vars.len());

View file

@ -90,7 +90,7 @@ impl<'a> DescriptionCtx<'a> {
}; };
me.span = Some(sp); me.span = Some(sp);
} }
ty::BrAnon(_, span) => { ty::BrAnon(span) => {
me.kind = "defined_here"; me.kind = "defined_here";
me.span = match span { me.span = match span {
Some(_) => span, Some(_) => span,

View file

@ -772,7 +772,7 @@ impl<'cx, 'tcx> Canonicalizer<'cx, 'tcx> {
r: ty::Region<'tcx>, r: ty::Region<'tcx>,
) -> ty::Region<'tcx> { ) -> ty::Region<'tcx> {
let var = self.canonical_var(info, r.into()); let var = self.canonical_var(info, r.into());
let br = ty::BoundRegion { var, kind: ty::BrAnon(var.as_u32(), None) }; let br = ty::BoundRegion { var, kind: ty::BrAnon(None) };
self.interner().mk_re_late_bound(self.binder_index, br) self.interner().mk_re_late_bound(self.binder_index, br)
} }

View file

@ -174,11 +174,11 @@ fn msg_span_from_named_region<'tcx>(
.. ..
}) => (format!("the lifetime `{name}` as defined here"), Some(tcx.def_span(def_id))), }) => (format!("the lifetime `{name}` as defined here"), Some(tcx.def_span(def_id))),
ty::RePlaceholder(ty::PlaceholderRegion { ty::RePlaceholder(ty::PlaceholderRegion {
bound: ty::BoundRegion { kind: ty::BoundRegionKind::BrAnon(_, Some(span)), .. }, bound: ty::BoundRegion { kind: ty::BoundRegionKind::BrAnon(Some(span)), .. },
.. ..
}) => (format!("the anonymous lifetime defined here"), Some(span)), }) => (format!("the anonymous lifetime defined here"), Some(span)),
ty::RePlaceholder(ty::PlaceholderRegion { ty::RePlaceholder(ty::PlaceholderRegion {
bound: ty::BoundRegion { kind: ty::BoundRegionKind::BrAnon(_, None), .. }, bound: ty::BoundRegion { kind: ty::BoundRegionKind::BrAnon(None), .. },
.. ..
}) => (format!("an anonymous lifetime"), None), }) => (format!("an anonymous lifetime"), None),
_ => bug!("{:?}", region), _ => bug!("{:?}", region),
@ -226,7 +226,7 @@ fn msg_span_from_early_bound_and_free_regions<'tcx>(
}; };
(text, sp) (text, sp)
} }
ty::BrAnon(_, span) => ( ty::BrAnon(span) => (
"the anonymous lifetime as defined here".to_string(), "the anonymous lifetime as defined here".to_string(),
match span { match span {
Some(span) => span, Some(span) => span,

View file

@ -36,14 +36,14 @@ impl<'tcx> NiceRegionError<'_, 'tcx> {
ty::BrNamed(def_id, symbol) => { ty::BrNamed(def_id, symbol) => {
(Some(self.tcx().def_span(def_id)), Some(symbol)) (Some(self.tcx().def_span(def_id)), Some(symbol))
} }
ty::BrAnon(_, span) => (*span, None), ty::BrAnon(span) => (*span, None),
ty::BrEnv => (None, None), ty::BrEnv => (None, None),
}; };
let (sup_span, sup_symbol) = match sup_name { let (sup_span, sup_symbol) = match sup_name {
ty::BrNamed(def_id, symbol) => { ty::BrNamed(def_id, symbol) => {
(Some(self.tcx().def_span(def_id)), Some(symbol)) (Some(self.tcx().def_span(def_id)), Some(symbol))
} }
ty::BrAnon(_, span) => (*span, None), ty::BrAnon(span) => (*span, None),
ty::BrEnv => (None, None), ty::BrEnv => (None, None),
}; };
let diag = match (sub_span, sup_span, sub_symbol, sup_symbol) { let diag = match (sub_span, sup_span, sub_symbol, sup_symbol) {

View file

@ -411,7 +411,7 @@ impl<'tcx> CanonicalVarValues<'tcx> {
CanonicalVarKind::Region(_) | CanonicalVarKind::PlaceholderRegion(_) => { CanonicalVarKind::Region(_) | CanonicalVarKind::PlaceholderRegion(_) => {
let br = ty::BoundRegion { let br = ty::BoundRegion {
var: ty::BoundVar::from_usize(i), var: ty::BoundVar::from_usize(i),
kind: ty::BrAnon(i as u32, None), kind: ty::BrAnon(None),
}; };
tcx.mk_re_late_bound(ty::INNERMOST, br).into() tcx.mk_re_late_bound(ty::INNERMOST, br).into()
} }

View file

@ -411,10 +411,8 @@ impl<'tcx> ClosureOutlivesSubjectTy<'tcx> {
pub fn bind(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Self { pub fn bind(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Self {
let inner = tcx.fold_regions(ty, |r, depth| match r.kind() { let inner = tcx.fold_regions(ty, |r, depth| match r.kind() {
ty::ReVar(vid) => { ty::ReVar(vid) => {
let br = ty::BoundRegion { let br =
var: ty::BoundVar::new(vid.index()), ty::BoundRegion { var: ty::BoundVar::new(vid.index()), kind: ty::BrAnon(None) };
kind: ty::BrAnon(vid.as_u32(), None),
};
tcx.mk_re_late_bound(depth, br) tcx.mk_re_late_bound(depth, br)
} }
_ => bug!("unexpected region in ClosureOutlivesSubjectTy: {r:?}"), _ => bug!("unexpected region in ClosureOutlivesSubjectTy: {r:?}"),

View file

@ -311,7 +311,7 @@ pub struct CommonLifetimes<'tcx> {
pub re_vars: Vec<Region<'tcx>>, pub re_vars: Vec<Region<'tcx>>,
/// Pre-interned values of the form: /// Pre-interned values of the form:
/// `ReLateBound(DebruijnIndex(i), BoundRegion { var: v, kind: BrAnon(v, None) })` /// `ReLateBound(DebruijnIndex(i), BoundRegion { var: v, kind: BrAnon(None) })`
/// for small values of `i` and `v`. /// for small values of `i` and `v`.
pub re_late_bounds: Vec<Vec<Region<'tcx>>>, pub re_late_bounds: Vec<Vec<Region<'tcx>>>,
} }
@ -386,10 +386,7 @@ impl<'tcx> CommonLifetimes<'tcx> {
.map(|v| { .map(|v| {
mk(ty::ReLateBound( mk(ty::ReLateBound(
ty::DebruijnIndex::from(i), ty::DebruijnIndex::from(i),
ty::BoundRegion { ty::BoundRegion { var: ty::BoundVar::from(v), kind: ty::BrAnon(None) },
var: ty::BoundVar::from(v),
kind: ty::BrAnon(v, None),
},
)) ))
}) })
.collect() .collect()
@ -2075,10 +2072,9 @@ impl<'tcx> TyCtxt<'tcx> {
bound_region: ty::BoundRegion, bound_region: ty::BoundRegion,
) -> Region<'tcx> { ) -> Region<'tcx> {
// Use a pre-interned one when possible. // Use a pre-interned one when possible.
if let ty::BoundRegion { var, kind: ty::BrAnon(v, None) } = bound_region if let ty::BoundRegion { var, kind: ty::BrAnon(None) } = bound_region
&& var.as_u32() == v
&& let Some(inner) = self.lifetimes.re_late_bounds.get(debruijn.as_usize()) && let Some(inner) = self.lifetimes.re_late_bounds.get(debruijn.as_usize())
&& let Some(re) = inner.get(v as usize).copied() && let Some(re) = inner.get(var.as_usize()).copied()
{ {
re re
} else { } else {

View file

@ -379,9 +379,7 @@ impl<'tcx> TyCtxt<'tcx> {
let index = entry.index(); let index = entry.index();
let var = ty::BoundVar::from_usize(index); let var = ty::BoundVar::from_usize(index);
let kind = entry let kind = entry
.or_insert_with(|| { .or_insert_with(|| ty::BoundVariableKind::Region(ty::BrAnon(None)))
ty::BoundVariableKind::Region(ty::BrAnon(index as u32, None))
})
.expect_region(); .expect_region();
let br = ty::BoundRegion { var, kind }; let br = ty::BoundRegion { var, kind };
self.tcx.mk_re_late_bound(ty::INNERMOST, br) self.tcx.mk_re_late_bound(ty::INNERMOST, br)

View file

@ -68,7 +68,7 @@ impl<'tcx> fmt::Debug for ty::adjustment::Adjustment<'tcx> {
impl fmt::Debug for ty::BoundRegionKind { impl fmt::Debug for ty::BoundRegionKind {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self { match *self {
ty::BrAnon(n, span) => write!(f, "BrAnon({n:?}, {span:?})"), ty::BrAnon(span) => write!(f, "BrAnon({span:?})"),
ty::BrNamed(did, name) => { ty::BrNamed(did, name) => {
if did.is_crate_root() { if did.is_crate_root() {
write!(f, "BrNamed({})", name) write!(f, "BrNamed({})", name)

View file

@ -60,7 +60,7 @@ pub struct FreeRegion {
#[derive(HashStable)] #[derive(HashStable)]
pub enum BoundRegionKind { pub enum BoundRegionKind {
/// An anonymous region parameter for a given fn (&T) /// An anonymous region parameter for a given fn (&T)
BrAnon(u32, Option<Span>), BrAnon(Option<Span>),
/// Named region parameters for functions (a in &'a T) /// Named region parameters for functions (a in &'a T)
/// ///

View file

@ -1,5 +1,5 @@
use rustc_data_structures::base_n; use rustc_data_structures::base_n;
use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::intern::Interned; use rustc_data_structures::intern::Interned;
use rustc_hir as hir; use rustc_hir as hir;
use rustc_hir::def::CtorKind; use rustc_hir::def::CtorKind;
@ -81,9 +81,9 @@ pub(super) fn mangle_typeid_for_trait_ref<'tcx>(
struct BinderLevel { struct BinderLevel {
/// The range of distances from the root of what's /// The range of distances from the root of what's
/// being printed, to the lifetimes in a binder. /// being printed, to the lifetimes in a binder.
/// Specifically, a `BrAnon(i)` lifetime has depth /// Specifically, a `BrAnon` lifetime has depth
/// `lifetime_depths.start + i`, going away from the /// `lifetime_depths.start + index`, going away from the
/// the root and towards its use site, as `i` increases. /// the root and towards its use site, as the var index increases.
/// This is used to flatten rustc's pairing of `BrAnon` /// This is used to flatten rustc's pairing of `BrAnon`
/// (intra-binder disambiguation) with a `DebruijnIndex` /// (intra-binder disambiguation) with a `DebruijnIndex`
/// (binder addressing), to "true" de Bruijn indices, /// (binder addressing), to "true" de Bruijn indices,
@ -208,24 +208,15 @@ impl<'tcx> SymbolMangler<'tcx> {
where where
T: TypeVisitable<TyCtxt<'tcx>>, T: TypeVisitable<TyCtxt<'tcx>>,
{ {
// FIXME(non-lifetime-binders): What to do here?
let regions = if value.has_late_bound_regions() {
self.tcx.collect_referenced_late_bound_regions(value)
} else {
FxHashSet::default()
};
let mut lifetime_depths = let mut lifetime_depths =
self.binders.last().map(|b| b.lifetime_depths.end).map_or(0..0, |i| i..i); self.binders.last().map(|b| b.lifetime_depths.end).map_or(0..0, |i| i..i);
let lifetimes = regions // FIXME(non-lifetime-binders): What to do here?
.into_iter() let lifetimes = value
.map(|br| match br { .bound_vars()
ty::BrAnon(i, _) => i, .iter()
_ => bug!("symbol_names: non-anonymized region `{:?}` in `{:?}`", br, value), .filter(|var| matches!(var, ty::BoundVariableKind::Region(..)))
}) .count() as u32;
.max()
.map_or(0, |max| max + 1);
self.push_opt_integer_62("G", lifetimes as u64); self.push_opt_integer_62("G", lifetimes as u64);
lifetime_depths.end += lifetimes; lifetime_depths.end += lifetimes;
@ -338,9 +329,9 @@ impl<'tcx> Printer<'tcx> for &mut SymbolMangler<'tcx> {
// Late-bound lifetimes use indices starting at 1, // Late-bound lifetimes use indices starting at 1,
// see `BinderLevel` for more details. // see `BinderLevel` for more details.
ty::ReLateBound(debruijn, ty::BoundRegion { kind: ty::BrAnon(i, _), .. }) => { ty::ReLateBound(debruijn, ty::BoundRegion { var, kind: ty::BrAnon(_) }) => {
let binder = &self.binders[self.binders.len() - 1 - debruijn.index()]; let binder = &self.binders[self.binders.len() - 1 - debruijn.index()];
let depth = binder.lifetime_depths.start + i; let depth = binder.lifetime_depths.start + var.as_u32();
1 + (self.binders.last().unwrap().lifetime_depths.end - 1 - depth) 1 + (self.binders.last().unwrap().lifetime_depths.end - 1 - depth)
} }

View file

@ -257,7 +257,7 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for Canonicalizer<'_, 'tcx> {
self.primitive_var_infos.push(CanonicalVarInfo { kind }); self.primitive_var_infos.push(CanonicalVarInfo { kind });
var var
}); });
let br = ty::BoundRegion { var, kind: BrAnon(var.as_u32(), None) }; let br = ty::BoundRegion { var, kind: BrAnon(None) };
self.interner().mk_re_late_bound(self.binder_index, br) self.interner().mk_re_late_bound(self.binder_index, br)
} }

View file

@ -3017,7 +3017,7 @@ fn bind_generator_hidden_types_above<'tcx>(
if let ty::ReErased = r.kind() { if let ty::ReErased = r.kind() {
let br = ty::BoundRegion { let br = ty::BoundRegion {
var: ty::BoundVar::from_u32(counter), var: ty::BoundVar::from_u32(counter),
kind: ty::BrAnon(counter, None), kind: ty::BrAnon(None),
}; };
counter += 1; counter += 1;
r = tcx.mk_re_late_bound(current_depth, br); r = tcx.mk_re_late_bound(current_depth, br);
@ -3033,7 +3033,7 @@ fn bind_generator_hidden_types_above<'tcx>(
debug_assert!(!hidden_types.has_erased_regions()); debug_assert!(!hidden_types.has_erased_regions());
} }
let bound_vars = tcx.mk_bound_variable_kinds_from_iter(bound_vars.iter().chain( let bound_vars = tcx.mk_bound_variable_kinds_from_iter(bound_vars.iter().chain(
(num_bound_variables..counter).map(|i| ty::BoundVariableKind::Region(ty::BrAnon(i, None))), (num_bound_variables..counter).map(|_| ty::BoundVariableKind::Region(ty::BrAnon(None))),
)); ));
ty::Binder::bind_with_vars(hidden_types, bound_vars) ty::Binder::bind_with_vars(hidden_types, bound_vars)
} }

View file

@ -730,7 +730,7 @@ fn bound_vars_for_item(tcx: TyCtxt<'_>, def_id: DefId) -> SubstsRef<'_> {
ty::GenericParamDefKind::Lifetime => { ty::GenericParamDefKind::Lifetime => {
let br = ty::BoundRegion { let br = ty::BoundRegion {
var: ty::BoundVar::from_usize(substs.len()), var: ty::BoundVar::from_usize(substs.len()),
kind: ty::BrAnon(substs.len() as u32, None), kind: ty::BrAnon(None),
}; };
tcx.mk_re_late_bound(ty::INNERMOST, br).into() tcx.mk_re_late_bound(ty::INNERMOST, br).into()
} }

View file

@ -533,7 +533,7 @@ impl<'tcx> LowerInto<'tcx, Region<'tcx>> for &chalk_ir::Lifetime<RustInterner<'t
ty::DebruijnIndex::from_u32(var.debruijn.depth()), ty::DebruijnIndex::from_u32(var.debruijn.depth()),
ty::BoundRegion { ty::BoundRegion {
var: ty::BoundVar::from_usize(var.index), var: ty::BoundVar::from_usize(var.index),
kind: ty::BrAnon(var.index as u32, None), kind: ty::BrAnon(None),
}, },
), ),
chalk_ir::LifetimeData::InferenceVar(_var) => unimplemented!(), chalk_ir::LifetimeData::InferenceVar(_var) => unimplemented!(),
@ -541,7 +541,7 @@ impl<'tcx> LowerInto<'tcx, Region<'tcx>> for &chalk_ir::Lifetime<RustInterner<'t
universe: ty::UniverseIndex::from_usize(p.ui.counter), universe: ty::UniverseIndex::from_usize(p.ui.counter),
bound: ty::BoundRegion { bound: ty::BoundRegion {
var: ty::BoundVar::from_usize(p.idx), var: ty::BoundVar::from_usize(p.idx),
kind: ty::BoundRegionKind::BrAnon(p.idx as u32, None), kind: ty::BoundRegionKind::BrAnon(None),
}, },
}), }),
chalk_ir::LifetimeData::Static => tcx.lifetimes.re_static, chalk_ir::LifetimeData::Static => tcx.lifetimes.re_static,
@ -976,7 +976,7 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for BoundVarsCollector<'tcx> {
} }
} }
ty::BoundRegionKind::BrAnon(var, _) => match self.parameters.entry(var) { ty::BoundRegionKind::BrAnon(_) => match self.parameters.entry(br.var.as_u32()) {
Entry::Vacant(entry) => { Entry::Vacant(entry) => {
entry.insert(chalk_ir::VariableKind::Lifetime); entry.insert(chalk_ir::VariableKind::Lifetime);
} }
@ -1036,8 +1036,8 @@ impl<'a, 'tcx> TypeFolder<TyCtxt<'tcx>> for NamedBoundVarSubstitutor<'a, 'tcx> {
match *r { match *r {
ty::ReLateBound(index, br) if index == self.binder_index => match br.kind { ty::ReLateBound(index, br) if index == self.binder_index => match br.kind {
ty::BrNamed(def_id, _name) => match self.named_parameters.get(&def_id) { ty::BrNamed(def_id, _name) => match self.named_parameters.get(&def_id) {
Some(idx) => { Some(_) => {
let new_br = ty::BoundRegion { var: br.var, kind: ty::BrAnon(*idx, None) }; let new_br = ty::BoundRegion { var: br.var, kind: ty::BrAnon(None) };
return self.tcx.mk_re_late_bound(index, new_br); return self.tcx.mk_re_late_bound(index, new_br);
} }
None => panic!("Missing `BrNamed`."), None => panic!("Missing `BrNamed`."),
@ -1127,7 +1127,7 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for ParamsSubstitutor<'tcx> {
Some(idx) => { Some(idx) => {
let br = ty::BoundRegion { let br = ty::BoundRegion {
var: ty::BoundVar::from_u32(*idx), var: ty::BoundVar::from_u32(*idx),
kind: ty::BrAnon(*idx, None), kind: ty::BrAnon(None),
}; };
self.tcx.mk_re_late_bound(self.binder_index, br) self.tcx.mk_re_late_bound(self.binder_index, br)
} }
@ -1135,7 +1135,7 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for ParamsSubstitutor<'tcx> {
let idx = self.named_regions.len() as u32; let idx = self.named_regions.len() as u32;
let br = ty::BoundRegion { let br = ty::BoundRegion {
var: ty::BoundVar::from_u32(idx), var: ty::BoundVar::from_u32(idx),
kind: ty::BrAnon(idx, None), kind: ty::BrAnon(None),
}; };
self.named_regions.insert(_re.def_id, idx); self.named_regions.insert(_re.def_id, idx);
self.tcx.mk_re_late_bound(self.binder_index, br) self.tcx.mk_re_late_bound(self.binder_index, br)
@ -1213,8 +1213,9 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for PlaceholdersCollector {
fn visit_region(&mut self, r: Region<'tcx>) -> ControlFlow<Self::BreakTy> { fn visit_region(&mut self, r: Region<'tcx>) -> ControlFlow<Self::BreakTy> {
match *r { match *r {
ty::RePlaceholder(p) if p.universe == self.universe_index => { ty::RePlaceholder(p) if p.universe == self.universe_index => {
if let ty::BoundRegionKind::BrAnon(anon, _) = p.bound.kind { if let ty::BoundRegionKind::BrAnon(_) = p.bound.kind {
self.next_anon_region_placeholder = self.next_anon_region_placeholder.max(anon); self.next_anon_region_placeholder =
self.next_anon_region_placeholder.max(p.bound.var.as_u32());
} }
// FIXME: This doesn't seem to handle BrNamed at all? // FIXME: This doesn't seem to handle BrNamed at all?
} }

View file

@ -6,7 +6,7 @@ LL | fn a() -> impl Fn(&u8) -> impl Debug {
LL | |x| x LL | |x| x
| --- ^ | --- ^
| | | |
| hidden type `&u8` captures the anonymous lifetime #1 defined here | hidden type `&u8` captures the anonymous lifetime as defined here
error: aborting due to previous error error: aborting due to previous error

View file

@ -6,7 +6,7 @@ LL | let mut closure = expect_sig(|p, y| *p = y);
| |
= note: defining type: test::{closure#0} with closure substs [ = note: defining type: test::{closure#0} with closure substs [
i16, i16,
for<Region(BrAnon(0, None)), Region(BrAnon(1, None)), Region(BrAnon(2, None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) mut &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) i32, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(2, None) }) i32)), for<Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) mut &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) i32, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(None) }) i32)),
(), (),
] ]

View file

@ -6,7 +6,7 @@ LL | let mut closure = expect_sig(|p, y| *p = y);
| |
= note: defining type: test::{closure#0} with closure substs [ = note: defining type: test::{closure#0} with closure substs [
i16, i16,
for<Region(BrAnon(0, None)), Region(BrAnon(1, None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) mut &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) i32, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) i32)), for<Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) mut &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) i32, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) i32)),
(), (),
] ]

View file

@ -6,7 +6,7 @@ LL | |_outlives1, _outlives2, _outlives3, x, y| {
| |
= note: defining type: supply::{closure#0} with closure substs [ = note: defining type: supply::{closure#0} with closure substs [
i16, i16,
for<Region(BrAnon(0, None)), Region(BrAnon(1, None))> extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) u32>, std::cell::Cell<&'_#2r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) &'_#3r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) u32>)), for<Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>, std::cell::Cell<&'_#2r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) &'_#3r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>)),
(), (),
] ]
= note: late-bound region is '_#4r = note: late-bound region is '_#4r

View file

@ -6,7 +6,7 @@ LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y
| |
= note: defining type: supply::{closure#0} with closure substs [ = note: defining type: supply::{closure#0} with closure substs [
i16, i16,
for<Region(BrAnon(0, None)), Region(BrAnon(1, None)), Region(BrAnon(2, None)), Region(BrAnon(3, None)), Region(BrAnon(4, None)), Region(BrAnon(5, None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(2, None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(3, None) }) &'_#2r u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(4, None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 5, kind: BrAnon(5, None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(3, None) }) u32>)), for<Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(None) }) &'_#2r u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 5, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(None) }) u32>)),
(), (),
] ]
= note: late-bound region is '_#3r = note: late-bound region is '_#3r

View file

@ -6,7 +6,7 @@ LL | foo(cell, |cell_a, cell_x| {
| |
= note: defining type: case1::{closure#0} with closure substs [ = note: defining type: case1::{closure#0} with closure substs [
i32, i32,
for<Region(BrAnon(0, None))> extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) u32>)), for<Region(BrAnon(None))> extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>)),
(), (),
] ]
@ -36,7 +36,7 @@ LL | foo(cell, |cell_a, cell_x| {
| |
= note: defining type: case2::{closure#0} with closure substs [ = note: defining type: case2::{closure#0} with closure substs [
i32, i32,
for<Region(BrAnon(0, None))> extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) u32>)), for<Region(BrAnon(None))> extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>)),
(), (),
] ]
= note: number of external vids: 2 = note: number of external vids: 2

View file

@ -6,7 +6,7 @@ LL | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| {
| |
= note: defining type: supply::{closure#0} with closure substs [ = note: defining type: supply::{closure#0} with closure substs [
i16, i16,
for<Region(BrAnon(0, None)), Region(BrAnon(1, None)), Region(BrAnon(2, None)), Region(BrAnon(3, None)), Region(BrAnon(4, None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(2, None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(3, None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(4, None) }) u32>)), for<Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(None) }) u32>)),
(), (),
] ]
= note: late-bound region is '_#2r = note: late-bound region is '_#2r

View file

@ -6,7 +6,7 @@ LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y
| |
= note: defining type: supply::{closure#0} with closure substs [ = note: defining type: supply::{closure#0} with closure substs [
i16, i16,
for<Region(BrAnon(0, None)), Region(BrAnon(1, None)), Region(BrAnon(2, None)), Region(BrAnon(3, None)), Region(BrAnon(4, None)), Region(BrAnon(5, None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(2, None) }) std::cell::Cell<&'_#2r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(3, None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(4, None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 5, kind: BrAnon(5, None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(3, None) }) u32>)), for<Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(None) }) std::cell::Cell<&'_#2r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 5, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(None) }) u32>)),
(), (),
] ]
= note: late-bound region is '_#3r = note: late-bound region is '_#3r

View file

@ -6,7 +6,7 @@ LL | establish_relationships(cell_a, cell_b, |outlives1, outlives2, x, y| {
| |
= note: defining type: test::{closure#0} with closure substs [ = note: defining type: test::{closure#0} with closure substs [
i16, i16,
for<Region(BrAnon(0, None)), Region(BrAnon(1, None))> extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) &'_#2r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) u32>)), for<Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) &'_#2r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>)),
(), (),
] ]
= note: late-bound region is '_#3r = note: late-bound region is '_#3r

View file

@ -6,7 +6,7 @@ LL | |_outlives1, _outlives2, x, y| {
| |
= note: defining type: supply::{closure#0} with closure substs [ = note: defining type: supply::{closure#0} with closure substs [
i16, i16,
for<Region(BrAnon(0, None)), Region(BrAnon(1, None))> extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) &'_#2r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) u32>)), for<Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) &'_#2r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>)),
(), (),
] ]
= note: late-bound region is '_#3r = note: late-bound region is '_#3r

View file

@ -6,7 +6,7 @@ LL | establish_relationships(&cell_a, &cell_b, |_outlives, x, y| {
| |
= note: defining type: supply::{closure#0} with closure substs [ = note: defining type: supply::{closure#0} with closure substs [
i16, i16,
for<Region(BrAnon(0, None)), Region(BrAnon(1, None)), Region(BrAnon(2, None)), Region(BrAnon(3, None)), Region(BrAnon(4, None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) &'_#1r u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(2, None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(3, None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(4, None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) u32>)), for<Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) &'_#1r u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>)),
(), (),
] ]
= note: late-bound region is '_#2r = note: late-bound region is '_#2r

View file

@ -6,7 +6,7 @@ LL | establish_relationships(&cell_a, &cell_b, |_outlives1, _outlives2, x, y
| |
= note: defining type: supply::{closure#0} with closure substs [ = note: defining type: supply::{closure#0} with closure substs [
i16, i16,
for<Region(BrAnon(0, None)), Region(BrAnon(1, None)), Region(BrAnon(2, None)), Region(BrAnon(3, None)), Region(BrAnon(4, None)), Region(BrAnon(5, None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) &'_#1r u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(2, None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(3, None) }) &'_#2r u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(4, None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 5, kind: BrAnon(5, None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(3, None) }) u32>)), for<Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) &'_#1r u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(None) }) &'_#2r u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 5, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(None) }) u32>)),
(), (),
] ]
= note: late-bound region is '_#3r = note: late-bound region is '_#3r

View file

@ -6,7 +6,7 @@ LL | expect_sig(|a, b| b); // ought to return `a`
| |
= note: defining type: test::{closure#0} with closure substs [ = note: defining type: test::{closure#0} with closure substs [
i16, i16,
for<Region(BrAnon(0, None)), Region(BrAnon(1, None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) i32, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) i32)) -> &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) i32, for<Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) i32, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) i32)) -> &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) i32,
(), (),
] ]

View file

@ -6,7 +6,7 @@ LL | twice(cell, value, |a, b| invoke(a, b));
| |
= note: defining type: generic::<T>::{closure#0} with closure substs [ = note: defining type: generic::<T>::{closure#0} with closure substs [
i16, i16,
for<Region(BrAnon(0, None)), Region(BrAnon(1, None))> extern "rust-call" fn((std::option::Option<std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) ()>>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) T)), for<Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((std::option::Option<std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) ()>>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) T)),
(), (),
] ]
= note: number of external vids: 2 = note: number of external vids: 2
@ -28,7 +28,7 @@ LL | twice(cell, value, |a, b| invoke(a, b));
| |
= note: defining type: generic_fail::<T>::{closure#0} with closure substs [ = note: defining type: generic_fail::<T>::{closure#0} with closure substs [
i16, i16,
for<Region(BrAnon(0, None)), Region(BrAnon(1, None))> extern "rust-call" fn((std::option::Option<std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(0, None) }) ()>>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(1, None) }) T)), for<Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((std::option::Option<std::cell::Cell<&'_#1r &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) ()>>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) T)),
(), (),
] ]
= note: late-bound region is '_#2r = note: late-bound region is '_#2r