]> git.lizzy.rs Git - rust.git/commitdiff
Trigger stable feature lint for lib features
authorvarkor <github@varkor.com>
Mon, 23 Jul 2018 00:21:35 +0000 (01:21 +0100)
committervarkor <github@varkor.com>
Sun, 5 Aug 2018 14:54:49 +0000 (15:54 +0100)
src/librustc/middle/stability.rs

index 75dbd70a982dcd0c4a59fbdaca656ab8aaf770a0..50f949854870cec5d4d57377ad7cebcce5588085 100644 (file)
@@ -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);
     }