@@ -123,7 +123,8 @@ impl<'a, 'tcx: 'a> Annotator<'a, 'tcx> {
123
123
item_sp : Span , kind : AnnotationKind , visit_children : F )
124
124
where F : FnOnce ( & mut Self )
125
125
{
126
- if self . index . staged_api [ & LOCAL_CRATE ] {
126
+ if self . tcx . sess . features . borrow ( ) . staged_api {
127
+ // This crate explicitly wants staged API.
127
128
debug ! ( "annotate(id = {:?}, attrs = {:?})" , id, attrs) ;
128
129
if let Some ( ..) = attr:: find_deprecation ( self . tcx . sess . diagnostic ( ) , attrs, item_sp) {
129
130
self . tcx . sess . span_err ( item_sp, "`#[deprecated]` cannot be used in staged api, \
@@ -204,6 +205,15 @@ impl<'a, 'tcx: 'a> Annotator<'a, 'tcx> {
204
205
}
205
206
}
206
207
208
+ // Propagate unstability. This can happen even for non-staged-api crates in case
209
+ // -Zforce-unstable-if-unmarked is set.
210
+ if let Some ( stab) = self . parent_stab {
211
+ if stab. level . is_unstable ( ) {
212
+ let def_id = self . tcx . hir . local_def_id ( id) ;
213
+ self . index . stab_map . insert ( def_id, Some ( stab) ) ;
214
+ }
215
+ }
216
+
207
217
if let Some ( depr) = attr:: find_deprecation ( self . tcx . sess . diagnostic ( ) , attrs, item_sp) {
208
218
if kind == AnnotationKind :: Prohibited {
209
219
self . tcx . sess . span_err ( item_sp, "This deprecation annotation is useless" ) ;
0 commit comments