Remove span from BrAnon.

This commit is contained in:
Camille GILLOT 2023-08-03 15:56:56 +00:00
parent ded1a8b026
commit 26cb34cd18
39 changed files with 76 additions and 107 deletions

View file

@ -354,7 +354,7 @@ impl<'tcx> MirBorrowckCtxt<'_, 'tcx> {
}) })
} }
ty::BoundRegionKind::BrAnon(..) => None, ty::BoundRegionKind::BrAnon => None,
}, },
ty::ReLateBound(..) ty::ReLateBound(..)

View file

@ -7,7 +7,7 @@ use rustc_middle::mir::visit::{MutVisitor, TyContext};
use rustc_middle::mir::{Body, ConstOperand, Location, Promoted}; use rustc_middle::mir::{Body, ConstOperand, Location, Promoted};
use rustc_middle::ty::GenericArgsRef; use rustc_middle::ty::GenericArgsRef;
use rustc_middle::ty::{self, Ty, TyCtxt, TypeFoldable}; use rustc_middle::ty::{self, Ty, TyCtxt, TypeFoldable};
use rustc_span::{Span, Symbol}; use rustc_span::Symbol;
/// Replaces all free regions appearing in the MIR with fresh /// Replaces all free regions appearing in the MIR with fresh
/// inference variables, returning the number of variables created. /// inference variables, returning the number of variables created.
@ -28,21 +28,15 @@ pub fn renumber_mir<'tcx>(
renumberer.visit_body(body); renumberer.visit_body(body);
} }
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
pub(crate) enum BoundRegionInfo {
Name(Symbol),
Span(Span),
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)] #[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
pub(crate) enum RegionCtxt { pub(crate) enum RegionCtxt {
Location(Location), Location(Location),
TyContext(TyContext), TyContext(TyContext),
Free(Symbol), Free(Symbol),
Bound(BoundRegionInfo), Bound(Symbol),
LateBound(BoundRegionInfo), LateBound(Symbol),
Existential(Option<Symbol>), Existential(Option<Symbol>),
Placeholder(BoundRegionInfo), Placeholder(Symbol),
Unknown, Unknown,
} }

View file

@ -1367,14 +1367,13 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
} }
}; };
let (sig, map) = tcx.replace_late_bound_regions(sig, |br| { let (sig, map) = tcx.replace_late_bound_regions(sig, |br| {
use crate::renumber::{BoundRegionInfo, RegionCtxt}; use crate::renumber::RegionCtxt;
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)) => BoundRegionInfo::Span(span), ty::BoundRegionKind::BrAnon => sym::anon,
ty::BoundRegionKind::BrAnon(..) => BoundRegionInfo::Name(sym::anon), ty::BoundRegionKind::BrNamed(_, name) => name,
ty::BoundRegionKind::BrNamed(_, name) => BoundRegionInfo::Name(name), ty::BoundRegionKind::BrEnv => sym::env,
ty::BoundRegionKind::BrEnv => BoundRegionInfo::Name(sym::env),
}; };
RegionCtxt::LateBound(reg_info) RegionCtxt::LateBound(reg_info)

View file

@ -11,7 +11,7 @@ use rustc_span::{Span, Symbol};
use crate::constraints::OutlivesConstraint; use crate::constraints::OutlivesConstraint;
use crate::diagnostics::UniverseInfo; use crate::diagnostics::UniverseInfo;
use crate::renumber::{BoundRegionInfo, RegionCtxt}; use crate::renumber::RegionCtxt;
use crate::type_check::{InstantiateOpaqueType, Locations, TypeChecker}; use crate::type_check::{InstantiateOpaqueType, Locations, TypeChecker};
impl<'a, 'tcx> TypeChecker<'a, 'tcx> { impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
@ -126,10 +126,9 @@ 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 => sym::anon,
ty::BoundRegionKind::BrAnon(..) => BoundRegionInfo::Name(sym::anon), ty::BoundRegionKind::BrNamed(_, name) => name,
ty::BoundRegionKind::BrNamed(_, name) => BoundRegionInfo::Name(name), ty::BoundRegionKind::BrEnv => sym::env,
ty::BoundRegionKind::BrEnv => BoundRegionInfo::Name(sym::env),
}; };
if cfg!(debug_assertions) { if cfg!(debug_assertions) {

View file

@ -28,7 +28,7 @@ use rustc_span::symbol::{kw, sym};
use rustc_span::Symbol; use rustc_span::Symbol;
use std::iter; use std::iter;
use crate::renumber::{BoundRegionInfo, RegionCtxt}; use crate::renumber::RegionCtxt;
use crate::BorrowckInferCtxt; use crate::BorrowckInferCtxt;
#[derive(Debug)] #[derive(Debug)]
@ -446,9 +446,7 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
if !indices.indices.contains_key(&r) { if !indices.indices.contains_key(&r) {
let region_vid = { let region_vid = {
let name = r.get_name_or_anon(); let name = r.get_name_or_anon();
self.infcx.next_nll_region_var(FR, || { self.infcx.next_nll_region_var(FR, || RegionCtxt::LateBound(name))
RegionCtxt::LateBound(BoundRegionInfo::Name(name))
})
}; };
debug!(?region_vid); debug!(?region_vid);
@ -480,9 +478,7 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
if !indices.indices.contains_key(&r) { if !indices.indices.contains_key(&r) {
let region_vid = { let region_vid = {
let name = r.get_name_or_anon(); let name = r.get_name_or_anon();
self.infcx.next_nll_region_var(FR, || { self.infcx.next_nll_region_var(FR, || RegionCtxt::LateBound(name))
RegionCtxt::LateBound(BoundRegionInfo::Name(name))
})
}; };
debug!(?region_vid); debug!(?region_vid);
@ -796,7 +792,7 @@ impl<'cx, 'tcx> InferCtxtExt<'tcx> for BorrowckInferCtxt<'cx, 'tcx> {
_ => sym::anon, _ => sym::anon,
}; };
self.next_nll_region_var(origin, || RegionCtxt::Bound(BoundRegionInfo::Name(name))) self.next_nll_region_var(origin, || RegionCtxt::Bound(name))
}; };
indices.insert_late_bound_region(liberated_region, region_vid.as_var()); indices.insert_late_bound_region(liberated_region, region_vid.as_var());
@ -826,9 +822,7 @@ impl<'cx, 'tcx> InferCtxtExt<'tcx> for BorrowckInferCtxt<'cx, 'tcx> {
if !indices.indices.contains_key(&r) { if !indices.indices.contains_key(&r) {
let region_vid = { let region_vid = {
let name = r.get_name_or_anon(); let name = r.get_name_or_anon();
self.next_nll_region_var(FR, || { self.next_nll_region_var(FR, || RegionCtxt::LateBound(name))
RegionCtxt::LateBound(BoundRegionInfo::Name(name))
})
}; };
debug!(?region_vid); debug!(?region_vid);
@ -848,9 +842,7 @@ impl<'cx, 'tcx> InferCtxtExt<'tcx> for BorrowckInferCtxt<'cx, 'tcx> {
if !indices.indices.contains_key(&r) { if !indices.indices.contains_key(&r) {
let region_vid = { let region_vid = {
let name = r.get_name_or_anon(); let name = r.get_name_or_anon();
self.next_nll_region_var(FR, || { self.next_nll_region_var(FR, || RegionCtxt::LateBound(name))
RegionCtxt::LateBound(BoundRegionInfo::Name(name))
})
}; };
indices.insert_late_bound_region(r, region_vid.as_var()); indices.insert_late_bound_region(r, region_vid.as_var());

View file

@ -2781,7 +2781,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
) { ) {
for br in referenced_regions.difference(&constrained_regions) { for br in referenced_regions.difference(&constrained_regions) {
let br_name = match *br { let br_name = match *br {
ty::BrNamed(_, kw::UnderscoreLifetime) | ty::BrAnon(..) | ty::BrEnv => { ty::BrNamed(_, kw::UnderscoreLifetime) | ty::BrAnon | ty::BrEnv => {
"an anonymous lifetime".to_string() "an anonymous lifetime".to_string()
} }
ty::BrNamed(_, name) => format!("lifetime `{name}`"), ty::BrNamed(_, name) => format!("lifetime `{name}`"),
@ -2789,7 +2789,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
let mut err = generate_err(&br_name); let mut err = generate_err(&br_name);
if let ty::BrNamed(_, kw::UnderscoreLifetime) | ty::BrAnon(..) = *br { if let ty::BrNamed(_, kw::UnderscoreLifetime) | ty::BrAnon = *br {
// The only way for an anonymous lifetime to wind up // The only way for an anonymous lifetime to wind up
// in the return type but **also** be unconstrained is // in the return type but **also** be unconstrained is
// if it only appears in "associated types" in the // if it only appears in "associated types" in the

View file

@ -137,7 +137,7 @@ 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(None)), ty::BoundVariableKind::Region(ty::BrAnon),
ty::BoundVariableKind::Region(ty::BrEnv), ty::BoundVariableKind::Region(ty::BrEnv),
]); ]);
let mk_va_list_ty = |mutbl| { let mk_va_list_ty = |mutbl| {
@ -145,7 +145,7 @@ pub fn check_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem<'_>) {
let region = ty::Region::new_late_bound( let region = ty::Region::new_late_bound(
tcx, tcx,
ty::INNERMOST, ty::INNERMOST,
ty::BoundRegion { var: ty::BoundVar::from_u32(0), kind: ty::BrAnon(None) }, ty::BoundRegion { var: ty::BoundVar::from_u32(0), kind: ty::BrAnon },
); );
let env_region = ty::Region::new_late_bound( let env_region = ty::Region::new_late_bound(
tcx, tcx,
@ -405,7 +405,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 = ty::BoundRegion { var: ty::BoundVar::from_u32(0), kind: ty::BrAnon(None) }; let br = ty::BoundRegion { var: ty::BoundVar::from_u32(0), kind: ty::BrAnon };
( (
1, 1,
vec![Ty::new_imm_ref( vec![Ty::new_imm_ref(
@ -463,7 +463,7 @@ pub fn check_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem<'_>) {
} }
sym::raw_eq => { sym::raw_eq => {
let br = ty::BoundRegion { var: ty::BoundVar::from_u32(0), kind: ty::BrAnon(None) }; let br = ty::BoundRegion { var: ty::BoundVar::from_u32(0), kind: ty::BrAnon };
let param_ty = Ty::new_imm_ref( let param_ty = Ty::new_imm_ref(
tcx, tcx,
ty::Region::new_late_bound(tcx, ty::INNERMOST, br), ty::Region::new_late_bound(tcx, ty::INNERMOST, br),

View file

@ -204,7 +204,7 @@ fn check_panic_info_fn(tcx: TyCtxt<'_>, fn_id: LocalDefId, fn_sig: ty::FnSig<'_>
&[ty::GenericArg::from(ty::Region::new_late_bound( &[ty::GenericArg::from(ty::Region::new_late_bound(
tcx, tcx,
ty::INNERMOST, ty::INNERMOST,
ty::BoundRegion { var: ty::BoundVar::from_u32(1), kind: ty::BrAnon(None) }, ty::BoundRegion { var: ty::BoundVar::from_u32(1), kind: ty::BrAnon },
))], ))],
); );
let panic_info_ref_ty = Ty::new_imm_ref( let panic_info_ref_ty = Ty::new_imm_ref(
@ -212,14 +212,14 @@ fn check_panic_info_fn(tcx: TyCtxt<'_>, fn_id: LocalDefId, fn_sig: ty::FnSig<'_>
ty::Region::new_late_bound( ty::Region::new_late_bound(
tcx, tcx,
ty::INNERMOST, ty::INNERMOST,
ty::BoundRegion { var: ty::BoundVar::from_u32(0), kind: ty::BrAnon(None) }, ty::BoundRegion { var: ty::BoundVar::from_u32(0), kind: ty::BrAnon },
), ),
panic_info_ty, panic_info_ty,
); );
let bounds = tcx.mk_bound_variable_kinds(&[ let bounds = tcx.mk_bound_variable_kinds(&[
ty::BoundVariableKind::Region(ty::BrAnon(None)), ty::BoundVariableKind::Region(ty::BrAnon),
ty::BoundVariableKind::Region(ty::BrAnon(None)), ty::BoundVariableKind::Region(ty::BrAnon),
]); ]);
let expected_sig = ty::Binder::bind_with_vars( let expected_sig = ty::Binder::bind_with_vars(
tcx.mk_fn_sig([panic_info_ref_ty], tcx.types.never, false, fn_sig.unsafety, Abi::Rust), tcx.mk_fn_sig([panic_info_ref_ty], tcx.types.never, false, fn_sig.unsafety, Abi::Rust),

View file

@ -56,11 +56,8 @@ impl<'a> DescriptionCtx<'a> {
(Some(span), "as_defined", name.to_string()) (Some(span), "as_defined", name.to_string())
} }
} }
ty::BrAnon(span) => { ty::BrAnon => {
let span = match span { let span = Some(tcx.def_span(scope));
Some(_) => span,
None => Some(tcx.def_span(scope)),
};
(span, "defined_here", String::new()) (span, "defined_here", String::new())
} }
_ => { _ => {

View file

@ -775,7 +775,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(None) }; let br = ty::BoundRegion { var, kind: ty::BrAnon };
ty::Region::new_late_bound(self.interner(), self.binder_index, br) ty::Region::new_late_bound(self.interner(), self.binder_index, br)
} }

View file

@ -242,12 +242,9 @@ fn msg_span_from_named_region<'tcx>(
}; };
(text, Some(span)) (text, Some(span))
} }
ty::BrAnon(span) => ( ty::BrAnon => (
"the anonymous lifetime as defined here".to_string(), "the anonymous lifetime as defined here".to_string(),
Some(match span { Some(tcx.def_span(scope))
Some(span) => span,
None => tcx.def_span(scope)
})
), ),
_ => ( _ => (
format!("the lifetime `{region}` as defined here"), format!("the lifetime `{region}` as defined here"),
@ -262,11 +259,7 @@ 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, .. },
..
}) => ("the anonymous lifetime defined here".to_owned(), Some(span)),
ty::RePlaceholder(ty::PlaceholderRegion {
bound: ty::BoundRegion { kind: ty::BoundRegionKind::BrAnon(None), .. },
.. ..
}) => ("an anonymous lifetime".to_owned(), None), }) => ("an anonymous lifetime".to_owned(), None),
_ => bug!("{:?}", region), _ => bug!("{:?}", region),

View file

@ -61,7 +61,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
let is_impl_item = region_info.is_impl_item; let is_impl_item = region_info.is_impl_item;
match br { match br {
ty::BrNamed(_, kw::UnderscoreLifetime) | ty::BrAnon(..) => {} ty::BrNamed(_, kw::UnderscoreLifetime) | ty::BrAnon => {}
_ => { _ => {
/* not an anonymous region */ /* not an anonymous region */
debug!("try_report_named_anon_conflict: not an anonymous region"); debug!("try_report_named_anon_conflict: not an anonymous region");

View file

@ -36,15 +36,13 @@ 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 | 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 | 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) {
(Some(sub_span), Some(sup_span), Some(&sub_symbol), Some(&sup_symbol)) => { (Some(sub_span), Some(sup_span), Some(&sub_symbol), Some(&sup_symbol)) => {

View file

@ -455,7 +455,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(None), kind: ty::BrAnon,
}; };
ty::Region::new_late_bound(tcx, ty::INNERMOST, br).into() ty::Region::new_late_bound(tcx, ty::INNERMOST, br).into()
} }

View file

@ -414,8 +414,7 @@ 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 = let br = ty::BoundRegion { var: ty::BoundVar::new(vid.index()), kind: ty::BrAnon };
ty::BoundRegion { var: ty::BoundVar::new(vid.index()), kind: ty::BrAnon(None) };
ty::Region::new_late_bound(tcx, depth, br) ty::Region::new_late_bound(tcx, depth, br)
} }
_ => bug!("unexpected region in ClosureOutlivesSubjectTy: {r:?}"), _ => bug!("unexpected region in ClosureOutlivesSubjectTy: {r:?}"),

View file

@ -318,7 +318,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(None) })` /// `ReLateBound(DebruijnIndex(i), BoundRegion { var: v, kind: BrAnon })`
/// 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>>>,
} }
@ -395,7 +395,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 { var: ty::BoundVar::from(v), kind: ty::BrAnon(None) }, ty::BoundRegion { var: ty::BoundVar::from(v), kind: ty::BrAnon },
)) ))
}) })
.collect() .collect()

View file

@ -385,7 +385,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(|| ty::BoundVariableKind::Region(ty::BrAnon(None))) .or_insert_with(|| ty::BoundVariableKind::Region(ty::BrAnon))
.expect_region(); .expect_region();
let br = ty::BoundRegion { var, kind }; let br = ty::BoundRegion { var, kind };
ty::Region::new_late_bound(self.tcx, ty::INNERMOST, br) ty::Region::new_late_bound(self.tcx, ty::INNERMOST, br)

View file

@ -2330,7 +2330,7 @@ impl<'a, 'tcx> ty::TypeFolder<TyCtxt<'tcx>> for RegionFolder<'a, 'tcx> {
// 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 {
ty::BrAnon(..) | ty::BrEnv => r, ty::BrAnon | ty::BrEnv => r,
_ => { _ => {
// Index doesn't matter, since this is just for naming and these never get bound // Index doesn't matter, since this is just for naming and these never get bound
let br = ty::BoundRegion { var: ty::BoundVar::from_u32(0), kind }; let br = ty::BoundRegion { var: ty::BoundVar::from_u32(0), kind };
@ -2451,7 +2451,7 @@ impl<'tcx> FmtPrinter<'_, 'tcx> {
binder_level_idx: ty::DebruijnIndex, binder_level_idx: ty::DebruijnIndex,
br: ty::BoundRegion| { br: ty::BoundRegion| {
let (name, kind) = match br.kind { let (name, kind) = match br.kind {
ty::BrAnon(..) | ty::BrEnv => { ty::BrAnon | ty::BrEnv => {
let name = next_name(&self); let name = next_name(&self);
if let Some(lt_idx) = lifetime_idx { if let Some(lt_idx) = lifetime_idx {

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(span) => write!(f, "BrAnon({span:?})"), ty::BrAnon => write!(f, "BrAnon"),
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

@ -69,7 +69,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(Option<Span>), BrAnon,
/// Named region parameters for functions (a in &'a T) /// Named region parameters for functions (a in &'a T)
/// ///
@ -1465,7 +1465,7 @@ impl<'tcx> Region<'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(None) } = bound_region if let ty::BoundRegion { var, kind: ty::BrAnon } = bound_region
&& let Some(inner) = tcx.lifetimes.re_late_bounds.get(debruijn.as_usize()) && let Some(inner) = tcx.lifetimes.re_late_bounds.get(debruijn.as_usize())
&& let Some(re) = inner.get(var.as_usize()).copied() && let Some(re) = inner.get(var.as_usize()).copied()
{ {
@ -3010,7 +3010,7 @@ mod size_asserts {
use super::*; use super::*;
use rustc_data_structures::static_assert_size; use rustc_data_structures::static_assert_size;
// tidy-alphabetical-start // tidy-alphabetical-start
static_assert_size!(RegionKind<'_>, 28); static_assert_size!(RegionKind<'_>, 24);
static_assert_size!(TyKind<'_>, 32); static_assert_size!(TyKind<'_>, 32);
// tidy-alphabetical-end // tidy-alphabetical-end
} }

View file

@ -979,13 +979,11 @@ impl<'tcx> Stable<'tcx> for ty::BoundTyKind {
impl<'tcx> Stable<'tcx> for ty::BoundRegionKind { impl<'tcx> Stable<'tcx> for ty::BoundRegionKind {
type T = stable_mir::ty::BoundRegionKind; type T = stable_mir::ty::BoundRegionKind;
fn stable(&self, tables: &mut Tables<'tcx>) -> Self::T { fn stable(&self, _: &mut Tables<'tcx>) -> Self::T {
use stable_mir::ty::BoundRegionKind; use stable_mir::ty::BoundRegionKind;
match self { match self {
ty::BoundRegionKind::BrAnon(option_span) => { ty::BoundRegionKind::BrAnon => BoundRegionKind::BrAnon,
BoundRegionKind::BrAnon(option_span.map(|span| span.stable(tables)))
}
ty::BoundRegionKind::BrNamed(def_id, symbol) => { ty::BoundRegionKind::BrNamed(def_id, symbol) => {
BoundRegionKind::BrNamed(rustc_internal::br_named_def(*def_id), symbol.to_string()) BoundRegionKind::BrNamed(rustc_internal::br_named_def(*def_id), symbol.to_string())
} }

View file

@ -286,7 +286,7 @@ pub enum BoundTyKind {
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub enum BoundRegionKind { pub enum BoundRegionKind {
BrAnon(Option<Span>), BrAnon,
BrNamed(BrNamedDef, String), BrNamed(BrNamedDef, String),
BrEnv, BrEnv,
} }

View file

@ -329,7 +329,7 @@ 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 { var, kind: ty::BrAnon(_) }) => { 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 + var.as_u32(); let depth = binder.lifetime_depths.start + var.as_u32();

View file

@ -94,8 +94,7 @@ pub(in crate::solve) fn replace_erased_lifetimes_with_bound_vars<'tcx>(
let mut counter = 0; let mut counter = 0;
let ty = tcx.fold_regions(ty, |r, current_depth| match r.kind() { let ty = tcx.fold_regions(ty, |r, current_depth| match r.kind() {
ty::ReErased => { ty::ReErased => {
let br = let br = ty::BoundRegion { var: ty::BoundVar::from_u32(counter), kind: ty::BrAnon };
ty::BoundRegion { var: ty::BoundVar::from_u32(counter), kind: ty::BrAnon(None) };
counter += 1; counter += 1;
ty::Region::new_late_bound(tcx, current_depth, br) ty::Region::new_late_bound(tcx, current_depth, br)
} }
@ -103,7 +102,7 @@ pub(in crate::solve) fn replace_erased_lifetimes_with_bound_vars<'tcx>(
r => bug!("unexpected region: {r:?}"), r => bug!("unexpected region: {r:?}"),
}); });
let bound_vars = tcx.mk_bound_variable_kinds_from_iter( let bound_vars = tcx.mk_bound_variable_kinds_from_iter(
(0..counter).map(|_| ty::BoundVariableKind::Region(ty::BrAnon(None))), (0..counter).map(|_| ty::BoundVariableKind::Region(ty::BrAnon)),
); );
ty::Binder::bind_with_vars(ty, bound_vars) ty::Binder::bind_with_vars(ty, bound_vars)
} }

View file

@ -269,7 +269,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(None) }; let br = ty::BoundRegion { var, kind: BrAnon };
ty::Region::new_late_bound(self.interner(), self.binder_index, br) ty::Region::new_late_bound(self.interner(), self.binder_index, br)
} }

View file

@ -3102,7 +3102,7 @@ fn bind_generator_hidden_types_above<'tcx>(
ty::ReErased => { ty::ReErased => {
let br = ty::BoundRegion { let br = ty::BoundRegion {
var: ty::BoundVar::from_u32(counter), var: ty::BoundVar::from_u32(counter),
kind: ty::BrAnon(None), kind: ty::BrAnon,
}; };
counter += 1; counter += 1;
ty::Region::new_late_bound(tcx, current_depth, br) ty::Region::new_late_bound(tcx, current_depth, br)
@ -3118,8 +3118,9 @@ fn bind_generator_hidden_types_above<'tcx>(
if considering_regions { if considering_regions {
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 =
(num_bound_variables..counter).map(|_| ty::BoundVariableKind::Region(ty::BrAnon(None))), tcx.mk_bound_variable_kinds_from_iter(bound_vars.iter().chain(
)); (num_bound_variables..counter).map(|_| ty::BoundVariableKind::Region(ty::BrAnon)),
));
ty::Binder::bind_with_vars(hidden_types, bound_vars) ty::Binder::bind_with_vars(hidden_types, bound_vars)
} }

View file

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

View file

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

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 args [ = note: defining type: supply::{closure#0} with closure args [
i16, i16,
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<&'?1 &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) }) &'?2 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>)), for<Region(BrAnon), Region(BrAnon), Region(BrAnon), Region(BrAnon), Region(BrAnon), Region(BrAnon)> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon }) &'?2 u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 5, kind: BrAnon }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon }) u32>)),
(), (),
] ]
= note: late-bound region is '?3 = note: late-bound region is '?3

View file

@ -6,7 +6,7 @@ LL | foo(cell, |cell_a, cell_x| {
| |
= note: defining type: case1::{closure#0} with closure args [ = note: defining type: case1::{closure#0} with closure args [
i32, i32,
for<Region(BrAnon(None))> extern "rust-call" fn((std::cell::Cell<&'?1 u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>)), for<Region(BrAnon)> extern "rust-call" fn((std::cell::Cell<&'?1 u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) u32>)),
(), (),
] ]
@ -36,7 +36,7 @@ LL | foo(cell, |cell_a, cell_x| {
| |
= note: defining type: case2::{closure#0} with closure args [ = note: defining type: case2::{closure#0} with closure args [
i32, i32,
for<Region(BrAnon(None))> extern "rust-call" fn((std::cell::Cell<&'?1 u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>)), for<Region(BrAnon)> extern "rust-call" fn((std::cell::Cell<&'?1 u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) 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 args [ = note: defining type: supply::{closure#0} with closure args [
i16, i16,
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<&'?1 &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>)), for<Region(BrAnon), Region(BrAnon), Region(BrAnon), Region(BrAnon), Region(BrAnon)> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon }) u32>)),
(), (),
] ]
= note: late-bound region is '?2 = note: late-bound region is '?2

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 args [ = note: defining type: supply::{closure#0} with closure args [
i16, i16,
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<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(None) }) std::cell::Cell<&'?2 &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>)), for<Region(BrAnon), Region(BrAnon), Region(BrAnon), Region(BrAnon), Region(BrAnon), Region(BrAnon)> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon }) std::cell::Cell<&'?2 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 5, kind: BrAnon }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon }) u32>)),
(), (),
] ]
= note: late-bound region is '?3 = note: late-bound region is '?3

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 args [ = note: defining type: test::{closure#0} with closure args [
i16, i16,
for<Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) &'?2 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>)), for<Region(BrAnon), Region(BrAnon)> extern "rust-call" fn((std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) &'?2 u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) u32>)),
(), (),
] ]
= note: late-bound region is '?3 = note: late-bound region is '?3

View file

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

View file

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

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 args [ = note: defining type: supply::{closure#0} with closure args [
i16, i16,
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) }) &'?1 u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon(None) }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon(None) }) &'?2 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>)), for<Region(BrAnon), Region(BrAnon), Region(BrAnon), Region(BrAnon), Region(BrAnon), Region(BrAnon)> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) &'?1 u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 2, kind: BrAnon }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon }) &'?2 u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 4, kind: BrAnon }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) u32>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 5, kind: BrAnon }) std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 3, kind: BrAnon }) u32>)),
(), (),
] ]
= note: late-bound region is '?3 = note: late-bound region is '?3

View file

@ -6,7 +6,7 @@ LL | expect_sig(|a, b| b); // ought to return `a`
| |
= note: defining type: test::{closure#0} with closure args [ = note: defining type: test::{closure#0} with closure args [
i16, i16,
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, for<Region(BrAnon), Region(BrAnon)> extern "rust-call" fn((&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) i32, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) i32)) -> &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) 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 args [ = note: defining type: generic::<T>::{closure#0} with closure args [
i16, i16,
for<Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((std::option::Option<std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) ()>>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) T)), for<Region(BrAnon), Region(BrAnon)> extern "rust-call" fn((std::option::Option<std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) ()>>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) 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 args [ = note: defining type: generic_fail::<T>::{closure#0} with closure args [
i16, i16,
for<Region(BrAnon(None)), Region(BrAnon(None))> extern "rust-call" fn((std::option::Option<std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon(None) }) ()>>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon(None) }) T)), for<Region(BrAnon), Region(BrAnon)> extern "rust-call" fn((std::option::Option<std::cell::Cell<&'?1 &ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) ()>>, &ReLateBound(DebruijnIndex(0), BoundRegion { var: 1, kind: BrAnon }) T)),
(), (),
] ]
= note: late-bound region is '?2 = note: late-bound region is '?2