1
Fork 0

Gate const closures even when they appear in macros

This commit is contained in:
Michael Goulet 2023-03-11 21:29:15 +00:00
parent bd4355500a
commit c3159b851a
5 changed files with 29 additions and 15 deletions

View file

@ -422,14 +422,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
ast::ExprKind::TryBlock(_) => {
gate_feature_post!(&self, try_blocks, e.span, "`try` expression is experimental");
}
ast::ExprKind::Closure(box ast::Closure { constness: ast::Const::Yes(_), .. }) => {
gate_feature_post!(
&self,
const_closures,
e.span,
"const closures are experimental"
);
}
_ => {}
}
visit::walk_expr(self, e)
@ -592,6 +584,7 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session) {
gate_all!(associated_const_equality, "associated const equality is incomplete");
gate_all!(yeet_expr, "`do yeet` expression is experimental");
gate_all!(dyn_star, "`dyn*` trait objects are experimental");
gate_all!(const_closures, "const closures are experimental");
// All uses of `gate_all!` below this point were added in #65742,
// and subsequently disabled (with the non-early gating readded).