1
- use crate :: errors:: { FailedWritingFile , RustcErrorFatal , RustcErrorUnexpectedAnnotation } ;
1
+ use crate :: errors:: FailedWritingFile ;
2
2
use crate :: interface:: { Compiler , Result } ;
3
3
use crate :: { errors, passes} ;
4
4
@@ -15,7 +15,6 @@ use rustc_middle::ty::{GlobalCtxt, TyCtxt};
15
15
use rustc_serialize:: opaque:: FileEncodeResult ;
16
16
use rustc_session:: config:: { self , OutputFilenames , OutputType } ;
17
17
use rustc_session:: Session ;
18
- use rustc_span:: symbol:: sym;
19
18
use std:: any:: Any ;
20
19
use std:: cell:: { RefCell , RefMut } ;
21
20
use std:: sync:: Arc ;
@@ -125,39 +124,6 @@ impl<'tcx> Queries<'tcx> {
125
124
Ok ( ( ) )
126
125
}
127
126
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
-
161
127
pub fn codegen_and_build_linker ( & ' tcx self ) -> Result < Linker > {
162
128
self . global_ctxt ( ) ?. enter ( |tcx| {
163
129
// Don't do code generation if there were any errors. Likewise if
@@ -167,9 +133,6 @@ impl<'tcx> Queries<'tcx> {
167
133
return Err ( guar) ;
168
134
}
169
135
170
- // Hook for UI tests.
171
- Self :: check_for_rustc_errors_attr ( tcx) ;
172
-
173
136
let ongoing_codegen = passes:: start_codegen ( & * self . compiler . codegen_backend , tcx) ;
174
137
175
138
Ok ( Linker {
0 commit comments