1 // Check that CopyProp does not propagate an assignment to a function argument
2 // (doing so can break usages of the original argument value)
4 fn dummy(x: u8) -> u8 {
8 // EMIT_MIR copy_propagation_arg.foo.CopyProp.diff
10 // calling `dummy` to make a use of `x` that copyprop cannot eliminate
11 x = dummy(x); // this will assign a local to `x`
14 // EMIT_MIR copy_propagation_arg.bar.CopyProp.diff
20 // EMIT_MIR copy_propagation_arg.baz.CopyProp.diff
21 fn baz(mut x: i32) -> i32 {
22 // self-assignment to a function argument should be eliminated
27 // EMIT_MIR copy_propagation_arg.arg_src.CopyProp.diff
28 fn arg_src(mut x: i32) -> i32 {
30 x = 123; // Don't propagate this assignment to `y`
35 // Make sure the function actually gets instantiated.