summaryrefslogtreecommitdiffstats
path: root/tests/ui/cast/issue-106883-is-empty.stderr
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/ui/cast/issue-106883-is-empty.stderr58
1 files changed, 58 insertions, 0 deletions
diff --git a/tests/ui/cast/issue-106883-is-empty.stderr b/tests/ui/cast/issue-106883-is-empty.stderr
new file mode 100644
index 000000000..7115c7704
--- /dev/null
+++ b/tests/ui/cast/issue-106883-is-empty.stderr
@@ -0,0 +1,58 @@
+error[E0606]: casting `&'static str` as `bool` is invalid
+ --> $DIR/issue-106883-is-empty.rs:14:13
+ |
+LL | let _ = "foo" as bool;
+ | ^^^^^^^^^^^^^
+ |
+help: consider using the `is_empty` method on `&'static str` to determine if it contains anything
+ |
+LL | let _ = !"foo".is_empty();
+ | + ~~~~~~~~~~~
+
+error[E0605]: non-primitive cast: `String` as `bool`
+ --> $DIR/issue-106883-is-empty.rs:17:13
+ |
+LL | let _ = String::from("foo") as bool;
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object
+ |
+note: this expression `Deref`s to `str` which implements `is_empty`
+ --> $DIR/issue-106883-is-empty.rs:17:13
+ |
+LL | let _ = String::from("foo") as bool;
+ | ^^^^^^^^^^^^^^^^^^^
+help: consider using the `is_empty` method on `String` to determine if it contains anything
+ |
+LL | let _ = !String::from("foo").is_empty();
+ | + ~~~~~~~~~~~
+
+error[E0605]: non-primitive cast: `Foo` as `bool`
+ --> $DIR/issue-106883-is-empty.rs:20:13
+ |
+LL | let _ = Foo as bool;
+ | ^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object
+ |
+note: this expression `Deref`s to `[u8]` which implements `is_empty`
+ --> $DIR/issue-106883-is-empty.rs:20:13
+ |
+LL | let _ = Foo as bool;
+ | ^^^
+help: consider using the `is_empty` method on `Foo` to determine if it contains anything
+ |
+LL | let _ = !Foo.is_empty();
+ | + ~~~~~~~~~~~
+
+error[E0606]: casting `&[i32]` as `bool` is invalid
+ --> $DIR/issue-106883-is-empty.rs:25:5
+ |
+LL | bar as bool
+ | ^^^^^^^^^^^
+ |
+help: consider using the `is_empty` method on `&[i32]` to determine if it contains anything
+ |
+LL | !bar.is_empty()
+ | + ~~~~~~~~~~~
+
+error: aborting due to 4 previous errors
+
+Some errors have detailed explanations: E0605, E0606.
+For more information about an error, try `rustc --explain E0605`.