Skip to content

Commit 89b8840

Browse files
squash OpaqueTy and ProjectionTy into AliasTy
1 parent a274e7e commit 89b8840

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

clippy_lints/src/future_not_send.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use rustc_hir::intravisit::FnKind;
44
use rustc_hir::{Body, FnDecl, HirId};
55
use rustc_infer::infer::TyCtxtInferExt;
66
use rustc_lint::{LateContext, LateLintPass};
7-
use rustc_middle::ty::{Clause, EarlyBinder, Opaque, OpaqueTy, PredicateKind};
7+
use rustc_middle::ty::{AliasTy, Clause, EarlyBinder, Opaque, PredicateKind};
88
use rustc_session::{declare_lint_pass, declare_tool_lint};
99
use rustc_span::{sym, Span};
1010
use rustc_trait_selection::traits::error_reporting::suggestions::TypeErrCtxtExt;
@@ -62,7 +62,7 @@ impl<'tcx> LateLintPass<'tcx> for FutureNotSend {
6262
return;
6363
}
6464
let ret_ty = return_ty(cx, hir_id);
65-
if let Opaque(OpaqueTy { def_id, substs }) = *ret_ty.kind() {
65+
if let Opaque(AliasTy { def_id, substs }) = *ret_ty.kind() {
6666
let preds = cx.tcx.explicit_item_bounds(def_id);
6767
let mut is_future = false;
6868
for &(p, _span) in preds {

clippy_utils/src/ty.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use rustc_lint::LateContext;
1717
use rustc_middle::mir::interpret::{ConstValue, Scalar};
1818
use rustc_middle::ty::{
1919
self, AdtDef, AssocKind, Binder, BoundRegion, DefIdTree, FnSig, IntTy, List, ParamEnv, Predicate, PredicateKind,
20-
ProjectionTy, Region, RegionKind, SubstsRef, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable, TypeVisitor, UintTy,
20+
AliasTy, Region, RegionKind, SubstsRef, Ty, TyCtxt, TypeSuperVisitable, TypeVisitable, TypeVisitor, UintTy,
2121
VariantDef, VariantDiscr,
2222
};
2323
use rustc_middle::ty::{GenericArg, GenericArgKind};
@@ -79,7 +79,7 @@ pub fn contains_ty_adt_constructor_opaque<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'
7979
return true;
8080
}
8181

82-
if let ty::Opaque(ty::OpaqueTy { def_id, substs: _ }) = *inner_ty.kind() {
82+
if let ty::Opaque(ty::AliasTy { def_id, substs: _ }) = *inner_ty.kind() {
8383
for &(predicate, _span) in cx.tcx.explicit_item_bounds(def_id) {
8484
match predicate.kind().skip_binder() {
8585
// For `impl Trait<U>`, it will register a predicate of `T: Trait<U>`, so we go through
@@ -250,7 +250,7 @@ pub fn is_must_use_ty<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> bool {
250250
is_must_use_ty(cx, *ty)
251251
},
252252
ty::Tuple(substs) => substs.iter().any(|ty| is_must_use_ty(cx, ty)),
253-
ty::Opaque(ty::OpaqueTy { def_id, substs: _ }) => {
253+
ty::Opaque(ty::AliasTy { def_id, substs: _ }) => {
254254
for (predicate, _) in cx.tcx.explicit_item_bounds(*def_id) {
255255
if let ty::PredicateKind::Clause(ty::Clause::Trait(trait_predicate)) = predicate.kind().skip_binder() {
256256
if cx.tcx.has_attr(trait_predicate.trait_ref.def_id, sym::must_use) {
@@ -631,7 +631,7 @@ pub fn ty_sig<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'tcx>) -> Option<ExprFnSig<'t
631631
Some(ExprFnSig::Closure(decl, subs.as_closure().sig()))
632632
},
633633
ty::FnDef(id, subs) => Some(ExprFnSig::Sig(cx.tcx.bound_fn_sig(id).subst(cx.tcx, subs), Some(id))),
634-
ty::Opaque(ty::OpaqueTy{ def_id, substs: _ }) => sig_from_bounds(cx, ty, cx.tcx.item_bounds(def_id), cx.tcx.opt_parent(def_id)),
634+
ty::Opaque(ty::AliasTy { def_id, substs: _ }) => sig_from_bounds(cx, ty, cx.tcx.item_bounds(def_id), cx.tcx.opt_parent(def_id)),
635635
ty::FnPtr(sig) => Some(ExprFnSig::Sig(sig, None)),
636636
ty::Dynamic(bounds, _, _) => {
637637
let lang_items = cx.tcx.lang_items();
@@ -701,7 +701,7 @@ fn sig_from_bounds<'tcx>(
701701
inputs.map(|ty| ExprFnSig::Trait(ty, output, predicates_id))
702702
}
703703

704-
fn sig_for_projection<'tcx>(cx: &LateContext<'tcx>, ty: ProjectionTy<'tcx>) -> Option<ExprFnSig<'tcx>> {
704+
fn sig_for_projection<'tcx>(cx: &LateContext<'tcx>, ty: AliasTy<'tcx>) -> Option<ExprFnSig<'tcx>> {
705705
let mut inputs = None;
706706
let mut output = None;
707707
let lang_items = cx.tcx.lang_items();
@@ -980,13 +980,13 @@ pub fn make_projection<'tcx>(
980980
container_id: DefId,
981981
assoc_ty: Symbol,
982982
substs: impl IntoIterator<Item = impl Into<GenericArg<'tcx>>>,
983-
) -> Option<ProjectionTy<'tcx>> {
983+
) -> Option<AliasTy<'tcx>> {
984984
fn helper<'tcx>(
985985
tcx: TyCtxt<'tcx>,
986986
container_id: DefId,
987987
assoc_ty: Symbol,
988988
substs: SubstsRef<'tcx>,
989-
) -> Option<ProjectionTy<'tcx>> {
989+
) -> Option<AliasTy<'tcx>> {
990990
let Some(assoc_item) = tcx
991991
.associated_items(container_id)
992992
.find_by_name_and_kind(tcx, Ident::with_dummy_span(assoc_ty), AssocKind::Type, container_id)
@@ -1039,7 +1039,7 @@ pub fn make_projection<'tcx>(
10391039
}
10401040
}
10411041

1042-
Some(ProjectionTy {
1042+
Some(AliasTy {
10431043
substs,
10441044
def_id: assoc_item.def_id,
10451045
})
@@ -1065,7 +1065,7 @@ pub fn make_normalized_projection<'tcx>(
10651065
assoc_ty: Symbol,
10661066
substs: impl IntoIterator<Item = impl Into<GenericArg<'tcx>>>,
10671067
) -> Option<Ty<'tcx>> {
1068-
fn helper<'tcx>(tcx: TyCtxt<'tcx>, param_env: ParamEnv<'tcx>, ty: ProjectionTy<'tcx>) -> Option<Ty<'tcx>> {
1068+
fn helper<'tcx>(tcx: TyCtxt<'tcx>, param_env: ParamEnv<'tcx>, ty: AliasTy<'tcx>) -> Option<Ty<'tcx>> {
10691069
#[cfg(debug_assertions)]
10701070
if let Some((i, subst)) = ty
10711071
.substs

0 commit comments

Comments
 (0)