Skip to content

Commit

Permalink
Rename some _sty variables to _kind
Browse files Browse the repository at this point in the history
  • Loading branch information
varkor committed Sep 26, 2019
1 parent bea3d67 commit e3fb05d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions src/librustc/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
8 changes: 4 additions & 4 deletions src/librustc/ty/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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(_) |
Expand Down
8 changes: 4 additions & 4 deletions src/librustc_codegen_llvm/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down
8 changes: 4 additions & 4 deletions src/librustdoc/clean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand All @@ -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))),
Expand All @@ -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 },
};
Expand Down

0 comments on commit e3fb05d

Please sign in to comment.