about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-11-21 15:29:00 +0100
committerGitHub <noreply@github.com>2019-11-21 15:29:00 +0100
commit0828d5327b9950ef4b1fedd058bbc8eaed00f8be (patch)
tree7171b26c8e91d1db3a24777c0b45f6738b864e92 /src/libstd
parentf1b882b55805c342e46ee4ca3beeef1d1fa2044b (diff)
parent238d03b3a32e7415becbcf22748286880ce21e3f (diff)
downloadrust-0828d5327b9950ef4b1fedd058bbc8eaed00f8be.tar.gz
rust-0828d5327b9950ef4b1fedd058bbc8eaed00f8be.zip
Rollup merge of #65355 - Centril:almost-is-never-enough, r=oli-obk
Stabilize `!` in Rust 1.41.0

This PR stabilizes the `never_type` (written `!`). The type represents computations that we know diverge in the type system and therefore has no values / inhabitants / elements / members.

The current nightly version is 1.40.0 which will become stable on 2019-12-19.

Tracking issue: https://github.com/rust-lang/rust/issues/35121.
Closes https://github.com/rust-lang/rust/issues/57012.
Closes https://github.com/rust-lang/rust/issues/58184.
Original stabilization report: https://github.com/rust-lang/rust/issues/57012#issuecomment-452398538

Additional notes:

- In #62661 we reserved `impl<T> From<!> for T` so this concern should be resolved.
- The type inference fallback change is moved to `#![feature(never_type_fallback)]` (https://github.com/rust-lang/rust/issues/65992).
- You can find all of the tests referencing `never_type` in this PR which also reorganizes these tests whereas they were more scattered before.

r? @nikomatsakis
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/error.rs9
-rw-r--r--src/libstd/lib.rs2
-rw-r--r--src/libstd/primitive_docs.rs4
3 files changed, 3 insertions, 12 deletions
diff --git a/src/libstd/error.rs b/src/libstd/error.rs
index d1cb0862d82..74a9e7c9e33 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> {
     }
 }
 
-#[unstable(feature = "never_type", issue = "35121")]
+#[stable(feature = "never_type", since = "1.41.0")]
 impl Error for ! {
     fn description(&self) -> &str { *self }
 }
@@ -551,13 +551,6 @@ impl Error for string::FromUtf16Error {
     }
 }
 
-#[stable(feature = "str_parse_error2", since = "1.8.0")]
-impl Error for string::ParseError {
-    fn description(&self) -> &str {
-        match *self {}
-    }
-}
-
 #[stable(feature = "decode_utf16", since = "1.9.0")]
 impl Error for char::DecodeUtf16Error {
     fn description(&self) -> &str {
diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs
index 32023a5b75b..acf53f7f003 100644
--- a/src/libstd/lib.rs
+++ b/src/libstd/lib.rs
@@ -280,7 +280,7 @@
 #![feature(maybe_uninit_ref)]
 #![feature(maybe_uninit_slice)]
 #![feature(needs_panic_runtime)]
-#![feature(never_type)]
+#![cfg_attr(bootstrap, 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 a72951c0346..b4495588c99 100644
--- a/src/libstd/primitive_docs.rs
+++ b/src/libstd/primitive_docs.rs
@@ -71,7 +71,6 @@ mod prim_bool { }
 /// write:
 ///
 /// ```
-/// #![feature(never_type)]
 /// # fn foo() -> u32 {
 /// let x: ! = {
 ///     return 123
@@ -201,7 +200,6 @@ mod prim_bool { }
 /// for example:
 ///
 /// ```
-/// #![feature(never_type)]
 /// # use std::fmt;
 /// # trait Debug {
 /// # fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result;
@@ -239,7 +237,7 @@ mod prim_bool { }
 /// [`Default`]: default/trait.Default.html
 /// [`default()`]: default/trait.Default.html#tymethod.default
 ///
-#[unstable(feature = "never_type", issue = "35121")]
+#[stable(feature = "never_type", since = "1.41.0")]
 mod prim_never { }
 
 #[doc(primitive = "char")]