@@ -51,14 +51,12 @@ use std::iter;
51
51
use std:: path:: { Path , PathBuf } ;
52
52
use std:: rc:: Rc ;
53
53
use std:: sync:: mpsc;
54
- use syntax:: { ast, diagnostics, visit} ;
55
- use syntax:: attr;
54
+ use syntax:: { self , ast, attr, diagnostics, visit} ;
56
55
use syntax:: ext:: base:: ExtCtxt ;
57
56
use syntax:: fold:: Folder ;
58
57
use syntax:: parse:: { self , PResult } ;
59
58
use syntax:: util:: node_count:: NodeCounter ;
60
59
use syntax_pos:: FileName ;
61
- use syntax;
62
60
use syntax_ext;
63
61
64
62
use derive_registrar;
@@ -274,10 +272,6 @@ pub fn compile_input(trans: Box<TransCrate>,
274
272
Ok ( ( ) )
275
273
}
276
274
277
- fn keep_hygiene_data ( sess : & Session ) -> bool {
278
- sess. opts . debugging_opts . keep_hygiene_data
279
- }
280
-
281
275
pub fn source_name ( input : & Input ) -> FileName {
282
276
match * input {
283
277
Input :: File ( ref ifile) => ifile. clone ( ) . into ( ) ,
@@ -851,7 +845,7 @@ pub fn phase_2_configure_and_expand<F>(sess: &Session,
851
845
|| lint:: check_ast_crate ( sess, & krate) ) ;
852
846
853
847
// 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 {
855
849
syntax:: ext:: hygiene:: clear_markings ( ) ;
856
850
}
857
851
@@ -915,18 +909,6 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(trans: &TransCrate,
915
909
mpsc:: Receiver < Box < Any + Send > > ,
916
910
CompileResult ) -> R
917
911
{
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
-
930
912
let time_passes = sess. time_passes ( ) ;
931
913
932
914
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,
987
969
|| stability:: check_unstable_api_usage ( tcx) ) ;
988
970
989
971
// 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
+ }
991
979
992
980
time ( time_passes,
993
981
"const checking" ,
0 commit comments