Skip to content

Commit c8dff04

Browse files
authored
Unrolled build for rust-lang#136271
Rollup merge of rust-lang#136271 - Sky9x:debug-maybeuninit-footgun, r=tgross35 Remove minor future footgun in `impl Debug for MaybeUninit` No longer breaks if `MaybeUninit` moves modules (technically it could break if `MaybeUninit` were renamed but realistically that will never happen) Debug impl originally added in rust-lang#133282
2 parents a730edc + b320e17 commit c8dff04

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

library/core/src/mem/maybe_uninit.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -276,10 +276,9 @@ impl<T: Copy> Clone for MaybeUninit<T> {
276276
impl<T> fmt::Debug for MaybeUninit<T> {
277277
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
278278
// NB: there is no `.pad_fmt` so we can't use a simpler `format_args!("MaybeUninit<{..}>").
279-
// This needs to be adjusted if `MaybeUninit` moves modules.
280279
let full_name = type_name::<Self>();
281-
let short_name = full_name.split_once("mem::maybe_uninit::").unwrap().1;
282-
f.pad(short_name)
280+
let prefix_len = full_name.find("MaybeUninit").unwrap();
281+
f.pad(&full_name[prefix_len..])
283282
}
284283
}
285284

0 commit comments

Comments
 (0)