about summary refs log tree commit diff
path: root/src/libsyntax/feature_gate
diff options
context:
space:
mode:
authorEduard-Mihai Burtescu <edy.burt@gmail.com>2019-10-31 18:46:29 +0200
committerEduard-Mihai Burtescu <edy.burt@gmail.com>2019-10-31 19:08:12 +0200
commit8f1eb345eacae619cf3fdeb17ef7bc6ec581fa2e (patch)
treedf384f12429e6261ad417b80b5ee908799ba3549 /src/libsyntax/feature_gate
parentada4a6430d7bcfb542b0c0fa6a43c9dd3291f2ff (diff)
downloadrust-8f1eb345eacae619cf3fdeb17ef7bc6ec581fa2e.tar.gz
rust-8f1eb345eacae619cf3fdeb17ef7bc6ec581fa2e.zip
Revert "pre-expansion gate const_generics"
This reverts commit 49cbfa1a6f6469ddbc0e88161e52104cc87aea9b.
Diffstat (limited to 'src/libsyntax/feature_gate')
-rw-r--r--src/libsyntax/feature_gate/check.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/libsyntax/feature_gate/check.rs b/src/libsyntax/feature_gate/check.rs
index bcafb9e03ff..3a32f12b255 100644
--- a/src/libsyntax/feature_gate/check.rs
+++ b/src/libsyntax/feature_gate/check.rs
@@ -3,7 +3,7 @@ use super::accepted::ACCEPTED_FEATURES;
 use super::removed::{REMOVED_FEATURES, STABLE_REMOVED_FEATURES};
 use super::builtin_attrs::{AttributeGate, BUILTIN_ATTRIBUTE_MAP};
 
-use crate::ast::{self, NodeId, PatKind, RangeEnd, VariantData};
+use crate::ast::{self, NodeId, GenericParam, GenericParamKind, PatKind, RangeEnd, VariantData};
 use crate::attr::{self, check_builtin_attribute};
 use crate::source_map::Spanned;
 use crate::edition::{ALL_EDITIONS, Edition};
@@ -594,6 +594,16 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
         visit::walk_fn(self, fn_kind, fn_decl, span)
     }
 
+    fn visit_generic_param(&mut self, param: &'a GenericParam) {
+        match param.kind {
+            GenericParamKind::Const { .. } =>
+                gate_feature_post!(&self, const_generics, param.ident.span,
+                    "const generics are unstable"),
+            _ => {}
+        }
+        visit::walk_generic_param(self, param)
+    }
+
     fn visit_trait_item(&mut self, ti: &'a ast::TraitItem) {
         match ti.kind {
             ast::TraitItemKind::Method(ref sig, ref block) => {