Skip to content

Commit 3848428

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 61f8e2c commit 3848428

File tree

77 files changed

+127
-198
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

+127
-198
lines changed

src/libcore/cmp.rs

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

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

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

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

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

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

src/libcore/fmt/mod.rs

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

15711571
fmt_refs! { Debug, Display, Octal, Binary, LowerHex, UpperHex, LowerExp, UpperExp }
15721572

1573-
#[unstable(feature = "never_type", issue = "35121")]
1573+
#[stable(feature = "never_type", since = "1.24.0")]
15741574
impl Debug for ! {
15751575
fn fmt(&self, _: &mut Formatter) -> Result {
15761576
*self
15771577
}
15781578
}
15791579

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

src/libcore/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
#![feature(inclusive_range_syntax)]
7979
#![feature(intrinsics)]
8080
#![feature(lang_items)]
81-
#![feature(never_type)]
81+
#![feature(exhaustive_patterns)]
8282
#![feature(no_core)]
8383
#![feature(on_unimplemented)]
8484
#![feature(optin_builtin_traits)]
@@ -91,6 +91,7 @@
9191
#![feature(untagged_unions)]
9292
#![feature(unwind_attributes)]
9393
#![feature(doc_spotlight)]
94+
#![cfg_attr(stage0, feature(never_type))]
9495

9596
#[prelude_import]
9697
#[allow(unused)]

src/librustc/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
#![cfg_attr(windows, feature(libc))]
5757
#![feature(macro_vis_matcher)]
5858
#![feature(match_default_bindings)]
59-
#![feature(never_type)]
59+
#![feature(exhaustive_patterns)]
6060
#![feature(nonzero)]
6161
#![feature(quote)]
6262
#![feature(refcell_replace_swap)]

src/librustc_const_eval/_match.rs

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

203203
fn is_uninhabited(&self, ty: Ty<'tcx>) -> bool {
204-
if self.tcx.sess.features.borrow().never_type {
204+
if self.tcx.sess.features.borrow().exhaustive_patterns {
205205
self.tcx.is_ty_uninhabited_from(self.module, ty)
206206
} else {
207207
false
@@ -227,7 +227,7 @@ impl<'a, 'tcx> MatchCheckCtxt<'a, 'tcx> {
227227
substs: &'tcx ty::subst::Substs<'tcx>)
228228
-> bool
229229
{
230-
if self.tcx.sess.features.borrow().never_type {
230+
if self.tcx.sess.features.borrow().exhaustive_patterns {
231231
self.tcx.is_enum_variant_uninhabited_from(self.module, variant, substs)
232232
} else {
233233
false
@@ -636,7 +636,7 @@ pub fn is_useful<'p, 'a: 'p, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
636636
// test for details.
637637
//
638638
// FIXME: currently the only way I know of something can
639-
// be a privately-empty enum is when the never_type
639+
// be a privately-empty enum is when the exhaustive_patterns
640640
// feature flag is not present, so this is only
641641
// needed for that case.
642642

src/librustc_const_eval/check_match.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,9 @@ impl<'a, 'tcx> MatchVisitor<'a, 'tcx> {
205205
let pat_ty = self.tables.node_id_to_type(scrut.hir_id);
206206
let module = self.tcx.hir.get_module_parent(scrut.id);
207207
if inlined_arms.is_empty() {
208-
let scrutinee_is_uninhabited = if self.tcx.sess.features.borrow().never_type {
208+
let scrutinee_is_uninhabited = if self.tcx.sess.features
209+
.borrow()
210+
.exhaustive_patterns {
209211
self.tcx.is_ty_uninhabited_from(module, pat_ty)
210212
} else {
211213
self.conservative_is_uninhabited(pat_ty)

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
@@ -100,7 +100,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> {
100100
PatternKind::Variant { adt_def, substs, variant_index, ref subpatterns } => {
101101
let irrefutable = adt_def.variants.iter().enumerate().all(|(i, v)| {
102102
i == variant_index || {
103-
self.hir.tcx().sess.features.borrow().never_type &&
103+
self.hir.tcx().sess.features.borrow().exhaustive_patterns &&
104104
self.hir.tcx().is_variant_uninhabited_from_all_modules(v, substs)
105105
}
106106
});

src/librustc_mir/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,14 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
3030
#![feature(inclusive_range)]
3131
#![feature(macro_vis_matcher)]
3232
#![feature(match_default_bindings)]
33-
#![feature(never_type)]
33+
#![feature(exhaustive_patterns)]
3434
#![feature(range_contains)]
3535
#![feature(rustc_diagnostic_macros)]
3636
#![feature(placement_in_syntax)]
3737
#![feature(collection_placement)]
3838
#![feature(nonzero)]
3939
#![feature(underscore_lifetimes)]
40+
#![cfg_attr(stage0, feature(never_type))]
4041

4142
#[macro_use]
4243
extern crate bitflags;

src/librustc_typeck/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,12 @@ This API is completely unstable and subject to change.
7979
#![feature(conservative_impl_trait)]
8080
#![feature(from_ref)]
8181
#![feature(match_default_bindings)]
82-
#![feature(never_type)]
82+
#![feature(exhaustive_patterns)]
8383
#![feature(quote)]
8484
#![feature(refcell_replace_swap)]
8585
#![feature(rustc_diagnostic_macros)]
8686
#![feature(slice_patterns)]
87+
#![cfg_attr(stage0, feature(never_type))]
8788

8889
#[macro_use] extern crate log;
8990
#[macro_use] extern crate syntax;

0 commit comments

Comments
 (0)