Change ty.kind to a method
This commit is contained in:
parent
ef55a0a92f
commit
3e14b684dd
189 changed files with 947 additions and 899 deletions
|
@ -53,7 +53,7 @@ fn inner_resolve_instance<'tcx>(
|
|||
let ty = tcx.type_of(def.def_id_for_type_of());
|
||||
let item_type = tcx.subst_and_normalize_erasing_regions(substs, param_env, &ty);
|
||||
|
||||
let def = match item_type.kind {
|
||||
let def = match *item_type.kind() {
|
||||
ty::FnDef(..)
|
||||
if {
|
||||
let f = item_type.fn_sig(tcx);
|
||||
|
@ -68,7 +68,7 @@ fn inner_resolve_instance<'tcx>(
|
|||
|
||||
if ty.needs_drop(tcx, param_env) {
|
||||
debug!(" => nontrivial drop glue");
|
||||
match ty.kind {
|
||||
match *ty.kind() {
|
||||
ty::Closure(..)
|
||||
| ty::Generator(..)
|
||||
| ty::Tuple(..)
|
||||
|
@ -231,7 +231,7 @@ fn resolve_associated_item<'tcx>(
|
|||
trait_closure_kind,
|
||||
))
|
||||
}
|
||||
traits::ImplSourceFnPointer(ref data) => match data.fn_ty.kind {
|
||||
traits::ImplSourceFnPointer(ref data) => match data.fn_ty.kind() {
|
||||
ty::FnDef(..) | ty::FnPtr(..) => Some(Instance {
|
||||
def: ty::InstanceDef::FnPtrShim(trait_item.def_id, data.fn_ty),
|
||||
substs: rcvr_substs,
|
||||
|
@ -250,7 +250,7 @@ fn resolve_associated_item<'tcx>(
|
|||
let self_ty = trait_ref.self_ty();
|
||||
|
||||
let is_copy = self_ty.is_copy_modulo_regions(tcx.at(DUMMY_SP), param_env);
|
||||
match self_ty.kind {
|
||||
match self_ty.kind() {
|
||||
_ if is_copy => (),
|
||||
ty::Array(..) | ty::Closure(..) | ty::Tuple(..) => {}
|
||||
_ => return Ok(None),
|
||||
|
|
|
@ -90,7 +90,7 @@ where
|
|||
};
|
||||
|
||||
for component in components {
|
||||
match component.kind {
|
||||
match *component.kind() {
|
||||
_ if component.is_copy_modulo_regions(tcx.at(DUMMY_SP), self.param_env) => (),
|
||||
|
||||
ty::Closure(_, substs) => {
|
||||
|
@ -106,7 +106,7 @@ where
|
|||
}
|
||||
|
||||
let witness = substs.witness();
|
||||
let interior_tys = match &witness.kind {
|
||||
let interior_tys = match witness.kind() {
|
||||
ty::GeneratorWitness(tys) => tcx.erase_late_bound_regions(tys),
|
||||
_ => {
|
||||
tcx.sess.delay_span_bug(
|
||||
|
|
|
@ -18,7 +18,7 @@ fn sized_constraint_for_ty<'tcx>(
|
|||
) -> Vec<Ty<'tcx>> {
|
||||
use ty::TyKind::*;
|
||||
|
||||
let result = match ty.kind {
|
||||
let result = match ty.kind() {
|
||||
Bool | Char | Int(..) | Uint(..) | Float(..) | RawPtr(..) | Ref(..) | FnDef(..)
|
||||
| FnPtr(_) | Array(..) | Closure(..) | Generator(..) | Never => vec![],
|
||||
|
||||
|
@ -344,7 +344,7 @@ fn issue33140_self_ty(tcx: TyCtxt<'_>, def_id: DefId) -> Option<Ty<'_>> {
|
|||
}
|
||||
|
||||
let self_ty = trait_ref.self_ty();
|
||||
let self_ty_matches = match self_ty.kind {
|
||||
let self_ty_matches = match self_ty.kind() {
|
||||
ty::Dynamic(ref data, ty::ReStatic) => data.principal().is_none(),
|
||||
_ => false,
|
||||
};
|
||||
|
@ -398,21 +398,21 @@ fn associated_type_projection_predicates(
|
|||
let pred = obligation.predicate;
|
||||
match pred.skip_binders() {
|
||||
ty::PredicateAtom::Trait(tr, _) => {
|
||||
if let ty::Projection(p) = tr.self_ty().kind {
|
||||
if let ty::Projection(p) = *tr.self_ty().kind() {
|
||||
if p == assoc_item_ty {
|
||||
return Some(pred);
|
||||
}
|
||||
}
|
||||
}
|
||||
ty::PredicateAtom::Projection(proj) => {
|
||||
if let ty::Projection(p) = proj.projection_ty.self_ty().kind {
|
||||
if let ty::Projection(p) = *proj.projection_ty.self_ty().kind() {
|
||||
if p == assoc_item_ty {
|
||||
return Some(pred);
|
||||
}
|
||||
}
|
||||
}
|
||||
ty::PredicateAtom::TypeOutlives(outlives) => {
|
||||
if let ty::Projection(p) = outlives.0.kind {
|
||||
if let ty::Projection(p) = *outlives.0.kind() {
|
||||
if p == assoc_item_ty {
|
||||
return Some(pred);
|
||||
}
|
||||
|
@ -449,14 +449,15 @@ fn opaque_type_projection_predicates(
|
|||
let pred = obligation.predicate;
|
||||
match pred.skip_binders() {
|
||||
ty::PredicateAtom::Trait(tr, _) => {
|
||||
if let ty::Opaque(opaque_def_id, opaque_substs) = tr.self_ty().kind {
|
||||
if let ty::Opaque(opaque_def_id, opaque_substs) = *tr.self_ty().kind() {
|
||||
if opaque_def_id == def_id && opaque_substs == substs {
|
||||
return Some(pred);
|
||||
}
|
||||
}
|
||||
}
|
||||
ty::PredicateAtom::Projection(proj) => {
|
||||
if let ty::Opaque(opaque_def_id, opaque_substs) = proj.projection_ty.self_ty().kind
|
||||
if let ty::Opaque(opaque_def_id, opaque_substs) =
|
||||
*proj.projection_ty.self_ty().kind()
|
||||
{
|
||||
if opaque_def_id == def_id && opaque_substs == substs {
|
||||
return Some(pred);
|
||||
|
@ -464,7 +465,7 @@ fn opaque_type_projection_predicates(
|
|||
}
|
||||
}
|
||||
ty::PredicateAtom::TypeOutlives(outlives) => {
|
||||
if let ty::Opaque(opaque_def_id, opaque_substs) = outlives.0.kind {
|
||||
if let ty::Opaque(opaque_def_id, opaque_substs) = *outlives.0.kind() {
|
||||
if opaque_def_id == def_id && opaque_substs == substs {
|
||||
return Some(pred);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue