@@ -51,14 +51,12 @@ use std::iter;
5151use std:: path:: { Path , PathBuf } ;
5252use std:: rc:: Rc ;
5353use std:: sync:: mpsc;
54- use syntax:: { ast, diagnostics, visit} ;
55- use syntax:: attr;
54+ use syntax:: { self , ast, attr, diagnostics, visit} ;
5655use syntax:: ext:: base:: ExtCtxt ;
5756use syntax:: fold:: Folder ;
5857use syntax:: parse:: { self , PResult } ;
5958use syntax:: util:: node_count:: NodeCounter ;
6059use syntax_pos:: FileName ;
61- use syntax;
6260use syntax_ext;
6361
6462use derive_registrar;
@@ -274,10 +272,6 @@ pub fn compile_input(trans: Box<TransCrate>,
274272 Ok ( ( ) )
275273}
276274
277- fn keep_hygiene_data ( sess : & Session ) -> bool {
278- sess. opts . debugging_opts . keep_hygiene_data
279- }
280-
281275pub fn source_name ( input : & Input ) -> FileName {
282276 match * input {
283277 Input :: File ( ref ifile) => ifile. clone ( ) . into ( ) ,
@@ -851,7 +845,7 @@ pub fn phase_2_configure_and_expand<F>(sess: &Session,
851845 || lint:: check_ast_crate ( sess, & krate) ) ;
852846
853847 // Discard hygiene data, which isn't required after lowering to HIR.
854- if !keep_hygiene_data ( sess) {
848+ if !sess. opts . debugging_opts . keep_hygiene_data {
855849 syntax:: ext:: hygiene:: clear_markings ( ) ;
856850 }
857851
@@ -915,18 +909,6 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(trans: &TransCrate,
915909 mpsc:: Receiver < Box < Any + Send > > ,
916910 CompileResult ) -> R
917911{
918- macro_rules! try_with_f {
919- ( $e: expr, ( $( $t: tt) * ) ) => {
920- match $e {
921- Ok ( x) => x,
922- Err ( x) => {
923- f( $( $t) * , Err ( x) ) ;
924- return Err ( x) ;
925- }
926- }
927- }
928- }
929-
930912 let time_passes = sess. time_passes ( ) ;
931913
932914 let query_result_on_disk_cache = time ( time_passes,
@@ -987,7 +969,13 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(trans: &TransCrate,
987969 || stability:: check_unstable_api_usage ( tcx) ) ;
988970
989971 // passes are timed inside typeck
990- try_with_f ! ( typeck:: check_crate( tcx) , ( tcx, analysis, rx) ) ;
972+ match typeck:: check_crate ( tcx) {
973+ Ok ( x) => x,
974+ Err ( x) => {
975+ f ( tcx, analysis, rx, Err ( x) ) ;
976+ return Err ( x) ;
977+ }
978+ }
991979
992980 time ( time_passes,
993981 "const checking" ,
0 commit comments