Skip to content

Commit 3828eea

Browse files
committed
Prepare for change to unary panic! rejecting fmt string literals.
1 parent af1c39c commit 3828eea

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/libcore/macros.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ macro_rules! panic {
5656
macro_rules! assert {
5757
($cond:expr) => (
5858
if !$cond {
59-
panic!(concat!("assertion failed: ", stringify!($cond)))
59+
const MSG: &'static str = concat!("assertion failed: ", stringify!($cond));
60+
panic!(MSG)
6061
}
6162
);
6263
($cond:expr, $($arg:tt)+) => (

src/libcoretest/nonzero.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,6 @@ fn test_match_option_string() {
9595
let five = "Five".to_string();
9696
match Some(five) {
9797
Some(s) => assert_eq!(s, "Five"),
98-
None => panic!("unexpected None while matching on Some(String { ... })")
98+
None => panic!("{}", "unexpected None while matching on Some(String { ... })")
9999
}
100100
}

0 commit comments

Comments
 (0)