Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Late toolchain upgrade to use nightly-2022-08-02 #1522

Merged
merged 6 commits into from
Aug 17, 2022

Conversation

celinval
Copy link
Contributor

Description of changes:

These are changes related to the toolchain upgrade scheduled for 0.8. They are related to the following upstream changes:

Resolved issues:

Resolves #1474

Call-outs:

Unfortunately, this update took longer than usual and I couldn't finish it on time for 0.8, but I wanted to finish it on time for the next upgrade.

The upgrade uncovered an issue on how we have been handling unsized objects. Not every unsized object is hidden behind a fat pointer, like it was being assumed previously. I had to include a fix as part of this PR. (See the 3rd commit).

I have also uncovered another issue with our casting code while writing tests for the former fix. Since the second isn't a regression, I added a fixme test and I'll create a jira for it.

Testing:

  • How is this change tested? Old tests + new tests

  • Is this a refactor change? No

Checklist

  • Each commit message has a non-empty body, explaining why the change was made
  • Methods or procedures are documented
  • Regression or unit tests are included, or existing tests cover the modified code
  • My PR is restricted to a single feature or bugfix

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.

The compiler has reverted their fix to Opaque types due to performance
degradation.
 - Add an implementation for vtable_size and vtable_align intrinsics.
 - Change how we handled Foreign types. Even though they are unsized, a
   pointer to foreign types are thin pointers.
@celinval celinval requested a review from a team as a code owner August 15, 2022 22:24
@@ -20,7 +20,7 @@ use std::fs::File;
use std::io::{self, Read, Seek};
use std::path::{Path, PathBuf};

use rustc_codegen_ssa::back::archive::ArchiveBuilder;
use rustc_codegen_ssa::back::archive::{ArchiveBuilder, ArchiveBuilderBuilder};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tests/kani/ProjectionElem/OpaqueCast/check_opaque_cast.rs Outdated Show resolved Hide resolved
tests/kani/DynTrait/unsized_rc_cast_fixme.rs Outdated Show resolved Hide resolved
pub fn use_thin_pointer(&self, mir_type: Ty<'tcx>) -> bool {
// ptr_metadata_ty is not defined on all types, the projection of an associated type
let (metadata, _check_is_sized) = mir_type.ptr_metadata_ty(self.tcx, normalize_type);
!self.is_unsized(mir_type) || metadata == self.tcx.types.unit
}

/// We use fat pointer if not thin pointer.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expand this comment to mirror the one above

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair.

ty::Ref(_, pointee_type, _) => Some(*pointee_type),
ty::RawPtr(ty::TypeAndMut { ty: pointee_type, .. }) => Some(*pointee_type),
_ => None,
}
}

pub fn std_pointee_type(mir_type: Ty) -> Option<Ty> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this function doing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add a doc

kani-compiler/src/codegen_cprover_gotoc/codegen/typ.rs Outdated Show resolved Hide resolved
@celinval celinval merged commit 632fda6 into model-checking:main Aug 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update rust toolchain version for Kani 0.8
2 participants