|
15 | 15 | use AttributeType::*;
|
16 | 16 | use AttributeGate::*;
|
17 | 17 |
|
18 |
| -use crate::ast::{self, NodeId, GenericParam, GenericParamKind, PatKind, RangeEnd}; |
| 18 | +use crate::ast::{ |
| 19 | + self, AssocTyConstraint, AssocTyConstraintKind, NodeId, GenericParam, GenericParamKind, |
| 20 | + PatKind, RangeEnd, |
| 21 | +}; |
19 | 22 | use crate::attr;
|
20 | 23 | use crate::early_buffered_lints::BufferedEarlyLintId;
|
21 | 24 | use crate::source_map::Spanned;
|
@@ -554,6 +557,9 @@ declare_features! (
|
554 | 557 | // Allows using C-variadics.
|
555 | 558 | (active, c_variadic, "1.34.0", Some(44930), None),
|
556 | 559 |
|
| 560 | + // Allows the user of associated type bounds. |
| 561 | + (active, associated_type_bounds, "1.34.0", Some(52662), None), |
| 562 | + |
557 | 563 | // -------------------------------------------------------------------------
|
558 | 564 | // feature-group-end: actual feature gates
|
559 | 565 | // -------------------------------------------------------------------------
|
@@ -1917,7 +1923,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
|
1917 | 1923 | self.builtin_attributes.get(&ident.name).map(|a| *a)
|
1918 | 1924 | });
|
1919 | 1925 |
|
1920 |
| - // check for gated attributes |
| 1926 | + // Check for gated attributes. |
1921 | 1927 | self.context.check_attribute(attr, attr_info, false);
|
1922 | 1928 |
|
1923 | 1929 | if attr.check_name(sym::doc) {
|
@@ -2115,7 +2121,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
|
2115 | 2121 | fn visit_fn_ret_ty(&mut self, ret_ty: &'a ast::FunctionRetTy) {
|
2116 | 2122 | if let ast::FunctionRetTy::Ty(ref output_ty) = *ret_ty {
|
2117 | 2123 | if let ast::TyKind::Never = output_ty.node {
|
2118 |
| - // Do nothing |
| 2124 | + // Do nothing. |
2119 | 2125 | } else {
|
2120 | 2126 | self.visit_ty(output_ty)
|
2121 | 2127 | }
|
@@ -2171,7 +2177,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
|
2171 | 2177 | }
|
2172 | 2178 | _ => {}
|
2173 | 2179 | }
|
2174 |
| - visit::walk_expr(self, e); |
| 2180 | + visit::walk_expr(self, e) |
2175 | 2181 | }
|
2176 | 2182 |
|
2177 | 2183 | fn visit_arm(&mut self, arm: &'a ast::Arm) {
|
@@ -2220,15 +2226,27 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
|
2220 | 2226 | gate_feature_post!(&self, c_variadic, span, "C-variadic functions are unstable");
|
2221 | 2227 | }
|
2222 | 2228 |
|
2223 |
| - visit::walk_fn(self, fn_kind, fn_decl, span); |
| 2229 | + visit::walk_fn(self, fn_kind, fn_decl, span) |
2224 | 2230 | }
|
2225 | 2231 |
|
2226 | 2232 | fn visit_generic_param(&mut self, param: &'a GenericParam) {
|
2227 |
| - if let GenericParamKind::Const { .. } = param.kind { |
2228 |
| - gate_feature_post!(&self, const_generics, param.ident.span, |
2229 |
| - "const generics are unstable"); |
| 2233 | + match param.kind { |
| 2234 | + GenericParamKind::Const { .. } => |
| 2235 | + gate_feature_post!(&self, const_generics, param.ident.span, |
| 2236 | + "const generics are unstable"), |
| 2237 | + _ => {} |
| 2238 | + } |
| 2239 | + visit::walk_generic_param(self, param) |
| 2240 | + } |
| 2241 | + |
| 2242 | + fn visit_assoc_ty_constraint(&mut self, constraint: &'a AssocTyConstraint) { |
| 2243 | + match constraint.kind { |
| 2244 | + AssocTyConstraintKind::Bound { .. } => |
| 2245 | + gate_feature_post!(&self, associated_type_bounds, constraint.span, |
| 2246 | + "associated type bounds are unstable"), |
| 2247 | + _ => {} |
2230 | 2248 | }
|
2231 |
| - visit::walk_generic_param(self, param); |
| 2249 | + visit::walk_assoc_ty_constraint(self, constraint) |
2232 | 2250 | }
|
2233 | 2251 |
|
2234 | 2252 | fn visit_trait_item(&mut self, ti: &'a ast::TraitItem) {
|
@@ -2266,7 +2284,7 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
|
2266 | 2284 | }
|
2267 | 2285 | _ => {}
|
2268 | 2286 | }
|
2269 |
| - visit::walk_trait_item(self, ti); |
| 2287 | + visit::walk_trait_item(self, ti) |
2270 | 2288 | }
|
2271 | 2289 |
|
2272 | 2290 | fn visit_impl_item(&mut self, ii: &'a ast::ImplItem) {
|
@@ -2298,15 +2316,15 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
|
2298 | 2316 | }
|
2299 | 2317 | _ => {}
|
2300 | 2318 | }
|
2301 |
| - visit::walk_impl_item(self, ii); |
| 2319 | + visit::walk_impl_item(self, ii) |
2302 | 2320 | }
|
2303 | 2321 |
|
2304 | 2322 | fn visit_vis(&mut self, vis: &'a ast::Visibility) {
|
2305 | 2323 | if let ast::VisibilityKind::Crate(ast::CrateSugar::JustCrate) = vis.node {
|
2306 | 2324 | gate_feature_post!(&self, crate_visibility_modifier, vis.span,
|
2307 | 2325 | "`crate` visibility modifier is experimental");
|
2308 | 2326 | }
|
2309 |
| - visit::walk_vis(self, vis); |
| 2327 | + visit::walk_vis(self, vis) |
2310 | 2328 | }
|
2311 | 2329 | }
|
2312 | 2330 |
|
|
0 commit comments