File tree 2 files changed +27
-0
lines changed
2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -155,6 +155,14 @@ macro_rules! __parse_ensure {
155
155
$crate:: __parse_ensure!( 0 $stack $bail ( $( $fuel) * ) { ( $( $buf) * $and $mut) $( $parse) * } ( $( $rest) * ) $( $rest) * )
156
156
} ;
157
157
158
+ ( 0 $stack: tt $bail: tt ( ~$( $fuel: tt) * ) { ( $( $buf: tt) * ) $( $parse: tt) * } ( $and: tt $raw: tt $mut: tt $( $dup: tt) * ) & raw mut $( $rest: tt) * ) => {
159
+ $crate:: __parse_ensure!( 0 $stack $bail ( $( $fuel) * ) { ( $( $buf) * $and $raw $mut) $( $parse) * } ( $( $rest) * ) $( $rest) * )
160
+ } ;
161
+
162
+ ( 0 $stack: tt $bail: tt ( ~$( $fuel: tt) * ) { ( $( $buf: tt) * ) $( $parse: tt) * } ( $and: tt $raw: tt $const: tt $( $dup: tt) * ) & raw const $( $rest: tt) * ) => {
163
+ $crate:: __parse_ensure!( 0 $stack $bail ( $( $fuel) * ) { ( $( $buf) * $and $raw $const) $( $parse) * } ( $( $rest) * ) $( $rest) * )
164
+ } ;
165
+
158
166
( 0 $stack: tt $bail: tt ( ~$( $fuel: tt) * ) { ( $( $buf: tt) * ) $( $parse: tt) * } ( $and: tt $( $dup: tt) * ) & $( $rest: tt) * ) => {
159
167
$crate:: __parse_ensure!( 0 $stack $bail ( $( $fuel) * ) { ( $( $buf) * $and) $( $parse) * } ( $( $rest) * ) $( $rest) * )
160
168
} ;
@@ -163,6 +171,14 @@ macro_rules! __parse_ensure {
163
171
$crate:: __parse_ensure!( 0 $stack $bail ( $( $fuel) * ) { ( $( $buf) * $andand $mut) $( $parse) * } ( $( $rest) * ) $( $rest) * )
164
172
} ;
165
173
174
+ ( 0 $stack: tt $bail: tt ( ~$( $fuel: tt) * ) { ( $( $buf: tt) * ) $( $parse: tt) * } ( $andand: tt $raw: tt $mut: tt $( $dup: tt) * ) &&raw mut $( $rest: tt) * ) => {
175
+ $crate:: __parse_ensure!( 0 $stack $bail ( $( $fuel) * ) { ( $( $buf) * $andand $raw $mut) $( $parse) * } ( $( $rest) * ) $( $rest) * )
176
+ } ;
177
+
178
+ ( 0 $stack: tt $bail: tt ( ~$( $fuel: tt) * ) { ( $( $buf: tt) * ) $( $parse: tt) * } ( $andand: tt $raw: tt $const: tt $( $dup: tt) * ) &&raw const $( $rest: tt) * ) => {
179
+ $crate:: __parse_ensure!( 0 $stack $bail ( $( $fuel) * ) { ( $( $buf) * $andand $raw $const) $( $parse) * } ( $( $rest) * ) $( $rest) * )
180
+ } ;
181
+
166
182
( 0 $stack: tt $bail: tt ( ~$( $fuel: tt) * ) { ( $( $buf: tt) * ) $( $parse: tt) * } ( $andand: tt $( $dup: tt) * ) && $( $rest: tt) * ) => {
167
183
$crate:: __parse_ensure!( 0 $stack $bail ( $( $fuel) * ) { ( $( $buf) * $andand) $( $parse) * } ( $( $rest) * ) $( $rest) * )
168
184
} ;
Original file line number Diff line number Diff line change @@ -186,6 +186,17 @@ fn test_unary() {
186
186
assert_err ( test, "Condition failed: `&mut x == *&&mut &2` (1 vs 2)" ) ;
187
187
}
188
188
189
+ #[ rustversion:: since( 1.82 ) ]
190
+ #[ test]
191
+ fn test_raw_addr ( ) {
192
+ let mut x = 1 ;
193
+ let test = || Ok ( ensure ! ( S + & raw const x != S + & raw mut x) ) ;
194
+ assert_err (
195
+ test,
196
+ "Condition failed: `S + &raw const x != S + &raw mut x` (false vs false)" ,
197
+ ) ;
198
+ }
199
+
189
200
#[ test]
190
201
fn test_if ( ) {
191
202
#[ rustfmt:: skip]
You can’t perform that action at this time.
0 commit comments