11use rustc_hir:: def_id:: { DefId , LOCAL_CRATE } ;
22use rustc_hir:: def:: CtorKind ;
33use rustc_hir:: Mutability ;
4- use rustc_middle:: mir:: { BinOp , Body , CastKind , interpret, NullOp , UnOp } ;
4+ use rustc_middle:: mir:: { AssertMessage , BasicBlock , BinOp , Body , CastKind , interpret, NullOp , UnOp } ;
55use rustc_middle:: ty:: { self , DynKind , FloatTy , IntTy , TyCtxt , UintTy } ;
66use rustc_session:: Session ;
77use rustc_span:: Span ;
@@ -10,6 +10,7 @@ use rustc_target::spec::abi::Abi;
1010use serde_json;
1111use std:: collections:: BTreeMap ;
1212use std:: collections:: { HashMap , HashSet , hash_map} ;
13+ use std:: fmt:: Write ;
1314use std:: hash:: { Hash , Hasher } ;
1415use std:: ops:: Deref ;
1516use std:: mem;
@@ -400,28 +401,23 @@ impl<'tcx, K, V> ToJson<'tcx> for BTreeMap<K, V>
400401 }
401402}
402403
403- #[ macro_export]
404- macro_rules! basic_json_impl {
405- ( $n : path) => {
406- impl ToJson <' _> for $n {
407- fn to_json( & self , _ : & mut MirState ) -> serde_json:: Value {
404+ impl < ' a > ToJson < ' _ > for AssertMessage < ' a > {
405+ fn to_json ( & self , _: & mut MirState ) -> serde_json:: Value {
408406 let mut s = String :: new ( ) ;
409407 write ! ( & mut s, "{:?}" , self ) . unwrap ( ) ;
410408 json ! ( s)
411409 }
412410}
413- } ;
414- ( $n : path, $lt : tt) => {
415- impl <$lt> ToJson <' _> for $n {
416- fn to_json( & self , _ : & mut MirState ) -> serde_json:: Value {
411+
412+ impl ToJson < ' _ > for BasicBlock {
413+ fn to_json ( & self , _: & mut MirState ) -> serde_json:: Value {
417414 let mut s = String :: new ( ) ;
418415 write ! ( & mut s, "{:?}" , self ) . unwrap ( ) ;
419416 json ! ( s)
420417 }
421418}
422419
423- } ;
424- }
420+ // enum handlers
425421
426422impl ToJson < ' _ > for Abi {
427423 fn to_json ( & self , _: & mut MirState ) -> serde_json:: Value {
@@ -562,6 +558,8 @@ impl ToJson<'_> for UintTy {
562558 }
563559}
564560
561+ // end enum handlers
562+
565563impl ToJson < ' _ > for UnOp {
566564 fn to_json ( & self , _: & mut MirState ) -> serde_json:: Value {
567565 match self {
0 commit comments