backtrace-rs icon indicating copy to clipboard operation
backtrace-rs copied to clipboard

Update backtrace Debug formatting

Open 0paIescent opened this issue 6 years ago • 2 comments

Part of the PR for an issue over at rust-lang/rust here. Once this gets merged here, I'll submit the PR over there, just want to make sure everything integrates properly first.

0paIescent avatar Oct 25 '19 21:10 0paIescent

Thanks for the PR here @0paIescent!

The changes in https://github.com/rust-lang/rust/issues/65280 all sound reasonable to me, but I might recommend organizing this a bit differently. In the standard library we want to continue to have two implementations for std::fmt traits, one for Display and one for Debug. Today they are the same but I think we want Display's rendering to stay as-is and only Debug's rendering should be updated to use a flat array-like structure. In that sense I think this change will want to continue to support both renderings, chosen via methods and/or an enum value. I'd recommend leaving the currently builder largely as-is but adding something new which takes a fmt::DebugList (or something like that) for the debug implementation improvements.

Does that make sense?

With all that in place I think we'll want to update libstd to have a new Debug implementation (using the builder), but I think this library itself will want to keep Debug using the same rendering it has today. I want to be sure to not unexpectedly change a bunch of code relying on this crate in the wild by accident!

alexcrichton avatar Oct 28 '19 14:10 alexcrichton

Of course! You make some great points, I'll definitely keep those in mind when I refactor these changes.

Thanks for the tips!

0paIescent avatar Oct 29 '19 00:10 0paIescent