@@ -114,13 +114,18 @@ fn extract_error_codes(
114
114
. expect ( "failed to canonicalize error explanation file path" ) ;
115
115
match read_to_string ( & path) {
116
116
Ok ( content) => {
117
- if !IGNORE_EXPLANATION_CHECK . contains ( & err_code. as_str ( ) )
118
- && !check_if_error_code_is_test_in_explanation ( & content, & err_code)
119
- {
117
+ let has_test = check_if_error_code_is_test_in_explanation ( & content, & err_code) ;
118
+ if !has_test && !IGNORE_EXPLANATION_CHECK . contains ( & err_code. as_str ( ) ) {
120
119
errors. push ( format ! (
121
120
"`{}` doesn't use its own error code in compile_fail example" ,
122
121
path. display( ) ,
123
122
) ) ;
123
+ } else if has_test && IGNORE_EXPLANATION_CHECK . contains ( & err_code. as_str ( ) ) {
124
+ errors. push ( format ! (
125
+ "`{}` has a compile_fail example with its own error code, it shouldn't \
126
+ be listed in IGNORE_EXPLANATION_CHECK!",
127
+ path. display( ) ,
128
+ ) ) ;
124
129
}
125
130
if check_error_code_explanation ( & content, error_codes, err_code) {
126
131
errors. push ( format ! (
@@ -198,6 +203,11 @@ pub fn check(paths: &[&Path], bad: &mut bool) {
198
203
for ( err_code, nb) in & error_codes {
199
204
if !* nb && !EXEMPTED_FROM_TEST . contains ( & err_code. as_str ( ) ) {
200
205
errors. push ( format ! ( "Error code {} needs to have at least one UI test!" , err_code) ) ;
206
+ } else if * nb && EXEMPTED_FROM_TEST . contains ( & err_code. as_str ( ) ) {
207
+ errors. push ( format ! (
208
+ "Error code {} has a UI test, it shouldn't be listed into EXEMPTED_FROM_TEST!" ,
209
+ err_code
210
+ ) ) ;
201
211
}
202
212
}
203
213
}
0 commit comments