From 218caa410aa38c29984be31a5229b9fa717560ee Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:13 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- compiler/rustc_ast_passes/src/feature_gate.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'compiler/rustc_ast_passes/src/feature_gate.rs') diff --git a/compiler/rustc_ast_passes/src/feature_gate.rs b/compiler/rustc_ast_passes/src/feature_gate.rs index 32f45f8b5..89ba6f936 100644 --- a/compiler/rustc_ast_passes/src/feature_gate.rs +++ b/compiler/rustc_ast_passes/src/feature_gate.rs @@ -385,6 +385,14 @@ 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) @@ -630,7 +638,7 @@ fn check_incompatible_features(sess: &Session) { { let spans = vec![f1_span, f2_span]; sess.struct_span_err( - spans.clone(), + spans, &format!( "features `{}` and `{}` are incompatible, using them at the same time \ is not allowed", -- cgit v1.2.3