Repository: rust-lang/rust
File: compiler/rustc_ast_passes/src/feature_gate.rs (Rust)

Code before:
            gate!(&self, c_variadic, span, "C-variadic functions are unstable");
        }

        visit::walk_fn(self, fn_kind)
    }

    fn visit_assoc_item(&mut self, i: &'a ast::AssocItem, ctxt: AssocCtxt) {
        let is_fn = match &i.kind {
            ast::AssocItemKind::Fn(_) => true,
            ast::AssocItemKind::Type(box ast::TyAlias { ty, .. }) => {
                if let (Some(_), AssocCtxt::Trait) = (ty, ctxt) {
                    gate!(
                        &self,
                        associated_type_defaults,
                        i.span,
                        "associated type defaults are unstable"
                    );
                }
                if let Some(ty) = ty {
                    self.check_impl_trait(ty, true);
                }
                false
            }
            ast::AssocItemKind::Const(_) => {
                if let (AssocCtxt::Trait, true) =
                    (ctxt, i.attrs.iter().any(|attr| attr.has_name(sym::type_const)))
                {
                    gate!(
                        &self,
                        associated_type_defaults,
                        i.span,
                        "associated type defaults are unstable"
                    );
                }
                false
            }
            _ => false,
        };
        if let ast::Defaultness::Default(_) = i.kind.defaultness() {
            // Limit `min_specialization` to only specializing functions.
            gate_alt!(
                &self,
                self.features.specialization() || (is_fn && self.features.min_specialization()),
                sym::specialization,
                i.span,
                "specialization is unstable"
            );
        }
        visit::walk_assoc_item(self, i, ctxt)
    }
}

Review comment (suggestion):
this will need to be update to the new way of checking whether an assoc const is a type const or not (see your merge conflict)

Code after:
        if let Some(_header) = fn_kind.header() {
            // Stability of const fn methods are covered in `visit_assoc_item` below.
        }

        if let FnKind::Closure(ast::ClosureBinder::For { generic_params, .. }, ..) = fn_kind {
            self.check_late_bound_lifetime_defs(generic_params);
        }

        if fn_kind.ctxt() != Some(FnCtxt::Foreign) && fn_kind.decl().c_variadic() {
            gate!(&self, c_variadic, span, "C-variadic functions are unstable");
        }

        visit::walk_fn(self, fn_kind)
    }

    fn visit_assoc_item(&mut self, i: &'a ast::AssocItem, ctxt: AssocCtxt) {
        let is_fn = match &i.kind {
            ast::AssocItemKind::Fn(_) => true,
            ast::AssocItemKind::Type(box ast::TyAlias { ty, .. }) => {
                if let (Some(_), AssocCtxt::Trait) = (ty, ctxt) {
                    gate!(
                        &self,
                        associated_type_defaults,
                        i.span,
                        "associated type defaults are unstable"
                    );
                }
                if let Some(ty) = ty {
                    self.check_impl_trait(ty, true);
                }
                false
            }
            ast::AssocItemKind::Const(box ast::ConstItem {
                rhs_kind: ast::ConstItemRhsKind::TypeConst { rhs },
                ..
            }) => {
                // Make sure this is only allowed if the feature gate is enabled.
                // #![feature(min_generic_const_args)]
                gate!(
                    &self,
                    min_generic_const_args,
                    i.span,
                    "associated `type const` are unstable"
                );
                // Make sure associated `type const` defaults in traits are only allowed
                // if the feature gate is enabled.
                // #![feature(associated_type_defaults)]
                if ctxt == AssocCtxt::Trait && rhs.is_some() {
                    gate!(
                        &self,
                        associated_type_defaults,