about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-12-14 22:02:59 +0000
committerbors <bors@rust-lang.org>2019-12-14 22:02:59 +0000
commit6f829840f7e5897745bc7b5ff951b006a2c4e0e3 (patch)
tree0c73bcad1ba6245af90566e58a69def359b598cd /src/libsyntax
parentc8ea4ace9213ae045123fdfeb59d1ac887656d31 (diff)
parent775076ff4dc9ce4986a1286669cfa268b01ac592 (diff)
downloadrust-6f829840f7e5897745bc7b5ff951b006a2c4e0e3.tar.gz
rust-6f829840f7e5897745bc7b5ff951b006a2c4e0e3.zip
Auto merge of #67224 - nikomatsakis:revert-stabilization-of-never-type, r=centril
Revert stabilization of never type

Fixes https://github.com/rust-lang/rust/issues/66757

I decided to keep the separate `never-type-fallback` feature gate, but tried to otherwise revert https://github.com/rust-lang/rust/pull/65355. Seemed pretty clean.

( cc @Centril, author of #65355, you may want to check this over briefly )
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/feature_gate/check.rs18
1 files changed, 18 insertions, 0 deletions
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) => {