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

Update Kani to Rust nightly-2022-10-11 #1788

Merged
merged 5 commits into from
Oct 14, 2022

Conversation

tedinski
Copy link
Contributor

Description of changes:

Updates to newer nightly. Notable impacting changes from upstream:

  1. Remove mir::CastKind::Misc rust-lang/rust#102675

    • CastKind::Misc became CastKind::IntToInt | CastKind::FloatToFloat | CastKind::FloatToInt | CastKind::IntToFloat | CastKind::FnPtrToPtr | CastKind::PtrToPtr
  2. Use only ty::Unevaluated<'tcx, ()> in type system rust-lang/rust#98588

    • MIR created ConstantKind::Unevaluated to replace ContantKind::Ty wrapping a ConstKind::Unevaluated. Note the ANT in Constant distinguishing these!
    • visit_const was removed from MirVisitor as a consequence
  3. Initial implementation of dyn* rust-lang/rust#101212

    • Initial implementation of dyn* might create problems for us in the future but simple change for now
    • It looks like they just littered fixmes about... so the only place that broke I've added a codegen_unimplemented for now
  4. Allow destructuring opaque types in their defining scopes rust-lang/rust#98582

  5. panic-on-uninit: adjust checks to 0x01-filling rust-lang/rust#101061

    • Seems like intrinsics::assert_uninit_valid::<bool>() is ok now? Switch to ! like that pull request

Resolved issues:

Resolves #1746

Call-outs:

  • simd_shuffle is disabled right now, but there's probably a new issue in the way of re-enabling it (it is or can be plain simd_shuffle now not just e.g. simd_shuffle8) @adpaco-aws
  • let_else is getting stabilized? Woo hoo!

Testing:

  • How is this change tested? ci

  • 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.

@tedinski tedinski requested a review from a team as a code owner October 14, 2022 19:17
Copy link
Contributor

@celinval celinval left a comment

Choose a reason for hiding this comment

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

Awesome! Just some nits.

ty: Ty<'tcx>,
span: Option<&Span>,
) -> Expr {
debug!("The literal was a Unevaluated");
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please add the constant?

debug!(?unevaluated, "codegen_const_unevaluated");

Nit: I usually add the name of the function to the log so it's easy to find it in the code. But I don't think we have any guidelines on this. So just a suggestion.

}
// A `ConstantKind::Ty(ConstKind::Unevaluated)` should no longer show up
// and should be a `ConstantKind::Unevaluated` instead (and thus handled
// in `codegen_constant` not here.)
Copy link
Contributor

Choose a reason for hiding this comment

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

in codegen_const_unevaluated

@@ -2,10 +2,6 @@
//
// Modifications Copyright Kani Contributors
// See GitHub history for details.
//
// NOTE: The initial fix for this has been reverted from rustc. I'm keeping this test here so we
Copy link
Contributor

Choose a reason for hiding this comment

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

Hopefully this was useful. :)

// TODO: can be empty now (i.e. `simd_shuffle` instead of `simd_shuffle8`)
// `parse` fails on empty, so comment that bit of code out.
// To re-enable this we'll need to investigate how size is computed now.
// let n: u64 = stripped.parse().unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the heads-up! I'll figure this out as part of the work being done in #1148.

// intrinsic `assert_uninit_valid` to generate a panic during compilation.
#[kani::proof]
fn main() {
let _var: () = unsafe {
intrinsics::assert_uninit_valid::<bool>();
intrinsics::assert_uninit_valid::<!>();
Copy link
Contributor

Choose a reason for hiding this comment

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

The problem is that this triggers the same path as tests/kani/Intrinsics/Assert/inhabited_panic.rs. Can you check that you get the message below if you replace bool with &i32?

attempted to leave type `&i32` uninitialized, which is invalid

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep! Fixed.

@tedinski tedinski merged commit 91a608d into model-checking:main Oct 14, 2022
@tedinski tedinski deleted the toolchain-13 branch October 14, 2022 22:22
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.13
3 participants