Skip to content

panic! does not warn about failing to provide an argument #43257

Closed
@shepmaster

Description

@shepmaster

I expected panic! to behave like println! and warn me that I have a formatter argument that is unused. Tested with Rust 1.18.0.

println!

println!("{:p}"); 
error: invalid reference to argument `0` (no arguments given)
 --> src/main.rs:2:5
  |
2 |     println!("{:p}");
  |     ^^^^^^^^^^^^^^^^^
  |
  = note: this error originates in a macro outside of the current crate

panic!

panic!("{:p}");
thread 'main' panicked at '{:p}', src/main.rs:4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions