@@ -30,7 +30,6 @@ use std::iter::FromIterator;
3030use std:: vec:: Vec ;
3131
3232const EXCEPT : Symbol = sym:: except;
33- const LABEL : Symbol = sym:: label;
3433const CFG : Symbol = sym:: cfg;
3534
3635// Base and Extra labels to build up the labels
@@ -122,16 +121,6 @@ struct Assertion {
122121 dirty : Labels ,
123122}
124123
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-
135124pub fn check_dirty_clean_annotations ( tcx : TyCtxt < ' _ > ) {
136125 if !tcx. sess . opts . debugging_opts . query_dep_graph {
137126 return ;
@@ -181,15 +170,7 @@ impl DirtyCleanVisitor<'tcx> {
181170 // skip: not the correct `cfg=`
182171 return None ;
183172 }
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) ;
193174 Some ( assertion)
194175 }
195176
@@ -218,16 +199,6 @@ impl DirtyCleanVisitor<'tcx> {
218199 }
219200 }
220201
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-
231202 /// `except=` attribute value
232203 fn except ( & self , attr : & Attribute ) -> Labels {
233204 for item in attr. meta_item_list ( ) . unwrap_or_else ( Vec :: new) {
@@ -437,30 +408,19 @@ impl ItemLikeVisitor<'tcx> for DirtyCleanVisitor<'tcx> {
437408/// Given a `#[rustc_dirty]` or `#[rustc_clean]` attribute, scan
438409/// for a `cfg="foo"` attribute and check whether we have a cfg
439410/// flag called `foo`.
440- ///
441- /// Also make sure that the `label` and `except` fields do not
442- /// both exist.
443411fn check_config ( tcx : TyCtxt < ' _ > , attr : & Attribute ) -> bool {
444412 debug ! ( "check_config(attr={:?})" , attr) ;
445413 let config = & tcx. sess . parse_sess . config ;
446414 debug ! ( "check_config: config={:?}" , config) ;
447- let ( mut cfg, mut except , mut label ) = ( None , false , false ) ;
415+ let mut cfg = None ;
448416 for item in attr. meta_item_list ( ) . unwrap_or_else ( Vec :: new) {
449417 if item. has_name ( CFG ) {
450418 let value = expect_associated_value ( tcx, & item) ;
451419 debug ! ( "check_config: searching for cfg {:?}" , value) ;
452420 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( ) ) ) ;
453423 }
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`" ) ;
464424 }
465425
466426 match cfg {
0 commit comments