Skip to content

Instantly share code, notes, and snippets.

@rust-play
Created September 17, 2019 17:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rust-play/8939d40e56d65ba69e6b1ddcb7c9c7bc to your computer and use it in GitHub Desktop.
Save rust-play/8939d40e56d65ba69e6b1ddcb7c9c7bc to your computer and use it in GitHub Desktop.
Code shared from the Rust Playground
#![allow(unreachable_code)]
fn main() {
println!("{:?}", {
u32::try_from(-1i32)
});
}
/* ~~~~=== stderr ===~~~~
Compiling playground v0.0.1 (/playground)
error[E0599]: no function or associated item named `try_from` found for type `u32` in the current scope
--> src/main.rs:6:14
|
6 | u32::try_from(-1i32)
| ^^^^^^^^ function or associated item not found in `u32`
|
= help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope, perhaps add a `use` for it:
|
4 | use std::convert::TryFrom;
|
error: aborting due to previous error
For more information about this error, try `rustc --explain E0599`.
error: Could not compile `playground`.
To learn more, run the command again with --verbose.
*/
/* ~~~~=== stdout ===~~~~
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment