5
5
//! to be const-safe.
6
6
7
7
use std:: convert:: TryFrom ;
8
- use std:: fmt:: Write ;
8
+ use std:: fmt:: { Display , Write } ;
9
9
use std:: num:: NonZeroUsize ;
10
10
11
11
use rustc_ast:: Mutability ;
@@ -311,7 +311,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, '
311
311
fn read_immediate (
312
312
& self ,
313
313
op : & OpTy < ' tcx , M :: Provenance > ,
314
- expected : & str ,
314
+ expected : impl Display ,
315
315
) -> InterpResult < ' tcx , ImmTy < ' tcx , M :: Provenance > > {
316
316
Ok ( try_validation ! (
317
317
self . ecx. read_immediate( op) ,
@@ -323,7 +323,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, '
323
323
fn read_scalar (
324
324
& self ,
325
325
op : & OpTy < ' tcx , M :: Provenance > ,
326
- expected : & str ,
326
+ expected : impl Display ,
327
327
) -> InterpResult < ' tcx , Scalar < M :: Provenance > > {
328
328
Ok ( self . read_immediate ( op, expected) ?. to_scalar ( ) )
329
329
}
@@ -368,7 +368,8 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, '
368
368
value : & OpTy < ' tcx , M :: Provenance > ,
369
369
kind : & str ,
370
370
) -> InterpResult < ' tcx > {
371
- let place = self . ecx . ref_to_mplace ( & self . read_immediate ( value, & format ! ( "a {kind}" ) ) ?) ?;
371
+ let place =
372
+ self . ecx . ref_to_mplace ( & self . read_immediate ( value, format_args ! ( "a {kind}" ) ) ?) ?;
372
373
// Handle wide pointers.
373
374
// Check metadata early, for better diagnostics
374
375
if place. layout . is_unsized ( ) {
0 commit comments