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. The issue here is tha

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

2018-01-13 Thread Xidorn Quan
On Sun, Jan 14, 2018, at 1: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. We could also just not derive them in > release mode. > > In the PR you link, AFAICT you also removed some uses that were just > very smal

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

2018-01-13 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 t

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

2018-01-13 Thread Anthony Ramine
I would much rather prefer if we just checked that we didn't use the Debug impls of large types. We could also just not derive them in release mode. In the PR you link, AFAICT you also removed some uses that were just very small enums or even integers, which may not be necessary. > Le 13 janv.

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 thin

[dev-servo] 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 method