about summary refs log tree commit diff
path: root/src/librustc/middle
diff options
context:
space:
mode:
authorvarkor <github@varkor.com>2018-07-23 01:21:35 +0100
committervarkor <github@varkor.com>2018-08-05 15:54:49 +0100
commit358460171580272faf1f68dfc06d58c08bb5fcb1 (patch)
treed8ec1d03408dd249d136b3142076750e93199c38 /src/librustc/middle
parent70ff6fd46f1e46faca928241448095866d46194d (diff)
downloadrust-358460171580272faf1f68dfc06d58c08bb5fcb1.tar.gz
rust-358460171580272faf1f68dfc06d58c08bb5fcb1.zip
Trigger stable feature lint for lib features
Diffstat (limited to 'src/librustc/middle')
-rw-r--r--src/librustc/middle/stability.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/librustc/middle/stability.rs b/src/librustc/middle/stability.rs
index 75dbd70a982..50f94985487 100644
--- a/src/librustc/middle/stability.rs
+++ b/src/librustc/middle/stability.rs
@@ -833,6 +833,16 @@ pub fn check_unused_or_stable_features<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
     remaining_lib_features.remove(&Symbol::intern("libc"));
 
     for (feature, stable) in tcx.lib_features().iter() {
+        // Warn if the user has enabled an already-stable feature.
+        if let Some(since) = stable {
+            if let Some(span) = remaining_lib_features.get(&feature) {
+                tcx.lint_node(lint::builtin::STABLE_FEATURES,
+                    ast::CRATE_NODE_ID,
+                    *span,
+                    &format_stable_since_msg(feature, &since.as_str()));
+            }
+        }
+
         remaining_lib_features.remove(&feature);
     }