about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2019-12-11 09:55:29 -0500
committerNiko Matsakis <niko@alum.mit.edu>2019-12-14 09:01:09 -0500
commitd286113024ce50ada7a34f00041f4ff41f3217e6 (patch)
tree70d2d7673cfdc4b87a1bc391ab94198af0bf634c
parent1719337d02b0830234e3a1a86aae8f05af888cbe (diff)
Revert "Stabilize the `never_type`, written `!`."
This reverts commit 15c30ddd69d6cc3fffe6d304c6dc968a5ed046f1.
-rw-r--r--src/libcore/clone.rs2
-rw-r--r--src/libcore/cmp.rs8
-rw-r--r--src/libcore/fmt/mod.rs4
-rw-r--r--src/libcore/lib.rs2
-rw-r--r--src/libcore/marker.rs2
-rw-r--r--src/libcore/num/mod.rs2
-rw-r--r--src/librustc/lib.rs2
-rw-r--r--src/librustc_codegen_utils/lib.rs2
-rw-r--r--src/librustc_error_codes/error_codes/E0725.md4
-rw-r--r--src/librustc_feature/accepted.rs2
-rw-r--r--src/librustc_feature/active.rs3
-rw-r--r--src/librustc_mir/lib.rs2
-rw-r--r--src/librustc_typeck/lib.rs2
-rw-r--r--src/librustdoc/lib.rs2
-rw-r--r--src/libserialize/lib.rs2
-rw-r--r--src/libstd/error.rs2
-rw-r--r--src/libstd/lib.rs2
-rw-r--r--src/libstd/primitive_docs.rs4
-rw-r--r--src/libsyntax/feature_gate/check.rs18
19 files changed, 44 insertions, 23 deletions
diff --git a/src/libcore/clone.rs b/src/libcore/clone.rs
index 6e7a46ba62a..18f808638de 100644
--- a/src/libcore/clone.rs
+++ b/src/libcore/clone.rs
@@ -195,7 +195,7 @@ mod impls {
         bool char
     }
 
-    #[stable(feature = "never_type", since = "1.41.0")]
+    #[unstable(feature = "never_type", issue = "35121")]
     impl Clone for ! {
         #[inline]
         fn clone(&self) -> Self {
diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs
index fd4be02e20f..4aa52a7a390 100644
--- a/src/libcore/cmp.rs
+++ b/src/libcore/cmp.rs
@@ -1141,24 +1141,24 @@ mod impls {
 
     ord_impl! { char usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
 
-    #[stable(feature = "never_type", since = "1.41.0")]
+    #[unstable(feature = "never_type", issue = "35121")]
     impl PartialEq for ! {
         fn eq(&self, _: &!) -> bool {
             *self
         }
     }
 
-    #[stable(feature = "never_type", since = "1.41.0")]
+    #[unstable(feature = "never_type", issue = "35121")]
     impl Eq for ! {}
 
-    #[stable(feature = "never_type", since = "1.41.0")]
+    #[unstable(feature = "never_type", issue = "35121")]
     impl PartialOrd for ! {
         fn partial_cmp(&self, _: &!) -> Option<Ordering> {
             *self
         }
     }
 
-    #[stable(feature = "never_type", since = "1.41.0")]
+    #[unstable(feature = "never_type", issue = "35121")]
     impl Ord for ! {
         fn cmp(&self, _: &!) -> Ordering {
             *self
diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs
index e2f49ee25a7..223f91d909b 100644
--- a/src/libcore/fmt/mod.rs
+++ b/src/libcore/fmt/mod.rs
@@ -1940,14 +1940,14 @@ macro_rules! fmt_refs {
 
 fmt_refs! { Debug, Display, Octal, Binary, LowerHex, UpperHex, LowerExp, UpperExp }
 
-#[stable(feature = "never_type", since = "1.41.0")]
+#[unstable(feature = "never_type", issue = "35121")]
 impl Debug for ! {
     fn fmt(&self, _: &mut Formatter<'_>) -> Result {
         *self
     }
 }
 
-#[stable(feature = "never_type", since = "1.41.0")]
+#[unstable(feature = "never_type", issue = "35121")]
 impl Display for ! {
     fn fmt(&self, _: &mut Formatter<'_>) -> Result {
         *self
diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs
index 8a514f1e78e..8412e79aa33 100644
--- a/src/libcore/lib.rs
+++ b/src/libcore/lib.rs
@@ -87,7 +87,7 @@
 #![feature(iter_once_with)]
 #![feature(lang_items)]
 #![feature(link_llvm_intrinsics)]
-#![cfg_attr(bootstrap, feature(never_type))]
+#![feature(never_type)]
 #![feature(nll)]
 #![feature(exhaustive_patterns)]
 #![feature(no_core)]
diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs
index 288017b7ca5..2db55508ad5 100644
--- a/src/libcore/marker.rs
+++ b/src/libcore/marker.rs
@@ -776,7 +776,7 @@ mod copy_impls {
         bool char
     }
 
-    #[stable(feature = "never_type", since = "1.41.0")]
+    #[unstable(feature = "never_type", issue = "35121")]
     impl Copy for ! {}
 
     #[stable(feature = "rust1", since = "1.0.0")]
diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs
index c2e6ae64a51..00447a7d532 100644
--- a/src/libcore/num/mod.rs
+++ b/src/libcore/num/mod.rs
@@ -4731,7 +4731,7 @@ impl From<Infallible> for TryFromIntError {
     }
 }
 
-#[stable(feature = "never_type", since = "1.41.0")]
+#[unstable(feature = "never_type", issue = "35121")]
 impl From<!> for TryFromIntError {
     fn from(never: !) -> TryFromIntError {
         // Match rather than coerce to make sure that code like
diff --git a/src/librustc/lib.rs b/src/librustc/lib.rs
index 24b87ffc80c..641e6a4f614 100644
--- a/src/librustc/lib.rs
+++ b/src/librustc/lib.rs
@@ -37,7 +37,7 @@
 #![feature(core_intrinsics)]
 #![feature(drain_filter)]
 #![cfg_attr(windows, feature(libc))]
-#![cfg_attr(bootstrap, feature(never_type))]
+#![feature(never_type)]
 #![feature(exhaustive_patterns)]
 #![feature(overlapping_marker_traits)]
 #![feature(extern_types)]
diff --git a/src/librustc_codegen_utils/lib.rs b/src/librustc_codegen_utils/lib.rs
index f2739a3b30c..fb2099e71a3 100644
--- a/src/librustc_codegen_utils/lib.rs
+++ b/src/librustc_codegen_utils/lib.rs
@@ -8,7 +8,7 @@
 #![feature(box_patterns)]
 #![feature(box_syntax)]
 #![feature(core_intrinsics)]
-#![cfg_attr(bootstrap, feature(never_type))]
+#![feature(never_type)]
 #![feature(nll)]
 #![feature(in_band_lifetimes)]
 
diff --git a/src/librustc_error_codes/error_codes/E0725.md b/src/librustc_error_codes/error_codes/E0725.md
index b96a5e694df..9bd321e5f82 100644
--- a/src/librustc_error_codes/error_codes/E0725.md
+++ b/src/librustc_error_codes/error_codes/E0725.md
@@ -4,8 +4,8 @@ command line flags.
 Erroneous code example:
 
 ```ignore (can't specify compiler flags from doctests)
-#![feature(specialization)] // error: the feature `specialization` is not in
-                            // the list of allowed features
+#![feature(never_type)] // error: the feature `never_type` is not in
+                        // the list of allowed features
 ```
 
 Delete the offending feature attribute, or add it to the list of allowed
diff --git a/src/librustc_feature/accepted.rs b/src/librustc_feature/accepted.rs
index fec5a7f1a45..3f294dc02ed 100644
--- a/src/librustc_feature/accepted.rs
+++ b/src/librustc_feature/accepted.rs
@@ -253,8 +253,6 @@ declare_features! (
     (accepted, const_constructor, "1.40.0", Some(61456), None),
     /// Allows the use of `#[cfg(doctest)]`, set when rustdoc is collecting doctests.
     (accepted, cfg_doctest, "1.40.0", Some(62210), None),
-    /// Allows the `!` type. Does not imply 'exhaustive_patterns' any more.
-    (accepted, never_type, "1.41.0", Some(35121), None),
     /// Allows relaxing the coherence rules such that
     /// `impl<T> ForeignTrait<LocalType> for ForeignType<T>` is permitted.
     (accepted, re_rebalance_coherence, "1.41.0", Some(55437), None),
diff --git a/src/librustc_feature/active.rs b/src/librustc_feature/active.rs
index 363621b3ca4..c0dfed99d3b 100644
--- a/src/librustc_feature/active.rs
+++ b/src/librustc_feature/active.rs
@@ -307,6 +307,9 @@ declare_features! (
     /// Allows `X..Y` patterns.
     (active, exclusive_range_pattern, "1.11.0", Some(37854), None),
 
+    /// Allows the `!` type. Does not imply 'exhaustive_patterns' (below) any more.
+    (active, never_type, "1.13.0", Some(35121), None),
+
     /// Allows exhaustive pattern matching on types that contain uninhabited types.
     (active, exhaustive_patterns, "1.13.0", Some(51085), None),
 
diff --git a/src/librustc_mir/lib.rs b/src/librustc_mir/lib.rs
index 42b72b64f8a..f6b3c5b8e5e 100644
--- a/src/librustc_mir/lib.rs
+++ b/src/librustc_mir/lib.rs
@@ -18,7 +18,7 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
 #![feature(drain_filter)]
 #![feature(exhaustive_patterns)]
 #![feature(iter_order_by)]
-#![cfg_attr(bootstrap, feature(never_type))]
+#![feature(never_type)]
 #![feature(specialization)]
 #![feature(try_trait)]
 #![feature(unicode_internals)]
diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs
index 6a6294b6f87..c6c9703e92c 100644
--- a/src/librustc_typeck/lib.rs
+++ b/src/librustc_typeck/lib.rs
@@ -67,7 +67,7 @@ This API is completely unstable and subject to change.
 #![feature(in_band_lifetimes)]
 #![feature(nll)]
 #![feature(slice_patterns)]
-#![cfg_attr(bootstrap, feature(never_type))]
+#![feature(never_type)]
 
 #![recursion_limit="256"]
 
diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs
index a7ef428bc85..11d50cb7ce6 100644
--- a/src/librustdoc/lib.rs
+++ b/src/librustdoc/lib.rs
@@ -14,7 +14,7 @@
 #![feature(crate_visibility_modifier)]
 #![feature(const_fn)]
 #![feature(drain_filter)]
-#![cfg_attr(bootstrap, feature(never_type))]
+#![feature(never_type)]
 #![feature(unicode_internals)]
 
 #![recursion_limit="256"]
diff --git a/src/libserialize/lib.rs b/src/libserialize/lib.rs
index 13d83337f5f..e45d56c320c 100644
--- a/src/libserialize/lib.rs
+++ b/src/libserialize/lib.rs
@@ -11,7 +11,7 @@ Core encoding and decoding interfaces.
 #![feature(box_syntax)]
 #![feature(core_intrinsics)]
 #![feature(specialization)]
-#![cfg_attr(bootstrap, feature(never_type))]
+#![feature(never_type)]
 #![feature(nll)]
 #![feature(associated_type_bounds)]
 #![cfg_attr(test, feature(test))]
diff --git a/src/libstd/error.rs b/src/libstd/error.rs
index 09fc60ec9e5..d4c4cb9c3b9 100644
--- a/src/libstd/error.rs
+++ b/src/libstd/error.rs
@@ -465,7 +465,7 @@ impl<'a> From<Cow<'a, str>> for Box<dyn Error> {
     }
 }
 
-#[stable(feature = "never_type", since = "1.41.0")]
+#[unstable(feature = "never_type", issue = "35121")]
 impl Error for ! {
     fn description(&self) -> &str { *self }
 }
diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs
index 1dbb0c6ec83..6128c1d46ae 100644
--- a/src/libstd/lib.rs
+++ b/src/libstd/lib.rs
@@ -281,7 +281,7 @@
 #![feature(maybe_uninit_ref)]
 #![feature(maybe_uninit_slice)]
 #![feature(needs_panic_runtime)]
-#![cfg_attr(bootstrap, feature(never_type))]
+#![feature(never_type)]
 #![feature(nll)]
 #![cfg_attr(bootstrap, feature(on_unimplemented))]
 #![feature(optin_builtin_traits)]
diff --git a/src/libstd/primitive_docs.rs b/src/libstd/primitive_docs.rs
index b4495588c99..a72951c0346 100644
--- a/src/libstd/primitive_docs.rs
+++ b/src/libstd/primitive_docs.rs
@@ -71,6 +71,7 @@ mod prim_bool { }
 /// write:
 ///
 /// ```
+/// #![feature(never_type)]
 /// # fn foo() -> u32 {
 /// let x: ! = {
 ///     return 123
@@ -200,6 +201,7 @@ mod prim_bool { }
 /// for example:
 ///
 /// ```
+/// #![feature(never_type)]
 /// # use std::fmt;
 /// # trait Debug {
 /// # fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result;
@@ -237,7 +239,7 @@ mod prim_bool { }
 /// [`Default`]: default/trait.Default.html
 /// [`default()`]: default/trait.Default.html#tymethod.default
 ///
-#[stable(feature = "never_type", since = "1.41.0")]
+#[unstable(feature = "never_type", issue = "35121")]
 mod prim_never { }
 
 #[doc(primitive = "char")]
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) => {