rust/tests/ui/coercion/non-primitive-cast-135412.s...

30 lines
1006 B
Plaintext

error[E0605]: non-primitive cast: `u32` as `Option<_>`
--> $DIR/non-primitive-cast-135412.rs:6:13
|
LL | let _ = 7u32 as Option<_>;
| ^^^^^^^^^^^^^^^^^
|
= note: 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>;
| ^^^^^^^^^^^^^^^^^^^^
|
= note: 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`.