From 64d98f8ee037282c35007b64c2649055c56af1db Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:03 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- src/test/ui/lint/lint-enum-intrinsics-non-enums.rs | 67 ---------------------- 1 file changed, 67 deletions(-) delete mode 100644 src/test/ui/lint/lint-enum-intrinsics-non-enums.rs (limited to 'src/test/ui/lint/lint-enum-intrinsics-non-enums.rs') diff --git a/src/test/ui/lint/lint-enum-intrinsics-non-enums.rs b/src/test/ui/lint/lint-enum-intrinsics-non-enums.rs deleted file mode 100644 index 8ad337064..000000000 --- a/src/test/ui/lint/lint-enum-intrinsics-non-enums.rs +++ /dev/null @@ -1,67 +0,0 @@ -// Test the enum_intrinsics_non_enums lint. - -#![feature(variant_count)] - -use std::mem::{discriminant, variant_count}; - -enum SomeEnum { - A, - B, -} - -struct SomeStruct; - -fn generic_discriminant(v: &T) { - discriminant::(v); -} - -fn generic_variant_count() -> usize { - variant_count::() -} - -fn test_discriminant() { - discriminant(&SomeEnum::A); - generic_discriminant(&SomeEnum::B); - - discriminant(&()); - //~^ error: the return value of `mem::discriminant` is unspecified when called with a non-enum type - - discriminant(&&SomeEnum::B); - //~^ error: the return value of `mem::discriminant` is unspecified when called with a non-enum type - - discriminant(&SomeStruct); - //~^ error: the return value of `mem::discriminant` is unspecified when called with a non-enum type - - discriminant(&123u32); - //~^ error: the return value of `mem::discriminant` is unspecified when called with a non-enum type - - discriminant(&&123i8); - //~^ error: the return value of `mem::discriminant` is unspecified when called with a non-enum type -} - -fn test_variant_count() { - variant_count::(); - generic_variant_count::(); - - variant_count::<&str>(); - //~^ error: the return value of `mem::variant_count` is unspecified when called with a non-enum type - - variant_count::<*const u8>(); - //~^ error: the return value of `mem::variant_count` is unspecified when called with a non-enum type - - variant_count::<()>(); - //~^ error: the return value of `mem::variant_count` is unspecified when called with a non-enum type - - variant_count::<&SomeEnum>(); - //~^ error: the return value of `mem::variant_count` is unspecified when called with a non-enum type -} - -fn main() { - test_discriminant(); - test_variant_count(); - - // The lint ignores cases where the type is generic, so these should be - // allowed even though their return values are unspecified - generic_variant_count::(); - generic_discriminant::(&SomeStruct); -} -- cgit v1.2.3