@@ -9,7 +9,7 @@ use rustc_middle::ty::{
99 self , GenericPredicates , ImplTraitInTraitData , Ty , TyCtxt , TypeVisitable , TypeVisitor , Upcast ,
1010} ;
1111use rustc_middle:: { bug, span_bug} ;
12- use rustc_span:: { DUMMY_SP , Ident , Span } ;
12+ use rustc_span:: { DUMMY_SP , Ident , Span , sym } ;
1313use tracing:: { debug, instrument, trace} ;
1414
1515use super :: item_bounds:: explicit_item_bounds_with_filter;
@@ -69,6 +69,7 @@ pub(super) fn predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericPredic
6969 ) ;
7070 }
7171
72+
7273 debug ! ( "predicates_of({:?}) = {:?}" , def_id, result) ;
7374 result
7475}
@@ -318,6 +319,18 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Gen
318319 predicates. extend ( const_evaluatable_predicates_of ( tcx, def_id, & predicates) ) ;
319320 }
320321
322+ for attr in tcx. get_attrs ( def_id, sym:: allow_unstable_feature) {
323+ if let Some ( list) = attr. meta_item_list ( ) {
324+ for item in list. iter ( ) {
325+ // TODO: deal with error later
326+ let feature_name = item. name ( ) . unwrap ( ) ;
327+ predicates
328+ . insert ( ( ty:: ClauseKind :: UnstableFeature ( feature_name) . upcast ( tcx) , tcx. def_span ( def_id) ) ) ;
329+
330+ }
331+ }
332+ }
333+
321334 let mut predicates: Vec < _ > = predicates. into_iter ( ) . collect ( ) ;
322335
323336 // Subtle: before we store the predicates into the tcx, we
0 commit comments