Rename some _sty variables to _kind

This commit is contained in:
varkor 2019-09-26 12:10:43 +01:00
parent bea3d67c77
commit e3fb05dc3c
4 changed files with 16 additions and 16 deletions

View file

@ -132,13 +132,13 @@ impl<'tcx> CtxtInterners<'tcx> {
#[allow(rustc::usage_of_ty_tykind)]
#[inline(never)]
fn intern_ty(&self,
st: TyKind<'tcx>
kind: TyKind<'tcx>
) -> Ty<'tcx> {
self.type_.intern(st, |st| {
let flags = super::flags::FlagComputation::for_sty(&st);
self.type_.intern(kind, |kind| {
let flags = super::flags::FlagComputation::for_kind(&kind);
let ty_struct = TyS {
kind: st,
kind,
flags: flags.flags,
outer_exclusive_binder: flags.outer_exclusive_binder,
};

View file

@ -19,9 +19,9 @@ impl FlagComputation {
}
#[allow(rustc::usage_of_ty_tykind)]
pub fn for_sty(st: &ty::TyKind<'_>) -> FlagComputation {
pub fn for_kind(kind: &ty::TyKind<'_>) -> FlagComputation {
let mut result = FlagComputation::new();
result.add_sty(st);
result.add_kind(kind);
result
}
@ -63,8 +63,8 @@ impl FlagComputation {
}
#[allow(rustc::usage_of_ty_tykind)]
fn add_sty(&mut self, st: &ty::TyKind<'_>) {
match st {
fn add_kind(&mut self, kind: &ty::TyKind<'_>) {
match kind {
&ty::Bool |
&ty::Char |
&ty::Int(_) |

View file

@ -324,7 +324,7 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
use syntax::ast::UintTy::*;
use rustc::ty::{Int, Uint};
let new_sty = match ty.kind {
let new_kind = match ty.kind {
Int(Isize) => Int(self.tcx.sess.target.isize_ty),
Uint(Usize) => Uint(self.tcx.sess.target.usize_ty),
ref t @ Uint(_) | ref t @ Int(_) => t.clone(),
@ -332,7 +332,7 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
};
let name = match oop {
OverflowOp::Add => match new_sty {
OverflowOp::Add => match new_kind {
Int(I8) => "llvm.sadd.with.overflow.i8",
Int(I16) => "llvm.sadd.with.overflow.i16",
Int(I32) => "llvm.sadd.with.overflow.i32",
@ -347,7 +347,7 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
_ => unreachable!(),
},
OverflowOp::Sub => match new_sty {
OverflowOp::Sub => match new_kind {
Int(I8) => "llvm.ssub.with.overflow.i8",
Int(I16) => "llvm.ssub.with.overflow.i16",
Int(I32) => "llvm.ssub.with.overflow.i32",
@ -362,7 +362,7 @@ impl BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
_ => unreachable!(),
},
OverflowOp::Mul => match new_sty {
OverflowOp::Mul => match new_kind {
Int(I8) => "llvm.smul.with.overflow.i8",
Int(I16) => "llvm.smul.with.overflow.i16",
Int(I32) => "llvm.smul.with.overflow.i32",

View file

@ -1098,7 +1098,7 @@ fn external_generic_args(
substs: SubstsRef<'_>,
) -> GenericArgs {
let mut skip_self = has_self;
let mut ty_sty = None;
let mut ty_kind = None;
let args: Vec<_> = substs.iter().filter_map(|kind| match kind.unpack() {
GenericArgKind::Lifetime(lt) => {
lt.clean(cx).and_then(|lt| Some(GenericArg::Lifetime(lt)))
@ -1108,7 +1108,7 @@ fn external_generic_args(
None
}
GenericArgKind::Type(ty) => {
ty_sty = Some(&ty.kind);
ty_kind = Some(&ty.kind);
Some(GenericArg::Type(ty.clean(cx)))
}
GenericArgKind::Const(ct) => Some(GenericArg::Const(ct.clean(cx))),
@ -1117,8 +1117,8 @@ fn external_generic_args(
match trait_did {
// Attempt to sugar an external path like Fn<(A, B,), C> to Fn(A, B) -> C
Some(did) if cx.tcx.lang_items().fn_trait_kind(did).is_some() => {
assert!(ty_sty.is_some());
let inputs = match ty_sty {
assert!(ty_kind.is_some());
let inputs = match ty_kind {
Some(ty::Tuple(ref tys)) => tys.iter().map(|t| t.expect_ty().clean(cx)).collect(),
_ => return GenericArgs::AngleBracketed { args, bindings },
};