File tree Expand file tree Collapse file tree 2 files changed +10
-10
lines changed
compiler/rustc_interface/src Expand file tree Collapse file tree 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<'_>) {
10081008pub ( crate ) fn start_codegen < ' tcx > (
10091009 codegen_backend : & dyn CodegenBackend ,
10101010 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+
10121019 // Hook for UI tests.
10131020 check_for_rustc_errors_attr ( tcx) ;
10141021
@@ -1034,7 +1041,7 @@ pub(crate) fn start_codegen<'tcx>(
10341041 }
10351042 }
10361043
1037- codegen
1044+ Ok ( codegen)
10381045}
10391046
10401047fn 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> {
126126
127127 pub fn codegen_and_build_linker ( & ' tcx self ) -> Result < Linker > {
128128 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) ?;
137130
138131 Ok ( Linker {
139132 dep_graph : tcx. dep_graph . clone ( ) ,
You can’t perform that action at this time.
0 commit comments