Skip to content

Commit 2bdeff2

Browse files
committed
visit_x_unambig
1 parent 6833c27 commit 2bdeff2

File tree

27 files changed

+92
-92
lines changed

27 files changed

+92
-92
lines changed

compiler/rustc_borrowck/src/diagnostics/region_errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -987,7 +987,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
987987
for found_did in found_dids {
988988
let mut traits = vec![];
989989
let mut hir_v = HirTraitObjectVisitor(&mut traits, *found_did);
990-
hir_v.visit_unambig_ty(self_ty);
990+
hir_v.visit_ty_unambig(self_ty);
991991
debug!("trait spans found: {:?}", traits);
992992
for span in &traits {
993993
let mut multi_span: MultiSpan = vec![*span].into();

compiler/rustc_hir/src/hir.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3067,7 +3067,7 @@ impl<'hir> Ty<'hir> {
30673067
}
30683068

30693069
let mut my_visitor = MyVisitor(vec![]);
3070-
my_visitor.visit_unambig_ty(self);
3070+
my_visitor.visit_ty_unambig(self);
30713071
my_visitor.0
30723072
}
30733073

compiler/rustc_hir/src/intravisit.rs

+38-38
Original file line numberDiff line numberDiff line change
@@ -504,12 +504,12 @@ pub trait Visitor<'v>: Sized {
504504
pub trait VisitorExt<'v>: Visitor<'v> {
505505
/// Extension trait method to visit types in unambiguous positions, this is not
506506
/// directly on the [`Visitor`] trait as this method should never be overridden.
507-
fn visit_unambig_ty(&mut self, t: &'v Ty<'v>) -> Self::Result {
507+
fn visit_ty_unambig(&mut self, t: &'v Ty<'v>) -> Self::Result {
508508
walk_unambig_ty(self, t)
509509
}
510510
/// Extension trait method to visit consts in unambiguous positions, this is not
511511
/// directly on the [`Visitor`] trait as this method should never be overridden.
512-
fn visit_unambig_const_arg(&mut self, c: &'v ConstArg<'v>) -> Self::Result {
512+
fn visit_const_arg_unambig(&mut self, c: &'v ConstArg<'v>) -> Self::Result {
513513
walk_const_arg(self, c)
514514
}
515515
}
@@ -532,12 +532,12 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item<'v>) -> V::
532532
}
533533
ItemKind::Static(ref typ, _, body) => {
534534
try_visit!(visitor.visit_id(item.hir_id()));
535-
try_visit!(visitor.visit_unambig_ty(typ));
535+
try_visit!(visitor.visit_ty_unambig(typ));
536536
try_visit!(visitor.visit_nested_body(body));
537537
}
538538
ItemKind::Const(ref typ, ref generics, body) => {
539539
try_visit!(visitor.visit_id(item.hir_id()));
540-
try_visit!(visitor.visit_unambig_ty(typ));
540+
try_visit!(visitor.visit_ty_unambig(typ));
541541
try_visit!(visitor.visit_generics(generics));
542542
try_visit!(visitor.visit_nested_body(body));
543543
}
@@ -568,7 +568,7 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item<'v>) -> V::
568568
}
569569
ItemKind::TyAlias(ref ty, ref generics) => {
570570
try_visit!(visitor.visit_id(item.hir_id()));
571-
try_visit!(visitor.visit_unambig_ty(ty));
571+
try_visit!(visitor.visit_ty_unambig(ty));
572572
try_visit!(visitor.visit_generics(generics));
573573
}
574574
ItemKind::Enum(ref enum_definition, ref generics) => {
@@ -590,7 +590,7 @@ pub fn walk_item<'v, V: Visitor<'v>>(visitor: &mut V, item: &'v Item<'v>) -> V::
590590
try_visit!(visitor.visit_id(item.hir_id()));
591591
try_visit!(visitor.visit_generics(generics));
592592
visit_opt!(visitor, visit_trait_ref, of_trait);
593-
try_visit!(visitor.visit_unambig_ty(self_ty));
593+
try_visit!(visitor.visit_ty_unambig(self_ty));
594594
walk_list!(visitor, visit_impl_item_ref, *items);
595595
}
596596
ItemKind::Struct(ref struct_definition, ref generics)
@@ -647,7 +647,7 @@ pub fn walk_foreign_item<'v, V: Visitor<'v>>(
647647
walk_list!(visitor, visit_ident, param_names.iter().copied());
648648
}
649649
ForeignItemKind::Static(ref typ, _, _) => {
650-
try_visit!(visitor.visit_unambig_ty(typ));
650+
try_visit!(visitor.visit_ty_unambig(typ));
651651
}
652652
ForeignItemKind::Type => (),
653653
}
@@ -661,7 +661,7 @@ pub fn walk_local<'v, V: Visitor<'v>>(visitor: &mut V, local: &'v LetStmt<'v>) -
661661
try_visit!(visitor.visit_id(local.hir_id));
662662
try_visit!(visitor.visit_pat(local.pat));
663663
visit_opt!(visitor, visit_block, local.els);
664-
visit_opt!(visitor, visit_unambig_ty, local.ty);
664+
visit_opt!(visitor, visit_ty_unambig, local.ty);
665665
V::Result::output()
666666
}
667667

@@ -775,7 +775,7 @@ pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr<'v>)
775775
}
776776
ExprKind::Repeat(ref element, ref count) => {
777777
try_visit!(visitor.visit_expr(element));
778-
try_visit!(visitor.visit_unambig_const_arg(count));
778+
try_visit!(visitor.visit_const_arg_unambig(count));
779779
}
780780
ExprKind::Struct(ref qpath, fields, ref optional_base) => {
781781
try_visit!(visitor.visit_qpath(qpath, expression.hir_id, expression.span));
@@ -806,7 +806,7 @@ pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr<'v>)
806806
}
807807
ExprKind::Cast(ref subexpression, ref typ) | ExprKind::Type(ref subexpression, ref typ) => {
808808
try_visit!(visitor.visit_expr(subexpression));
809-
try_visit!(visitor.visit_unambig_ty(typ));
809+
try_visit!(visitor.visit_ty_unambig(typ));
810810
}
811811
ExprKind::DropTemps(ref subexpression) => {
812812
try_visit!(visitor.visit_expr(subexpression));
@@ -815,7 +815,7 @@ pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr<'v>)
815815
// match the visit order in walk_local
816816
try_visit!(visitor.visit_expr(init));
817817
try_visit!(visitor.visit_pat(pat));
818-
visit_opt!(visitor, visit_unambig_ty, ty);
818+
visit_opt!(visitor, visit_ty_unambig, ty);
819819
}
820820
ExprKind::If(ref cond, ref then, ref else_opt) => {
821821
try_visit!(visitor.visit_expr(cond));
@@ -883,15 +883,15 @@ pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr<'v>)
883883
try_visit!(visitor.visit_inline_asm(asm, expression.hir_id));
884884
}
885885
ExprKind::OffsetOf(ref container, ref fields) => {
886-
try_visit!(visitor.visit_unambig_ty(container));
886+
try_visit!(visitor.visit_ty_unambig(container));
887887
walk_list!(visitor, visit_ident, fields.iter().copied());
888888
}
889889
ExprKind::Yield(ref subexpression, _) => {
890890
try_visit!(visitor.visit_expr(subexpression));
891891
}
892892
ExprKind::UnsafeBinderCast(_kind, expr, ty) => {
893893
try_visit!(visitor.visit_expr(expr));
894-
visit_opt!(visitor, visit_unambig_ty, ty);
894+
visit_opt!(visitor, visit_ty_unambig, ty);
895895
}
896896
ExprKind::Lit(_) | ExprKind::Err(_) => {}
897897
}
@@ -936,23 +936,23 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty<'v, AmbigArg>) -
936936
try_visit!(visitor.visit_id(typ.hir_id));
937937

938938
match typ.kind {
939-
TyKind::Slice(ref ty) => try_visit!(visitor.visit_unambig_ty(ty)),
940-
TyKind::Ptr(ref mutable_type) => try_visit!(visitor.visit_unambig_ty(mutable_type.ty)),
939+
TyKind::Slice(ref ty) => try_visit!(visitor.visit_ty_unambig(ty)),
940+
TyKind::Ptr(ref mutable_type) => try_visit!(visitor.visit_ty_unambig(mutable_type.ty)),
941941
TyKind::Ref(ref lifetime, ref mutable_type) => {
942942
try_visit!(visitor.visit_lifetime(lifetime));
943-
try_visit!(visitor.visit_unambig_ty(mutable_type.ty));
943+
try_visit!(visitor.visit_ty_unambig(mutable_type.ty));
944944
}
945945
TyKind::Never => {}
946946
TyKind::Tup(tuple_element_types) => {
947-
walk_list!(visitor, visit_unambig_ty, tuple_element_types);
947+
walk_list!(visitor, visit_ty_unambig, tuple_element_types);
948948
}
949949
TyKind::BareFn(ref function_declaration) => {
950950
walk_list!(visitor, visit_generic_param, function_declaration.generic_params);
951951
try_visit!(visitor.visit_fn_decl(function_declaration.decl));
952952
}
953953
TyKind::UnsafeBinder(ref unsafe_binder) => {
954954
walk_list!(visitor, visit_generic_param, unsafe_binder.generic_params);
955-
try_visit!(visitor.visit_unambig_ty(unsafe_binder.inner_ty));
955+
try_visit!(visitor.visit_ty_unambig(unsafe_binder.inner_ty));
956956
}
957957
TyKind::Path(ref qpath) => {
958958
try_visit!(visitor.visit_qpath(qpath, typ.hir_id, typ.span));
@@ -964,8 +964,8 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty<'v, AmbigArg>) -
964964
walk_list!(visitor, visit_param_bound, bounds);
965965
}
966966
TyKind::Array(ref ty, ref length) => {
967-
try_visit!(visitor.visit_unambig_ty(ty));
968-
try_visit!(visitor.visit_unambig_const_arg(length));
967+
try_visit!(visitor.visit_ty_unambig(ty));
968+
try_visit!(visitor.visit_const_arg_unambig(length));
969969
}
970970
TyKind::TraitObject(bounds, ref lifetime) => {
971971
for bound in bounds {
@@ -976,7 +976,7 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty<'v, AmbigArg>) -
976976
TyKind::Typeof(ref expression) => try_visit!(visitor.visit_anon_const(expression)),
977977
TyKind::InferDelegation(..) | TyKind::Err(_) => {}
978978
TyKind::Pat(ty, pat) => {
979-
try_visit!(visitor.visit_unambig_ty(ty));
979+
try_visit!(visitor.visit_ty_unambig(ty));
980980
try_visit!(visitor.visit_pattern_type_pattern(pat));
981981
}
982982
}
@@ -1019,10 +1019,10 @@ pub fn walk_generic_param<'v, V: Visitor<'v>>(
10191019
match param.kind {
10201020
GenericParamKind::Lifetime { .. } => {}
10211021
GenericParamKind::Type { ref default, .. } => {
1022-
visit_opt!(visitor, visit_unambig_ty, default)
1022+
visit_opt!(visitor, visit_ty_unambig, default)
10231023
}
10241024
GenericParamKind::Const { ref ty, ref default, synthetic: _ } => {
1025-
try_visit!(visitor.visit_unambig_ty(ty));
1025+
try_visit!(visitor.visit_ty_unambig(ty));
10261026
if let Some(ref default) = default {
10271027
try_visit!(visitor.visit_const_param_default(param.hir_id, default));
10281028
}
@@ -1035,7 +1035,7 @@ pub fn walk_const_param_default<'v, V: Visitor<'v>>(
10351035
visitor: &mut V,
10361036
ct: &'v ConstArg<'v>,
10371037
) -> V::Result {
1038-
visitor.visit_unambig_const_arg(ct)
1038+
visitor.visit_const_arg_unambig(ct)
10391039
}
10401040

10411041
pub fn walk_generics<'v, V: Visitor<'v>>(visitor: &mut V, generics: &'v Generics<'v>) -> V::Result {
@@ -1057,7 +1057,7 @@ pub fn walk_where_predicate<'v, V: Visitor<'v>>(
10571057
bound_generic_params,
10581058
origin: _,
10591059
}) => {
1060-
try_visit!(visitor.visit_unambig_ty(bounded_ty));
1060+
try_visit!(visitor.visit_ty_unambig(bounded_ty));
10611061
walk_list!(visitor, visit_param_bound, bounds);
10621062
walk_list!(visitor, visit_generic_param, bound_generic_params);
10631063
}
@@ -1070,8 +1070,8 @@ pub fn walk_where_predicate<'v, V: Visitor<'v>>(
10701070
walk_list!(visitor, visit_param_bound, bounds);
10711071
}
10721072
WherePredicateKind::EqPredicate(WhereEqPredicate { ref lhs_ty, ref rhs_ty }) => {
1073-
try_visit!(visitor.visit_unambig_ty(lhs_ty));
1074-
try_visit!(visitor.visit_unambig_ty(rhs_ty));
1073+
try_visit!(visitor.visit_ty_unambig(lhs_ty));
1074+
try_visit!(visitor.visit_ty_unambig(rhs_ty));
10751075
}
10761076
}
10771077
V::Result::output()
@@ -1081,13 +1081,13 @@ pub fn walk_fn_decl<'v, V: Visitor<'v>>(
10811081
visitor: &mut V,
10821082
function_declaration: &'v FnDecl<'v>,
10831083
) -> V::Result {
1084-
walk_list!(visitor, visit_unambig_ty, function_declaration.inputs);
1084+
walk_list!(visitor, visit_ty_unambig, function_declaration.inputs);
10851085
visitor.visit_fn_ret_ty(&function_declaration.output)
10861086
}
10871087

10881088
pub fn walk_fn_ret_ty<'v, V: Visitor<'v>>(visitor: &mut V, ret_ty: &'v FnRetTy<'v>) -> V::Result {
10891089
if let FnRetTy::Return(output_ty) = *ret_ty {
1090-
try_visit!(visitor.visit_unambig_ty(output_ty));
1090+
try_visit!(visitor.visit_ty_unambig(output_ty));
10911091
}
10921092
V::Result::output()
10931093
}
@@ -1140,7 +1140,7 @@ pub fn walk_trait_item<'v, V: Visitor<'v>>(
11401140
try_visit!(visitor.visit_id(hir_id));
11411141
match *kind {
11421142
TraitItemKind::Const(ref ty, default) => {
1143-
try_visit!(visitor.visit_unambig_ty(ty));
1143+
try_visit!(visitor.visit_ty_unambig(ty));
11441144
visit_opt!(visitor, visit_nested_body, default);
11451145
}
11461146
TraitItemKind::Fn(ref sig, TraitFn::Required(param_names)) => {
@@ -1158,7 +1158,7 @@ pub fn walk_trait_item<'v, V: Visitor<'v>>(
11581158
}
11591159
TraitItemKind::Type(bounds, ref default) => {
11601160
walk_list!(visitor, visit_param_bound, bounds);
1161-
visit_opt!(visitor, visit_unambig_ty, default);
1161+
visit_opt!(visitor, visit_ty_unambig, default);
11621162
}
11631163
}
11641164
V::Result::output()
@@ -1196,7 +1196,7 @@ pub fn walk_impl_item<'v, V: Visitor<'v>>(
11961196
try_visit!(visitor.visit_id(impl_item.hir_id()));
11971197
match *kind {
11981198
ImplItemKind::Const(ref ty, body) => {
1199-
try_visit!(visitor.visit_unambig_ty(ty));
1199+
try_visit!(visitor.visit_ty_unambig(ty));
12001200
visitor.visit_nested_body(body)
12011201
}
12021202
ImplItemKind::Fn(ref sig, body_id) => visitor.visit_fn(
@@ -1206,7 +1206,7 @@ pub fn walk_impl_item<'v, V: Visitor<'v>>(
12061206
impl_item.span,
12071207
impl_item.owner_id.def_id,
12081208
),
1209-
ImplItemKind::Type(ref ty) => visitor.visit_unambig_ty(ty),
1209+
ImplItemKind::Type(ref ty) => visitor.visit_ty_unambig(ty),
12101210
}
12111211
}
12121212

@@ -1294,7 +1294,7 @@ pub fn walk_field_def<'v, V: Visitor<'v>>(
12941294
try_visit!(visitor.visit_id(*hir_id));
12951295
try_visit!(visitor.visit_ident(*ident));
12961296
visit_opt!(visitor, visit_anon_const, default);
1297-
visitor.visit_unambig_ty(*ty)
1297+
visitor.visit_ty_unambig(*ty)
12981298
}
12991299

13001300
pub fn walk_enum_def<'v, V: Visitor<'v>>(
@@ -1335,11 +1335,11 @@ pub fn walk_qpath<'v, V: Visitor<'v>>(
13351335
) -> V::Result {
13361336
match *qpath {
13371337
QPath::Resolved(ref maybe_qself, ref path) => {
1338-
visit_opt!(visitor, visit_unambig_ty, maybe_qself);
1338+
visit_opt!(visitor, visit_ty_unambig, maybe_qself);
13391339
visitor.visit_path(path, id)
13401340
}
13411341
QPath::TypeRelative(ref qself, ref segment) => {
1342-
try_visit!(visitor.visit_unambig_ty(qself));
1342+
try_visit!(visitor.visit_ty_unambig(qself));
13431343
visitor.visit_path_segment(segment)
13441344
}
13451345
QPath::LangItem(..) => V::Result::output(),
@@ -1379,8 +1379,8 @@ pub fn walk_assoc_item_constraint<'v, V: Visitor<'v>>(
13791379
try_visit!(visitor.visit_generic_args(constraint.gen_args));
13801380
match constraint.kind {
13811381
AssocItemConstraintKind::Equality { ref term } => match term {
1382-
Term::Ty(ref ty) => try_visit!(visitor.visit_unambig_ty(ty)),
1383-
Term::Const(ref c) => try_visit!(visitor.visit_unambig_const_arg(c)),
1382+
Term::Ty(ref ty) => try_visit!(visitor.visit_ty_unambig(ty)),
1383+
Term::Const(ref c) => try_visit!(visitor.visit_const_arg_unambig(c)),
13841384
},
13851385
AssocItemConstraintKind::Bound { bounds } => {
13861386
walk_list!(visitor, visit_param_bound, bounds)

compiler/rustc_hir_analysis/src/check/compare_impl_item.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1624,7 +1624,7 @@ fn compare_synthetic_generics<'tcx>(
16241624

16251625
let span = input_tys
16261626
.iter()
1627-
.find_map(|ty| Visitor(impl_def_id).visit_unambig_ty(ty).break_value())?;
1627+
.find_map(|ty| Visitor(impl_def_id).visit_ty_unambig(ty).break_value())?;
16281628

16291629
let bounds = impl_m.generics.bounds_for_param(impl_def_id).next()?.bounds;
16301630
let bounds = bounds.first()?.span().to(bounds.last()?.span());

compiler/rustc_hir_analysis/src/collect.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ impl<'tcx> HirTyLowerer<'tcx> for ItemCtxt<'tcx> {
576576
}
577577

578578
// Only visit the type looking for `_` if we didn't fix the type above
579-
visitor.visit_unambig_ty(a);
579+
visitor.visit_ty_unambig(a);
580580
self.lowerer().lower_arg_ty(a, None)
581581
})
582582
.collect();
@@ -590,7 +590,7 @@ impl<'tcx> HirTyLowerer<'tcx> for ItemCtxt<'tcx> {
590590
infer_replacements.push((output.span, suggested_ty.to_string()));
591591
Ty::new_error_with_message(tcx, output.span, suggested_ty.to_string())
592592
} else {
593-
visitor.visit_unambig_ty(output);
593+
visitor.visit_ty_unambig(output);
594594
self.lower_ty(output)
595595
}
596596
}
@@ -1436,7 +1436,7 @@ fn recover_infer_ret_ty<'tcx>(
14361436
});
14371437

14381438
let mut visitor = HirPlaceholderCollector::default();
1439-
visitor.visit_unambig_ty(infer_ret_ty);
1439+
visitor.visit_ty_unambig(infer_ret_ty);
14401440

14411441
let mut diag = bad_placeholder(icx.lowerer(), visitor.spans, "return type");
14421442
let ret_ty = fn_sig.output();

compiler/rustc_hir_analysis/src/collect/generics_of.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ impl<'v> Visitor<'v> for AnonConstInParamTyDetector {
540540
if let GenericParamKind::Const { ty, default: _, synthetic: _ } = p.kind {
541541
let prev = self.in_param_ty;
542542
self.in_param_ty = true;
543-
let res = self.visit_unambig_ty(ty);
543+
let res = self.visit_ty_unambig(ty);
544544
self.in_param_ty = prev;
545545
res
546546
} else {

0 commit comments

Comments
 (0)