about summary refs log tree commit diff
diff options
context:
space:
mode:
authorvarkor <github@varkor.com>2018-09-15 17:05:52 +0100
committervarkor <github@varkor.com>2018-09-15 17:05:52 +0100
commit52c0f13ff164dc2e05b488e3dec939dee25e2745 (patch)
treec08e95a0cb14af05ef493eef32e232ddddc2c156
parent5384f0fd3e76013f4a3a72dcb3f017ff943ff325 (diff)
downloadrust-52c0f13ff164dc2e05b488e3dec939dee25e2745.tar.gz
rust-52c0f13ff164dc2e05b488e3dec939dee25e2745.zip
Support deprecated lints in find_lints
-rw-r--r--src/librustc/lint/context.rs16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs
index f498935a815..c633ae57fa9 100644
--- a/src/librustc/lint/context.rs
+++ b/src/librustc/lint/context.rs
@@ -297,7 +297,7 @@ impl LintStore {
         self.by_name.insert(name.into(), Removed(reason.into()));
     }
 
-    pub fn find_lints(&self, lint_name: &str) -> Result<Vec<LintId>, FindLintError> {
+    pub fn find_lints(&self, mut lint_name: &str) -> Result<Vec<LintId>, FindLintError> {
         match self.by_name.get(lint_name) {
             Some(&Id(lint_id)) => Ok(vec![lint_id]),
             Some(&Renamed(_, lint_id)) => {
@@ -307,9 +307,17 @@ impl LintStore {
                 Err(FindLintError::Removed)
             },
             None => {
-                match self.lint_groups.get(lint_name) {
-                    Some(v) => Ok(v.0.clone()),
-                    None => Err(FindLintError::Removed)
+                loop {
+                    return match self.lint_groups.get(lint_name) {
+                        Some((ids, _, depr)) => {
+                            if let Some((name, _)) = depr {
+                                lint_name = name;
+                                continue;
+                            }
+                            Ok(ids.clone())
+                        }
+                        None => Err(FindLintError::Removed)
+                    };
                 }
             }
         }