-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.
Description
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
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
jonas-schievink commentedon May 25, 2021
This behavior matches the plan outlined in RFC 3007. Why do you think the the lint should not warn here?
pravic commentedon 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 commentedon Jun 15, 2021
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!