|
15 | 15 | use AttributeType::*;
|
16 | 16 | use AttributeGate::*;
|
17 | 17 |
|
18 |
| -use crate::ast::{self, NodeId, PatKind, RangeEnd}; |
| 18 | +use crate::ast::{self, NodeId, GenericParam, GenericParamKind, PatKind, RangeEnd}; |
19 | 19 | use crate::attr;
|
20 | 20 | use crate::early_buffered_lints::BufferedEarlyLintId;
|
21 | 21 | use crate::source_map::Spanned;
|
@@ -462,6 +462,9 @@ declare_features! (
|
462 | 462 | // Re-Rebalance coherence
|
463 | 463 | (active, re_rebalance_coherence, "1.32.0", Some(55437), None),
|
464 | 464 |
|
| 465 | + // Const generic types. |
| 466 | + (active, const_generics, "1.34.0", Some(44580), None), |
| 467 | + |
465 | 468 | // #[optimize(X)]
|
466 | 469 | (active, optimize_attribute, "1.34.0", Some(54882), None),
|
467 | 470 |
|
@@ -1899,6 +1902,14 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
|
1899 | 1902 | visit::walk_fn(self, fn_kind, fn_decl, span);
|
1900 | 1903 | }
|
1901 | 1904 |
|
| 1905 | + fn visit_generic_param(&mut self, param: &'a GenericParam) { |
| 1906 | + if let GenericParamKind::Const { .. } = param.kind { |
| 1907 | + gate_feature_post!(&self, const_generics, param.ident.span, |
| 1908 | + "const generics are unstable"); |
| 1909 | + } |
| 1910 | + visit::walk_generic_param(self, param); |
| 1911 | + } |
| 1912 | + |
1902 | 1913 | fn visit_trait_item(&mut self, ti: &'a ast::TraitItem) {
|
1903 | 1914 | match ti.node {
|
1904 | 1915 | ast::TraitItemKind::Method(ref sig, ref block) => {
|
@@ -1984,7 +1995,7 @@ pub fn get_features(span_handler: &Handler, krate_attrs: &[ast::Attribute],
|
1984 | 1995 | // Some features are known to be incomplete and using them is likely to have
|
1985 | 1996 | // unanticipated results, such as compiler crashes. We warn the user about these
|
1986 | 1997 | // to alert them.
|
1987 |
| - let incomplete_features = ["generic_associated_types"]; |
| 1998 | + let incomplete_features = ["generic_associated_types", "const_generics"]; |
1988 | 1999 |
|
1989 | 2000 | let mut features = Features::new();
|
1990 | 2001 | let mut edition_enabled_features = FxHashMap::default();
|
|
0 commit comments