https://github.com/rust-lang/rust/pull/158547 moved `std::io::BufWriter` to
`alloc::io::BufWriter`. That allows it to be used in `no-std` configurations,
and in particular on platforms where unwinding isn't supported.
However one of the doc tests uses `catch_unwind`, which fails on platforms
which cannot unwind. Fix this by copying the magic incantation from a similar
doctest in library/core/src/range.rs