1
- #[ unstable( feature = "macros_internals" , reason = "macros implementation detail" , issue = "none" ) ]
2
- #[ doc( hidden) ]
3
- pub mod internals;
4
-
5
1
#[ cfg( bootstrap) ]
6
2
#[ doc( include = "panic.md" ) ]
7
3
#[ macro_export]
@@ -57,16 +53,17 @@ macro_rules! panic {
57
53
/// ```
58
54
#[ macro_export]
59
55
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
60
- #[ allow_internal_unstable( macros_internals ) ]
56
+ #[ allow_internal_unstable( core_panic ) ]
61
57
macro_rules! assert_eq {
62
58
( $left: expr, $right: expr $( , ) ?) => ( {
63
59
match ( & $left, & $right) {
64
60
( left_val, right_val) => {
65
61
if !( * left_val == * right_val) {
62
+ let kind = $crate:: panicking:: AssertKind :: Eq ;
66
63
// The reborrows below are intentional. Without them, the stack slot for the
67
64
// borrow is initialized even before the values are compared, leading to a
68
65
// 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 ) ;
70
67
}
71
68
}
72
69
}
@@ -75,10 +72,11 @@ macro_rules! assert_eq {
75
72
match ( & $left, & $right) {
76
73
( left_val, right_val) => {
77
74
if !( * left_val == * right_val) {
75
+ let kind = $crate:: panicking:: AssertKind :: Eq ;
78
76
// The reborrows below are intentional. Without them, the stack slot for the
79
77
// borrow is initialized even before the values are compared, leading to a
80
78
// 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) +) ) ) ;
82
80
}
83
81
}
84
82
}
@@ -104,16 +102,17 @@ macro_rules! assert_eq {
104
102
/// ```
105
103
#[ macro_export]
106
104
#[ stable( feature = "assert_ne" , since = "1.13.0" ) ]
107
- #[ allow_internal_unstable( macros_internals ) ]
105
+ #[ allow_internal_unstable( core_panic ) ]
108
106
macro_rules! assert_ne {
109
107
( $left: expr, $right: expr $( , ) ?) => ( {
110
108
match ( & $left, & $right) {
111
109
( left_val, right_val) => {
112
110
if * left_val == * right_val {
111
+ let kind = $crate:: panicking:: AssertKind :: Ne ;
113
112
// The reborrows below are intentional. Without them, the stack slot for the
114
113
// borrow is initialized even before the values are compared, leading to a
115
114
// 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 ) ;
117
116
}
118
117
}
119
118
}
@@ -122,10 +121,11 @@ macro_rules! assert_ne {
122
121
match ( & ( $left) , & ( $right) ) {
123
122
( left_val, right_val) => {
124
123
if * left_val == * right_val {
124
+ let kind = $crate:: panicking:: AssertKind :: Ne ;
125
125
// The reborrows below are intentional. Without them, the stack slot for the
126
126
// borrow is initialized even before the values are compared, leading to a
127
127
// 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) +) ) ) ;
129
129
}
130
130
}
131
131
}
0 commit comments