Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
bevyengine
GitHub Repository: bevyengine/bevy
Path: blob/main/tools/compile_fail_utils/tests/example_tests/basic_test.rs
6598 views
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
6
fn 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