@@ -6,7 +6,6 @@ use either::Right;
66use rustc_const_eval:: const_eval:: CheckAlignment ;
77use rustc_const_eval:: InterpErrorExt ;
88use rustc_data_structures:: fx:: FxHashSet ;
9- use rustc_errors:: { DiagnosticMessage , IntoDiagnostic } ;
109use rustc_hir:: def:: DefKind ;
1110use rustc_index:: bit_set:: BitSet ;
1211use rustc_index:: { IndexSlice , IndexVec } ;
@@ -17,7 +16,6 @@ use rustc_middle::mir::*;
1716use rustc_middle:: ty:: layout:: { LayoutError , LayoutOf , LayoutOfHelpers , TyAndLayout } ;
1817use rustc_middle:: ty:: InternalSubsts ;
1918use rustc_middle:: ty:: { self , ConstKind , Instance , ParamEnv , Ty , TyCtxt , TypeVisitableExt } ;
20- use rustc_span:: sym:: DiagnosticMessage ;
2119use rustc_span:: { def_id:: DefId , Span , DUMMY_SP } ;
2220use rustc_target:: abi:: { self , Align , HasDataLayout , Size , TargetDataLayout } ;
2321use rustc_target:: spec:: abi:: Abi as CallAbi ;
@@ -388,17 +386,7 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
388386 op
389387 }
390388 Err ( e) => {
391- let msg = ty:: tls:: with ( move |tcx| {
392- let handler = & tcx. sess . parse_sess . span_diagnostic ;
393- let err = InterpErrorExt ( e. into_kind ( ) ) ;
394- let builder = err. into_diagnostic ( handler) ;
395- builder. cancel ( ) ;
396- "Should be diagnostic message"
397- } ) ;
398- trace ! (
399- "get_const failed: {:?}" ,
400- todo!( "find a way to convert diagnostic builder to string" )
401- ) ;
389+ trace ! ( "get_const failed: {}" , InterpErrorExt ( e. into_kind( ) ) . to_string( ) ) ;
402390 return None ;
403391 }
404392 } ;
0 commit comments