1
Fork 0

visit_x_unambig

This commit is contained in:
Boxy 2025-01-18 22:45:41 +00:00
parent 6833c27090
commit 2bdeff2fb8
27 changed files with 92 additions and 92 deletions

View file

@ -48,7 +48,7 @@ fn find_component_for_bound_region<'tcx>(
region_def_id: DefId,
) -> Option<&'tcx hir::Ty<'tcx>> {
FindNestedTypeVisitor { tcx, region_def_id, current_index: ty::INNERMOST }
.visit_unambig_ty(arg)
.visit_ty_unambig(arg)
.break_value()
}

View file

@ -87,7 +87,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
for matching_def_id in v.0 {
let mut hir_v =
super::static_impl_trait::HirTraitObjectVisitor(&mut traits, matching_def_id);
hir_v.visit_unambig_ty(impl_self_ty);
hir_v.visit_ty_unambig(impl_self_ty);
}
if traits.is_empty() {

View file

@ -153,7 +153,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
let mut add_label = true;
if let hir::FnRetTy::Return(ty) = fn_decl.output {
let mut v = StaticLifetimeVisitor(vec![], tcx.hir());
v.visit_unambig_ty(ty);
v.visit_ty_unambig(ty);
if !v.0.is_empty() {
span = v.0.clone().into();
spans = v.0;
@ -500,7 +500,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
// In that case, only the first one will get suggestions.
let mut traits = vec![];
let mut hir_v = HirTraitObjectVisitor(&mut traits, *did);
hir_v.visit_unambig_ty(self_ty);
hir_v.visit_ty_unambig(self_ty);
!traits.is_empty()
})
{
@ -560,7 +560,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
for found_did in found_dids {
let mut traits = vec![];
let mut hir_v = HirTraitObjectVisitor(&mut traits, *found_did);
hir_v.visit_unambig_ty(self_ty);
hir_v.visit_ty_unambig(self_ty);
for &span in &traits {
let subdiag = DynTraitConstraintSuggestion { span, ident };
subdiag.add_to_diag(err);

View file

@ -178,7 +178,7 @@ pub fn suggest_restriction<'tcx, G: EmissionGuarantee>(
let mut ty_spans = vec![];
for input in fn_sig.decl.inputs {
ReplaceImplTraitVisitor { ty_spans: &mut ty_spans, param_did: param.def_id }
.visit_unambig_ty(input);
.visit_ty_unambig(input);
}
// The type param `T: Trait` we will suggest to introduce.
let type_param = format!("{type_param_name}: {bound_str}");

View file

@ -641,16 +641,16 @@ impl Subdiagnostic for AddLifetimeParamsSuggestion<'_> {
if let Some(fn_decl) = node.fn_decl()
&& let hir::FnRetTy::Return(ty) = fn_decl.output
{
visitor.visit_unambig_ty(ty);
visitor.visit_ty_unambig(ty);
}
if visitor.suggestions.is_empty() {
// Do not suggest constraining the `&self` param, but rather the return type.
// If that is wrong (because it is not sufficient), a follow up error will tell the
// user to fix it. This way we lower the chances of *over* constraining, but still
// get the cake of "correctly" contrained in two steps.
visitor.visit_unambig_ty(self.ty_sup);
visitor.visit_ty_unambig(self.ty_sup);
}
visitor.visit_unambig_ty(self.ty_sub);
visitor.visit_ty_unambig(self.ty_sub);
if visitor.suggestions.is_empty() {
return false;
}