]> git.proxmox.com Git - rustc.git/blame - src/test/ui/issues/issue-52262.rs
New upstream version 1.49.0+dfsg1
[rustc.git] / src / test / ui / issues / issue-52262.rs
CommitLineData
e74abb32
XL
1// compile-flags:-Ztreat-err-as-bug=5
2#[derive(Debug)]
3enum MyError {
4 NotFound { key: Vec<u8> },
5 Err41,
6}
7
8impl std::error::Error for MyError {}
9
10impl std::fmt::Display for MyError {
11 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
12 match self {
13 MyError::NotFound { key } => write!(
14 f,
15 "unknown error with code {}.",
16 String::from_utf8(*key).unwrap()
17 //~^ ERROR cannot move out of `*key` which is behind a shared reference
18 ),
19 MyError::Err41 => write!(f, "Sit by a lake"),
20 }
21 }
22}
23fn main() {
24 println!("Hello, world!");
25}