1// Compiler warnings also need to be annotated. We don't 2// want to annotate all the unused variables so let's instruct 3// the compiler to ignore them. 4#![allow(unused_variables)] 5 6fn bad_moves() { 7 let x = String::new(); 8 // Help diagnostics need to be annotated 9 let y = x; 10 //~^ HELP: consider cloning 11 12 // We expect a failure on this line 13 println!("{x}"); //~ ERROR: borrow 14 15 16 let x = String::new(); 17 // We expect the help message to mention cloning. 18 //~v HELP: consider cloning 19 let y = x; 20 21 // Check error message using a regex 22 println!("{x}"); 23 //~^ ERROR: /(move)|(borrow)/ 24} 25 26