File tree 2 files changed +10
-10
lines changed
compiler/rustc_interface/src
2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -1008,7 +1008,14 @@ fn check_for_rustc_errors_attr(tcx: TyCtxt<'_>) {
1008
1008
pub ( crate ) fn start_codegen < ' tcx > (
1009
1009
codegen_backend : & dyn CodegenBackend ,
1010
1010
tcx : TyCtxt < ' tcx > ,
1011
- ) -> Box < dyn Any > {
1011
+ ) -> Result < Box < dyn Any > > {
1012
+ // Don't do code generation if there were any errors. Likewise if
1013
+ // there were any delayed bugs, because codegen will likely cause
1014
+ // more ICEs, obscuring the original problem.
1015
+ if let Some ( guar) = tcx. sess . dcx ( ) . has_errors_or_delayed_bugs ( ) {
1016
+ return Err ( guar) ;
1017
+ }
1018
+
1012
1019
// Hook for UI tests.
1013
1020
check_for_rustc_errors_attr ( tcx) ;
1014
1021
@@ -1034,7 +1041,7 @@ pub(crate) fn start_codegen<'tcx>(
1034
1041
}
1035
1042
}
1036
1043
1037
- codegen
1044
+ Ok ( codegen)
1038
1045
}
1039
1046
1040
1047
fn get_recursion_limit ( krate_attrs : & [ ast:: Attribute ] , sess : & Session ) -> Limit {
Original file line number Diff line number Diff line change @@ -126,14 +126,7 @@ impl<'tcx> Queries<'tcx> {
126
126
127
127
pub fn codegen_and_build_linker ( & ' tcx self ) -> Result < Linker > {
128
128
self . global_ctxt ( ) ?. enter ( |tcx| {
129
- // Don't do code generation if there were any errors. Likewise if
130
- // there were any delayed bugs, because codegen will likely cause
131
- // more ICEs, obscuring the original problem.
132
- if let Some ( guar) = self . compiler . sess . dcx ( ) . has_errors_or_delayed_bugs ( ) {
133
- return Err ( guar) ;
134
- }
135
-
136
- let ongoing_codegen = passes:: start_codegen ( & * self . compiler . codegen_backend , tcx) ;
129
+ let ongoing_codegen = passes:: start_codegen ( & * self . compiler . codegen_backend , tcx) ?;
137
130
138
131
Ok ( Linker {
139
132
dep_graph : tcx. dep_graph . clone ( ) ,
You can’t perform that action at this time.
0 commit comments