Skip to content

Commit

Permalink
WIP inherited deprecation fixes #26040
Browse files Browse the repository at this point in the history
  • Loading branch information
Gankra committed Jun 11, 2015
1 parent c85f307 commit 836cdf0
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/librustc/middle/stability.rs
Expand Up @@ -60,8 +60,18 @@ impl<'a, 'tcx: 'a> Annotator<'a, 'tcx> {
if self.index.staged_api[&ast::LOCAL_CRATE] {
debug!("annotate(id = {:?}, attrs = {:?})", id, attrs);
match attr::find_stability(self.tcx.sess.diagnostic(), attrs, item_sp) {
Some(stab) => {
Some(mut stab) => {
debug!("annotate: found {:?}", stab);
// if parent is deprecated and we're not, inherit this by merging
// deprecated_since and its reason.
if let Some(parent_stab) = self.parent {
if parent_stab.deprecated_since.is_some()
&& stab.deprecated_since.is_none() {
stab.deprecated_since = parent_stab.deprecated_since.clone();
stab.reason = parent_stab.reason.clone();
}
}

let stab = self.tcx.intern_stability(stab);
self.index.map.insert(local_def(id), Some(stab));

Expand Down

0 comments on commit 836cdf0

Please sign in to comment.