Skip to content
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

non_fmt_panic warning on Rust 2015 #85674

Closed
pravic opened this issue May 25, 2021 · 3 comments
Closed

non_fmt_panic warning on Rust 2015 #85674

pravic opened this issue May 25, 2021 · 3 comments
Labels
C-bug Category: This is a bug.

Comments

@pravic
Copy link
Contributor

pravic commented May 25, 2021

I tried this code:

[package]
# ...
edition = "2015"
let message = "message";
panic!(message);

I expected to see this happen: No warnings when compiling Rust 2015.

Instead, this happened:

   |
25 |             panic!(message);
   |                    ^^^^^^^
   |
   = note: `#[warn(non_fmt_panic)]` on by default
   = note: this is no longer accepted in Rust 2021
help: add a "{}" format string to Display the message
   |
25 |             panic!("{}", message);
   |                    ^^^^^
help: or use std::panic::panic_any instead
   |
25 |             std::panic::panic_any(message);
   |             ^^^^^^^^^^^^^^^^^^^^^

warning: 1 warning emitted

Meta

rustc --version --verbose:

rustc 1.52.1 (9bc8c42bb 2021-05-09)
binary: rustc
commit-hash: 9bc8c42bb2f19e745a63f3445f1ac248fb015e53
commit-date: 2021-05-09
host: x86_64-pc-windows-msvc
release: 1.52.1
LLVM version: 12.0.0

cc #80162. #81645

@pravic pravic added the C-bug Category: This is a bug. label May 25, 2021
@jonas-schievink
Copy link
Contributor

This behavior matches the plan outlined in RFC 3007. Why do you think the the lint should not warn here?

@pravic
Copy link
Contributor Author

pravic commented May 25, 2021

Because we explicitly set the 2015 edition and won't be switching to a higher one. Why would our code break with a future compiler update?

@JohnTitor
Copy link
Member

We don't have a way to know whether the users consider switching the edition or not. This warning is for users considering it and if you don't, you can simply ignore/suppress it. I'm going to close as it works as intended, thanks for reporting anyway!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

3 participants