Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fn main() {
- println!("{:?}", {
- unsafe { [1, 2, 3, 4u8].as_ref() as &[u8; 8] }
- });
- }
- /* ~~~~=== stderr ===~~~~
- Compiling playground v0.0.1 (file:///playground)
- error[E0605]: non-primitive cast: `&[u8]` as `&[u8; 8]`
- --> src/main.rs:5:18
- |
- 5 | unsafe { [1, 2, 3, 4u8].as_ref() as &[u8; 8] }
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- |
- = note: an `as` expression can only be used to convert between primitive types. Consider using the `From` trait
- error: aborting due to previous error
- For more information about this error, try `rustc --explain E0605`.
- error: Could not compile `playground`.
- To learn more, run the command again with --verbose.
- */
- /* ~~~~=== stdout ===~~~~
- */
Add Comment
Please, Sign In to add comment