@@ -90,12 +90,9 @@ use build::{BlockAnd, BlockAndExtension, Builder, CFG, ScopeAuxiliary, ScopeId};
9090use  rustc:: middle:: region:: { CodeExtent ,  CodeExtentData } ; 
9191use  rustc:: middle:: lang_items; 
9292use  rustc:: ty:: subst:: { Substs ,  Subst ,  VecPerParamSpace } ; 
93- use  rustc:: ty:: { self ,   Ty ,  TyCtxt } ; 
93+ use  rustc:: ty:: { Ty ,  TyCtxt } ; 
9494use  rustc:: mir:: repr:: * ; 
95- use  syntax:: codemap:: { Span ,  DUMMY_SP } ; 
96- use  syntax:: parse:: token:: intern_and_get_ident; 
97- use  rustc:: middle:: const_val:: ConstVal ; 
98- use  rustc_const_math:: ConstInt ; 
95+ use  syntax:: codemap:: Span ; 
9996use  rustc_data_structures:: indexed_vec:: Idx ; 
10097
10198pub  struct  Scope < ' tcx >  { 
@@ -556,50 +553,6 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
556553        next_target. unit ( ) 
557554    } 
558555
559-     /// Create diverge cleanup and branch to it from `block`. 
560- // FIXME: Remove this (used only for unreachable cases in match). 
561-     pub  fn  panic ( & mut  self ,  block :  BasicBlock ,  msg :  & ' static  str ,  span :  Span )  { 
562-         // fn(&(msg: &'static str filename: &'static str, line: u32)) -> ! 
563-         let  region = ty:: ReStatic ;  // FIXME(mir-borrowck): use a better region? 
564-         let  func = self . lang_function ( lang_items:: PanicFnLangItem ) ; 
565-         let  args = self . hir . tcx ( ) . replace_late_bound_regions ( & func. ty . fn_args ( ) ,  |_| region) . 0 ; 
566- 
567-         let  ref_ty = args[ 0 ] ; 
568-         let  tup_ty = if  let  ty:: TyRef ( _,  tyandmut)  = ref_ty. sty  { 
569-             tyandmut. ty 
570-         }  else  { 
571-             span_bug ! ( span,  "unexpected panic type: {:?}" ,  func. ty) ; 
572-         } ; 
573- 
574-         let  ( tuple,  tuple_ref)  = ( self . temp ( tup_ty) ,  self . temp ( ref_ty) ) ; 
575-         let  ( file,  line)  = self . span_to_fileline_args ( span) ; 
576-         let  message = Constant  { 
577-             span :  span, 
578-             ty :  self . hir . tcx ( ) . mk_static_str ( ) , 
579-             literal :  self . hir . str_literal ( intern_and_get_ident ( msg) ) 
580-         } ; 
581-         let  elems = vec ! [ Operand :: Constant ( message) , 
582-                          Operand :: Constant ( file) , 
583-                          Operand :: Constant ( line) ] ; 
584-         let  source_info = self . source_info ( span) ; 
585-         // FIXME: We should have this as a constant, rather than a stack variable (to not pollute 
586-         // icache with cold branch code), however to achieve that we either have to rely on rvalue 
587-         // promotion or have some way, in MIR, to create constants. 
588-         self . cfg . push_assign ( block,  source_info,  & tuple,  // [1] 
589-                              Rvalue :: Aggregate ( AggregateKind :: Tuple ,  elems) ) ; 
590-         // [1] tuple = (message_arg, file_arg, line_arg); 
591-         // FIXME: is this region really correct here? 
592-         self . cfg . push_assign ( block,  source_info,  & tuple_ref,  // tuple_ref = &tuple; 
593-                              Rvalue :: Ref ( region,  BorrowKind :: Shared ,  tuple) ) ; 
594-         let  cleanup = self . diverge_cleanup ( ) ; 
595-         self . cfg . terminate ( block,  source_info,  TerminatorKind :: Call  { 
596-             func :  Operand :: Constant ( func) , 
597-             args :  vec ! [ Operand :: Consume ( tuple_ref) ] , 
598-             cleanup :  cleanup, 
599-             destination :  None , 
600-         } ) ; 
601-     } 
602- 
603556    /// Create an Assert terminator and return the success block. 
604557/// If the boolean condition operand is not the expected value, 
605558/// a runtime panic will be caused with the given message. 
@@ -625,39 +578,6 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
625578
626579        success_block
627580    } 
628- 
629-     fn  lang_function ( & mut  self ,  lang_item :  lang_items:: LangItem )  -> Constant < ' tcx >  { 
630-         let  funcdid = match  self . hir . tcx ( ) . lang_items . require ( lang_item)  { 
631-             Ok ( d)  => d, 
632-             Err ( m)  => { 
633-                 self . hir . tcx ( ) . sess . fatal ( & m) 
634-             } 
635-         } ; 
636-         Constant  { 
637-             span :  DUMMY_SP , 
638-             ty :  self . hir . tcx ( ) . lookup_item_type ( funcdid) . ty , 
639-             literal :  Literal :: Item  { 
640-                 def_id :  funcdid, 
641-                 substs :  self . hir . tcx ( ) . mk_substs ( Substs :: empty ( ) ) 
642-             } 
643-         } 
644-     } 
645- 
646-     fn  span_to_fileline_args ( & mut  self ,  span :  Span )  -> ( Constant < ' tcx > ,  Constant < ' tcx > )  { 
647-         let  span_lines = self . hir . tcx ( ) . sess . codemap ( ) . lookup_char_pos ( span. lo ) ; 
648-         ( Constant  { 
649-             span :  span, 
650-             ty :  self . hir . tcx ( ) . mk_static_str ( ) , 
651-             literal :  self . hir . str_literal ( intern_and_get_ident ( & span_lines. file . name ) ) 
652-         } ,  Constant  { 
653-             span :  span, 
654-             ty :  self . hir . tcx ( ) . types . u32 , 
655-             literal :  Literal :: Value  { 
656-                 value :  ConstVal :: Integral ( ConstInt :: U32 ( span_lines. line  as  u32 ) ) , 
657-             } , 
658-         } ) 
659-     } 
660- 
661581} 
662582
663583/// Builds drops for pop_scope and exit_scope. 
0 commit comments