Skip to content

Commit a9fc390

Browse files
committed
stabilise feature(never_type)
Replace feature(never_type) with feature(exhaustive_patterns). feature(exhaustive_patterns) only covers the pattern-exhaustives checks that used to be covered by feature(never_type)
1 parent 9b15ddb commit a9fc390

File tree

77 files changed

+89
-162
lines changed

Some content is hidden

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

77 files changed

+89
-162
lines changed

src/libcore/cmp.rs

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

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

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

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

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

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

src/libcore/fmt/mod.rs

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

15801580
fmt_refs! { Debug, Display, Octal, Binary, LowerHex, UpperHex, LowerExp, UpperExp }
15811581

1582-
#[unstable(feature = "never_type", issue = "35121")]
1582+
#[stable(feature = "never_type", since = "1.24.0")]
15831583
impl Debug for ! {
15841584
fn fmt(&self, _: &mut Formatter) -> Result {
15851585
*self
15861586
}
15871587
}
15881588

1589-
#[unstable(feature = "never_type", issue = "35121")]
1589+
#[stable(feature = "never_type", since = "1.24.0")]
15901590
impl Display for ! {
15911591
fn fmt(&self, _: &mut Formatter) -> Result {
15921592
*self

src/libcore/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
#![feature(iterator_repeat_with)]
8686
#![feature(lang_items)]
8787
#![feature(link_llvm_intrinsics)]
88-
#![feature(never_type)]
88+
#![feature(exhaustive_patterns)]
8989
#![feature(no_core)]
9090
#![feature(on_unimplemented)]
9191
#![feature(optin_builtin_traits)]
@@ -103,6 +103,7 @@
103103
#![feature(unwind_attributes)]
104104

105105
#![cfg_attr(stage0, allow(unused_attributes))]
106+
#![cfg_attr(stage0, feature(never_type))]
106107

107108
#[prelude_import]
108109
#[allow(unused)]

src/librustc/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
#![feature(match_default_bindings)]
6161
#![feature(macro_lifetime_matcher)]
6262
#![feature(macro_vis_matcher)]
63-
#![feature(never_type)]
63+
#![feature(exhaustive_patterns)]
6464
#![feature(non_exhaustive)]
6565
#![feature(nonzero)]
6666
#![feature(proc_macro_internals)]

src/librustc_lint/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#![feature(quote)]
3333
#![feature(rustc_diagnostic_macros)]
3434
#![feature(slice_patterns)]
35+
#![cfg_attr(stage0, feature(never_type))]
3536

3637
#[macro_use]
3738
extern crate syntax;

src/librustc_mir/build/matches/simplify.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +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 &&
116+
self.hir.tcx().features().exhaustive_patterns &&
117117
self.hir.tcx().is_variant_uninhabited_from_all_modules(v, substs)
118118
}
119119
});

src/librustc_mir/hair/pattern/_match.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ impl<'a, 'tcx> MatchCheckCtxt<'a, 'tcx> {
219219
}
220220

221221
fn is_uninhabited(&self, ty: Ty<'tcx>) -> bool {
222-
if self.tcx.features().never_type {
222+
if self.tcx.features().exhaustive_patterns {
223223
self.tcx.is_ty_uninhabited_from(self.module, ty)
224224
} else {
225225
false
@@ -245,7 +245,7 @@ impl<'a, 'tcx> MatchCheckCtxt<'a, 'tcx> {
245245
substs: &'tcx ty::subst::Substs<'tcx>)
246246
-> bool
247247
{
248-
if self.tcx.features().never_type {
248+
if self.tcx.features().exhaustive_patterns {
249249
self.tcx.is_enum_variant_uninhabited_from(self.module, variant, substs)
250250
} else {
251251
false
@@ -694,7 +694,7 @@ pub fn is_useful<'p, 'a: 'p, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
694694
// test for details.
695695
//
696696
// FIXME: currently the only way I know of something can
697-
// be a privately-empty enum is when the never_type
697+
// be a privately-empty enum is when the exhaustive_patterns
698698
// feature flag is not present, so this is only
699699
// needed for that case.
700700

src/librustc_mir/hair/pattern/check_match.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ impl<'a, 'tcx> MatchVisitor<'a, 'tcx> {
222222
let pat_ty = self.tables.node_id_to_type(scrut.hir_id);
223223
let module = self.tcx.hir.get_module_parent(scrut.id);
224224
if inlined_arms.is_empty() {
225-
let scrutinee_is_uninhabited = if self.tcx.features().never_type {
225+
let scrutinee_is_uninhabited = if self.tcx.features().exhaustive_patterns {
226226
self.tcx.is_ty_uninhabited_from(module, pat_ty)
227227
} else {
228228
self.conservative_is_uninhabited(pat_ty)

src/librustc_mir/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,14 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
3232
#![feature(inclusive_range)]
3333
#![feature(macro_vis_matcher)]
3434
#![feature(match_default_bindings)]
35-
#![feature(never_type)]
35+
#![feature(exhaustive_patterns)]
3636
#![feature(range_contains)]
3737
#![feature(rustc_diagnostic_macros)]
3838
#![feature(placement_in_syntax)]
3939
#![feature(collection_placement)]
4040
#![feature(nonzero)]
4141
#![feature(underscore_lifetimes)]
42+
#![cfg_attr(stage0, feature(never_type))]
4243

4344
extern crate arena;
4445
#[macro_use]

src/librustc_typeck/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,14 @@ This API is completely unstable and subject to change.
8080
#![feature(crate_visibility_modifier)]
8181
#![feature(from_ref)]
8282
#![feature(match_default_bindings)]
83-
#![feature(never_type)]
83+
#![feature(exhaustive_patterns)]
8484
#![feature(option_filter)]
8585
#![feature(quote)]
8686
#![feature(refcell_replace_swap)]
8787
#![feature(rustc_diagnostic_macros)]
8888
#![feature(slice_patterns)]
8989
#![feature(i128_type)]
90+
#![cfg_attr(stage0, feature(never_type))]
9091

9192
#[macro_use] extern crate log;
9293
#[macro_use] extern crate syntax;

0 commit comments

Comments
 (0)