Skip to content
Permalink
Browse files

Rename some `_sty` variables to `_kind`

  • Loading branch information...
varkor committed Sep 26, 2019
1 parent bea3d67 commit e3fb05dc3c32160e89ad354297b168fae11ffba1
Showing with 16 additions and 16 deletions.
  1. +4 −4 src/librustc/ty/context.rs
  2. +4 −4 src/librustc/ty/flags.rs
  3. +4 −4 src/librustc_codegen_llvm/builder.rs
  4. +4 −4 src/librustdoc/clean/mod.rs
@@ -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,
};
@@ -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(_) |
@@ -324,15 +324,15 @@ 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(),
_ => panic!("tried to get overflow intrinsic for op applied to non-int type")
};

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",
@@ -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 },
};

0 comments on commit e3fb05d

Please sign in to comment.
You can’t perform that action at this time.