1- #[ unstable( feature = "macros_internals" , reason = "macros implementation detail" , issue = "none" ) ]
2- #[ doc( hidden) ]
3- pub mod internals;
4-
51#[ cfg( bootstrap) ]
62#[ doc( include = "panic.md" ) ]
73#[ macro_export]
@@ -57,16 +53,17 @@ macro_rules! panic {
5753/// ```
5854#[ macro_export]
5955#[ stable( feature = "rust1" , since = "1.0.0" ) ]
60- #[ allow_internal_unstable( macros_internals ) ]
56+ #[ allow_internal_unstable( core_panic ) ]
6157macro_rules! assert_eq {
6258 ( $left: expr, $right: expr $( , ) ?) => ( {
6359 match ( & $left, & $right) {
6460 ( left_val, right_val) => {
6561 if !( * left_val == * right_val) {
62+ let kind = $crate:: panicking:: AssertKind :: Eq ;
6663 // The reborrows below are intentional. Without them, the stack slot for the
6764 // borrow is initialized even before the values are compared, leading to a
6865 // noticeable slow down.
69- $crate:: macros_internals :: assert_failed( "==" , & * left_val, & * right_val, $crate:: option:: Option :: None ) ;
66+ $crate:: panicking :: assert_failed( kind , & * left_val, & * right_val, $crate:: option:: Option :: None ) ;
7067 }
7168 }
7269 }
@@ -75,10 +72,11 @@ macro_rules! assert_eq {
7572 match ( & $left, & $right) {
7673 ( left_val, right_val) => {
7774 if !( * left_val == * right_val) {
75+ let kind = $crate:: panicking:: AssertKind :: Eq ;
7876 // The reborrows below are intentional. Without them, the stack slot for the
7977 // borrow is initialized even before the values are compared, leading to a
8078 // noticeable slow down.
81- $crate:: macros_internals :: assert_failed( "==" , & * left_val, & * right_val, $crate:: option:: Option :: Some ( $crate:: format_args!( $( $arg) +) ) ) ;
79+ $crate:: panicking :: assert_failed( kind , & * left_val, & * right_val, $crate:: option:: Option :: Some ( $crate:: format_args!( $( $arg) +) ) ) ;
8280 }
8381 }
8482 }
@@ -104,16 +102,17 @@ macro_rules! assert_eq {
104102/// ```
105103#[ macro_export]
106104#[ stable( feature = "assert_ne" , since = "1.13.0" ) ]
107- #[ allow_internal_unstable( macros_internals ) ]
105+ #[ allow_internal_unstable( core_panic ) ]
108106macro_rules! assert_ne {
109107 ( $left: expr, $right: expr $( , ) ?) => ( {
110108 match ( & $left, & $right) {
111109 ( left_val, right_val) => {
112110 if * left_val == * right_val {
111+ let kind = $crate:: panicking:: AssertKind :: Ne ;
113112 // The reborrows below are intentional. Without them, the stack slot for the
114113 // borrow is initialized even before the values are compared, leading to a
115114 // noticeable slow down.
116- $crate:: macros_internals :: assert_failed( "!=" , & * left_val, & * right_val, $crate:: option:: Option :: None ) ;
115+ $crate:: panicking :: assert_failed( kind , & * left_val, & * right_val, $crate:: option:: Option :: None ) ;
117116 }
118117 }
119118 }
@@ -122,10 +121,11 @@ macro_rules! assert_ne {
122121 match ( & ( $left) , & ( $right) ) {
123122 ( left_val, right_val) => {
124123 if * left_val == * right_val {
124+ let kind = $crate:: panicking:: AssertKind :: Ne ;
125125 // The reborrows below are intentional. Without them, the stack slot for the
126126 // borrow is initialized even before the values are compared, leading to a
127127 // noticeable slow down.
128- $crate:: macros_internals :: assert_failed( "!=" , & * left_val, & * right_val, $crate:: option:: Option :: Some ( $crate:: format_args!( $( $arg) +) ) ) ;
128+ $crate:: panicking :: assert_failed( kind , & * left_val, & * right_val, $crate:: option:: Option :: Some ( $crate:: format_args!( $( $arg) +) ) ) ;
129129 }
130130 }
131131 }
0 commit comments