summaryrefslogtreecommitdiffstats
path: root/tests/ui/lint/lint-enum-intrinsics-non-enums.stderr
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
commit218caa410aa38c29984be31a5229b9fa717560ee (patch)
treec54bd55eeb6e4c508940a30e94c0032fbd45d677 /tests/ui/lint/lint-enum-intrinsics-non-enums.stderr
parentReleasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz
rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/lint/lint-enum-intrinsics-non-enums.stderr')
-rw-r--r--tests/ui/lint/lint-enum-intrinsics-non-enums.stderr95
1 files changed, 95 insertions, 0 deletions
diff --git a/tests/ui/lint/lint-enum-intrinsics-non-enums.stderr b/tests/ui/lint/lint-enum-intrinsics-non-enums.stderr
new file mode 100644
index 000000000..63ed2503c
--- /dev/null
+++ b/tests/ui/lint/lint-enum-intrinsics-non-enums.stderr
@@ -0,0 +1,95 @@
+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
+