From ab41be55b674b95070f1d5d9732f9c3757c68fb9 Mon Sep 17 00:00:00 2001 From: Michael Tautschnig Date: Mon, 9 Oct 2023 15:50:38 +0200 Subject: [PATCH] Update Rust toolchain to 2023-10-09 (#2814) Source changes required by the following upstream commits: * rust-lang/rust@e8a2673159 Add VariantIdx back * rust-lang/rust@f14b7c9443 Move FieldIdx and Layout to rustc_target * rust-lang/rust@b47ad3b744 Bring back generic FieldIdx Resolves: #2813 --- .../src/codegen_cprover_gotoc/codegen/place.rs | 3 +-- .../codegen_cprover_gotoc/codegen/rvalue.rs | 3 +-- .../src/codegen_cprover_gotoc/codegen/typ.rs | 18 +++++++++--------- rust-toolchain.toml | 2 +- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/kani-compiler/src/codegen_cprover_gotoc/codegen/place.rs b/kani-compiler/src/codegen_cprover_gotoc/codegen/place.rs index 7c3e9dbdf305..c32962e3e4b8 100644 --- a/kani-compiler/src/codegen_cprover_gotoc/codegen/place.rs +++ b/kani-compiler/src/codegen_cprover_gotoc/codegen/place.rs @@ -11,14 +11,13 @@ use crate::codegen_cprover_gotoc::utils::{dynamic_fat_ptr, slice_fat_ptr}; use crate::codegen_cprover_gotoc::GotocCtx; use crate::unwrap_or_return_codegen_unimplemented; use cbmc::goto_program::{Expr, Location, Type}; -use rustc_abi::FieldIdx; use rustc_hir::Mutability; use rustc_middle::ty::layout::LayoutOf; use rustc_middle::{ mir::{Local, Place, ProjectionElem}, ty::{self, Ty, TypeAndMut, VariantDef}, }; -use rustc_target::abi::{TagEncoding, VariantIdx, Variants}; +use rustc_target::abi::{FieldIdx, TagEncoding, VariantIdx, Variants}; use tracing::{debug, trace, warn}; /// A projection in Kani can either be to a type (the normal case), diff --git a/kani-compiler/src/codegen_cprover_gotoc/codegen/rvalue.rs b/kani-compiler/src/codegen_cprover_gotoc/codegen/rvalue.rs index f57f42137574..896da44f532f 100644 --- a/kani-compiler/src/codegen_cprover_gotoc/codegen/rvalue.rs +++ b/kani-compiler/src/codegen_cprover_gotoc/codegen/rvalue.rs @@ -17,13 +17,12 @@ use cbmc::goto_program::{ use cbmc::MachineModel; use cbmc::{btree_string_map, InternString, InternedString}; use num::bigint::BigInt; -use rustc_abi::FieldIdx; use rustc_index::IndexVec; use rustc_middle::mir::{AggregateKind, BinOp, CastKind, NullOp, Operand, Place, Rvalue, UnOp}; use rustc_middle::ty::adjustment::PointerCoercion; use rustc_middle::ty::layout::LayoutOf; use rustc_middle::ty::{self, Instance, IntTy, Ty, TyCtxt, UintTy, VtblEntry}; -use rustc_target::abi::{FieldsShape, Size, TagEncoding, VariantIdx, Variants}; +use rustc_target::abi::{FieldIdx, FieldsShape, Size, TagEncoding, VariantIdx, Variants}; use std::collections::BTreeMap; use tracing::{debug, trace, warn}; diff --git a/kani-compiler/src/codegen_cprover_gotoc/codegen/typ.rs b/kani-compiler/src/codegen_cprover_gotoc/codegen/typ.rs index 800c256108bb..5538f4d9ceff 100644 --- a/kani-compiler/src/codegen_cprover_gotoc/codegen/typ.rs +++ b/kani-compiler/src/codegen_cprover_gotoc/codegen/typ.rs @@ -20,8 +20,8 @@ use rustc_middle::ty::{ use rustc_middle::ty::{List, TypeFoldable}; use rustc_span::def_id::DefId; use rustc_target::abi::{ - Abi::Vector, FieldsShape, Integer, LayoutS, Primitive, Size, TagEncoding, TyAndLayout, - VariantIdx, Variants, + Abi::Vector, FieldIdx, FieldsShape, Integer, LayoutS, Primitive, Size, TagEncoding, + TyAndLayout, VariantIdx, Variants, }; use rustc_target::spec::abi::Abi; use std::iter; @@ -870,7 +870,7 @@ impl<'tcx> GotocCtx<'tcx> { fn codegen_alignment_padding( &self, size: Size, - layout: &LayoutS, + layout: &LayoutS, idx: usize, ) -> Option { let align = Size::from_bits(layout.align.abi.bits()); @@ -895,7 +895,7 @@ impl<'tcx> GotocCtx<'tcx> { fn codegen_struct_fields( &mut self, flds: Vec<(String, Ty<'tcx>)>, - layout: &LayoutS, + layout: &LayoutS, initial_offset: Size, ) -> Vec { match &layout.fields { @@ -1352,7 +1352,7 @@ impl<'tcx> GotocCtx<'tcx> { &mut self, variant: &VariantDef, subst: &'tcx GenericArgsRef<'tcx>, - layout: &LayoutS, + layout: &LayoutS, initial_offset: Size, ) -> Vec { let flds: Vec<_> = @@ -1521,7 +1521,7 @@ impl<'tcx> GotocCtx<'tcx> { ty: Ty<'tcx>, adtdef: &'tcx AdtDef, subst: &'tcx GenericArgsRef<'tcx>, - variants: &IndexVec, + variants: &IndexVec>, ) -> Type { let non_zst_count = variants.iter().filter(|layout| layout.size.bytes() > 0).count(); let mangled_name = self.ty_mangled_name(ty); @@ -1540,7 +1540,7 @@ impl<'tcx> GotocCtx<'tcx> { pub(crate) fn variant_min_offset( &self, - variants: &IndexVec, + variants: &IndexVec>, ) -> Option { variants .iter() @@ -1625,7 +1625,7 @@ impl<'tcx> GotocCtx<'tcx> { pretty_name: InternedString, def: &'tcx AdtDef, subst: &'tcx GenericArgsRef<'tcx>, - layouts: &IndexVec, + layouts: &IndexVec>, initial_offset: Size, ) -> Vec { def.variants() @@ -1657,7 +1657,7 @@ impl<'tcx> GotocCtx<'tcx> { pretty_name: InternedString, case: &VariantDef, subst: &'tcx GenericArgsRef<'tcx>, - variant: &LayoutS, + variant: &LayoutS, initial_offset: Size, ) -> Type { let case_name = format!("{name}::{}", case.name); diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 1387169d056f..6586d333da5a 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -2,5 +2,5 @@ # SPDX-License-Identifier: Apache-2.0 OR MIT [toolchain] -channel = "nightly-2023-10-06" +channel = "nightly-2023-10-09" components = ["llvm-tools-preview", "rustc-dev", "rust-src", "rustfmt"]