diff options
| author | Alexis Beingessner <a.beingessner@gmail.com> | 2015-06-06 15:52:28 -0700 |
|---|---|---|
| committer | Alexis Beingessner <a.beingessner@gmail.com> | 2015-06-11 10:49:28 -0700 |
| commit | 836cdf0a02f6dc308cf69020c3397e0247ac047f (patch) | |
| tree | b6c3ca6835bc1250054b3804a314b3a15c25003d | |
| parent | c85f30736913cf42549d8e0fd40049b346b4cec4 (diff) | |
| download | rust-836cdf0a02f6dc308cf69020c3397e0247ac047f.tar.gz rust-836cdf0a02f6dc308cf69020c3397e0247ac047f.zip | |
WIP inherited deprecation fixes #26040
| -rw-r--r-- | src/librustc/middle/stability.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs index b29e40d2d5e..5d092167d5a 100644 --- a/src/librustc/middle/stability.rs +++ b/src/librustc/middle/stability.rs @@ -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)); |
