Re: [dev-servo] PSA: Avoid invoking Debug formatters in release-mode Rust

2018-01-18 Thread Anthony Ramine
That being said, looking at nsCSSParser.cpp in Gecko, I just realised you never had similar code (printing values when some invariant is broken). Given how old Gecko is, I guess that means this is not even useful to begin with (I mean the printing you removed was not useful to begin with, just

Re: PSA: Avoid invoking Debug formatters in release-mode Rust

2018-01-16 Thread Chris Peterson
On 2018-01-12 9:07 PM, Bobby Holley wrote: The most common way this seems to happen is in panic!() messages, where it can be tempting to include a stringified value to make the message more informative. Just a friendly reminder: panic messages that are parameterized to include debug data

Re: [dev-servo] PSA: Avoid invoking Debug formatters in release-mode Rust

2018-01-15 Thread Bobby Holley
(From your next message it sounds like there's no disagreement here, but I wanted to get the reasoning written down) On Sat, Jan 13, 2018 at 6:36 AM, Anthony Ramine wrote: > I would much rather prefer if we just checked that we didn't use the Debug > impls of large types.

Re: [dev-servo] PSA: Avoid invoking Debug formatters in release-mode Rust

2018-01-13 Thread Lars Bergstrom
At least for Servo, should we add a check to tidy ( https://github.com/servo/servo/blob/master/python/tidy/servo_tidy/tidy.py) immediately to catch the use of that fairly-unique formatting string, as we do for a bunch of other random stuff? We can always exempt particular files/folder where we

PSA: Avoid invoking Debug formatters in release-mode Rust

2018-01-12 Thread Bobby Holley
TL;DR: To prevent code bloat, avoid {:?} in format strings for panic!(), unreachable!(), error!(), warn!(), and info!() for Rust code that ships in Gecko. Longer version: One nice thing about Rust is that you can #[derive(Debug)] for a type, and the compiler will generate a stringification