1 // compile-flags:-Ztreat-err-as-bug=5
4 NotFound { key: Vec<u8> },
8 impl std::error::Error for MyError {}
10 impl std::fmt::Display for MyError {
11 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
13 MyError::NotFound { key } => write!(
15 "unknown error with code {}.",
16 String::from_utf8(*key).unwrap()
17 //~^ ERROR cannot move out of `*key` which is behind a shared reference
19 MyError::Err41 => write!(f, "Sit by a lake"),
24 println!("Hello, world!");