Revert "Stabilize the never_type
, written !
."
This reverts commit 15c30ddd69
.
This commit is contained in:
parent
1719337d02
commit
d286113024
@ -195,7 +195,7 @@ fn clone(&self) -> Self {
|
||||
bool char
|
||||
}
|
||||
|
||||
#[stable(feature = "never_type", since = "1.41.0")]
|
||||
#[unstable(feature = "never_type", issue = "35121")]
|
||||
impl Clone for ! {
|
||||
#[inline]
|
||||
fn clone(&self) -> Self {
|
||||
|
@ -1141,24 +1141,24 @@ fn cmp(&self, other: &bool) -> Ordering {
|
||||
|
||||
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
|
||||
|
@ -1940,14 +1940,14 @@ fn fmt(&self, f: &mut Formatter<'_>) -> Result { $tr::fmt(&**self, f) }
|
||||
|
||||
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
|
||||
|
@ -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)]
|
||||
|
@ -776,7 +776,7 @@ impl Copy for $t {}
|
||||
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")]
|
||||
|
@ -4731,7 +4731,7 @@ fn from(x: Infallible) -> 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
|
||||
|
@ -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)]
|
||||
|
@ -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)]
|
||||
|
||||
|
@ -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
|
||||
|
@ -253,8 +253,6 @@ macro_rules! 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),
|
||||
|
@ -307,6 +307,9 @@ pub fn set(&self, features: &mut Features, span: Span) {
|
||||
/// 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),
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
#![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)]
|
||||
|
@ -67,7 +67,7 @@
|
||||
#![feature(in_band_lifetimes)]
|
||||
#![feature(nll)]
|
||||
#![feature(slice_patterns)]
|
||||
#![cfg_attr(bootstrap, feature(never_type))]
|
||||
#![feature(never_type)]
|
||||
|
||||
#![recursion_limit="256"]
|
||||
|
||||
|
@ -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"]
|
||||
|
@ -11,7 +11,7 @@
|
||||
#![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))]
|
||||
|
@ -465,7 +465,7 @@ fn from(err: Cow<'a, str>) -> 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 }
|
||||
}
|
||||
|
@ -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)]
|
||||
|
@ -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")]
|
||||
|
@ -464,11 +464,25 @@ fn visit_ty(&mut self, ty: &'a ast::Ty) {
|
||||
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 @@ fn visit_expr(&mut self, e: &'a ast::Expr) {
|
||||
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) => {
|
||||
|
Loading…
Reference in New Issue
Block a user