Change ty.kind to a method
This commit is contained in:
@@ -236,7 +236,7 @@ impl<'mir, 'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> Visitor<'tcx>
|
||||
fn visit_terminator(&mut self, terminator: &mir::Terminator<'tcx>, location: Location) {
|
||||
let check = match terminator.kind {
|
||||
mir::TerminatorKind::Call { func: mir::Operand::Constant(ref c), ref args, .. } => {
|
||||
match c.literal.ty.kind {
|
||||
match *c.literal.ty.kind() {
|
||||
ty::FnDef(did, _) => Some((did, args)),
|
||||
_ => None,
|
||||
}
|
||||
|
||||
@@ -332,7 +332,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
args1 = [place.llval];
|
||||
&args1[..]
|
||||
};
|
||||
let (drop_fn, fn_abi) = match ty.kind {
|
||||
let (drop_fn, fn_abi) = match ty.kind() {
|
||||
// FIXME(eddyb) perhaps move some of this logic into
|
||||
// `Instance::resolve_drop_in_place`?
|
||||
ty::Dynamic(..) => {
|
||||
@@ -540,7 +540,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
// Create the callee. This is a fn ptr or zero-sized and hence a kind of scalar.
|
||||
let callee = self.codegen_operand(&mut bx, func);
|
||||
|
||||
let (instance, mut llfn) = match callee.layout.ty.kind {
|
||||
let (instance, mut llfn) = match *callee.layout.ty.kind() {
|
||||
ty::FnDef(def_id, substs) => (
|
||||
Some(
|
||||
ty::Instance::resolve(bx.tcx(), ty::ParamEnv::reveal_all(), def_id, substs)
|
||||
@@ -887,7 +887,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
_ => span_bug!(span, "expected ByRef for promoted asm const"),
|
||||
};
|
||||
let value = scalar.assert_bits(size);
|
||||
let string = match ty.kind {
|
||||
let string = match ty.kind() {
|
||||
ty::Uint(_) => value.to_string(),
|
||||
ty::Int(int_ty) => {
|
||||
match int_ty.normalize(bx.tcx().sess.target.ptr_width) {
|
||||
@@ -914,7 +914,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
}
|
||||
mir::InlineAsmOperand::SymFn { ref value } => {
|
||||
let literal = self.monomorphize(&value.literal);
|
||||
if let ty::FnDef(def_id, substs) = literal.ty.kind {
|
||||
if let ty::FnDef(def_id, substs) = *literal.ty.kind() {
|
||||
let instance = ty::Instance::resolve_for_fn_ptr(
|
||||
bx.tcx(),
|
||||
ty::ParamEnv::reveal_all(),
|
||||
|
||||
@@ -369,8 +369,8 @@ fn arg_local_refs<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
|
||||
// individual LLVM function arguments.
|
||||
|
||||
let arg_ty = fx.monomorphize(&arg_decl.ty);
|
||||
let tupled_arg_tys = match arg_ty.kind {
|
||||
ty::Tuple(ref tys) => tys,
|
||||
let tupled_arg_tys = match arg_ty.kind() {
|
||||
ty::Tuple(tys) => tys,
|
||||
_ => bug!("spread argument isn't a tuple?!"),
|
||||
};
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ impl<'a, 'tcx, V: CodegenObject> PlaceRef<'tcx, V> {
|
||||
// * no metadata available - just log the case
|
||||
// * known alignment - sized types, `[T]`, `str` or a foreign type
|
||||
// * packed struct - there is no alignment padding
|
||||
match field.ty.kind {
|
||||
match field.ty.kind() {
|
||||
_ if self.llextra.is_none() => {
|
||||
debug!(
|
||||
"unsized field `{}`, of `{:?}` has no metadata for adjustment",
|
||||
|
||||
@@ -185,7 +185,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
|
||||
let val = match *kind {
|
||||
mir::CastKind::Pointer(PointerCast::ReifyFnPointer) => {
|
||||
match operand.layout.ty.kind {
|
||||
match *operand.layout.ty.kind() {
|
||||
ty::FnDef(def_id, substs) => {
|
||||
if bx.cx().tcx().has_attr(def_id, sym::rustc_args_required_const) {
|
||||
bug!("reifying a fn ptr that requires const arguments");
|
||||
@@ -204,7 +204,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
}
|
||||
}
|
||||
mir::CastKind::Pointer(PointerCast::ClosureFnPointer(_)) => {
|
||||
match operand.layout.ty.kind {
|
||||
match *operand.layout.ty.kind() {
|
||||
ty::Closure(def_id, substs) => {
|
||||
let instance = Instance::resolve_closure(
|
||||
bx.cx().tcx(),
|
||||
@@ -564,7 +564,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
// because codegen_place() panics if Local is operand.
|
||||
if let Some(index) = place.as_local() {
|
||||
if let LocalRef::Operand(Some(op)) = self.locals[index] {
|
||||
if let ty::Array(_, n) = op.layout.ty.kind {
|
||||
if let ty::Array(_, n) = op.layout.ty.kind() {
|
||||
let n = n.eval_usize(bx.cx().tcx(), ty::ParamEnv::reveal_all());
|
||||
return bx.cx().const_usize(n);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user