rust/tests/ui/lint/lint-enum-intrinsics-non-en...

96 lines
3.9 KiB
Plaintext

error: the return value of `mem::discriminant` is unspecified when called with a non-enum type
--> $DIR/lint-enum-intrinsics-non-enums.rs:26:5
|
LL | discriminant(&());
| ^^^^^^^^^^^^^^^^^
|
note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `()`, which is not an enum.
--> $DIR/lint-enum-intrinsics-non-enums.rs:26:18
|
LL | discriminant(&());
| ^^^
= note: `#[deny(enum_intrinsics_non_enums)]` on by default
error: the return value of `mem::discriminant` is unspecified when called with a non-enum type
--> $DIR/lint-enum-intrinsics-non-enums.rs:29:5
|
LL | discriminant(&&SomeEnum::B);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `&SomeEnum`, which is not an enum.
--> $DIR/lint-enum-intrinsics-non-enums.rs:29:18
|
LL | discriminant(&&SomeEnum::B);
| ^^^^^^^^^^^^^
error: the return value of `mem::discriminant` is unspecified when called with a non-enum type
--> $DIR/lint-enum-intrinsics-non-enums.rs:32:5
|
LL | discriminant(&SomeStruct);
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `SomeStruct`, which is not an enum.
--> $DIR/lint-enum-intrinsics-non-enums.rs:32:18
|
LL | discriminant(&SomeStruct);
| ^^^^^^^^^^^
error: the return value of `mem::discriminant` is unspecified when called with a non-enum type
--> $DIR/lint-enum-intrinsics-non-enums.rs:35:5
|
LL | discriminant(&123u32);
| ^^^^^^^^^^^^^^^^^^^^^
|
note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `u32`, which is not an enum.
--> $DIR/lint-enum-intrinsics-non-enums.rs:35:18
|
LL | discriminant(&123u32);
| ^^^^^^^
error: the return value of `mem::discriminant` is unspecified when called with a non-enum type
--> $DIR/lint-enum-intrinsics-non-enums.rs:38:5
|
LL | discriminant(&&123i8);
| ^^^^^^^^^^^^^^^^^^^^^
|
note: the argument to `discriminant` should be a reference to an enum, but it was passed a reference to a `&i8`, which is not an enum.
--> $DIR/lint-enum-intrinsics-non-enums.rs:38:18
|
LL | discriminant(&&123i8);
| ^^^^^^^
error: the return value of `mem::variant_count` is unspecified when called with a non-enum type
--> $DIR/lint-enum-intrinsics-non-enums.rs:46:5
|
LL | variant_count::<&str>();
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the type parameter of `variant_count` should be an enum, but it was instantiated with the type `&str`, which is not an enum.
error: the return value of `mem::variant_count` is unspecified when called with a non-enum type
--> $DIR/lint-enum-intrinsics-non-enums.rs:49:5
|
LL | variant_count::<*const u8>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the type parameter of `variant_count` should be an enum, but it was instantiated with the type `*const u8`, which is not an enum.
error: the return value of `mem::variant_count` is unspecified when called with a non-enum type
--> $DIR/lint-enum-intrinsics-non-enums.rs:52:5
|
LL | variant_count::<()>();
| ^^^^^^^^^^^^^^^^^^^^^
|
= note: the type parameter of `variant_count` should be an enum, but it was instantiated with the type `()`, which is not an enum.
error: the return value of `mem::variant_count` is unspecified when called with a non-enum type
--> $DIR/lint-enum-intrinsics-non-enums.rs:55:5
|
LL | variant_count::<&SomeEnum>();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: the type parameter of `variant_count` should be an enum, but it was instantiated with the type `&SomeEnum`, which is not an enum.
error: aborting due to 9 previous errors