ty::BrK -> ty::BoundRegionKind::K
This commit is contained in:
parent
883f8705d4
commit
d458f850aa
37 changed files with 164 additions and 139 deletions
|
@ -2244,7 +2244,7 @@ fn param_env_with_gat_bounds<'tcx>(
|
|||
.into()
|
||||
}
|
||||
GenericParamDefKind::Lifetime => {
|
||||
let kind = ty::BoundRegionKind::BrNamed(param.def_id, param.name);
|
||||
let kind = ty::BoundRegionKind::Named(param.def_id, param.name);
|
||||
let bound_var = ty::BoundVariableKind::Region(kind);
|
||||
bound_vars.push(bound_var);
|
||||
ty::Region::new_bound(tcx, ty::INNERMOST, ty::BoundRegion {
|
||||
|
|
|
@ -178,19 +178,19 @@ pub fn check_intrinsic_type(
|
|||
let name_str = intrinsic_name.as_str();
|
||||
|
||||
let bound_vars = tcx.mk_bound_variable_kinds(&[
|
||||
ty::BoundVariableKind::Region(ty::BrAnon),
|
||||
ty::BoundVariableKind::Region(ty::BrAnon),
|
||||
ty::BoundVariableKind::Region(ty::BrEnv),
|
||||
ty::BoundVariableKind::Region(ty::BoundRegionKind::Anon),
|
||||
ty::BoundVariableKind::Region(ty::BoundRegionKind::Anon),
|
||||
ty::BoundVariableKind::Region(ty::BoundRegionKind::ClosureEnv),
|
||||
]);
|
||||
let mk_va_list_ty = |mutbl| {
|
||||
tcx.lang_items().va_list().map(|did| {
|
||||
let region = ty::Region::new_bound(tcx, ty::INNERMOST, ty::BoundRegion {
|
||||
var: ty::BoundVar::ZERO,
|
||||
kind: ty::BrAnon,
|
||||
kind: ty::BoundRegionKind::Anon,
|
||||
});
|
||||
let env_region = ty::Region::new_bound(tcx, ty::INNERMOST, ty::BoundRegion {
|
||||
var: ty::BoundVar::from_u32(2),
|
||||
kind: ty::BrEnv,
|
||||
kind: ty::BoundRegionKind::ClosureEnv,
|
||||
});
|
||||
let va_list_ty = tcx.type_of(did).instantiate(tcx, &[region.into()]);
|
||||
(Ty::new_ref(tcx, env_region, va_list_ty, mutbl), va_list_ty)
|
||||
|
@ -509,7 +509,8 @@ pub fn check_intrinsic_type(
|
|||
);
|
||||
let discriminant_def_id = assoc_items[0];
|
||||
|
||||
let br = ty::BoundRegion { var: ty::BoundVar::ZERO, kind: ty::BrAnon };
|
||||
let br =
|
||||
ty::BoundRegion { var: ty::BoundVar::ZERO, kind: ty::BoundRegionKind::Anon };
|
||||
(
|
||||
1,
|
||||
0,
|
||||
|
@ -573,10 +574,14 @@ pub fn check_intrinsic_type(
|
|||
}
|
||||
|
||||
sym::raw_eq => {
|
||||
let br = ty::BoundRegion { var: ty::BoundVar::ZERO, kind: ty::BrAnon };
|
||||
let br =
|
||||
ty::BoundRegion { var: ty::BoundVar::ZERO, kind: ty::BoundRegionKind::Anon };
|
||||
let param_ty_lhs =
|
||||
Ty::new_imm_ref(tcx, ty::Region::new_bound(tcx, ty::INNERMOST, br), param(0));
|
||||
let br = ty::BoundRegion { var: ty::BoundVar::from_u32(1), kind: ty::BrAnon };
|
||||
let br = ty::BoundRegion {
|
||||
var: ty::BoundVar::from_u32(1),
|
||||
kind: ty::BoundRegionKind::Anon,
|
||||
};
|
||||
let param_ty_rhs =
|
||||
Ty::new_imm_ref(tcx, ty::Region::new_bound(tcx, ty::INNERMOST, br), param(0));
|
||||
(1, 0, vec![param_ty_lhs, param_ty_rhs], tcx.types.bool)
|
||||
|
|
|
@ -634,7 +634,7 @@ fn get_new_lifetime_name<'tcx>(
|
|||
.collect_referenced_late_bound_regions(poly_trait_ref)
|
||||
.into_iter()
|
||||
.filter_map(|lt| {
|
||||
if let ty::BoundRegionKind::BrNamed(_, name) = lt {
|
||||
if let ty::BoundRegionKind::Named(_, name) = lt {
|
||||
Some(name.as_str().to_string())
|
||||
} else {
|
||||
None
|
||||
|
|
|
@ -322,7 +322,7 @@ fn late_arg_as_bound_arg<'tcx>(
|
|||
let name = tcx.item_name(def_id);
|
||||
match param.kind {
|
||||
GenericParamKind::Lifetime { .. } => {
|
||||
ty::BoundVariableKind::Region(ty::BrNamed(def_id, name))
|
||||
ty::BoundVariableKind::Region(ty::BoundRegionKind::Named(def_id, name))
|
||||
}
|
||||
GenericParamKind::Type { .. } => {
|
||||
ty::BoundVariableKind::Ty(ty::BoundTyKind::Param(def_id, name))
|
||||
|
@ -337,7 +337,7 @@ fn late_arg_as_bound_arg<'tcx>(
|
|||
fn generic_param_def_as_bound_arg(param: &ty::GenericParamDef) -> ty::BoundVariableKind {
|
||||
match param.kind {
|
||||
ty::GenericParamDefKind::Lifetime => {
|
||||
ty::BoundVariableKind::Region(ty::BoundRegionKind::BrNamed(param.def_id, param.name))
|
||||
ty::BoundVariableKind::Region(ty::BoundRegionKind::Named(param.def_id, param.name))
|
||||
}
|
||||
ty::GenericParamDefKind::Type { .. } => {
|
||||
ty::BoundVariableKind::Ty(ty::BoundTyKind::Param(param.def_id, param.name))
|
||||
|
|
|
@ -644,7 +644,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
|
|||
ty::GenericParamDefKind::Lifetime => {
|
||||
ty::Region::new_bound(tcx, ty::INNERMOST, ty::BoundRegion {
|
||||
var: ty::BoundVar::from_usize(num_bound_vars),
|
||||
kind: ty::BoundRegionKind::BrNamed(param.def_id, param.name),
|
||||
kind: ty::BoundRegionKind::Named(param.def_id, param.name),
|
||||
})
|
||||
.into()
|
||||
}
|
||||
|
@ -830,8 +830,8 @@ impl<'tcx> TypeVisitor<TyCtxt<'tcx>> for GenericParamAndBoundVarCollector<'_, 't
|
|||
}
|
||||
ty::ReBound(db, br) if db >= self.depth => {
|
||||
self.vars.insert(match br.kind {
|
||||
ty::BrNamed(def_id, name) => (def_id, name),
|
||||
ty::BrAnon | ty::BrEnv => {
|
||||
ty::BoundRegionKind::Named(def_id, name) => (def_id, name),
|
||||
ty::BoundRegionKind::Anon | ty::BoundRegionKind::ClosureEnv => {
|
||||
let guar = self
|
||||
.cx
|
||||
.dcx()
|
||||
|
|
|
@ -314,7 +314,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
|
|||
let name = lifetime_name(def_id);
|
||||
let br = ty::BoundRegion {
|
||||
var: ty::BoundVar::from_u32(index),
|
||||
kind: ty::BrNamed(def_id.to_def_id(), name),
|
||||
kind: ty::BoundRegionKind::Named(def_id.to_def_id(), name),
|
||||
};
|
||||
ty::Region::new_bound(tcx, debruijn, br)
|
||||
}
|
||||
|
@ -332,7 +332,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
|
|||
ty::Region::new_late_param(
|
||||
tcx,
|
||||
scope.to_def_id(),
|
||||
ty::BrNamed(id.to_def_id(), name),
|
||||
ty::BoundRegionKind::Named(id.to_def_id(), name),
|
||||
)
|
||||
|
||||
// (*) -- not late-bound, won't change
|
||||
|
@ -2449,15 +2449,17 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
|
|||
) {
|
||||
for br in referenced_regions.difference(&constrained_regions) {
|
||||
let br_name = match *br {
|
||||
ty::BrNamed(_, kw::UnderscoreLifetime) | ty::BrAnon | ty::BrEnv => {
|
||||
"an anonymous lifetime".to_string()
|
||||
}
|
||||
ty::BrNamed(_, name) => format!("lifetime `{name}`"),
|
||||
ty::BoundRegionKind::Named(_, kw::UnderscoreLifetime)
|
||||
| ty::BoundRegionKind::Anon
|
||||
| ty::BoundRegionKind::ClosureEnv => "an anonymous lifetime".to_string(),
|
||||
ty::BoundRegionKind::Named(_, name) => format!("lifetime `{name}`"),
|
||||
};
|
||||
|
||||
let mut err = generate_err(&br_name);
|
||||
|
||||
if let ty::BrNamed(_, kw::UnderscoreLifetime) | ty::BrAnon = *br {
|
||||
if let ty::BoundRegionKind::Named(_, kw::UnderscoreLifetime)
|
||||
| ty::BoundRegionKind::Anon = *br
|
||||
{
|
||||
// The only way for an anonymous lifetime to wind up
|
||||
// in the return type but **also** be unconstrained is
|
||||
// if it only appears in "associated types" in the
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue