Fix infinite recursion in Writer impl for &mut Writer

Closes issue #17767
auto merge of #17772 : bkoropoff/rust/issue-17767, r=alexcrichton

Closes issue #17767