Skip to content

Commit fadabd6

Browse files
committed
Revert stabilization of feature(never_type).
This commit is just covering the feature gate itself and the tests that made direct use of `!` and thus need to opt back into the feature. A follow on commit brings back the other change that motivates the revert: Namely, going back to the old rules for falling back to `()`.
1 parent 1a44439 commit fadabd6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+127
-17
lines changed

src/libcore/clone.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ mod impls {
179179
bool char
180180
}
181181

182-
#[stable(feature = "never_type", since = "1.26.0")]
182+
#[unstable(feature = "never_type", issue = "35121")]
183183
impl Clone for ! {
184184
#[inline]
185185
fn clone(&self) -> Self {

src/libcore/cmp.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -881,24 +881,24 @@ mod impls {
881881

882882
ord_impl! { char usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }
883883

884-
#[stable(feature = "never_type", since = "1.26.0")]
884+
#[unstable(feature = "never_type", issue = "35121")]
885885
impl PartialEq for ! {
886886
fn eq(&self, _: &!) -> bool {
887887
*self
888888
}
889889
}
890890

891-
#[stable(feature = "never_type", since = "1.26.0")]
891+
#[unstable(feature = "never_type", issue = "35121")]
892892
impl Eq for ! {}
893893

894-
#[stable(feature = "never_type", since = "1.26.0")]
894+
#[unstable(feature = "never_type", issue = "35121")]
895895
impl PartialOrd for ! {
896896
fn partial_cmp(&self, _: &!) -> Option<Ordering> {
897897
*self
898898
}
899899
}
900900

901-
#[stable(feature = "never_type", since = "1.26.0")]
901+
#[unstable(feature = "never_type", issue = "35121")]
902902
impl Ord for ! {
903903
fn cmp(&self, _: &!) -> Ordering {
904904
*self

src/libcore/fmt/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1780,14 +1780,14 @@ macro_rules! fmt_refs {
17801780

17811781
fmt_refs! { Debug, Display, Octal, Binary, LowerHex, UpperHex, LowerExp, UpperExp }
17821782

1783-
#[stable(feature = "never_type", since = "1.26.0")]
1783+
#[unstable(feature = "never_type", issue = "35121")]
17841784
impl Debug for ! {
17851785
fn fmt(&self, _: &mut Formatter) -> Result {
17861786
*self
17871787
}
17881788
}
17891789

1790-
#[stable(feature = "never_type", since = "1.26.0")]
1790+
#[unstable(feature = "never_type", issue = "35121")]
17911791
impl Display for ! {
17921792
fn fmt(&self, _: &mut Formatter) -> Result {
17931793
*self

src/libcore/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
#![feature(iterator_repeat_with)]
8383
#![feature(lang_items)]
8484
#![feature(link_llvm_intrinsics)]
85+
#![feature(never_type)]
8586
#![feature(exhaustive_patterns)]
8687
#![feature(macro_at_most_once_rep)]
8788
#![feature(no_core)]

src/libcore/marker.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ mod copy_impls {
630630
bool char
631631
}
632632

633-
#[stable(feature = "never_type", since = "1.26.0")]
633+
#[unstable(feature = "never_type", issue = "35121")]
634634
impl Copy for ! {}
635635

636636
#[stable(feature = "rust1", since = "1.0.0")]

src/librustc/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
#![cfg_attr(windows, feature(libc))]
5353
#![feature(macro_lifetime_matcher)]
5454
#![feature(macro_vis_matcher)]
55+
#![feature(never_type)]
5556
#![feature(exhaustive_patterns)]
5657
#![feature(non_exhaustive)]
5758
#![feature(nonzero)]

src/librustc_mir/build/matches/simplify.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
113113
PatternKind::Variant { adt_def, substs, variant_index, ref subpatterns } => {
114114
let irrefutable = adt_def.variants.iter().enumerate().all(|(i, v)| {
115115
i == variant_index || {
116+
self.hir.tcx().features().never_type &&
116117
self.hir.tcx().features().exhaustive_patterns &&
117118
self.hir.tcx().is_variant_uninhabited_from_all_modules(v, substs)
118119
}

src/libstd/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ impl<'a> From<Cow<'a, str>> for Box<Error> {
233233
}
234234
}
235235

236-
#[stable(feature = "never_type", since = "1.26.0")]
236+
#[unstable(feature = "never_type", issue = "35121")]
237237
impl Error for ! {
238238
fn description(&self) -> &str { *self }
239239
}

src/libstd/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@
275275
#![feature(macro_reexport)]
276276
#![feature(macro_vis_matcher)]
277277
#![feature(needs_panic_runtime)]
278+
#![feature(never_type)]
278279
#![feature(exhaustive_patterns)]
279280
#![feature(nonzero)]
280281
#![feature(num_bits_bytes)]

src/libsyntax/feature_gate.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,9 @@ declare_features! (
272272
// Allows cfg(target_has_atomic = "...").
273273
(active, cfg_target_has_atomic, "1.9.0", Some(32976), None),
274274

275+
// The `!` type. Does not imply exhaustive_patterns (below) any more.
276+
(active, never_type, "1.13.0", Some(35121), None),
277+
275278
// Allows exhaustive pattern matching on types that contain uninhabited types.
276279
(active, exhaustive_patterns, "1.13.0", None, None),
277280

@@ -1635,6 +1638,10 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
16351638
ast::TyKind::BareFn(ref bare_fn_ty) => {
16361639
self.check_abi(bare_fn_ty.abi, ty.span);
16371640
}
1641+
ast::TyKind::Never => {
1642+
gate_feature_post!(&self, never_type, ty.span,
1643+
"The `!` type is experimental");
1644+
}
16381645
ast::TyKind::TraitObject(_, ast::TraitObjectSyntax::Dyn) => {
16391646
gate_feature_post!(&self, dyn_trait, ty.span,
16401647
"`dyn Trait` syntax is unstable");

0 commit comments

Comments
 (0)