Review changes

This commit is contained in:
Jack Huey 2021-01-07 11:20:28 -05:00
parent 66c179946b
commit 3dea68de1d
67 changed files with 581 additions and 590 deletions

View file

@ -5,7 +5,7 @@ use rustc_middle::mir::*;
use rustc_middle::ty::{
self,
subst::{GenericArgKind, Subst, SubstsRef},
PredicateAtom, Ty, TyCtxt, TyS,
PredicateKind, Ty, TyCtxt, TyS,
};
use rustc_session::lint::builtin::FUNCTION_ITEM_REFERENCES;
use rustc_span::{symbol::sym, Span};
@ -105,7 +105,7 @@ impl<'a, 'tcx> FunctionItemRefChecker<'a, 'tcx> {
let param_env = self.tcx.param_env(def_id);
let bounds = param_env.caller_bounds();
for bound in bounds {
if let Some(bound_ty) = self.is_pointer_trait(&bound.skip_binders()) {
if let Some(bound_ty) = self.is_pointer_trait(&bound.kind().skip_binder()) {
// Get the argument types as they appear in the function signature.
let arg_defs = self.tcx.fn_sig(def_id).skip_binder().inputs();
for (arg_num, arg_def) in arg_defs.iter().enumerate() {
@ -131,8 +131,8 @@ impl<'a, 'tcx> FunctionItemRefChecker<'a, 'tcx> {
}
/// If the given predicate is the trait `fmt::Pointer`, returns the bound parameter type.
fn is_pointer_trait(&self, bound: &PredicateAtom<'tcx>) -> Option<Ty<'tcx>> {
if let ty::PredicateAtom::Trait(predicate, _) = bound {
fn is_pointer_trait(&self, bound: &PredicateKind<'tcx>) -> Option<Ty<'tcx>> {
if let ty::PredicateKind::Trait(predicate, _) = bound {
if self.tcx.is_diagnostic_item(sym::pointer_trait, predicate.def_id()) {
Some(predicate.trait_ref.self_ty())
} else {