55//! to be const-safe.
66
77use std:: convert:: TryFrom ;
8- use std:: fmt:: Write ;
8+ use std:: fmt:: { Display , Write } ;
99use std:: num:: NonZeroUsize ;
1010
1111use rustc_ast:: Mutability ;
@@ -311,7 +311,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, '
311311 fn read_immediate (
312312 & self ,
313313 op : & OpTy < ' tcx , M :: Provenance > ,
314- expected : & str ,
314+ expected : impl Display ,
315315 ) -> InterpResult < ' tcx , ImmTy < ' tcx , M :: Provenance > > {
316316 Ok ( try_validation ! (
317317 self . ecx. read_immediate( op) ,
@@ -323,7 +323,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, '
323323 fn read_scalar (
324324 & self ,
325325 op : & OpTy < ' tcx , M :: Provenance > ,
326- expected : & str ,
326+ expected : impl Display ,
327327 ) -> InterpResult < ' tcx , Scalar < M :: Provenance > > {
328328 Ok ( self . read_immediate ( op, expected) ?. to_scalar ( ) )
329329 }
@@ -368,7 +368,8 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, '
368368 value : & OpTy < ' tcx , M :: Provenance > ,
369369 kind : & str ,
370370 ) -> 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}" ) ) ?) ?;
372373 // Handle wide pointers.
373374 // Check metadata early, for better diagnostics
374375 if place. layout . is_unsized ( ) {
0 commit comments