1 // Issue 34101: Circa 2016-06-05, `fn inline` below issued an
2 // erroneous warning from the elaborate_drops pass about moving out of
3 // a field in `Foo`, which has a destructor (and thus cannot have
4 // content moved out of it). The reason that the warning is erroneous
5 // in this case is that we are doing a *replace*, not a move, of the
6 // content in question, and it is okay to replace fields within `Foo`.
8 // Another more subtle problem was that the elaborate_drops was
9 // creating a separate drop flag for that internally replaced content,
10 // even though the compiler should enforce an invariant that any drop
11 // flag for such subcontent of `Foo` will always have the same value
12 // as the drop flag for `Foo` itself.
30 // (dummy variable so `f` gets assigned `var1` in MIR for both fn's)
32 let mut f = Foo(String::from("foo"));
33 f.0 = String::from("bar");
37 let _s = String::from("foo");
39 f.0 = String::from("bar");