File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
src/librustc_mir/interpret Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -179,12 +179,16 @@ impl<'tcx> super::Machine<'tcx> for CompileTimeFunctionEvaluator {
179179 fn ptr_op < ' a > (
180180 _ecx : & EvalContext < ' a , ' tcx , Self > ,
181181 _bin_op : mir:: BinOp ,
182- _left : PrimVal ,
182+ left : PrimVal ,
183183 _left_ty : Ty < ' tcx > ,
184- _right : PrimVal ,
184+ right : PrimVal ,
185185 _right_ty : Ty < ' tcx > ,
186186 ) -> EvalResult < ' tcx , Option < ( PrimVal , bool ) > > {
187- Err ( ConstEvalError :: NeedsRfc ( "Pointer arithmetic or comparison" . to_string ( ) ) . into ( ) )
187+ if left. is_bytes ( ) && right. is_bytes ( ) {
188+ Ok ( None )
189+ } else {
190+ Err ( ConstEvalError :: NeedsRfc ( "Pointer arithmetic or comparison" . to_string ( ) ) . into ( ) )
191+ }
188192 }
189193
190194 fn mark_static_initialized ( m : !) -> EvalResult < ' tcx > {
You can’t perform that action at this time.
0 commit comments