|
1 | 1 | use rustc_ast as ast; |
2 | 2 | use rustc_ast::visit::{self, AssocCtxt, FnCtxt, FnKind, Visitor}; |
3 | | -use rustc_ast::{attr, AssocItemConstraint, AssocItemConstraintKind, NodeId}; |
| 3 | +use rustc_ast::{attr, NodeId}; |
4 | 4 | use rustc_ast::{token, PatKind}; |
5 | 5 | use rustc_feature::{AttributeGate, BuiltinAttribute, Features, GateIssue, BUILTIN_ATTRIBUTE_MAP}; |
6 | 6 | use rustc_session::parse::{feature_err, feature_err_issue, feature_warn}; |
@@ -445,23 +445,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { |
445 | 445 | visit::walk_fn(self, fn_kind) |
446 | 446 | } |
447 | 447 |
|
448 | | - fn visit_assoc_item_constraint(&mut self, constraint: &'a AssocItemConstraint) { |
449 | | - if let AssocItemConstraintKind::Bound { .. } = constraint.kind |
450 | | - && let Some(ast::GenericArgs::Parenthesized(args)) = constraint.gen_args.as_ref() |
451 | | - && args.inputs.is_empty() |
452 | | - && let ast::FnRetTy::Default(..) = args.output |
453 | | - { |
454 | | - gate!( |
455 | | - &self, |
456 | | - return_type_notation, |
457 | | - constraint.span, |
458 | | - "return type notation is experimental" |
459 | | - ); |
460 | | - } |
461 | | - |
462 | | - visit::walk_assoc_item_constraint(self, constraint) |
463 | | - } |
464 | | - |
465 | 448 | fn visit_assoc_item(&mut self, i: &'a ast::AssocItem, ctxt: AssocCtxt) { |
466 | 449 | let is_fn = match &i.kind { |
467 | 450 | ast::AssocItemKind::Fn(_) => true, |
@@ -566,6 +549,7 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) { |
566 | 549 | unsafe_extern_blocks, |
567 | 550 | "`unsafe extern {}` blocks and `safe` keyword are experimental" |
568 | 551 | ); |
| 552 | + gate_all!(return_type_notation, "return type notation is experimental"); |
569 | 553 |
|
570 | 554 | if !visitor.features.never_patterns { |
571 | 555 | if let Some(spans) = spans.get(&sym::never_patterns) { |
@@ -611,10 +595,6 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session, features: &Features) { |
611 | 595 |
|
612 | 596 | gate_all_legacy_dont_use!(box_patterns, "box pattern syntax is experimental"); |
613 | 597 | gate_all_legacy_dont_use!(trait_alias, "trait aliases are experimental"); |
614 | | - // Despite being a new feature, `where T: Trait<Assoc(): Sized>`, which is RTN syntax now, |
615 | | - // used to be gated under associated_type_bounds, which are right above, so RTN needs to |
616 | | - // be too. |
617 | | - gate_all_legacy_dont_use!(return_type_notation, "return type notation is experimental"); |
618 | 598 | gate_all_legacy_dont_use!(decl_macro, "`macro` is experimental"); |
619 | 599 | gate_all_legacy_dont_use!(try_blocks, "`try` blocks are unstable"); |
620 | 600 | gate_all_legacy_dont_use!(auto_traits, "`auto` traits are unstable"); |
|
0 commit comments