about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-03-14 23:43:04 +0000
committerbors <bors@rust-lang.org>2018-03-14 23:43:04 +0000
commit5ebf74851d685f75abec7ef4e805f75fc301460c (patch)
tree226dc784417a299554cc1ce7748f51d49797a2de /src/libstd
parent521d91c6be76367d966df419677dd187f799b116 (diff)
parenta8a0c691914b72d1ca54057914b4cee2bd097ae3 (diff)
downloadrust-5ebf74851d685f75abec7ef4e805f75fc301460c.tar.gz
rust-5ebf74851d685f75abec7ef4e805f75fc301460c.zip
Auto merge of #47630 - canndrew:exhaustive-patterns, r=nikomatsakis
Stabilise feature(never_type). Introduce feature(exhaustive_patterns)

This stabilizes `!`, removing the feature gate as well as the old defaulting-to-`()` behavior. The pattern exhaustiveness checks which were covered by `feature(never_type)` have been moved behind a new `feature(exhaustive_patterns)` gate.
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/error.rs2
-rw-r--r--src/libstd/lib.rs3
-rw-r--r--src/libstd/primitive_docs.rs11
3 files changed, 8 insertions, 8 deletions
diff --git a/src/libstd/error.rs b/src/libstd/error.rs
index eb5022ad577..f8dbe193fed 100644
--- a/src/libstd/error.rs
+++ b/src/libstd/error.rs
@@ -234,7 +234,7 @@ impl<'a> From<Cow<'a, str>> for Box<Error> {
     }
 }
 
-#[unstable(feature = "never_type", issue = "35121")]
+#[stable(feature = "never_type", since = "1.26.0")]
 impl Error for ! {
     fn description(&self) -> &str { *self }
 }
diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs
index da15941374d..eea0e6b6752 100644
--- a/src/libstd/lib.rs
+++ b/src/libstd/lib.rs
@@ -282,7 +282,7 @@
 #![feature(macro_reexport)]
 #![feature(macro_vis_matcher)]
 #![feature(needs_panic_runtime)]
-#![feature(never_type)]
+#![feature(exhaustive_patterns)]
 #![feature(num_bits_bytes)]
 #![feature(old_wrapping)]
 #![feature(on_unimplemented)]
@@ -324,6 +324,7 @@
 #![feature(doc_spotlight)]
 #![cfg_attr(test, feature(update_panic_count))]
 #![cfg_attr(windows, feature(used))]
+#![cfg_attr(stage0, feature(never_type))]
 
 #![default_lib_allocator]
 
diff --git a/src/libstd/primitive_docs.rs b/src/libstd/primitive_docs.rs
index 358aa2c37df..e6e6be2e453 100644
--- a/src/libstd/primitive_docs.rs
+++ b/src/libstd/primitive_docs.rs
@@ -79,7 +79,6 @@ mod prim_bool { }
 /// write:
 ///
 /// ```
-/// #![feature(never_type)]
 /// # fn foo() -> u32 {
 /// let x: ! = {
 ///     return 123
@@ -131,13 +130,15 @@ mod prim_bool { }
 /// [`Result<String, !>`] which we can unpack like this:
 ///
 /// ```ignore (string-from-str-error-type-is-not-never-yet)
+/// #[feature(exhaustive_patterns)]
 /// // NOTE: This does not work today!
 /// let Ok(s) = String::from_str("hello");
 /// ```
 ///
-/// Since the [`Err`] variant contains a `!`, it can never occur. So we can exhaustively match on
-/// [`Result<T, !>`] by just taking the [`Ok`] variant. This illustrates another behaviour of `!` -
-/// it can be used to "delete" certain enum variants from generic types like `Result`.
+/// Since the [`Err`] variant contains a `!`, it can never occur. If the `exhaustive_patterns`
+/// feature is present this means we can exhaustively match on [`Result<T, !>`] by just taking the
+/// [`Ok`] variant. This illustrates another behaviour of `!` - it can be used to "delete" certain
+/// enum variants from generic types like `Result`.
 ///
 /// [`String::from_str`]: str/trait.FromStr.html#tymethod.from_str
 /// [`Result<String, !>`]: result/enum.Result.html
@@ -154,7 +155,6 @@ mod prim_bool { }
 /// for example:
 ///
 /// ```
-/// # #![feature(never_type)]
 /// # use std::fmt;
 /// # trait Debug {
 /// # fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result;
@@ -192,7 +192,6 @@ mod prim_bool { }
 /// [`Default`]: default/trait.Default.html
 /// [`default()`]: default/trait.Default.html#tymethod.default
 ///
-#[unstable(feature = "never_type", issue = "35121")]
 mod prim_never { }
 
 #[doc(primitive = "char")]