summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_ast_passes/src/feature_gate.rs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/rustc_ast_passes/src/feature_gate.rs')
-rw-r--r--compiler/rustc_ast_passes/src/feature_gate.rs10
1 files changed, 9 insertions, 1 deletions
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",