diff --git a/tests/kani/Intrinsics/Compiler/variant_count.rs b/tests/kani/Intrinsics/Compiler/variant_count.rs index 3ba72f47d6f0..3a7c330aefe7 100644 --- a/tests/kani/Intrinsics/Compiler/variant_count.rs +++ b/tests/kani/Intrinsics/Compiler/variant_count.rs @@ -3,21 +3,14 @@ // kani-verify-fail // Check that `variant_count` is not supported. -// Commented out code below can be enabled to ensure the implementation works as -// expected when support is added +// This test can be replaced with `variant_count_fixme.rs` once the intrinsic is +// supported and works as expected. + #![feature(variant_count)] use std::mem; enum Void {} -enum MyError { - Error1, - Error2, -} fn main() { let _ = mem::variant_count::(); - // assert!(mem::variant_count::() == 0); - // assert!(mem::variant_count::() == 2); - // assert!(mem::variant_count::>() == 2); - // assert!(mem::variant_count::>() == 2); } diff --git a/tests/kani/Intrinsics/Compiler/variant_count_fixme.rs b/tests/kani/Intrinsics/Compiler/variant_count_fixme.rs new file mode 100644 index 000000000000..37a14dc967b1 --- /dev/null +++ b/tests/kani/Intrinsics/Compiler/variant_count_fixme.rs @@ -0,0 +1,21 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: Apache-2.0 OR MIT + +// Check that `variant_count` is supported and returns the expected result. + +#![feature(variant_count)] +use std::mem; + +enum Void {} +enum MyError { + Error1, + Error2, + Error3, +} + +fn main() { + assert!(mem::variant_count::() == 0); + assert!(mem::variant_count::() == 3); + assert!(mem::variant_count::>() == 2); + assert!(mem::variant_count::>() == 2); +}