1 // This is testing how the diagnostic from issue #54556 behaves when
2 // the destructor code is attached to a place held in a field of the
3 // temporary being dropped.
5 // Eventually it would be nice if the diagnostic would actually report
6 // that specific place and its type that implements the `Drop` trait.
7 // But for the short term, it is acceptable to just print out the
8 // whole type of the temporary.
12 struct Wrap
<'p
> { p: &'p mut i32 }
14 impl<'p
> Drop
for Wrap
<'p
> {
20 struct Foo
<'p
> { a: String, b: Wrap<'p> }
24 let wrap
= Wrap { p: &mut x }
;
25 let s
= String
::from("str");
26 let foo
= Foo { a: s, b: wrap }
;
27 x
= 1; //~ ERROR cannot assign to `x` because it is borrowed [E0506]