1 // build-pass (FIXME(62277): should be check-pass)
2 // aux-build:fancy-panic.rs
4 extern crate fancy_panic;
6 const C: &str = "abc {}";
7 static S: &str = "{bla}";
9 #[allow(unreachable_code)]
11 panic!("here's a brace: {"); //~ WARN panic message contains a brace
12 std::panic!("another one: }"); //~ WARN panic message contains a brace
13 core::panic!("Hello {}"); //~ WARN panic message contains an unused formatting placeholder
14 assert!(false, "{:03x} {test} bla");
15 //~^ WARN panic message contains unused formatting placeholders
16 debug_assert!(false, "{{}} bla"); //~ WARN panic message contains braces
17 panic!(C); // No warning (yet)
18 panic!(S); // No warning (yet)
19 panic!(concat!("{", "}")); //~ WARN panic message contains an unused formatting placeholder
20 panic!(concat!("{", "{")); //~ WARN panic message contains braces
22 fancy_panic::fancy_panic!("test {} 123");
23 //~^ WARN panic message contains an unused formatting placeholder
25 // Check that the lint only triggers for std::panic and core::panic,
26 // not any panic macro: