summaryrefslogtreecommitdiffstats
path: root/tests/ui/cast/issue-106883-is-empty.stderr
blob: 7115c7704ca29dfd4af9160e2a748e6981767857 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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`.