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 place_contents_drop_state_cannot_differ<'tcx>(
|
|||
place: mir::Place<'tcx>,
|
||||
) -> bool {
|
||||
let ty = place.ty(body, tcx).ty;
|
||||
match ty.kind {
|
||||
match ty.kind() {
|
||||
ty::Array(..) => {
|
||||
debug!(
|
||||
"place_contents_drop_state_cannot_differ place: {:?} ty: {:?} => false",
|
||||
|
|
|
@ -559,7 +559,7 @@ fn switch_on_enum_discriminant(
|
|||
Some(mir::StatementKind::Assign(box (lhs, mir::Rvalue::Discriminant(discriminated))))
|
||||
if *lhs == switch_on =>
|
||||
{
|
||||
match &discriminated.ty(body, tcx).ty.kind {
|
||||
match &discriminated.ty(body, tcx).ty.kind() {
|
||||
ty::Adt(def, _) => Some((*discriminated, def)),
|
||||
|
||||
// `Rvalue::Discriminant` is also used to get the active yield point for a
|
||||
|
|
|
@ -110,7 +110,7 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> {
|
|||
let body = self.builder.body;
|
||||
let tcx = self.builder.tcx;
|
||||
let place_ty = Place::ty_from(place.local, proj_base, body, tcx).ty;
|
||||
match place_ty.kind {
|
||||
match place_ty.kind() {
|
||||
ty::Ref(..) | ty::RawPtr(..) => {
|
||||
let proj = &place.projection[..i + 1];
|
||||
return Err(MoveError::cannot_move_out_of(
|
||||
|
@ -480,7 +480,7 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> {
|
|||
}
|
||||
};
|
||||
let base_ty = base_place.ty(self.builder.body, self.builder.tcx).ty;
|
||||
let len: u64 = match base_ty.kind {
|
||||
let len: u64 = match base_ty.kind() {
|
||||
ty::Array(_, size) => {
|
||||
let length = size.eval_usize(self.builder.tcx, self.builder.param_env);
|
||||
length
|
||||
|
@ -525,7 +525,9 @@ impl<'b, 'a, 'tcx> Gatherer<'b, 'a, 'tcx> {
|
|||
// of the union so it is marked as initialized again.
|
||||
if let [proj_base @ .., ProjectionElem::Field(_, _)] = place.projection {
|
||||
if let ty::Adt(def, _) =
|
||||
Place::ty_from(place.local, proj_base, self.builder.body, self.builder.tcx).ty.kind
|
||||
Place::ty_from(place.local, proj_base, self.builder.body, self.builder.tcx)
|
||||
.ty
|
||||
.kind()
|
||||
{
|
||||
if def.is_union() {
|
||||
place = PlaceRef { local: place.local, projection: proj_base }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue