@@ -30,7 +30,6 @@ use std::iter::FromIterator;
30
30
use std:: vec:: Vec ;
31
31
32
32
const EXCEPT : Symbol = sym:: except;
33
- const LABEL : Symbol = sym:: label;
34
33
const CFG : Symbol = sym:: cfg;
35
34
36
35
// Base and Extra labels to build up the labels
@@ -122,16 +121,6 @@ struct Assertion {
122
121
dirty : Labels ,
123
122
}
124
123
125
- impl Assertion {
126
- fn from_clean_labels ( labels : Labels ) -> Assertion {
127
- Assertion { clean : labels, dirty : Labels :: default ( ) }
128
- }
129
-
130
- fn from_dirty_labels ( labels : Labels ) -> Assertion {
131
- Assertion { clean : Labels :: default ( ) , dirty : labels }
132
- }
133
- }
134
-
135
124
pub fn check_dirty_clean_annotations ( tcx : TyCtxt < ' _ > ) {
136
125
if !tcx. sess . opts . debugging_opts . query_dep_graph {
137
126
return ;
@@ -181,15 +170,7 @@ impl DirtyCleanVisitor<'tcx> {
181
170
// skip: not the correct `cfg=`
182
171
return None ;
183
172
}
184
- let assertion = if let Some ( labels) = self . labels ( attr) {
185
- if is_clean {
186
- Assertion :: from_clean_labels ( labels)
187
- } else {
188
- Assertion :: from_dirty_labels ( labels)
189
- }
190
- } else {
191
- self . assertion_auto ( item_id, attr, is_clean)
192
- } ;
173
+ let assertion = self . assertion_auto ( item_id, attr, is_clean) ;
193
174
Some ( assertion)
194
175
}
195
176
@@ -218,16 +199,6 @@ impl DirtyCleanVisitor<'tcx> {
218
199
}
219
200
}
220
201
221
- fn labels ( & self , attr : & Attribute ) -> Option < Labels > {
222
- for item in attr. meta_item_list ( ) . unwrap_or_else ( Vec :: new) {
223
- if item. has_name ( LABEL ) {
224
- let value = expect_associated_value ( self . tcx , & item) ;
225
- return Some ( self . resolve_labels ( & item, value) ) ;
226
- }
227
- }
228
- None
229
- }
230
-
231
202
/// `except=` attribute value
232
203
fn except ( & self , attr : & Attribute ) -> Labels {
233
204
for item in attr. meta_item_list ( ) . unwrap_or_else ( Vec :: new) {
@@ -437,30 +408,19 @@ impl ItemLikeVisitor<'tcx> for DirtyCleanVisitor<'tcx> {
437
408
/// Given a `#[rustc_dirty]` or `#[rustc_clean]` attribute, scan
438
409
/// for a `cfg="foo"` attribute and check whether we have a cfg
439
410
/// flag called `foo`.
440
- ///
441
- /// Also make sure that the `label` and `except` fields do not
442
- /// both exist.
443
411
fn check_config ( tcx : TyCtxt < ' _ > , attr : & Attribute ) -> bool {
444
412
debug ! ( "check_config(attr={:?})" , attr) ;
445
413
let config = & tcx. sess . parse_sess . config ;
446
414
debug ! ( "check_config: config={:?}" , config) ;
447
- let ( mut cfg, mut except , mut label ) = ( None , false , false ) ;
415
+ let mut cfg = None ;
448
416
for item in attr. meta_item_list ( ) . unwrap_or_else ( Vec :: new) {
449
417
if item. has_name ( CFG ) {
450
418
let value = expect_associated_value ( tcx, & item) ;
451
419
debug ! ( "check_config: searching for cfg {:?}" , value) ;
452
420
cfg = Some ( config. contains ( & ( value, None ) ) ) ;
421
+ } else if !item. has_name ( EXCEPT ) {
422
+ tcx. sess . span_err ( attr. span , & format ! ( "unknown item `{}`" , item. name_or_empty( ) ) ) ;
453
423
}
454
- if item. has_name ( LABEL ) {
455
- label = true ;
456
- }
457
- if item. has_name ( EXCEPT ) {
458
- except = true ;
459
- }
460
- }
461
-
462
- if label && except {
463
- tcx. sess . span_fatal ( attr. span , "must specify only one of: `label`, `except`" ) ;
464
424
}
465
425
466
426
match cfg {
0 commit comments