diff options
| -rw-r--r-- | src/libcore/clone.rs | 2 | ||||
| -rw-r--r-- | src/libcore/cmp.rs | 8 | ||||
| -rw-r--r-- | src/libcore/fmt/mod.rs | 4 | ||||
| -rw-r--r-- | src/libcore/lib.rs | 2 | ||||
| -rw-r--r-- | src/libcore/marker.rs | 2 | ||||
| -rw-r--r-- | src/libcore/num/mod.rs | 2 | ||||
| -rw-r--r-- | src/librustc/lib.rs | 2 | ||||
| -rw-r--r-- | src/librustc/ty/context.rs | 6 | ||||
| -rw-r--r-- | src/librustc_codegen_utils/lib.rs | 2 | ||||
| -rw-r--r-- | src/librustc_error_codes/error_codes/E0725.md | 4 | ||||
| -rw-r--r-- | src/librustc_mir/lib.rs | 2 | ||||
| -rw-r--r-- | src/librustc_typeck/check/mod.rs | 5 | ||||
| -rw-r--r-- | src/librustc_typeck/lib.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/lib.rs | 2 | ||||
| -rw-r--r-- | src/libserialize/lib.rs | 2 | ||||
| -rw-r--r-- | src/libstd/error.rs | 2 | ||||
| -rw-r--r-- | src/libstd/lib.rs | 2 | ||||
| -rw-r--r-- | src/libstd/primitive_docs.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/feature_gate/accepted.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/feature_gate/active.rs | 3 | ||||
| -rw-r--r-- | src/libsyntax/feature_gate/check.rs | 18 |
21 files changed, 26 insertions, 52 deletions
diff --git a/src/libcore/clone.rs b/src/libcore/clone.rs index 14d947ccf24..86dd77f10f3 100644 --- a/src/libcore/clone.rs +++ b/src/libcore/clone.rs @@ -185,7 +185,7 @@ mod impls { bool char } - #[unstable(feature = "never_type", issue = "35121")] + #[stable(feature = "never_type", since = "1.41.0")] impl Clone for ! { #[inline] fn clone(&self) -> Self { diff --git a/src/libcore/cmp.rs b/src/libcore/cmp.rs index 1ac51291b93..1e2e595f1dd 100644 --- a/src/libcore/cmp.rs +++ b/src/libcore/cmp.rs @@ -1128,24 +1128,24 @@ mod impls { ord_impl! { char usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 } - #[unstable(feature = "never_type", issue = "35121")] + #[stable(feature = "never_type", since = "1.41.0")] impl PartialEq for ! { fn eq(&self, _: &!) -> bool { *self } } - #[unstable(feature = "never_type", issue = "35121")] + #[stable(feature = "never_type", since = "1.41.0")] impl Eq for ! {} - #[unstable(feature = "never_type", issue = "35121")] + #[stable(feature = "never_type", since = "1.41.0")] impl PartialOrd for ! { fn partial_cmp(&self, _: &!) -> Option<Ordering> { *self } } - #[unstable(feature = "never_type", issue = "35121")] + #[stable(feature = "never_type", since = "1.41.0")] impl Ord for ! { fn cmp(&self, _: &!) -> Ordering { *self diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index 5a039144f66..07dca9ad214 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -1935,14 +1935,14 @@ macro_rules! fmt_refs { fmt_refs! { Debug, Display, Octal, Binary, LowerHex, UpperHex, LowerExp, UpperExp } -#[unstable(feature = "never_type", issue = "35121")] +#[stable(feature = "never_type", since = "1.41.0")] impl Debug for ! { fn fmt(&self, _: &mut Formatter<'_>) -> Result { *self } } -#[unstable(feature = "never_type", issue = "35121")] +#[stable(feature = "never_type", since = "1.41.0")] impl Display for ! { fn fmt(&self, _: &mut Formatter<'_>) -> Result { *self diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index ea5536eb50c..ec19392450a 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -85,7 +85,7 @@ #![feature(iter_once_with)] #![feature(lang_items)] #![feature(link_llvm_intrinsics)] -#![feature(never_type)] +#![cfg_attr(bootstrap, feature(never_type))] #![feature(nll)] #![feature(exhaustive_patterns)] #![feature(no_core)] diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs index 2d2fc4102e1..86ee673cea9 100644 --- a/src/libcore/marker.rs +++ b/src/libcore/marker.rs @@ -774,7 +774,7 @@ mod copy_impls { bool char } - #[unstable(feature = "never_type", issue = "35121")] + #[stable(feature = "never_type", since = "1.41.0")] 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 b5d61a3fd4e..c2f85b9535e 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -4728,7 +4728,7 @@ impl From<Infallible> for TryFromIntError { } } -#[unstable(feature = "never_type", issue = "35121")] +#[stable(feature = "never_type", since = "1.41.0")] 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 38877dee711..1fc157eca3e 100644 --- a/src/librustc/lib.rs +++ b/src/librustc/lib.rs @@ -36,7 +36,7 @@ #![feature(core_intrinsics)] #![feature(drain_filter)] #![cfg_attr(windows, feature(libc))] -#![feature(never_type)] +#![cfg_attr(bootstrap, feature(never_type))] #![feature(exhaustive_patterns)] #![feature(overlapping_marker_traits)] #![feature(extern_types)] diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index 41d069bf6ae..2dea2216f38 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -2440,11 +2440,7 @@ impl<'tcx> TyCtxt<'tcx> { #[inline] pub fn mk_diverging_default(self) -> Ty<'tcx> { - if self.features().never_type { - self.types.never - } else { - self.intern_tup(&[]) - } + self.types.never } #[inline] diff --git a/src/librustc_codegen_utils/lib.rs b/src/librustc_codegen_utils/lib.rs index fb2099e71a3..f2739a3b30c 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)] -#![feature(never_type)] +#![cfg_attr(bootstrap, 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 9bd321e5f82..b96a5e694df 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(never_type)] // error: the feature `never_type` is not in - // the list of allowed features +#![feature(specialization)] // error: the feature `specialization` 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_mir/lib.rs b/src/librustc_mir/lib.rs index 6d19cd63bc3..cbb6408126a 100644 --- a/src/librustc_mir/lib.rs +++ b/src/librustc_mir/lib.rs @@ -16,7 +16,7 @@ Rust MIR: a lowered representation of Rust. Also: an experiment! #![feature(decl_macro)] #![feature(drain_filter)] #![feature(exhaustive_patterns)] -#![feature(never_type)] +#![cfg_attr(bootstrap, feature(never_type))] #![feature(specialization)] #![feature(try_trait)] #![feature(unicode_internals)] diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 50c1a74fe91..8f3e274b79f 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -3129,9 +3129,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } // Tries to apply a fallback to `ty` if it is an unsolved variable. - // Non-numerics get replaced with ! or () (depending on whether - // feature(never_type) is enabled, unconstrained ints with i32, - // unconstrained floats with f64. + // Non-numerics get replaced with `!`, unconstrained ints with `i32`, + // unconstrained floats with `f64`. // Fallback becomes very dubious if we have encountered type-checking errors. // In that case, fallback to Error. // The return value indicates whether fallback has occurred. diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index 9289f3c7ef3..0f147f92b5f 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -66,7 +66,7 @@ This API is completely unstable and subject to change. #![feature(in_band_lifetimes)] #![feature(nll)] #![feature(slice_patterns)] -#![feature(never_type)] +#![cfg_attr(bootstrap, feature(never_type))] #![recursion_limit="256"] diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs index 277475f6fff..6ed2d4b8477 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)] -#![feature(never_type)] +#![cfg_attr(bootstrap, feature(never_type))] #![feature(unicode_internals)] #![recursion_limit="256"] diff --git a/src/libserialize/lib.rs b/src/libserialize/lib.rs index e45d56c320c..13d83337f5f 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)] -#![feature(never_type)] +#![cfg_attr(bootstrap, 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 d1cb0862d82..45f1160ca79 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 } } 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")] diff --git a/src/libsyntax/feature_gate/accepted.rs b/src/libsyntax/feature_gate/accepted.rs index 0107611460b..dab83f48a03 100644 --- a/src/libsyntax/feature_gate/accepted.rs +++ b/src/libsyntax/feature_gate/accepted.rs @@ -253,6 +253,8 @@ 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/libsyntax/feature_gate/active.rs b/src/libsyntax/feature_gate/active.rs index 2819ee273d9..23718f56246 100644 --- a/src/libsyntax/feature_gate/active.rs +++ b/src/libsyntax/feature_gate/active.rs @@ -318,9 +318,6 @@ 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/libsyntax/feature_gate/check.rs b/src/libsyntax/feature_gate/check.rs index abf9adefd3c..f966850254f 100644 --- a/src/libsyntax/feature_gate/check.rs +++ b/src/libsyntax/feature_gate/check.rs @@ -521,25 +521,11 @@ 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(_) => { @@ -567,10 +553,6 @@ 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) => { |
