File: issue-106883-is-empty.stderr

package info (click to toggle)
rustc-web 1.85.0%2Bdfsg3-1~deb12u3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bookworm-proposed-updates
  • size: 1,759,988 kB
  • sloc: xml: 158,127; python: 35,830; javascript: 19,497; cpp: 19,002; sh: 17,245; ansic: 13,127; asm: 4,376; makefile: 1,056; lisp: 29; perl: 29; ruby: 19; sql: 11
file content (58 lines) | stat: -rw-r--r-- 2,106 bytes parent folder | download | duplicates (7)
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`.