mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
Auto merge of #110036 - jackh726:placeholder_boundvar, r=nnethercote
Remove u32 on BrAnon and BoundTyKind::Anon in favor of BoundVar on Placeholder types r? `@nnethercote` Better alternative to #110025
This commit is contained in:
commit
94524020ea
@ -181,8 +181,8 @@ trait TypeOpInfo<'tcx> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let placeholder_region = tcx.mk_re_placeholder(ty::Placeholder {
|
let placeholder_region = tcx.mk_re_placeholder(ty::Placeholder {
|
||||||
name: placeholder.name,
|
|
||||||
universe: adjusted_universe.into(),
|
universe: adjusted_universe.into(),
|
||||||
|
bound: placeholder.bound,
|
||||||
});
|
});
|
||||||
|
|
||||||
let error_region =
|
let error_region =
|
||||||
@ -191,8 +191,8 @@ trait TypeOpInfo<'tcx> {
|
|||||||
error_placeholder.universe.as_u32().checked_sub(base_universe.as_u32());
|
error_placeholder.universe.as_u32().checked_sub(base_universe.as_u32());
|
||||||
adjusted_universe.map(|adjusted| {
|
adjusted_universe.map(|adjusted| {
|
||||||
tcx.mk_re_placeholder(ty::Placeholder {
|
tcx.mk_re_placeholder(ty::Placeholder {
|
||||||
name: error_placeholder.name,
|
|
||||||
universe: adjusted.into(),
|
universe: adjusted.into(),
|
||||||
|
bound: error_placeholder.bound,
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
@ -467,9 +467,10 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
|||||||
if let ty::Ref(region, ..) = ty.kind() {
|
if let ty::Ref(region, ..) = ty.kind() {
|
||||||
match **region {
|
match **region {
|
||||||
ty::ReLateBound(_, ty::BoundRegion { kind: br, .. })
|
ty::ReLateBound(_, ty::BoundRegion { kind: br, .. })
|
||||||
| ty::RePlaceholder(ty::PlaceholderRegion { name: br, .. }) => {
|
| ty::RePlaceholder(ty::PlaceholderRegion {
|
||||||
printer.region_highlight_mode.highlighting_bound_region(br, counter)
|
bound: ty::BoundRegion { kind: br, .. },
|
||||||
}
|
..
|
||||||
|
}) => printer.region_highlight_mode.highlighting_bound_region(br, counter),
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -485,9 +486,10 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
|||||||
let region = if let ty::Ref(region, ..) = ty.kind() {
|
let region = if let ty::Ref(region, ..) = ty.kind() {
|
||||||
match **region {
|
match **region {
|
||||||
ty::ReLateBound(_, ty::BoundRegion { kind: br, .. })
|
ty::ReLateBound(_, ty::BoundRegion { kind: br, .. })
|
||||||
| ty::RePlaceholder(ty::PlaceholderRegion { name: br, .. }) => {
|
| ty::RePlaceholder(ty::PlaceholderRegion {
|
||||||
printer.region_highlight_mode.highlighting_bound_region(br, counter)
|
bound: ty::BoundRegion { kind: br, .. },
|
||||||
}
|
..
|
||||||
|
}) => printer.region_highlight_mode.highlighting_bound_region(br, counter),
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
region
|
region
|
||||||
|
@ -207,7 +207,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> {
|
|||||||
.regioncx
|
.regioncx
|
||||||
.placeholders_contained_in(lower_bound)
|
.placeholders_contained_in(lower_bound)
|
||||||
.map(|placeholder| {
|
.map(|placeholder| {
|
||||||
if let Some(id) = placeholder.name.get_id()
|
if let Some(id) = placeholder.bound.kind.get_id()
|
||||||
&& let Some(placeholder_id) = id.as_local()
|
&& let Some(placeholder_id) = id.as_local()
|
||||||
&& let gat_hir_id = hir.local_def_id_to_hir_id(placeholder_id)
|
&& let gat_hir_id = hir.local_def_id_to_hir_id(placeholder_id)
|
||||||
&& let Some(generics_impl) = hir.get_parent(gat_hir_id).generics()
|
&& let Some(generics_impl) = hir.get_parent(gat_hir_id).generics()
|
||||||
|
@ -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"))
|
||||||
}
|
}
|
||||||
|
@ -123,8 +123,8 @@ impl<'tcx> TypeRelatingDelegate<'tcx> for NllTypeRelatingDelegate<'_, '_, 'tcx>
|
|||||||
.constraints
|
.constraints
|
||||||
.placeholder_region(self.type_checker.infcx, placeholder);
|
.placeholder_region(self.type_checker.infcx, placeholder);
|
||||||
|
|
||||||
let reg_info = match placeholder.name {
|
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")),
|
||||||
|
@ -2336,10 +2336,10 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||||||
FnMutDelegate {
|
FnMutDelegate {
|
||||||
regions: &mut |_| tcx.lifetimes.re_erased,
|
regions: &mut |_| tcx.lifetimes.re_erased,
|
||||||
types: &mut |bv| {
|
types: &mut |bv| {
|
||||||
tcx.mk_placeholder(ty::PlaceholderType { universe, name: bv.kind })
|
tcx.mk_placeholder(ty::PlaceholderType { universe, bound: bv })
|
||||||
},
|
},
|
||||||
consts: &mut |bv, ty| {
|
consts: &mut |bv, ty| {
|
||||||
tcx.mk_const(ty::PlaceholderConst { universe, name: bv }, ty)
|
tcx.mk_const(ty::PlaceholderConst { universe, bound: bv }, ty)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -2525,11 +2525,11 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||||||
regions: &mut |_| tcx.lifetimes.re_erased,
|
regions: &mut |_| tcx.lifetimes.re_erased,
|
||||||
types: &mut |bv| tcx.mk_placeholder(ty::PlaceholderType {
|
types: &mut |bv| tcx.mk_placeholder(ty::PlaceholderType {
|
||||||
universe,
|
universe,
|
||||||
name: bv.kind,
|
bound: bv,
|
||||||
}),
|
}),
|
||||||
consts: &mut |bv, ty| tcx.mk_const(ty::PlaceholderConst {
|
consts: &mut |bv, ty| tcx.mk_const(ty::PlaceholderConst {
|
||||||
universe,
|
universe,
|
||||||
name: bv
|
bound: bv,
|
||||||
}, ty),
|
}, ty),
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
@ -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)
|
||||||
}
|
}
|
||||||
|
@ -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());
|
||||||
|
@ -90,9 +90,8 @@ impl<'a> DescriptionCtx<'a> {
|
|||||||
};
|
};
|
||||||
me.span = Some(sp);
|
me.span = Some(sp);
|
||||||
}
|
}
|
||||||
ty::BrAnon(idx, span) => {
|
ty::BrAnon(span) => {
|
||||||
me.kind = "anon_num_here";
|
me.kind = "defined_here";
|
||||||
me.num_arg = idx+1;
|
|
||||||
me.span = match span {
|
me.span = match span {
|
||||||
Some(_) => span,
|
Some(_) => span,
|
||||||
None => Some(tcx.def_span(scope)),
|
None => Some(tcx.def_span(scope)),
|
||||||
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,9 +125,9 @@ impl<'tcx> InferCtxt<'tcx> {
|
|||||||
ty.into()
|
ty.into()
|
||||||
}
|
}
|
||||||
|
|
||||||
CanonicalVarKind::PlaceholderTy(ty::PlaceholderType { universe, name }) => {
|
CanonicalVarKind::PlaceholderTy(ty::PlaceholderType { universe, bound }) => {
|
||||||
let universe_mapped = universe_map(universe);
|
let universe_mapped = universe_map(universe);
|
||||||
let placeholder_mapped = ty::PlaceholderType { universe: universe_mapped, name };
|
let placeholder_mapped = ty::PlaceholderType { universe: universe_mapped, bound };
|
||||||
self.tcx.mk_placeholder(placeholder_mapped).into()
|
self.tcx.mk_placeholder(placeholder_mapped).into()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,9 +138,9 @@ impl<'tcx> InferCtxt<'tcx> {
|
|||||||
)
|
)
|
||||||
.into(),
|
.into(),
|
||||||
|
|
||||||
CanonicalVarKind::PlaceholderRegion(ty::PlaceholderRegion { universe, name }) => {
|
CanonicalVarKind::PlaceholderRegion(ty::PlaceholderRegion { universe, bound }) => {
|
||||||
let universe_mapped = universe_map(universe);
|
let universe_mapped = universe_map(universe);
|
||||||
let placeholder_mapped = ty::PlaceholderRegion { universe: universe_mapped, name };
|
let placeholder_mapped = ty::PlaceholderRegion { universe: universe_mapped, bound };
|
||||||
self.tcx.mk_re_placeholder(placeholder_mapped).into()
|
self.tcx.mk_re_placeholder(placeholder_mapped).into()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,9 +152,9 @@ impl<'tcx> InferCtxt<'tcx> {
|
|||||||
)
|
)
|
||||||
.into(),
|
.into(),
|
||||||
|
|
||||||
CanonicalVarKind::PlaceholderConst(ty::PlaceholderConst { universe, name }, ty) => {
|
CanonicalVarKind::PlaceholderConst(ty::PlaceholderConst { universe, bound }, ty) => {
|
||||||
let universe_mapped = universe_map(universe);
|
let universe_mapped = universe_map(universe);
|
||||||
let placeholder_mapped = ty::PlaceholderConst { universe: universe_mapped, name };
|
let placeholder_mapped = ty::PlaceholderConst { universe: universe_mapped, bound };
|
||||||
self.tcx.mk_const(placeholder_mapped, ty).into()
|
self.tcx.mk_const(placeholder_mapped, ty).into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -170,15 +170,15 @@ fn msg_span_from_named_region<'tcx>(
|
|||||||
}
|
}
|
||||||
ty::ReStatic => ("the static lifetime".to_owned(), alt_span),
|
ty::ReStatic => ("the static lifetime".to_owned(), alt_span),
|
||||||
ty::RePlaceholder(ty::PlaceholderRegion {
|
ty::RePlaceholder(ty::PlaceholderRegion {
|
||||||
name: ty::BoundRegionKind::BrNamed(def_id, name),
|
bound: ty::BoundRegion { kind: ty::BoundRegionKind::BrNamed(def_id, name), .. },
|
||||||
..
|
..
|
||||||
}) => (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 {
|
||||||
name: 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 {
|
||||||
name: 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,8 +226,8 @@ fn msg_span_from_early_bound_and_free_regions<'tcx>(
|
|||||||
};
|
};
|
||||||
(text, sp)
|
(text, sp)
|
||||||
}
|
}
|
||||||
ty::BrAnon(idx, span) => (
|
ty::BrAnon(span) => (
|
||||||
format!("the anonymous lifetime #{} defined here", idx + 1),
|
"the anonymous lifetime as defined here".to_string(),
|
||||||
match span {
|
match span {
|
||||||
Some(span) => span,
|
Some(span) => span,
|
||||||
None => tcx.def_span(scope)
|
None => tcx.def_span(scope)
|
||||||
|
@ -16,22 +16,34 @@ impl<'tcx> NiceRegionError<'_, 'tcx> {
|
|||||||
match &self.error {
|
match &self.error {
|
||||||
Some(RegionResolutionError::ConcreteFailure(
|
Some(RegionResolutionError::ConcreteFailure(
|
||||||
SubregionOrigin::RelateRegionParamBound(span),
|
SubregionOrigin::RelateRegionParamBound(span),
|
||||||
Region(Interned(RePlaceholder(ty::Placeholder { name: sub_name, .. }), _)),
|
Region(Interned(
|
||||||
Region(Interned(RePlaceholder(ty::Placeholder { name: sup_name, .. }), _)),
|
RePlaceholder(ty::Placeholder {
|
||||||
|
bound: ty::BoundRegion { kind: sub_name, .. },
|
||||||
|
..
|
||||||
|
}),
|
||||||
|
_,
|
||||||
|
)),
|
||||||
|
Region(Interned(
|
||||||
|
RePlaceholder(ty::Placeholder {
|
||||||
|
bound: ty::BoundRegion { kind: sup_name, .. },
|
||||||
|
..
|
||||||
|
}),
|
||||||
|
_,
|
||||||
|
)),
|
||||||
)) => {
|
)) => {
|
||||||
let span = *span;
|
let span = *span;
|
||||||
let (sub_span, sub_symbol) = match sub_name {
|
let (sub_span, sub_symbol) = match sub_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 (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) {
|
||||||
|
@ -82,20 +82,20 @@ impl<'tcx> InferCtxt<'tcx> {
|
|||||||
|
|
||||||
let delegate = FnMutDelegate {
|
let delegate = FnMutDelegate {
|
||||||
regions: &mut |br: ty::BoundRegion| {
|
regions: &mut |br: ty::BoundRegion| {
|
||||||
self.tcx.mk_re_placeholder(ty::PlaceholderRegion {
|
self.tcx
|
||||||
universe: next_universe,
|
.mk_re_placeholder(ty::PlaceholderRegion { universe: next_universe, bound: br })
|
||||||
name: br.kind,
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
types: &mut |bound_ty: ty::BoundTy| {
|
types: &mut |bound_ty: ty::BoundTy| {
|
||||||
self.tcx.mk_placeholder(ty::PlaceholderType {
|
self.tcx.mk_placeholder(ty::PlaceholderType {
|
||||||
universe: next_universe,
|
universe: next_universe,
|
||||||
name: bound_ty.kind,
|
bound: bound_ty,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
consts: &mut |bound_var: ty::BoundVar, ty| {
|
consts: &mut |bound_var: ty::BoundVar, ty| {
|
||||||
self.tcx
|
self.tcx.mk_const(
|
||||||
.mk_const(ty::PlaceholderConst { universe: next_universe, name: bound_var }, ty)
|
ty::PlaceholderConst { universe: next_universe, bound: bound_var },
|
||||||
|
ty,
|
||||||
|
)
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2130,13 +2130,17 @@ fn replace_param_and_infer_substs_with_placeholder<'tcx>(
|
|||||||
|
|
||||||
fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
|
fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
|
||||||
if let ty::Infer(_) = t.kind() {
|
if let ty::Infer(_) = t.kind() {
|
||||||
self.tcx.mk_placeholder(ty::PlaceholderType {
|
let idx = {
|
||||||
universe: ty::UniverseIndex::ROOT,
|
|
||||||
name: ty::BoundTyKind::Anon({
|
|
||||||
let idx = self.idx;
|
let idx = self.idx;
|
||||||
self.idx += 1;
|
self.idx += 1;
|
||||||
idx
|
idx
|
||||||
}),
|
};
|
||||||
|
self.tcx.mk_placeholder(ty::PlaceholderType {
|
||||||
|
universe: ty::UniverseIndex::ROOT,
|
||||||
|
bound: ty::BoundTy {
|
||||||
|
var: ty::BoundVar::from_u32(idx),
|
||||||
|
kind: ty::BoundTyKind::Anon,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
t.super_fold_with(self)
|
t.super_fold_with(self)
|
||||||
@ -2153,7 +2157,7 @@ fn replace_param_and_infer_substs_with_placeholder<'tcx>(
|
|||||||
self.tcx.mk_const(
|
self.tcx.mk_const(
|
||||||
ty::PlaceholderConst {
|
ty::PlaceholderConst {
|
||||||
universe: ty::UniverseIndex::ROOT,
|
universe: ty::UniverseIndex::ROOT,
|
||||||
name: ty::BoundVar::from_u32({
|
bound: ty::BoundVar::from_u32({
|
||||||
let idx = self.idx;
|
let idx = self.idx;
|
||||||
self.idx += 1;
|
self.idx += 1;
|
||||||
idx
|
idx
|
||||||
|
@ -296,7 +296,7 @@ where
|
|||||||
universe
|
universe
|
||||||
});
|
});
|
||||||
|
|
||||||
let placeholder = ty::PlaceholderRegion { universe, name: br.kind };
|
let placeholder = ty::PlaceholderRegion { universe, bound: br };
|
||||||
debug!(?placeholder);
|
debug!(?placeholder);
|
||||||
let placeholder_reg = nll_delegate.next_placeholder_region(placeholder);
|
let placeholder_reg = nll_delegate.next_placeholder_region(placeholder);
|
||||||
debug!(?placeholder_reg);
|
debug!(?placeholder_reg);
|
||||||
|
@ -290,9 +290,9 @@ impl<'me, 'tcx> LeakCheck<'me, 'tcx> {
|
|||||||
) -> TypeError<'tcx> {
|
) -> TypeError<'tcx> {
|
||||||
debug!("error: placeholder={:?}, other_region={:?}", placeholder, other_region);
|
debug!("error: placeholder={:?}, other_region={:?}", placeholder, other_region);
|
||||||
if self.overly_polymorphic {
|
if self.overly_polymorphic {
|
||||||
TypeError::RegionsOverlyPolymorphic(placeholder.name, other_region)
|
TypeError::RegionsOverlyPolymorphic(placeholder.bound.kind, other_region)
|
||||||
} else {
|
} else {
|
||||||
TypeError::RegionsInsufficientlyPolymorphic(placeholder.name, other_region)
|
TypeError::RegionsInsufficientlyPolymorphic(placeholder.bound.kind, other_region)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -149,15 +149,15 @@ impl<'tcx> CanonicalVarInfo<'tcx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn expect_anon_placeholder(self) -> u32 {
|
pub fn expect_placeholder_index(self) -> usize {
|
||||||
match self.kind {
|
match self.kind {
|
||||||
CanonicalVarKind::Ty(_)
|
CanonicalVarKind::Ty(_)
|
||||||
| CanonicalVarKind::Region(_)
|
| CanonicalVarKind::Region(_)
|
||||||
| CanonicalVarKind::Const(_, _) => bug!("expected placeholder: {self:?}"),
|
| CanonicalVarKind::Const(_, _) => bug!("expected placeholder: {self:?}"),
|
||||||
|
|
||||||
CanonicalVarKind::PlaceholderRegion(placeholder) => placeholder.name.expect_anon(),
|
CanonicalVarKind::PlaceholderRegion(placeholder) => placeholder.bound.var.as_usize(),
|
||||||
CanonicalVarKind::PlaceholderTy(placeholder) => placeholder.name.expect_anon(),
|
CanonicalVarKind::PlaceholderTy(placeholder) => placeholder.bound.var.as_usize(),
|
||||||
CanonicalVarKind::PlaceholderConst(placeholder, _) => placeholder.name.as_u32(),
|
CanonicalVarKind::PlaceholderConst(placeholder, _) => placeholder.bound.as_usize(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -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()
|
||||||
}
|
}
|
||||||
|
@ -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:?}"),
|
||||||
|
@ -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 {
|
||||||
|
@ -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)
|
||||||
@ -391,9 +389,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::Ty(ty::BoundTyKind::Anon))
|
||||||
ty::BoundVariableKind::Ty(ty::BoundTyKind::Anon(index as u32))
|
|
||||||
})
|
|
||||||
.expect_ty();
|
.expect_ty();
|
||||||
self.tcx.mk_bound(ty::INNERMOST, BoundTy { var, kind })
|
self.tcx.mk_bound(ty::INNERMOST, BoundTy { var, kind })
|
||||||
}
|
}
|
||||||
|
@ -1454,12 +1454,12 @@ impl<'tcx> OpaqueHiddenType<'tcx> {
|
|||||||
#[derive(HashStable, TyEncodable, TyDecodable)]
|
#[derive(HashStable, TyEncodable, TyDecodable)]
|
||||||
pub struct Placeholder<T> {
|
pub struct Placeholder<T> {
|
||||||
pub universe: UniverseIndex,
|
pub universe: UniverseIndex,
|
||||||
pub name: T,
|
pub bound: T,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type PlaceholderRegion = Placeholder<BoundRegionKind>;
|
pub type PlaceholderRegion = Placeholder<BoundRegion>;
|
||||||
|
|
||||||
pub type PlaceholderType = Placeholder<BoundTyKind>;
|
pub type PlaceholderType = Placeholder<BoundTy>;
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, HashStable)]
|
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, HashStable)]
|
||||||
#[derive(TyEncodable, TyDecodable, PartialOrd, Ord)]
|
#[derive(TyEncodable, TyDecodable, PartialOrd, Ord)]
|
||||||
|
@ -701,9 +701,7 @@ pub trait PrettyPrinter<'tcx>:
|
|||||||
ty::Error(_) => p!("[type error]"),
|
ty::Error(_) => p!("[type error]"),
|
||||||
ty::Param(ref param_ty) => p!(print(param_ty)),
|
ty::Param(ref param_ty) => p!(print(param_ty)),
|
||||||
ty::Bound(debruijn, bound_ty) => match bound_ty.kind {
|
ty::Bound(debruijn, bound_ty) => match bound_ty.kind {
|
||||||
ty::BoundTyKind::Anon(bv) => {
|
ty::BoundTyKind::Anon => self.pretty_print_bound_var(debruijn, bound_ty.var)?,
|
||||||
self.pretty_print_bound_var(debruijn, ty::BoundVar::from_u32(bv))?
|
|
||||||
}
|
|
||||||
ty::BoundTyKind::Param(_, s) => match self.should_print_verbose() {
|
ty::BoundTyKind::Param(_, s) => match self.should_print_verbose() {
|
||||||
true if debruijn == ty::INNERMOST => p!(write("^{}", s)),
|
true if debruijn == ty::INNERMOST => p!(write("^{}", s)),
|
||||||
true => p!(write("^{}_{}", debruijn.index(), s)),
|
true => p!(write("^{}_{}", debruijn.index(), s)),
|
||||||
@ -739,8 +737,8 @@ pub trait PrettyPrinter<'tcx>:
|
|||||||
p!(print(data))
|
p!(print(data))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ty::Placeholder(placeholder) => match placeholder.name {
|
ty::Placeholder(placeholder) => match placeholder.bound.kind {
|
||||||
ty::BoundTyKind::Anon(_) => p!(write("Placeholder({:?})", placeholder)),
|
ty::BoundTyKind::Anon => p!(write("Placeholder({:?})", placeholder)),
|
||||||
ty::BoundTyKind::Param(_, name) => p!(write("{}", name)),
|
ty::BoundTyKind::Param(_, name) => p!(write("{}", name)),
|
||||||
},
|
},
|
||||||
ty::Alias(ty::Opaque, ty::AliasTy { def_id, substs, .. }) => {
|
ty::Alias(ty::Opaque, ty::AliasTy { def_id, substs, .. }) => {
|
||||||
@ -2104,7 +2102,9 @@ impl<'tcx> PrettyPrinter<'tcx> for FmtPrinter<'_, 'tcx> {
|
|||||||
|
|
||||||
ty::ReLateBound(_, ty::BoundRegion { kind: br, .. })
|
ty::ReLateBound(_, ty::BoundRegion { kind: br, .. })
|
||||||
| ty::ReFree(ty::FreeRegion { bound_region: br, .. })
|
| ty::ReFree(ty::FreeRegion { bound_region: br, .. })
|
||||||
| ty::RePlaceholder(ty::Placeholder { name: br, .. }) => {
|
| ty::RePlaceholder(ty::Placeholder {
|
||||||
|
bound: ty::BoundRegion { kind: br, .. }, ..
|
||||||
|
}) => {
|
||||||
if br.is_named() {
|
if br.is_named() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -2181,7 +2181,9 @@ impl<'tcx> FmtPrinter<'_, 'tcx> {
|
|||||||
}
|
}
|
||||||
ty::ReLateBound(_, ty::BoundRegion { kind: br, .. })
|
ty::ReLateBound(_, ty::BoundRegion { kind: br, .. })
|
||||||
| ty::ReFree(ty::FreeRegion { bound_region: br, .. })
|
| ty::ReFree(ty::FreeRegion { bound_region: br, .. })
|
||||||
| ty::RePlaceholder(ty::Placeholder { name: br, .. }) => {
|
| ty::RePlaceholder(ty::Placeholder {
|
||||||
|
bound: ty::BoundRegion { kind: br, .. }, ..
|
||||||
|
}) => {
|
||||||
if let ty::BrNamed(_, name) = br && br.is_named() {
|
if let ty::BrNamed(_, name) = br && br.is_named() {
|
||||||
p!(write("{}", name));
|
p!(write("{}", name));
|
||||||
return Ok(self);
|
return Ok(self);
|
||||||
@ -2259,7 +2261,10 @@ impl<'a, 'tcx> ty::TypeFolder<TyCtxt<'tcx>> for RegionFolder<'a, 'tcx> {
|
|||||||
ty::ReLateBound(db, br) if db >= self.current_index => {
|
ty::ReLateBound(db, br) if db >= self.current_index => {
|
||||||
*self.region_map.entry(br).or_insert_with(|| name(Some(db), self.current_index, br))
|
*self.region_map.entry(br).or_insert_with(|| name(Some(db), self.current_index, br))
|
||||||
}
|
}
|
||||||
ty::RePlaceholder(ty::PlaceholderRegion { name: kind, .. }) => {
|
ty::RePlaceholder(ty::PlaceholderRegion {
|
||||||
|
bound: ty::BoundRegion { kind, .. },
|
||||||
|
..
|
||||||
|
}) => {
|
||||||
// If this is an anonymous placeholder, don't rename. Otherwise, in some
|
// If this is an anonymous placeholder, don't rename. Otherwise, in some
|
||||||
// async fns, we get a `for<'r> Send` bound
|
// async fns, we get a `for<'r> Send` bound
|
||||||
match kind {
|
match kind {
|
||||||
|
@ -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)
|
||||||
@ -254,8 +254,8 @@ TrivialTypeTraversalAndLiftImpls! {
|
|||||||
crate::ty::AssocKind,
|
crate::ty::AssocKind,
|
||||||
crate::ty::AliasKind,
|
crate::ty::AliasKind,
|
||||||
crate::ty::AliasRelationDirection,
|
crate::ty::AliasRelationDirection,
|
||||||
crate::ty::Placeholder<crate::ty::BoundRegionKind>,
|
crate::ty::Placeholder<crate::ty::BoundRegion>,
|
||||||
crate::ty::Placeholder<crate::ty::BoundTyKind>,
|
crate::ty::Placeholder<crate::ty::BoundTy>,
|
||||||
crate::ty::ClosureKind,
|
crate::ty::ClosureKind,
|
||||||
crate::ty::FreeRegion,
|
crate::ty::FreeRegion,
|
||||||
crate::ty::InferTy,
|
crate::ty::InferTy,
|
||||||
|
@ -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)
|
||||||
///
|
///
|
||||||
@ -107,15 +107,6 @@ impl BoundRegionKind {
|
|||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn expect_anon(&self) -> u32 {
|
|
||||||
match *self {
|
|
||||||
BoundRegionKind::BrNamed(_, _) | BoundRegionKind::BrEnv => {
|
|
||||||
bug!("expected anon region: {self:?}")
|
|
||||||
}
|
|
||||||
BoundRegionKind::BrAnon(idx, _) => idx,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait Article {
|
pub trait Article {
|
||||||
@ -136,10 +127,6 @@ impl<'tcx> Article for TyKind<'tcx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// `TyKind` is used a lot. Make sure it doesn't unintentionally get bigger.
|
|
||||||
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
|
||||||
static_assert_size!(TyKind<'_>, 32);
|
|
||||||
|
|
||||||
/// A closure can be modeled as a struct that looks like:
|
/// A closure can be modeled as a struct that looks like:
|
||||||
/// ```ignore (illustrative)
|
/// ```ignore (illustrative)
|
||||||
/// struct Closure<'l0...'li, T0...Tj, CK, CS, U>(...U);
|
/// struct Closure<'l0...'li, T0...Tj, CK, CS, U>(...U);
|
||||||
@ -1533,22 +1520,13 @@ pub struct BoundTy {
|
|||||||
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, TyEncodable, TyDecodable)]
|
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, TyEncodable, TyDecodable)]
|
||||||
#[derive(HashStable)]
|
#[derive(HashStable)]
|
||||||
pub enum BoundTyKind {
|
pub enum BoundTyKind {
|
||||||
Anon(u32),
|
Anon,
|
||||||
Param(DefId, Symbol),
|
Param(DefId, Symbol),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BoundTyKind {
|
|
||||||
pub fn expect_anon(self) -> u32 {
|
|
||||||
match self {
|
|
||||||
BoundTyKind::Anon(i) => i,
|
|
||||||
_ => bug!(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<BoundVar> for BoundTy {
|
impl From<BoundVar> for BoundTy {
|
||||||
fn from(var: BoundVar) -> Self {
|
fn from(var: BoundVar) -> Self {
|
||||||
BoundTy { var, kind: BoundTyKind::Anon(var.as_u32()) }
|
BoundTy { var, kind: BoundTyKind::Anon }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1632,7 +1610,7 @@ impl<'tcx> Region<'tcx> {
|
|||||||
ty::ReLateBound(_, br) => br.kind.get_name(),
|
ty::ReLateBound(_, br) => br.kind.get_name(),
|
||||||
ty::ReFree(fr) => fr.bound_region.get_name(),
|
ty::ReFree(fr) => fr.bound_region.get_name(),
|
||||||
ty::ReStatic => Some(kw::StaticLifetime),
|
ty::ReStatic => Some(kw::StaticLifetime),
|
||||||
ty::RePlaceholder(placeholder) => placeholder.name.get_name(),
|
ty::RePlaceholder(placeholder) => placeholder.bound.kind.get_name(),
|
||||||
_ => None,
|
_ => None,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1650,7 +1628,7 @@ impl<'tcx> Region<'tcx> {
|
|||||||
ty::ReFree(fr) => fr.bound_region.is_named(),
|
ty::ReFree(fr) => fr.bound_region.is_named(),
|
||||||
ty::ReStatic => true,
|
ty::ReStatic => true,
|
||||||
ty::ReVar(..) => false,
|
ty::ReVar(..) => false,
|
||||||
ty::RePlaceholder(placeholder) => placeholder.name.is_named(),
|
ty::RePlaceholder(placeholder) => placeholder.bound.kind.is_named(),
|
||||||
ty::ReErased => false,
|
ty::ReErased => false,
|
||||||
ty::ReError(_) => false,
|
ty::ReError(_) => false,
|
||||||
}
|
}
|
||||||
@ -2514,3 +2492,14 @@ impl<'tcx> VarianceDiagInfo<'tcx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Some types are used a lot. Make sure they don't unintentionally get bigger.
|
||||||
|
#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
|
||||||
|
mod size_asserts {
|
||||||
|
use super::*;
|
||||||
|
use rustc_data_structures::static_assert_size;
|
||||||
|
// tidy-alphabetical-start
|
||||||
|
static_assert_size!(RegionKind<'_>, 28);
|
||||||
|
static_assert_size!(TyKind<'_>, 32);
|
||||||
|
// tidy-alphabetical-end
|
||||||
|
}
|
||||||
|
@ -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)
|
||||||
}
|
}
|
||||||
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -300,14 +300,20 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for Canonicalizer<'_, 'tcx> {
|
|||||||
ty::Placeholder(placeholder) => match self.canonicalize_mode {
|
ty::Placeholder(placeholder) => match self.canonicalize_mode {
|
||||||
CanonicalizeMode::Input => CanonicalVarKind::PlaceholderTy(ty::Placeholder {
|
CanonicalizeMode::Input => CanonicalVarKind::PlaceholderTy(ty::Placeholder {
|
||||||
universe: placeholder.universe,
|
universe: placeholder.universe,
|
||||||
name: BoundTyKind::Anon(self.variables.len() as u32),
|
bound: ty::BoundTy {
|
||||||
|
var: ty::BoundVar::from_usize(self.variables.len()),
|
||||||
|
kind: ty::BoundTyKind::Anon,
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
CanonicalizeMode::Response { .. } => CanonicalVarKind::PlaceholderTy(placeholder),
|
CanonicalizeMode::Response { .. } => CanonicalVarKind::PlaceholderTy(placeholder),
|
||||||
},
|
},
|
||||||
ty::Param(_) => match self.canonicalize_mode {
|
ty::Param(_) => match self.canonicalize_mode {
|
||||||
CanonicalizeMode::Input => CanonicalVarKind::PlaceholderTy(ty::Placeholder {
|
CanonicalizeMode::Input => CanonicalVarKind::PlaceholderTy(ty::Placeholder {
|
||||||
universe: ty::UniverseIndex::ROOT,
|
universe: ty::UniverseIndex::ROOT,
|
||||||
name: ty::BoundTyKind::Anon(self.variables.len() as u32),
|
bound: ty::BoundTy {
|
||||||
|
var: ty::BoundVar::from_usize(self.variables.len()),
|
||||||
|
kind: ty::BoundTyKind::Anon,
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
CanonicalizeMode::Response { .. } => bug!("param ty in response: {t:?}"),
|
CanonicalizeMode::Response { .. } => bug!("param ty in response: {t:?}"),
|
||||||
},
|
},
|
||||||
@ -345,7 +351,7 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for Canonicalizer<'_, 'tcx> {
|
|||||||
var
|
var
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
let bt = ty::BoundTy { var, kind: BoundTyKind::Anon(var.index() as u32) };
|
let bt = ty::BoundTy { var, kind: BoundTyKind::Anon };
|
||||||
self.interner().mk_bound(self.binder_index, bt)
|
self.interner().mk_bound(self.binder_index, bt)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -373,7 +379,7 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for Canonicalizer<'_, 'tcx> {
|
|||||||
CanonicalizeMode::Input => CanonicalVarKind::PlaceholderConst(
|
CanonicalizeMode::Input => CanonicalVarKind::PlaceholderConst(
|
||||||
ty::Placeholder {
|
ty::Placeholder {
|
||||||
universe: placeholder.universe,
|
universe: placeholder.universe,
|
||||||
name: ty::BoundVar::from(self.variables.len()),
|
bound: ty::BoundVar::from(self.variables.len()),
|
||||||
},
|
},
|
||||||
c.ty(),
|
c.ty(),
|
||||||
),
|
),
|
||||||
@ -385,7 +391,7 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for Canonicalizer<'_, 'tcx> {
|
|||||||
CanonicalizeMode::Input => CanonicalVarKind::PlaceholderConst(
|
CanonicalizeMode::Input => CanonicalVarKind::PlaceholderConst(
|
||||||
ty::Placeholder {
|
ty::Placeholder {
|
||||||
universe: ty::UniverseIndex::ROOT,
|
universe: ty::UniverseIndex::ROOT,
|
||||||
name: ty::BoundVar::from(self.variables.len()),
|
bound: ty::BoundVar::from(self.variables.len()),
|
||||||
},
|
},
|
||||||
c.ty(),
|
c.ty(),
|
||||||
),
|
),
|
||||||
|
@ -188,7 +188,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> {
|
|||||||
} else {
|
} else {
|
||||||
// For placeholders which were already part of the input, we simply map this
|
// For placeholders which were already part of the input, we simply map this
|
||||||
// universal bound variable back the placeholder of the input.
|
// universal bound variable back the placeholder of the input.
|
||||||
original_values[info.expect_anon_placeholder() as usize]
|
original_values[info.expect_placeholder_index()]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
));
|
));
|
||||||
|
@ -95,17 +95,15 @@ fn replace_erased_lifetimes_with_bound_vars<'tcx>(
|
|||||||
let mut counter = 0;
|
let mut counter = 0;
|
||||||
let ty = tcx.fold_regions(ty, |mut r, current_depth| {
|
let ty = tcx.fold_regions(ty, |mut r, current_depth| {
|
||||||
if let ty::ReErased = r.kind() {
|
if let ty::ReErased = r.kind() {
|
||||||
let br = ty::BoundRegion {
|
let br =
|
||||||
var: ty::BoundVar::from_u32(counter),
|
ty::BoundRegion { var: ty::BoundVar::from_u32(counter), kind: ty::BrAnon(None) };
|
||||||
kind: ty::BrAnon(counter, None),
|
|
||||||
};
|
|
||||||
counter += 1;
|
counter += 1;
|
||||||
r = tcx.mk_re_late_bound(current_depth, br);
|
r = tcx.mk_re_late_bound(current_depth, br);
|
||||||
}
|
}
|
||||||
r
|
r
|
||||||
});
|
});
|
||||||
let bound_vars = tcx.mk_bound_variable_kinds_from_iter(
|
let bound_vars = tcx.mk_bound_variable_kinds_from_iter(
|
||||||
(0..counter).map(|i| ty::BoundVariableKind::Region(ty::BrAnon(i, None))),
|
(0..counter).map(|_| ty::BoundVariableKind::Region(ty::BrAnon(None))),
|
||||||
);
|
);
|
||||||
ty::Binder::bind_with_vars(ty, bound_vars)
|
ty::Binder::bind_with_vars(ty, bound_vars)
|
||||||
}
|
}
|
||||||
|
@ -772,7 +772,7 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for BoundVarReplacer<'_, 'tcx> {
|
|||||||
}
|
}
|
||||||
ty::ReLateBound(debruijn, br) if debruijn >= self.current_index => {
|
ty::ReLateBound(debruijn, br) if debruijn >= self.current_index => {
|
||||||
let universe = self.universe_for(debruijn);
|
let universe = self.universe_for(debruijn);
|
||||||
let p = ty::PlaceholderRegion { universe, name: br.kind };
|
let p = ty::PlaceholderRegion { universe, bound: br };
|
||||||
self.mapped_regions.insert(p, br);
|
self.mapped_regions.insert(p, br);
|
||||||
self.infcx.tcx.mk_re_placeholder(p)
|
self.infcx.tcx.mk_re_placeholder(p)
|
||||||
}
|
}
|
||||||
@ -790,7 +790,7 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for BoundVarReplacer<'_, 'tcx> {
|
|||||||
}
|
}
|
||||||
ty::Bound(debruijn, bound_ty) if debruijn >= self.current_index => {
|
ty::Bound(debruijn, bound_ty) if debruijn >= self.current_index => {
|
||||||
let universe = self.universe_for(debruijn);
|
let universe = self.universe_for(debruijn);
|
||||||
let p = ty::PlaceholderType { universe, name: bound_ty.kind };
|
let p = ty::PlaceholderType { universe, bound: bound_ty };
|
||||||
self.mapped_types.insert(p, bound_ty);
|
self.mapped_types.insert(p, bound_ty);
|
||||||
self.infcx.tcx.mk_placeholder(p)
|
self.infcx.tcx.mk_placeholder(p)
|
||||||
}
|
}
|
||||||
@ -809,7 +809,7 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for BoundVarReplacer<'_, 'tcx> {
|
|||||||
}
|
}
|
||||||
ty::ConstKind::Bound(debruijn, bound_const) if debruijn >= self.current_index => {
|
ty::ConstKind::Bound(debruijn, bound_const) if debruijn >= self.current_index => {
|
||||||
let universe = self.universe_for(debruijn);
|
let universe = self.universe_for(debruijn);
|
||||||
let p = ty::PlaceholderConst { universe, name: bound_const };
|
let p = ty::PlaceholderConst { universe, bound: bound_const };
|
||||||
self.mapped_consts.insert(p, bound_const);
|
self.mapped_consts.insert(p, bound_const);
|
||||||
self.infcx.tcx.mk_const(p, ct.ty())
|
self.infcx.tcx.mk_const(p, ct.ty())
|
||||||
}
|
}
|
||||||
|
@ -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)
|
||||||
}
|
}
|
||||||
|
@ -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()
|
||||||
}
|
}
|
||||||
|
@ -376,7 +376,7 @@ impl<'tcx> LowerInto<'tcx, chalk_ir::Ty<RustInterner<'tcx>>> for Ty<'tcx> {
|
|||||||
ty::Placeholder(_placeholder) => {
|
ty::Placeholder(_placeholder) => {
|
||||||
chalk_ir::TyKind::Placeholder(chalk_ir::PlaceholderIndex {
|
chalk_ir::TyKind::Placeholder(chalk_ir::PlaceholderIndex {
|
||||||
ui: chalk_ir::UniverseIndex { counter: _placeholder.universe.as_usize() },
|
ui: chalk_ir::UniverseIndex { counter: _placeholder.universe.as_usize() },
|
||||||
idx: _placeholder.name.expect_anon() as usize,
|
idx: _placeholder.bound.var.as_usize(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
ty::Infer(_infer) => unimplemented!(),
|
ty::Infer(_infer) => unimplemented!(),
|
||||||
@ -479,12 +479,15 @@ impl<'tcx> LowerInto<'tcx, Ty<'tcx>> for &chalk_ir::Ty<RustInterner<'tcx>> {
|
|||||||
ty::DebruijnIndex::from_usize(bound.debruijn.depth() as usize),
|
ty::DebruijnIndex::from_usize(bound.debruijn.depth() as usize),
|
||||||
ty::BoundTy {
|
ty::BoundTy {
|
||||||
var: ty::BoundVar::from_usize(bound.index),
|
var: ty::BoundVar::from_usize(bound.index),
|
||||||
kind: ty::BoundTyKind::Anon(bound.index as u32),
|
kind: ty::BoundTyKind::Anon,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
TyKind::Placeholder(placeholder) => ty::Placeholder(ty::Placeholder {
|
TyKind::Placeholder(placeholder) => ty::Placeholder(ty::Placeholder {
|
||||||
universe: ty::UniverseIndex::from_usize(placeholder.ui.counter),
|
universe: ty::UniverseIndex::from_usize(placeholder.ui.counter),
|
||||||
name: ty::BoundTyKind::Anon(placeholder.idx as u32),
|
bound: ty::BoundTy {
|
||||||
|
var: ty::BoundVar::from_usize(placeholder.idx),
|
||||||
|
kind: ty::BoundTyKind::Anon,
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
TyKind::InferenceVar(_, _) => unimplemented!(),
|
TyKind::InferenceVar(_, _) => unimplemented!(),
|
||||||
TyKind::Dyn(_) => unimplemented!(),
|
TyKind::Dyn(_) => unimplemented!(),
|
||||||
@ -530,13 +533,16 @@ 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!(),
|
||||||
chalk_ir::LifetimeData::Placeholder(p) => tcx.mk_re_placeholder(ty::Placeholder {
|
chalk_ir::LifetimeData::Placeholder(p) => tcx.mk_re_placeholder(ty::Placeholder {
|
||||||
universe: ty::UniverseIndex::from_usize(p.ui.counter),
|
universe: ty::UniverseIndex::from_usize(p.ui.counter),
|
||||||
name: ty::BoundRegionKind::BrAnon(p.idx as u32, None),
|
bound: ty::BoundRegion {
|
||||||
|
var: ty::BoundVar::from_usize(p.idx),
|
||||||
|
kind: ty::BoundRegionKind::BrAnon(None),
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
chalk_ir::LifetimeData::Static => tcx.lifetimes.re_static,
|
chalk_ir::LifetimeData::Static => tcx.lifetimes.re_static,
|
||||||
chalk_ir::LifetimeData::Erased => tcx.lifetimes.re_erased,
|
chalk_ir::LifetimeData::Erased => tcx.lifetimes.re_erased,
|
||||||
@ -685,7 +691,7 @@ impl<'tcx> LowerInto<'tcx, chalk_ir::Binders<chalk_ir::QuantifiedWhereClauses<Ru
|
|||||||
let self_ty = interner.tcx.mk_bound(
|
let self_ty = interner.tcx.mk_bound(
|
||||||
// This is going to be wrapped in a binder
|
// This is going to be wrapped in a binder
|
||||||
ty::DebruijnIndex::from_usize(1),
|
ty::DebruijnIndex::from_usize(1),
|
||||||
ty::BoundTy { var: ty::BoundVar::from_usize(0), kind: ty::BoundTyKind::Anon(0) },
|
ty::BoundTy { var: ty::BoundVar::from_usize(0), kind: ty::BoundTyKind::Anon },
|
||||||
);
|
);
|
||||||
let where_clauses = predicates.into_iter().map(|predicate| {
|
let where_clauses = predicates.into_iter().map(|predicate| {
|
||||||
let (predicate, binders, _named_regions) =
|
let (predicate, binders, _named_regions) =
|
||||||
@ -970,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);
|
||||||
}
|
}
|
||||||
@ -1030,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`."),
|
||||||
@ -1090,7 +1096,10 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for ParamsSubstitutor<'tcx> {
|
|||||||
ty::Param(param) => match self.list.iter().position(|r| r == ¶m) {
|
ty::Param(param) => match self.list.iter().position(|r| r == ¶m) {
|
||||||
Some(idx) => self.tcx.mk_placeholder(ty::PlaceholderType {
|
Some(idx) => self.tcx.mk_placeholder(ty::PlaceholderType {
|
||||||
universe: ty::UniverseIndex::from_usize(0),
|
universe: ty::UniverseIndex::from_usize(0),
|
||||||
name: ty::BoundTyKind::Anon(idx as u32),
|
bound: ty::BoundTy {
|
||||||
|
var: ty::BoundVar::from_usize(idx),
|
||||||
|
kind: ty::BoundTyKind::Anon,
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
None => {
|
None => {
|
||||||
self.list.push(param);
|
self.list.push(param);
|
||||||
@ -1098,7 +1107,10 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for ParamsSubstitutor<'tcx> {
|
|||||||
self.params.insert(idx as u32, param);
|
self.params.insert(idx as u32, param);
|
||||||
self.tcx.mk_placeholder(ty::PlaceholderType {
|
self.tcx.mk_placeholder(ty::PlaceholderType {
|
||||||
universe: ty::UniverseIndex::from_usize(0),
|
universe: ty::UniverseIndex::from_usize(0),
|
||||||
name: ty::BoundTyKind::Anon(idx as u32),
|
bound: ty::BoundTy {
|
||||||
|
var: ty::BoundVar::from_usize(idx),
|
||||||
|
kind: ty::BoundTyKind::Anon,
|
||||||
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -1115,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)
|
||||||
}
|
}
|
||||||
@ -1123,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)
|
||||||
@ -1156,8 +1168,8 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for ReverseParamsSubstitutor<'tcx> {
|
|||||||
|
|
||||||
fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
|
fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
|
||||||
match *t.kind() {
|
match *t.kind() {
|
||||||
ty::Placeholder(ty::PlaceholderType { universe: ty::UniverseIndex::ROOT, name }) => {
|
ty::Placeholder(ty::PlaceholderType { universe: ty::UniverseIndex::ROOT, bound }) => {
|
||||||
match self.params.get(&name.expect_anon()) {
|
match self.params.get(&bound.var.as_u32()) {
|
||||||
Some(&ty::ParamTy { index, name }) => self.tcx.mk_ty_param(index, name),
|
Some(&ty::ParamTy { index, name }) => self.tcx.mk_ty_param(index, name),
|
||||||
None => t,
|
None => t,
|
||||||
}
|
}
|
||||||
@ -1189,8 +1201,7 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for PlaceholdersCollector {
|
|||||||
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
|
fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow<Self::BreakTy> {
|
||||||
match t.kind() {
|
match t.kind() {
|
||||||
ty::Placeholder(p) if p.universe == self.universe_index => {
|
ty::Placeholder(p) if p.universe == self.universe_index => {
|
||||||
self.next_ty_placeholder =
|
self.next_ty_placeholder = self.next_ty_placeholder.max(p.bound.var.as_usize() + 1);
|
||||||
self.next_ty_placeholder.max(p.name.expect_anon() as usize + 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_ => (),
|
_ => (),
|
||||||
@ -1202,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.name {
|
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?
|
||||||
}
|
}
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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)),
|
||||||
(),
|
(),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -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)),
|
||||||
(),
|
(),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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,
|
||||||
(),
|
(),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user