Skip to content

non_fmt_panic warning on Rust 2015  #85674

Closed
@pravic

Description

@pravic

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions