-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regression in the Debug formatter #47619
Comments
euclid and expecttest are also affected (but euclid now it's fixed on master). cc @zummenix |
We make zero guarantees as to what Debug implementations look like. |
I'm fine with this, I'll change my tests =) |
I'll change my tests too. @pietroalbini thanks for cc me! |
postgis is also affected. cc @andelf @pka |
Thanks for the heads up! If you want to restore "consistent" behaviour across old and future rust versions, you can just replace print!("{:?}", 0.0); // stable: "0", nightly "0.0"
print!("{:.0?}", 0.0); // stable: "0", nightly "0"
print!("{:.1?}", 0.0); // stable: "0.0", nightly "0.0" |
Shall there be a [clippy] lint against using Debug output for |
This also affects spectral (crater log). cc @cfrancia |
Yes, it's foolish to depend on exact |
Closing as not a bug; we do not expect to make any changes here. |
Workaround for rust-lang/rust#47619
Broke the tests in the turtle crate too. Any of our tests using #[test]
#[should_panic(expected = "Invalid color: Color { red: NaN, green: 0, blue: 0, alpha: 0 }. See the color module documentation for more information.")]
fn rejects_invalid_background_color() {
// ...
} Not a huge deal this time because there were just a few tests like that, but this really shouldn't be taken lightly either. Any breaking change, no matter how small for you can be really frustrating for someone else who doesn't see it coming.
In this case, for
I'm fine with this, because it makes sense to me too, but as I said earlier I don't think any breaking change should be taken too lightly just because no explicit guarantees have been made. It's clear from this issue that a lot of people were relying on that being a certain way. |
The
Debug
formatter output was recently changed in #30967 to always include a decimal point, and apparently some crates' test suites depends on the exact output of the formatter. I don't know if it's worth to revert the change, but I reported it just in case.cc @dtolnay @Luthaf @rodolf0
The text was updated successfully, but these errors were encountered: