diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs index 91ee064aaba6a..7975b16c408b7 100644 --- a/src/libcore/macros.rs +++ b/src/libcore/macros.rs @@ -116,8 +116,9 @@ macro_rules! assert_eq { match (&$left, &$right) { (left_val, right_val) => { if !(*left_val == *right_val) { - panic!("assertion failed: `(left == right)` \ - (left: `{:?}`, right: `{:?}`)", left_val, right_val) + panic!(r#"assertion failed: `(left == right)` + left: `{:?}`, + right: `{:?}`"#, left_val, right_val) } } } @@ -126,8 +127,9 @@ macro_rules! assert_eq { match (&($left), &($right)) { (left_val, right_val) => { if !(*left_val == *right_val) { - panic!("assertion failed: `(left == right)` \ - (left: `{:?}`, right: `{:?}`): {}", left_val, right_val, + panic!(r#"assertion failed: `(left == right)` + left: `{:?}`, + right: `{:?}`: {}"#, left_val, right_val, format_args!($($arg)+)) } } @@ -162,8 +164,9 @@ macro_rules! assert_ne { match (&$left, &$right) { (left_val, right_val) => { if *left_val == *right_val { - panic!("assertion failed: `(left != right)` \ - (left: `{:?}`, right: `{:?}`)", left_val, right_val) + panic!(r#"assertion failed: `(left != right)` + left: `{:?}`, + right: `{:?}`"#, left_val, right_val) } } } @@ -172,8 +175,9 @@ macro_rules! assert_ne { match (&($left), &($right)) { (left_val, right_val) => { if *left_val == *right_val { - panic!("assertion failed: `(left != right)` \ - (left: `{:?}`, right: `{:?}`): {}", left_val, right_val, + panic!(r#"assertion failed: `(left != right)` + left: `{:?}`, + right: `{:?}`: {}"#, left_val, right_val, format_args!($($arg)+)) } } diff --git a/src/test/run-fail/assert-eq-macro-panic.rs b/src/test/run-fail/assert-eq-macro-panic.rs index a3e0a1f904faa..fed2ee0beab29 100644 --- a/src/test/run-fail/assert-eq-macro-panic.rs +++ b/src/test/run-fail/assert-eq-macro-panic.rs @@ -8,7 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// error-pattern:assertion failed: `(left == right)` (left: `14`, right: `15`) +// error-pattern:assertion failed: `(left == right)` +// error-pattern: left: `14` +// error-pattern:right: `15` fn main() { assert_eq!(14, 15); diff --git a/src/test/run-fail/assert-ne-macro-panic.rs b/src/test/run-fail/assert-ne-macro-panic.rs new file mode 100644 index 0000000000000..d57bb0fb67fb0 --- /dev/null +++ b/src/test/run-fail/assert-ne-macro-panic.rs @@ -0,0 +1,17 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// error-pattern:assertion failed: `(left != right)` +// error-pattern: left: `14` +// error-pattern:right: `14` + +fn main() { + assert_ne!(14, 14); +} diff --git a/src/tools/cargo b/src/tools/cargo index 50b1c24d146fa..534ce68621ce4 160000 --- a/src/tools/cargo +++ b/src/tools/cargo @@ -1 +1 @@ -Subproject commit 50b1c24d146fa072db71f12005deed319ac5ba9a +Subproject commit 534ce68621ce4feec0b7e8627cfd3b077d4f3900