Skip to content

Commit 75390b9

Browse files
committed
Rename AstConv to HIR ty lowering
This includes updating astconv-related items and a few local variables.
1 parent 0e62b18 commit 75390b9

File tree

8 files changed

+17
-17
lines changed

8 files changed

+17
-17
lines changed

clippy_lints/src/implicit_hasher.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use rustc_errors::Diag;
55
use rustc_hir as hir;
66
use rustc_hir::intravisit::{walk_body, walk_expr, walk_inf, walk_ty, Visitor};
77
use rustc_hir::{Body, Expr, ExprKind, GenericArg, Item, ItemKind, QPath, TyKind};
8-
use rustc_hir_analysis::hir_ty_to_ty;
8+
use rustc_hir_analysis::lower_ty;
99
use rustc_lint::{LateContext, LateLintPass};
1010
use rustc_middle::hir::nested_filter;
1111
use rustc_middle::ty::{Ty, TypeckResults};
@@ -227,7 +227,7 @@ impl<'tcx> ImplicitHasherType<'tcx> {
227227
.collect();
228228
let params_len = params.len();
229229

230-
let ty = hir_ty_to_ty(cx.tcx, hir_ty);
230+
let ty = lower_ty(cx.tcx, hir_ty);
231231

232232
if is_type_diagnostic_item(cx, ty, sym::HashMap) && params_len == 2 {
233233
Some(ImplicitHasherType::HashMap(

clippy_lints/src/implied_bounds_in_impls.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use rustc_hir::{
66
GenericArg, GenericBound, GenericBounds, ItemKind, PredicateOrigin, TraitBoundModifier, TyKind, TypeBinding,
77
WherePredicate,
88
};
9-
use rustc_hir_analysis::hir_ty_to_ty;
9+
use rustc_hir_analysis::lower_ty;
1010
use rustc_lint::{LateContext, LateLintPass};
1111
use rustc_middle::ty::{self, ClauseKind, Generics, Ty, TyCtxt};
1212
use rustc_session::declare_lint_pass;
@@ -146,7 +146,7 @@ fn try_resolve_type<'tcx>(
146146
index: usize,
147147
) -> Option<Ty<'tcx>> {
148148
match args.get(index - 1) {
149-
Some(GenericArg::Type(ty)) => Some(hir_ty_to_ty(tcx, ty)),
149+
Some(GenericArg::Type(ty)) => Some(lower_ty(tcx, ty)),
150150
Some(_) => None,
151151
None => Some(tcx.type_of(generics.params[index].def_id).skip_binder()),
152152
}

clippy_lints/src/types/redundant_allocation.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use clippy_utils::{path_def_id, qpath_generic_tys};
44
use rustc_errors::Applicability;
55
use rustc_hir::def_id::DefId;
66
use rustc_hir::{self as hir, QPath, TyKind};
7-
use rustc_hir_analysis::hir_ty_to_ty;
7+
use rustc_hir_analysis::lower_ty;
88
use rustc_lint::LateContext;
99
use rustc_middle::ty::TypeVisitableExt;
1010
use rustc_span::symbol::sym;
@@ -59,7 +59,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, hir_ty: &hir::Ty<'tcx>, qpath:
5959
// Reallocation of a fat pointer causes it to become thin. `hir_ty_to_ty` is safe to use
6060
// here because `mod.rs` guarantees this lint is only run on types outside of bodies and
6161
// is not run on locals.
62-
let ty = hir_ty_to_ty(cx.tcx, hir_ty);
62+
let ty = lower_ty(cx.tcx, hir_ty);
6363
if ty.has_escaping_bound_vars() || !ty.is_sized(cx.tcx, cx.param_env) {
6464
return false;
6565
}

clippy_lints/src/types/vec_box.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use clippy_utils::source::snippet;
44
use rustc_errors::Applicability;
55
use rustc_hir::def_id::DefId;
66
use rustc_hir::{self as hir, GenericArg, LangItem, QPath, TyKind};
7-
use rustc_hir_analysis::hir_ty_to_ty;
7+
use rustc_hir_analysis::lower_ty;
88
use rustc_lint::LateContext;
99
use rustc_middle::ty::layout::LayoutOf;
1010
use rustc_middle::ty::TypeVisitableExt;
@@ -35,7 +35,7 @@ pub(super) fn check<'tcx>(
3535
&& let Some(GenericArg::Type(boxed_ty)) = last.args.first()
3636
// extract allocator from the Box for later
3737
&& let boxed_alloc_ty = last.args.get(1)
38-
&& let ty_ty = hir_ty_to_ty(cx.tcx, boxed_ty)
38+
&& let ty_ty = lower_ty(cx.tcx, boxed_ty)
3939
&& !ty_ty.has_escaping_bound_vars()
4040
&& ty_ty.is_sized(cx.tcx, cx.param_env)
4141
&& let Ok(ty_ty_size) = cx.layout_of(ty_ty).map(|l| l.size.bytes())
@@ -55,7 +55,7 @@ pub(super) fn check<'tcx>(
5555
}
5656
},
5757
(Some(GenericArg::Type(l)), Some(GenericArg::Type(r))) =>
58-
hir_ty_to_ty(cx.tcx, l) == hir_ty_to_ty(cx.tcx, r),
58+
lower_ty(cx.tcx, l) == lower_ty(cx.tcx, r),
5959
_ => false
6060
}
6161
{

clippy_lints/src/unconditional_recursion.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use rustc_hir::def::{DefKind, Res};
77
use rustc_hir::def_id::{DefId, LocalDefId};
88
use rustc_hir::intravisit::{walk_body, walk_expr, FnKind, Visitor};
99
use rustc_hir::{Body, Expr, ExprKind, FnDecl, HirId, Item, ItemKind, Node, QPath, TyKind};
10-
use rustc_hir_analysis::hir_ty_to_ty;
10+
use rustc_hir_analysis::lower_ty;
1111
use rustc_lint::{LateContext, LateLintPass};
1212
use rustc_middle::hir::map::Map;
1313
use rustc_middle::hir::nested_filter;
@@ -74,7 +74,7 @@ fn get_hir_ty_def_id<'tcx>(tcx: TyCtxt<'tcx>, hir_ty: rustc_hir::Ty<'tcx>) -> Op
7474
match qpath {
7575
QPath::Resolved(_, path) => path.res.opt_def_id(),
7676
QPath::TypeRelative(_, _) => {
77-
let ty = hir_ty_to_ty(tcx, &hir_ty);
77+
let ty = lower_ty(tcx, &hir_ty);
7878

7979
match ty.kind() {
8080
ty::Alias(ty::Projection, proj) => {

clippy_lints/src/uninhabited_references.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use clippy_utils::diagnostics::span_lint;
22
use rustc_hir::intravisit::FnKind;
33
use rustc_hir::{Body, Expr, ExprKind, FnDecl, FnRetTy, TyKind, UnOp};
4-
use rustc_hir_analysis::hir_ty_to_ty;
4+
use rustc_hir_analysis::lower_ty;
55
use rustc_lint::{LateContext, LateLintPass};
66
use rustc_middle::lint::in_external_macro;
77
use rustc_session::declare_lint_pass;
@@ -71,7 +71,7 @@ impl LateLintPass<'_> for UninhabitedReferences {
7171
}
7272
if let FnRetTy::Return(hir_ty) = fndecl.output
7373
&& let TyKind::Ref(_, mut_ty) = hir_ty.kind
74-
&& hir_ty_to_ty(cx.tcx, mut_ty.ty).is_privately_uninhabited(cx.tcx, cx.param_env)
74+
&& lower_ty(cx.tcx, mut_ty.ty).is_privately_uninhabited(cx.tcx, cx.param_env)
7575
{
7676
span_lint(
7777
cx,

clippy_lints/src/use_self.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use rustc_hir::{
1111
self as hir, Expr, ExprKind, FnRetTy, FnSig, GenericArgsParentheses, GenericParam, GenericParamKind, HirId, Impl,
1212
ImplItemKind, Item, ItemKind, Pat, PatKind, Path, QPath, Ty, TyKind,
1313
};
14-
use rustc_hir_analysis::hir_ty_to_ty;
14+
use rustc_hir_analysis::lower_ty;
1515
use rustc_lint::{LateContext, LateLintPass};
1616
use rustc_middle::ty::Ty as MiddleTy;
1717
use rustc_session::impl_lint_pass;
@@ -224,7 +224,7 @@ impl<'tcx> LateLintPass<'tcx> for UseSelf {
224224
&& let ty = if in_body > 0 {
225225
cx.typeck_results().node_type(hir_ty.hir_id)
226226
} else {
227-
hir_ty_to_ty(cx.tcx, hir_ty)
227+
lower_ty(cx.tcx, hir_ty)
228228
}
229229
&& let impl_ty = cx.tcx.type_of(impl_id).instantiate_identity()
230230
&& same_type_and_consts(ty, impl_ty)

clippy_lints/src/zero_sized_map_values.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use clippy_utils::diagnostics::span_lint_and_help;
22
use clippy_utils::ty::{is_normalizable, is_type_diagnostic_item};
33
use rustc_hir::{self as hir, HirId, ItemKind, Node};
4-
use rustc_hir_analysis::hir_ty_to_ty;
4+
use rustc_hir_analysis::lower_ty;
55
use rustc_lint::{LateContext, LateLintPass};
66
use rustc_middle::ty::layout::LayoutOf as _;
77
use rustc_middle::ty::{Adt, Ty, TypeVisitableExt};
@@ -91,5 +91,5 @@ fn ty_from_hir_ty<'tcx>(cx: &LateContext<'tcx>, hir_ty: &hir::Ty<'tcx>) -> Ty<'t
9191
None
9292
}
9393
})
94-
.unwrap_or_else(|| hir_ty_to_ty(cx.tcx, hir_ty))
94+
.unwrap_or_else(|| lower_ty(cx.tcx, hir_ty))
9595
}

0 commit comments

Comments
 (0)