about summary refs log tree commit diff
path: root/tests/ui/coercion/non-primitive-cast-135412.stderr
blob: e5e9ee134597d61bbdb7d4d9217fa2b614f68b84 (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
error[E0605]: non-primitive cast: `u32` as `Option<_>`
  --> $DIR/non-primitive-cast-135412.rs:6:13
   |
LL |     let _ = 7u32 as Option<_>;
   |             ^^^^^^^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object
   |
help: consider using the `From` trait instead
   |
LL -     let _ = 7u32 as Option<_>;
LL +     let _ = Option::<_>::from(7u32);
   |

error[E0605]: non-primitive cast: `&'static str` as `Arc<str>`
  --> $DIR/non-primitive-cast-135412.rs:8:13
   |
LL |     let _ = "String" as Arc<str>;
   |             ^^^^^^^^^^^^^^^^^^^^ an `as` expression can only be used to convert between primitive types or to coerce to a specific trait object
   |
help: consider using the `From` trait instead
   |
LL -     let _ = "String" as Arc<str>;
LL +     let _ = Arc::<str>::from("String");
   |

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0605`.