1- use crate :: errors:: { FailedWritingFile , RustcErrorFatal , RustcErrorUnexpectedAnnotation } ;
1+ use crate :: errors:: FailedWritingFile ;
22use crate :: interface:: { Compiler , Result } ;
33use crate :: { errors, passes} ;
44
@@ -15,7 +15,6 @@ use rustc_middle::ty::{GlobalCtxt, TyCtxt};
1515use rustc_serialize:: opaque:: FileEncodeResult ;
1616use rustc_session:: config:: { self , OutputFilenames , OutputType } ;
1717use rustc_session:: Session ;
18- use rustc_span:: symbol:: sym;
1918use std:: any:: Any ;
2019use std:: cell:: { RefCell , RefMut } ;
2120use std:: sync:: Arc ;
@@ -125,39 +124,6 @@ impl<'tcx> Queries<'tcx> {
125124 Ok ( ( ) )
126125 }
127126
128- /// Check for the `#[rustc_error]` annotation, which forces an error in codegen. This is used
129- /// to write UI tests that actually test that compilation succeeds without reporting
130- /// an error.
131- fn check_for_rustc_errors_attr ( tcx : TyCtxt < ' _ > ) {
132- let Some ( ( def_id, _) ) = tcx. entry_fn ( ( ) ) else { return } ;
133- for attr in tcx. get_attrs ( def_id, sym:: rustc_error) {
134- match attr. meta_item_list ( ) {
135- // Check if there is a `#[rustc_error(delayed_bug_from_inside_query)]`.
136- Some ( list)
137- if list. iter ( ) . any ( |list_item| {
138- matches ! (
139- list_item. ident( ) . map( |i| i. name) ,
140- Some ( sym:: delayed_bug_from_inside_query)
141- )
142- } ) =>
143- {
144- tcx. ensure ( ) . trigger_delayed_bug ( def_id) ;
145- }
146-
147- // Bare `#[rustc_error]`.
148- None => {
149- tcx. dcx ( ) . emit_fatal ( RustcErrorFatal { span : tcx. def_span ( def_id) } ) ;
150- }
151-
152- // Some other attribute.
153- Some ( _) => {
154- tcx. dcx ( )
155- . emit_warn ( RustcErrorUnexpectedAnnotation { span : tcx. def_span ( def_id) } ) ;
156- }
157- }
158- }
159- }
160-
161127 pub fn codegen_and_build_linker ( & ' tcx self ) -> Result < Linker > {
162128 self . global_ctxt ( ) ?. enter ( |tcx| {
163129 // Don't do code generation if there were any errors. Likewise if
@@ -167,9 +133,6 @@ impl<'tcx> Queries<'tcx> {
167133 return Err ( guar) ;
168134 }
169135
170- // Hook for UI tests.
171- Self :: check_for_rustc_errors_attr ( tcx) ;
172-
173136 let ongoing_codegen = passes:: start_codegen ( & * self . compiler . codegen_backend , tcx) ;
174137
175138 Ok ( Linker {
0 commit comments