Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

Update toolchain #1139

Merged
merged 1 commit into from
Mar 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 18 additions & 17 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified binaries/summary_store.tar
Binary file not shown.
35 changes: 19 additions & 16 deletions checker/src/block_visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com
.set_path_rustc_type(path.clone(), ty);

if let TyKind::Adt(def, substs) = ty.kind() {
if let Some(destructor) = self.bv.tcx.adt_destructor(def.did) {
if let Some(destructor) = self.bv.tcx.adt_destructor(def.did()) {
let actual_argument_types = vec![self
.bv
.cv
Expand All @@ -457,7 +457,7 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com
.type_visitor()
.specialize_substs(substs, &self.type_visitor().generic_argument_map);
let callee_generic_argument_map = self.type_visitor().get_generic_arguments_map(
def.did,
def.did(),
callee_generic_arguments,
&actual_argument_types,
);
Expand Down Expand Up @@ -2224,8 +2224,8 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com
let (len, alignment) = if let Ok(ty_and_layout) = self.type_visitor().layout_of(ty) {
let layout = ty_and_layout.layout;
(
Rc::new((layout.size.bytes() as u128).into()),
Rc::new((layout.align.abi.bytes() as u128).into()),
Rc::new((layout.size().bytes() as u128).into()),
Rc::new((layout.align().abi.bytes() as u128).into()),
)
} else {
let type_index = self.type_visitor().get_index_for(self.bv.tcx.types.u128);
Expand Down Expand Up @@ -2468,7 +2468,7 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com
self.type_visitor().layout_of(substs.type_at(0))
{
if !ty_and_layout.is_unsized() {
let size_of_t = ty_and_layout.layout.size.bytes();
let size_of_t = ty_and_layout.layout.size().bytes();
let min_non_zero_cap: u128 = if size_of_t == 1 {
8
} else if size_of_t <= 1024 {
Expand Down Expand Up @@ -2581,13 +2581,14 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com
);
}
rustc_middle::ty::ConstKind::Value(ConstValue::ByRef { alloc, offset }) => {
let alloc_len = alloc.len();
let alloc_len = alloc.inner().len();
let offset_bytes = offset.bytes() as usize;
// The Rust compiler should ensure this.
assume!(alloc_len > offset_bytes);
let num_bytes = alloc_len - offset_bytes;
let bytes =
alloc.inspect_with_uninit_and_ptr_outside_interpreter(offset_bytes..alloc_len);
let bytes = alloc
.inner()
.inspect_with_uninit_and_ptr_outside_interpreter(offset_bytes..alloc_len);
let (heap_val, target_path) = self.bv.get_new_heap_block(
Rc::new((num_bytes as u128).into()),
Rc::new(1u128.into()),
Expand Down Expand Up @@ -2655,12 +2656,13 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com
rustc_middle::ty::ConstKind::Value(ConstValue::Scalar(Scalar::Ptr(ptr, _))) => {
match self.bv.tcx.get_global_alloc(ptr.provenance) {
Some(GlobalAlloc::Memory(alloc)) => {
let alloc_len = alloc.len() as u64;
let alloc_len = alloc.inner().len() as u64;
let offset_bytes = ptr.into_parts().1.bytes();
// The Rust compiler should ensure this.
assume!(alloc_len > offset_bytes);
let size = alloc_len - offset_bytes;
let bytes = alloc
.inner()
.get_bytes(
&self.bv.tcx,
alloc_range(
Expand Down Expand Up @@ -2743,6 +2745,7 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com
assume!(*end > *start); // The Rust compiler should ensure this.
let size = *end - *start;
let bytes = data
.inner()
.get_bytes(
&self.bv.tcx,
alloc_range(
Expand Down Expand Up @@ -2827,7 +2830,7 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com
if !discr_has_data {
bytes_left_to_deserialize = &bytes_left_to_deserialize[1..];
}
let variant = &def.variants[discr_index];
let variant = &def.variants()[discr_index];
trace!("deserializing variant {:?}", variant);
for (i, field) in variant.fields.iter().enumerate() {
trace!("deserializing field({}) {:?}", i, field);
Expand All @@ -2850,7 +2853,7 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com
TyKind::Adt(def, substs) => {
trace!("deserializing {:?} {:?}", def, substs);
let mut bytes_left_to_deserialize = bytes;
for variant in def.variants.iter() {
for variant in def.variants().iter() {
trace!("deserializing variant {:?}", variant);
bytes_left_to_deserialize = bytes;
for (i, field) in variant.fields.iter().enumerate() {
Expand Down Expand Up @@ -3133,7 +3136,7 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com
// Obtains the name of this variant.
let name = {
let enum_def = ty.ty_adt_def().unwrap();
let variant_def = &enum_def.variants[discr_index];
let variant_def = &enum_def.variants()[discr_index];
variant_def.ident(self.bv.tcx)
};
let name_str = name.as_str();
Expand Down Expand Up @@ -3284,7 +3287,7 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com
VariantIdx::from_u32(variant_index)
} else {
discr_has_data = true;
let fields = &variants[dataful_variant].fields;
let fields = &variants[dataful_variant].fields();
checked_assume!(
fields.count() == 1
&& fields.offset(0).bytes() == 0
Expand Down Expand Up @@ -3467,7 +3470,7 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com
if place.projection.is_empty() {
match ty.kind() {
TyKind::Adt(def, ..) => {
let ty_name = self.bv.cv.known_names_cache.get(self.bv.tcx, def.did);
let ty_name = self.bv.cv.known_names_cache.get(self.bv.tcx, def.did());
if ty_name == KnownNames::StdMarkerPhantomData {
return Rc::new(PathEnum::PhantomData.into());
}
Expand Down Expand Up @@ -3552,7 +3555,7 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com
&self.type_visitor().generic_argument_map,
);
if let TyKind::Adt(def, ..) = ty.kind() {
let ty_name = self.bv.cv.known_names_cache.get(tcx, def.did);
let ty_name = self.bv.cv.known_names_cache.get(tcx, def.did());
if ty_name == KnownNames::StdMarkerPhantomData {
return Rc::new(PathEnum::PhantomData.into());
}
Expand Down Expand Up @@ -3590,7 +3593,7 @@ impl<'block, 'analysis, 'compilation, 'tcx> BlockVisitor<'block, 'analysis, 'com
mir::ProjectionElem::Field(field, ..) => {
if let TyKind::Adt(def, _) = base_ty.kind() {
if def.is_union() {
let variants = &def.variants;
let variants = &def.variants();
assume!(variants.len() == 1); // only enums have more than one variant
let variant = &variants[variants.last().unwrap()];
return PathSelector::UnionField {
Expand Down
4 changes: 2 additions & 2 deletions checker/src/body_visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1776,8 +1776,8 @@ impl<'analysis, 'compilation, 'tcx> BodyVisitor<'analysis, 'compilation, 'tcx> {
tcx: TyCtxt<'a>,
accumulator: &mut Vec<(Rc<Path>, Ty<'a>)>,
) {
if !def.variants.is_empty() {
let variant = def.variants.iter().next().expect("at least one variant");
if !def.variants().is_empty() {
let variant = def.variants().iter().next().expect("at least one variant");
for (i, field) in variant.fields.iter().enumerate() {
let field_path = Path::new_field(path.clone(), i);
let field_ty = field.ty(tcx, substs);
Expand Down
16 changes: 8 additions & 8 deletions checker/src/call_visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -647,11 +647,11 @@ impl<'call, 'block, 'analysis, 'compilation, 'tcx>
precondition!(self.actual_argument_types.len() == 1);
if let TyKind::Ref(_, t, _) = self.actual_argument_types[0].kind() {
if let TyKind::Adt(def, substs) = t.kind() {
if def.variants.is_empty() {
if def.variants().is_empty() {
return false;
}
let variant_0 = VariantIdx::from_u32(0);
if Some(def.variants[variant_0].def_id)
if Some(def.variants()[variant_0].def_id)
== self.block_visitor.bv.tcx.lang_items().option_none_variant()
{
if let Some((place, _)) = &self.destination {
Expand Down Expand Up @@ -2274,7 +2274,7 @@ impl<'call, 'block, 'analysis, 'compilation, 'tcx>
.expect_ty();
if let Ok(ty_and_layout) = self.type_visitor().layout_of(t) {
if !ty_and_layout.is_unsized() {
return Rc::new((ty_and_layout.layout.size.bytes() as u128).into());
return Rc::new((ty_and_layout.layout.size().bytes() as u128).into());
}
}
let path = self.block_visitor.visit_rh_place(
Expand Down Expand Up @@ -2318,7 +2318,7 @@ impl<'call, 'block, 'analysis, 'compilation, 'tcx>
.type_visitor()
.get_dereferenced_type(self.actual_argument_types[0]);
if let Ok(ty_and_layout) = self.type_visitor().layout_of(t) {
return Rc::new((ty_and_layout.layout.align.abi.bytes() as u128).into());
return Rc::new((ty_and_layout.layout.align().abi.bytes() as u128).into());
}
// todo: need an expression that resolves to the value size once the value is known (typically after call site refinement).
let path = self.block_visitor.visit_rh_place(
Expand Down Expand Up @@ -2357,7 +2357,7 @@ impl<'call, 'block, 'analysis, 'compilation, 'tcx>
if let Ok(ty_and_layout) = self.type_visitor().layout_of(elem_t) {
if !ty_and_layout.is_unsized() {
let elem_size_val: Rc<AbstractValue> =
Rc::new((ty_and_layout.layout.size.bytes() as u128).into());
Rc::new((ty_and_layout.layout.size().bytes() as u128).into());
let length_path = Path::new_length(self.actual_args[0].0.clone());
let len_val = self.block_visitor.bv.lookup_path_and_refine_result(
length_path,
Expand All @@ -2375,7 +2375,7 @@ impl<'call, 'block, 'analysis, 'compilation, 'tcx>
.expect_ty();
if let Ok(ty_and_layout) = self.type_visitor().layout_of(t) {
if !ty_and_layout.is_unsized() {
return Rc::new((ty_and_layout.layout.size.bytes() as u128).into());
return Rc::new((ty_and_layout.layout.size().bytes() as u128).into());
}
}
// todo: need an expression that resolves to the value size once the value is known (typically after call site refinement).
Expand Down Expand Up @@ -3107,12 +3107,12 @@ impl<'call, 'block, 'analysis, 'compilation, 'tcx>
&tag_propagation_set_value.expression
{
let tag = Tag {
def_id: tag_adt_def.did.into(),
def_id: tag_adt_def.did().into(),
prop_set: *data,
};

// Record the tag if it is the constant-time verification tag.
self.check_and_record_constant_time_verification_tag(tag_adt_def.did, &tag);
self.check_and_record_constant_time_verification_tag(tag_adt_def.did(), &tag);

Some(tag)
} else {
Expand Down
8 changes: 4 additions & 4 deletions checker/src/crate_visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,17 +256,17 @@ impl<'compilation, 'tcx> CrateVisitor<'compilation, 'tcx> {
self.session.diagnostic().reset_err_count();
if self.options.statistics {
let num_diags = self.diagnostics_for.values().flatten().count();
for (_, mut diags) in self.diagnostics_for.drain() {
for db in diags.drain(0..) {
for (_, diags) in self.diagnostics_for.drain() {
for db in diags.into_iter() {
db.cancel();
}
}
print!("{}, analyzed, {}", self.file_name, num_diags);
} else if self.test_run {
let mut expected_errors = expected_errors::ExpectedErrors::new(self.file_name);
let mut diags = vec![];
for (_, mut dbs) in self.diagnostics_for.drain() {
for db in dbs.drain(0..) {
for (_, dbs) in self.diagnostics_for.drain() {
for db in dbs.into_iter() {
db.buffer(&mut diags);
}
}
Expand Down
Loading