]> git.lizzy.rs Git - rust.git/blob - tests/ui/issues/issue-52262.rs
Auto merge of #107044 - cuviper:more-llvm-ci, r=Mark-Simulacrum
[rust.git] / tests / ui / issues / issue-52262.rs
1 #[derive(Debug)]
2 enum MyError {
3     NotFound { key: Vec<u8> },
4     Err41,
5 }
6
7 impl std::error::Error for MyError {}
8
9 impl std::fmt::Display for MyError {
10     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
11         match self {
12             MyError::NotFound { key } => write!(
13                 f,
14                 "unknown error with code {}.",
15                 String::from_utf8(*key).unwrap()
16                 //~^ ERROR cannot move out of `*key` which is behind a shared reference
17             ),
18             MyError::Err41 => write!(f, "Sit by a lake"),
19         }
20     }
21 }
22 fn main() {
23     println!("Hello, world!");
24 }