Revert "Stabilize the never_type
, written !
."
This reverts commit 15c30ddd69
.
This commit is contained in:
parent
1719337d02
commit
d286113024
19 changed files with 44 additions and 23 deletions
|
@ -195,7 +195,7 @@ mod impls {
|
||||||
bool char
|
bool char
|
||||||
}
|
}
|
||||||
|
|
||||||
#[stable(feature = "never_type", since = "1.41.0")]
|
#[unstable(feature = "never_type", issue = "35121")]
|
||||||
impl Clone for ! {
|
impl Clone for ! {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
|
|
|
@ -1141,24 +1141,24 @@ mod impls {
|
||||||
|
|
||||||
ord_impl! { char usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
|
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 ! {
|
impl PartialEq for ! {
|
||||||
fn eq(&self, _: &!) -> bool {
|
fn eq(&self, _: &!) -> bool {
|
||||||
*self
|
*self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[stable(feature = "never_type", since = "1.41.0")]
|
#[unstable(feature = "never_type", issue = "35121")]
|
||||||
impl Eq for ! {}
|
impl Eq for ! {}
|
||||||
|
|
||||||
#[stable(feature = "never_type", since = "1.41.0")]
|
#[unstable(feature = "never_type", issue = "35121")]
|
||||||
impl PartialOrd for ! {
|
impl PartialOrd for ! {
|
||||||
fn partial_cmp(&self, _: &!) -> Option<Ordering> {
|
fn partial_cmp(&self, _: &!) -> Option<Ordering> {
|
||||||
*self
|
*self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[stable(feature = "never_type", since = "1.41.0")]
|
#[unstable(feature = "never_type", issue = "35121")]
|
||||||
impl Ord for ! {
|
impl Ord for ! {
|
||||||
fn cmp(&self, _: &!) -> Ordering {
|
fn cmp(&self, _: &!) -> Ordering {
|
||||||
*self
|
*self
|
||||||
|
|
|
@ -1940,14 +1940,14 @@ macro_rules! fmt_refs {
|
||||||
|
|
||||||
fmt_refs! { Debug, Display, Octal, Binary, LowerHex, UpperHex, LowerExp, UpperExp }
|
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 ! {
|
impl Debug for ! {
|
||||||
fn fmt(&self, _: &mut Formatter<'_>) -> Result {
|
fn fmt(&self, _: &mut Formatter<'_>) -> Result {
|
||||||
*self
|
*self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[stable(feature = "never_type", since = "1.41.0")]
|
#[unstable(feature = "never_type", issue = "35121")]
|
||||||
impl Display for ! {
|
impl Display for ! {
|
||||||
fn fmt(&self, _: &mut Formatter<'_>) -> Result {
|
fn fmt(&self, _: &mut Formatter<'_>) -> Result {
|
||||||
*self
|
*self
|
||||||
|
|
|
@ -87,7 +87,7 @@
|
||||||
#![feature(iter_once_with)]
|
#![feature(iter_once_with)]
|
||||||
#![feature(lang_items)]
|
#![feature(lang_items)]
|
||||||
#![feature(link_llvm_intrinsics)]
|
#![feature(link_llvm_intrinsics)]
|
||||||
#![cfg_attr(bootstrap, feature(never_type))]
|
#![feature(never_type)]
|
||||||
#![feature(nll)]
|
#![feature(nll)]
|
||||||
#![feature(exhaustive_patterns)]
|
#![feature(exhaustive_patterns)]
|
||||||
#![feature(no_core)]
|
#![feature(no_core)]
|
||||||
|
|
|
@ -776,7 +776,7 @@ mod copy_impls {
|
||||||
bool char
|
bool char
|
||||||
}
|
}
|
||||||
|
|
||||||
#[stable(feature = "never_type", since = "1.41.0")]
|
#[unstable(feature = "never_type", issue = "35121")]
|
||||||
impl Copy for ! {}
|
impl Copy for ! {}
|
||||||
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
|
|
|
@ -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 {
|
impl From<!> for TryFromIntError {
|
||||||
fn from(never: !) -> TryFromIntError {
|
fn from(never: !) -> TryFromIntError {
|
||||||
// Match rather than coerce to make sure that code like
|
// Match rather than coerce to make sure that code like
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
#![feature(core_intrinsics)]
|
#![feature(core_intrinsics)]
|
||||||
#![feature(drain_filter)]
|
#![feature(drain_filter)]
|
||||||
#![cfg_attr(windows, feature(libc))]
|
#![cfg_attr(windows, feature(libc))]
|
||||||
#![cfg_attr(bootstrap, feature(never_type))]
|
#![feature(never_type)]
|
||||||
#![feature(exhaustive_patterns)]
|
#![feature(exhaustive_patterns)]
|
||||||
#![feature(overlapping_marker_traits)]
|
#![feature(overlapping_marker_traits)]
|
||||||
#![feature(extern_types)]
|
#![feature(extern_types)]
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
#![feature(box_patterns)]
|
#![feature(box_patterns)]
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
#![feature(core_intrinsics)]
|
#![feature(core_intrinsics)]
|
||||||
#![cfg_attr(bootstrap, feature(never_type))]
|
#![feature(never_type)]
|
||||||
#![feature(nll)]
|
#![feature(nll)]
|
||||||
#![feature(in_band_lifetimes)]
|
#![feature(in_band_lifetimes)]
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ command line flags.
|
||||||
Erroneous code example:
|
Erroneous code example:
|
||||||
|
|
||||||
```ignore (can't specify compiler flags from doctests)
|
```ignore (can't specify compiler flags from doctests)
|
||||||
#![feature(specialization)] // error: the feature `specialization` is not in
|
#![feature(never_type)] // error: the feature `never_type` is not in
|
||||||
// the list of allowed features
|
// the list of allowed features
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -253,8 +253,6 @@ declare_features! (
|
||||||
(accepted, const_constructor, "1.40.0", Some(61456), None),
|
(accepted, const_constructor, "1.40.0", Some(61456), None),
|
||||||
/// Allows the use of `#[cfg(doctest)]`, set when rustdoc is collecting doctests.
|
/// Allows the use of `#[cfg(doctest)]`, set when rustdoc is collecting doctests.
|
||||||
(accepted, cfg_doctest, "1.40.0", Some(62210), None),
|
(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
|
/// Allows relaxing the coherence rules such that
|
||||||
/// `impl<T> ForeignTrait<LocalType> for ForeignType<T>` is permitted.
|
/// `impl<T> ForeignTrait<LocalType> for ForeignType<T>` is permitted.
|
||||||
(accepted, re_rebalance_coherence, "1.41.0", Some(55437), None),
|
(accepted, re_rebalance_coherence, "1.41.0", Some(55437), None),
|
||||||
|
|
|
@ -307,6 +307,9 @@ declare_features! (
|
||||||
/// Allows `X..Y` patterns.
|
/// Allows `X..Y` patterns.
|
||||||
(active, exclusive_range_pattern, "1.11.0", Some(37854), None),
|
(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.
|
/// Allows exhaustive pattern matching on types that contain uninhabited types.
|
||||||
(active, exhaustive_patterns, "1.13.0", Some(51085), None),
|
(active, exhaustive_patterns, "1.13.0", Some(51085), None),
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
|
||||||
#![feature(drain_filter)]
|
#![feature(drain_filter)]
|
||||||
#![feature(exhaustive_patterns)]
|
#![feature(exhaustive_patterns)]
|
||||||
#![feature(iter_order_by)]
|
#![feature(iter_order_by)]
|
||||||
#![cfg_attr(bootstrap, feature(never_type))]
|
#![feature(never_type)]
|
||||||
#![feature(specialization)]
|
#![feature(specialization)]
|
||||||
#![feature(try_trait)]
|
#![feature(try_trait)]
|
||||||
#![feature(unicode_internals)]
|
#![feature(unicode_internals)]
|
||||||
|
|
|
@ -67,7 +67,7 @@ This API is completely unstable and subject to change.
|
||||||
#![feature(in_band_lifetimes)]
|
#![feature(in_band_lifetimes)]
|
||||||
#![feature(nll)]
|
#![feature(nll)]
|
||||||
#![feature(slice_patterns)]
|
#![feature(slice_patterns)]
|
||||||
#![cfg_attr(bootstrap, feature(never_type))]
|
#![feature(never_type)]
|
||||||
|
|
||||||
#![recursion_limit="256"]
|
#![recursion_limit="256"]
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#![feature(crate_visibility_modifier)]
|
#![feature(crate_visibility_modifier)]
|
||||||
#![feature(const_fn)]
|
#![feature(const_fn)]
|
||||||
#![feature(drain_filter)]
|
#![feature(drain_filter)]
|
||||||
#![cfg_attr(bootstrap, feature(never_type))]
|
#![feature(never_type)]
|
||||||
#![feature(unicode_internals)]
|
#![feature(unicode_internals)]
|
||||||
|
|
||||||
#![recursion_limit="256"]
|
#![recursion_limit="256"]
|
||||||
|
|
|
@ -11,7 +11,7 @@ Core encoding and decoding interfaces.
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
#![feature(core_intrinsics)]
|
#![feature(core_intrinsics)]
|
||||||
#![feature(specialization)]
|
#![feature(specialization)]
|
||||||
#![cfg_attr(bootstrap, feature(never_type))]
|
#![feature(never_type)]
|
||||||
#![feature(nll)]
|
#![feature(nll)]
|
||||||
#![feature(associated_type_bounds)]
|
#![feature(associated_type_bounds)]
|
||||||
#![cfg_attr(test, feature(test))]
|
#![cfg_attr(test, feature(test))]
|
||||||
|
|
|
@ -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 ! {
|
impl Error for ! {
|
||||||
fn description(&self) -> &str { *self }
|
fn description(&self) -> &str { *self }
|
||||||
}
|
}
|
||||||
|
|
|
@ -281,7 +281,7 @@
|
||||||
#![feature(maybe_uninit_ref)]
|
#![feature(maybe_uninit_ref)]
|
||||||
#![feature(maybe_uninit_slice)]
|
#![feature(maybe_uninit_slice)]
|
||||||
#![feature(needs_panic_runtime)]
|
#![feature(needs_panic_runtime)]
|
||||||
#![cfg_attr(bootstrap, feature(never_type))]
|
#![feature(never_type)]
|
||||||
#![feature(nll)]
|
#![feature(nll)]
|
||||||
#![cfg_attr(bootstrap, feature(on_unimplemented))]
|
#![cfg_attr(bootstrap, feature(on_unimplemented))]
|
||||||
#![feature(optin_builtin_traits)]
|
#![feature(optin_builtin_traits)]
|
||||||
|
|
|
@ -71,6 +71,7 @@ mod prim_bool { }
|
||||||
/// write:
|
/// write:
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
|
/// #![feature(never_type)]
|
||||||
/// # fn foo() -> u32 {
|
/// # fn foo() -> u32 {
|
||||||
/// let x: ! = {
|
/// let x: ! = {
|
||||||
/// return 123
|
/// return 123
|
||||||
|
@ -200,6 +201,7 @@ mod prim_bool { }
|
||||||
/// for example:
|
/// for example:
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
|
/// #![feature(never_type)]
|
||||||
/// # use std::fmt;
|
/// # use std::fmt;
|
||||||
/// # trait Debug {
|
/// # trait Debug {
|
||||||
/// # fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result;
|
/// # 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
|
||||||
/// [`default()`]: default/trait.Default.html#tymethod.default
|
/// [`default()`]: default/trait.Default.html#tymethod.default
|
||||||
///
|
///
|
||||||
#[stable(feature = "never_type", since = "1.41.0")]
|
#[unstable(feature = "never_type", issue = "35121")]
|
||||||
mod prim_never { }
|
mod prim_never { }
|
||||||
|
|
||||||
#[doc(primitive = "char")]
|
#[doc(primitive = "char")]
|
||||||
|
|
|
@ -464,11 +464,25 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
|
||||||
ast::TyKind::BareFn(ref bare_fn_ty) => {
|
ast::TyKind::BareFn(ref bare_fn_ty) => {
|
||||||
self.check_extern(bare_fn_ty.ext);
|
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)
|
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) {
|
fn visit_expr(&mut self, e: &'a ast::Expr) {
|
||||||
match e.kind {
|
match e.kind {
|
||||||
ast::ExprKind::Box(_) => {
|
ast::ExprKind::Box(_) => {
|
||||||
|
@ -499,6 +513,10 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
|
||||||
visit::walk_expr(self, e)
|
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) {
|
fn visit_pat(&mut self, pattern: &'a ast::Pat) {
|
||||||
match &pattern.kind {
|
match &pattern.kind {
|
||||||
PatKind::Slice(pats) => {
|
PatKind::Slice(pats) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue