mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 09:14:20 +00:00
Rename AstConv to HIR ty lowering
This includes updating astconv-related items and a few local variables.
This commit is contained in:
parent
0e62b18435
commit
75390b9f7f
@ -5,7 +5,7 @@ use rustc_errors::Diag;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::intravisit::{walk_body, walk_expr, walk_inf, walk_ty, Visitor};
|
||||
use rustc_hir::{Body, Expr, ExprKind, GenericArg, Item, ItemKind, QPath, TyKind};
|
||||
use rustc_hir_analysis::hir_ty_to_ty;
|
||||
use rustc_hir_analysis::lower_ty;
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
use rustc_middle::hir::nested_filter;
|
||||
use rustc_middle::ty::{Ty, TypeckResults};
|
||||
@ -227,7 +227,7 @@ impl<'tcx> ImplicitHasherType<'tcx> {
|
||||
.collect();
|
||||
let params_len = params.len();
|
||||
|
||||
let ty = hir_ty_to_ty(cx.tcx, hir_ty);
|
||||
let ty = lower_ty(cx.tcx, hir_ty);
|
||||
|
||||
if is_type_diagnostic_item(cx, ty, sym::HashMap) && params_len == 2 {
|
||||
Some(ImplicitHasherType::HashMap(
|
||||
|
@ -6,7 +6,7 @@ use rustc_hir::{
|
||||
GenericArg, GenericBound, GenericBounds, ItemKind, PredicateOrigin, TraitBoundModifier, TyKind, TypeBinding,
|
||||
WherePredicate,
|
||||
};
|
||||
use rustc_hir_analysis::hir_ty_to_ty;
|
||||
use rustc_hir_analysis::lower_ty;
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
use rustc_middle::ty::{self, ClauseKind, Generics, Ty, TyCtxt};
|
||||
use rustc_session::declare_lint_pass;
|
||||
@ -146,7 +146,7 @@ fn try_resolve_type<'tcx>(
|
||||
index: usize,
|
||||
) -> Option<Ty<'tcx>> {
|
||||
match args.get(index - 1) {
|
||||
Some(GenericArg::Type(ty)) => Some(hir_ty_to_ty(tcx, ty)),
|
||||
Some(GenericArg::Type(ty)) => Some(lower_ty(tcx, ty)),
|
||||
Some(_) => None,
|
||||
None => Some(tcx.type_of(generics.params[index].def_id).skip_binder()),
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ use clippy_utils::{path_def_id, qpath_generic_tys};
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::{self as hir, QPath, TyKind};
|
||||
use rustc_hir_analysis::hir_ty_to_ty;
|
||||
use rustc_hir_analysis::lower_ty;
|
||||
use rustc_lint::LateContext;
|
||||
use rustc_middle::ty::TypeVisitableExt;
|
||||
use rustc_span::symbol::sym;
|
||||
@ -59,7 +59,7 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, hir_ty: &hir::Ty<'tcx>, qpath:
|
||||
// Reallocation of a fat pointer causes it to become thin. `hir_ty_to_ty` is safe to use
|
||||
// here because `mod.rs` guarantees this lint is only run on types outside of bodies and
|
||||
// is not run on locals.
|
||||
let ty = hir_ty_to_ty(cx.tcx, hir_ty);
|
||||
let ty = lower_ty(cx.tcx, hir_ty);
|
||||
if ty.has_escaping_bound_vars() || !ty.is_sized(cx.tcx, cx.param_env) {
|
||||
return false;
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ use clippy_utils::source::snippet;
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::{self as hir, GenericArg, LangItem, QPath, TyKind};
|
||||
use rustc_hir_analysis::hir_ty_to_ty;
|
||||
use rustc_hir_analysis::lower_ty;
|
||||
use rustc_lint::LateContext;
|
||||
use rustc_middle::ty::layout::LayoutOf;
|
||||
use rustc_middle::ty::TypeVisitableExt;
|
||||
@ -35,7 +35,7 @@ pub(super) fn check<'tcx>(
|
||||
&& let Some(GenericArg::Type(boxed_ty)) = last.args.first()
|
||||
// extract allocator from the Box for later
|
||||
&& let boxed_alloc_ty = last.args.get(1)
|
||||
&& let ty_ty = hir_ty_to_ty(cx.tcx, boxed_ty)
|
||||
&& let ty_ty = lower_ty(cx.tcx, boxed_ty)
|
||||
&& !ty_ty.has_escaping_bound_vars()
|
||||
&& ty_ty.is_sized(cx.tcx, cx.param_env)
|
||||
&& let Ok(ty_ty_size) = cx.layout_of(ty_ty).map(|l| l.size.bytes())
|
||||
@ -55,7 +55,7 @@ pub(super) fn check<'tcx>(
|
||||
}
|
||||
},
|
||||
(Some(GenericArg::Type(l)), Some(GenericArg::Type(r))) =>
|
||||
hir_ty_to_ty(cx.tcx, l) == hir_ty_to_ty(cx.tcx, r),
|
||||
lower_ty(cx.tcx, l) == lower_ty(cx.tcx, r),
|
||||
_ => false
|
||||
}
|
||||
{
|
||||
|
@ -7,7 +7,7 @@ use rustc_hir::def::{DefKind, Res};
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_hir::intravisit::{walk_body, walk_expr, FnKind, Visitor};
|
||||
use rustc_hir::{Body, Expr, ExprKind, FnDecl, HirId, Item, ItemKind, Node, QPath, TyKind};
|
||||
use rustc_hir_analysis::hir_ty_to_ty;
|
||||
use rustc_hir_analysis::lower_ty;
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
use rustc_middle::hir::map::Map;
|
||||
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
|
||||
match qpath {
|
||||
QPath::Resolved(_, path) => path.res.opt_def_id(),
|
||||
QPath::TypeRelative(_, _) => {
|
||||
let ty = hir_ty_to_ty(tcx, &hir_ty);
|
||||
let ty = lower_ty(tcx, &hir_ty);
|
||||
|
||||
match ty.kind() {
|
||||
ty::Alias(ty::Projection, proj) => {
|
||||
|
@ -1,7 +1,7 @@
|
||||
use clippy_utils::diagnostics::span_lint;
|
||||
use rustc_hir::intravisit::FnKind;
|
||||
use rustc_hir::{Body, Expr, ExprKind, FnDecl, FnRetTy, TyKind, UnOp};
|
||||
use rustc_hir_analysis::hir_ty_to_ty;
|
||||
use rustc_hir_analysis::lower_ty;
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
use rustc_middle::lint::in_external_macro;
|
||||
use rustc_session::declare_lint_pass;
|
||||
@ -71,7 +71,7 @@ impl LateLintPass<'_> for UninhabitedReferences {
|
||||
}
|
||||
if let FnRetTy::Return(hir_ty) = fndecl.output
|
||||
&& let TyKind::Ref(_, mut_ty) = hir_ty.kind
|
||||
&& hir_ty_to_ty(cx.tcx, mut_ty.ty).is_privately_uninhabited(cx.tcx, cx.param_env)
|
||||
&& lower_ty(cx.tcx, mut_ty.ty).is_privately_uninhabited(cx.tcx, cx.param_env)
|
||||
{
|
||||
span_lint(
|
||||
cx,
|
||||
|
@ -11,7 +11,7 @@ use rustc_hir::{
|
||||
self as hir, Expr, ExprKind, FnRetTy, FnSig, GenericArgsParentheses, GenericParam, GenericParamKind, HirId, Impl,
|
||||
ImplItemKind, Item, ItemKind, Pat, PatKind, Path, QPath, Ty, TyKind,
|
||||
};
|
||||
use rustc_hir_analysis::hir_ty_to_ty;
|
||||
use rustc_hir_analysis::lower_ty;
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
use rustc_middle::ty::Ty as MiddleTy;
|
||||
use rustc_session::impl_lint_pass;
|
||||
@ -224,7 +224,7 @@ impl<'tcx> LateLintPass<'tcx> for UseSelf {
|
||||
&& let ty = if in_body > 0 {
|
||||
cx.typeck_results().node_type(hir_ty.hir_id)
|
||||
} else {
|
||||
hir_ty_to_ty(cx.tcx, hir_ty)
|
||||
lower_ty(cx.tcx, hir_ty)
|
||||
}
|
||||
&& let impl_ty = cx.tcx.type_of(impl_id).instantiate_identity()
|
||||
&& same_type_and_consts(ty, impl_ty)
|
||||
|
@ -1,7 +1,7 @@
|
||||
use clippy_utils::diagnostics::span_lint_and_help;
|
||||
use clippy_utils::ty::{is_normalizable, is_type_diagnostic_item};
|
||||
use rustc_hir::{self as hir, HirId, ItemKind, Node};
|
||||
use rustc_hir_analysis::hir_ty_to_ty;
|
||||
use rustc_hir_analysis::lower_ty;
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
use rustc_middle::ty::layout::LayoutOf as _;
|
||||
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
|
||||
None
|
||||
}
|
||||
})
|
||||
.unwrap_or_else(|| hir_ty_to_ty(cx.tcx, hir_ty))
|
||||
.unwrap_or_else(|| lower_ty(cx.tcx, hir_ty))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user