From d286113024ce50ada7a34f00041f4ff41f3217e6 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Wed, 11 Dec 2019 09:55:29 -0500 Subject: Revert "Stabilize the `never_type`, written `!`." This reverts commit 15c30ddd69d6cc3fffe6d304c6dc968a5ed046f1. --- src/libsyntax/feature_gate/check.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/libsyntax') diff --git a/src/libsyntax/feature_gate/check.rs b/src/libsyntax/feature_gate/check.rs index 3d2c3b1d4f9..99d89183e5b 100644 --- a/src/libsyntax/feature_gate/check.rs +++ b/src/libsyntax/feature_gate/check.rs @@ -464,11 +464,25 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { ast::TyKind::BareFn(ref bare_fn_ty) => { self.check_extern(bare_fn_ty.ext); } + ast::TyKind::Never => { + gate_feature_post!(&self, never_type, ty.span, + "The `!` type is experimental"); + } _ => {} } visit::walk_ty(self, ty) } + fn visit_fn_ret_ty(&mut self, ret_ty: &'a ast::FunctionRetTy) { + if let ast::FunctionRetTy::Ty(ref output_ty) = *ret_ty { + if let ast::TyKind::Never = output_ty.kind { + // Do nothing. + } else { + self.visit_ty(output_ty) + } + } + } + fn visit_expr(&mut self, e: &'a ast::Expr) { match e.kind { ast::ExprKind::Box(_) => { @@ -499,6 +513,10 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> { visit::walk_expr(self, e) } + fn visit_arm(&mut self, arm: &'a ast::Arm) { + visit::walk_arm(self, arm) + } + fn visit_pat(&mut self, pattern: &'a ast::Pat) { match &pattern.kind { PatKind::Slice(pats) => { -- cgit 1.4.1-3-g733a5