Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion compiler/rustc_arena/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
// tidy-alphabetical-start
#![allow(clippy::mut_from_ref)] // Arena allocators are one place where this pattern is fine.
#![allow(internal_features)]
#![cfg_attr(bootstrap, feature(never_type))]
#![cfg_attr(test, feature(test))]
#![deny(unsafe_op_in_unsafe_fn)]
#![doc(test(no_crate_inject, attr(deny(warnings), allow(internal_features))))]
#![feature(decl_macro)]
#![feature(dropck_eyepatch)]
#![feature(never_type)]
#![feature(rustc_attrs)]
#![feature(unwrap_infallible)]
// tidy-alphabetical-end
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ast_ir/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
//! `rustc_type_ir` for a single import.

// tidy-alphabetical-start
#![cfg_attr(all(feature = "nightly", bootstrap), feature(never_type))]
#![cfg_attr(feature = "nightly", allow(internal_features))]
#![cfg_attr(feature = "nightly", feature(never_type))]
#![cfg_attr(feature = "nightly", feature(rustc_attrs))]
// tidy-alphabetical-end

Expand Down
12 changes: 0 additions & 12 deletions compiler/rustc_ast_passes/src/feature_gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
// Function pointers cannot be `const`
self.check_late_bound_lifetime_defs(&fn_ptr_ty.generic_params);
}
ast::TyKind::Never => {
gate!(self, never_type, ty.span, "the `!` type is experimental");
}
ast::TyKind::Pat(..) => {
gate!(self, pattern_types, ty.span, "pattern types are unstable");
}
Expand Down Expand Up @@ -318,15 +315,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
}

fn visit_generic_args(&mut self, args: &'a ast::GenericArgs) {
// This check needs to happen here because the never type can be returned from a function,
// but cannot be used in any other context. If this check was in `visit_fn_ret_ty`, it
// include both functions and generics like `impl Fn() -> !`.
if let ast::GenericArgs::Parenthesized(generic_args) = args
&& let ast::FnRetTy::Ty(ref ty) = generic_args.output
&& matches!(ty.kind, ast::TyKind::Never)
{
gate!(self, never_type, ty.span, "the `!` type is experimental");
}
visit::walk_generic_args(self, args);
}

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

// tidy-alphabetical-start
#![allow(internal_features)]
#![cfg_attr(bootstrap, feature(never_type))]
#![feature(box_patterns)]
#![feature(default_field_values)]
#![feature(file_buffered)]
#![feature(negative_impls)]
#![feature(never_type)]
#![feature(rustc_attrs)]
#![feature(stmt_expr_attributes)]
#![feature(try_blocks)]
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_const_eval/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// tidy-alphabetical-start
#![cfg_attr(bootstrap, feature(never_type))]
#![feature(array_try_map)]
#![feature(box_patterns)]
#![feature(decl_macro)]
#![feature(never_type)]
#![feature(slice_ptr_get)]
#![feature(trait_alias)]
#![feature(unqualified_local_imports)]
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_data_structures/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#![allow(internal_features)]
#![allow(rustc::default_hash_types)]
#![allow(rustc::potential_query_instability)]
#![cfg_attr(bootstrap, feature(never_type))]
#![cfg_attr(test, feature(test))]
#![deny(unsafe_op_in_unsafe_fn)]
#![feature(allocator_api)]
Expand All @@ -24,7 +25,6 @@
#![feature(map_try_insert)]
#![feature(min_specialization)]
#![feature(negative_impls)]
#![feature(never_type)]
#![feature(pattern_type_macro)]
#![feature(pattern_types)]
#![feature(ptr_alignment_type)]
Expand Down
5 changes: 3 additions & 2 deletions compiler/rustc_error_codes/src/error_codes/E0725.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ 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(extern_item_impls)]
//~^ error: the feature `extern_item_impls`
// is not in the list of allowed features
```

Delete the offending feature attribute, or add it to the list of allowed
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_errors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
// tidy-alphabetical-start
#![allow(internal_features)]
#![allow(rustc::direct_use_of_rustc_type_ir)]
#![cfg_attr(bootstrap, feature(never_type))]
#![feature(associated_type_defaults)]
#![feature(default_field_values)]
#![feature(macro_metavar_expr_concat)]
#![feature(negative_impls)]
#![feature(never_type)]
#![feature(rustc_attrs)]
// tidy-alphabetical-end

Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_feature/src/accepted.rs
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,8 @@ declare_features! (
(accepted, native_link_modifiers_verbatim, "1.67.0", Some(81490)),
/// Allows specifying the whole-archive link modifier
(accepted, native_link_modifiers_whole_archive, "1.61.0", Some(81490)),
/// Allows the `!` type.
(accepted, never_type, "CURRENT_RUSTC_VERSION", Some(35121)),
/// Allows using non lexical lifetimes (RFC 2094).
(accepted, nll, "1.63.0", Some(43234)),
/// Allows using `#![no_std]`.
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_feature/src/unstable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -622,8 +622,6 @@ declare_features! (
(unstable, negative_impls, "1.44.0", Some(68318)),
/// Allows the `!` pattern.
(incomplete, never_patterns, "1.76.0", Some(118155)),
/// Allows the `!` type. Does not imply 'exhaustive_patterns' (below) any more.
(unstable, never_type, "1.13.0", Some(35121)),
/// Switch `..` syntax to use the new (`Copy + IntoIterator`) range types.
(unstable, new_range, "1.86.0", Some(123741)),
/// Allows `#![no_core]`.
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
//! [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/hir.html

// tidy-alphabetical-start
#![cfg_attr(bootstrap, feature(never_type))]
#![feature(associated_type_defaults)]
#![feature(closure_track_caller)]
#![feature(const_default)]
#![feature(const_trait_impl)]
#![feature(derive_const)]
#![feature(exhaustive_patterns)]
#![feature(never_type)]
#![feature(variant_count)]
#![recursion_limit = "256"]
// tidy-alphabetical-end
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_analysis/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ This API is completely unstable and subject to change.
*/

// tidy-alphabetical-start
#![cfg_attr(bootstrap, feature(never_type))]
#![feature(default_field_values)]
#![feature(gen_blocks)]
#![feature(iter_intersperse)]
#![feature(never_type)]
#![feature(slice_partition_dedup)]
#![feature(try_blocks)]
#![feature(unwrap_infallible)]
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_typeck/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// tidy-alphabetical-start
#![cfg_attr(bootstrap, feature(never_type))]
#![feature(box_patterns)]
#![feature(iter_intersperse)]
#![feature(iter_order_by)]
#![feature(never_type)]
#![feature(trim_prefix_suffix)]
// tidy-alphabetical-end

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_macros/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// tidy-alphabetical-start
#![allow(rustc::default_hash_types)]
#![feature(never_type)]
#![cfg_attr(bootstrap, feature(never_type))]
#![feature(proc_macro_diagnostic)]
#![feature(proc_macro_tracked_env)]
// tidy-alphabetical-end
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_metadata/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// tidy-alphabetical-start
#![allow(internal_features)]
#![cfg_attr(bootstrap, feature(never_type))]
#![feature(error_iter)]
#![feature(file_buffered)]
#![feature(gen_blocks)]
#![feature(macro_metavar_expr)]
#![feature(min_specialization)]
#![feature(never_type)]
#![feature(proc_macro_internals)]
#![feature(result_option_map_or_default)]
#![feature(strip_circumfix)]
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
// tidy-alphabetical-start
#![allow(internal_features)]
#![allow(rustc::direct_use_of_rustc_type_ir)]
#![cfg_attr(bootstrap, feature(never_type))]
#![cfg_attr(doc, feature(intra_doc_pointers))]
#![feature(allocator_api)]
#![feature(associated_type_defaults)]
Expand All @@ -44,7 +45,6 @@
#![feature(gen_blocks)]
#![feature(min_specialization)]
#![feature(negative_impls)]
#![feature(never_type)]
#![feature(ptr_alignment_type)]
#![feature(range_bounds_is_empty)]
#![feature(rustc_attrs)]
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_middle/src/ty/inhabitedness/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//!
//! # Example
//! ```rust
//! #![feature(never_type)]
#![cfg_attr(bootstrap, doc = "#![feature(never_type)]")]
//! mod a {
//! pub mod b {
//! pub struct SecretlyUninhabited {
Expand Down Expand Up @@ -141,7 +141,7 @@ impl<'tcx> Ty<'tcx> {
///
/// # Example
/// ```
/// #![feature(never_type)]
#[cfg_attr(bootstrap, doc = "#![feature(never_type)]")]
/// # fn main() {}
/// enum Void {}
/// mod a {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_dataflow/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// tidy-alphabetical-start
#![cfg_attr(bootstrap, feature(never_type))]
#![feature(associated_type_defaults)]
#![feature(box_patterns)]
#![feature(exact_size_is_empty)]
#![feature(file_buffered)]
#![feature(never_type)]
#![feature(try_blocks)]
// tidy-alphabetical-end

Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_pattern_analysis/src/constructor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@
//! constructors of a type. For example, all the following is ok:
//!
//! ```rust,ignore(example)
//! # #![feature(never_type)]
//! # #![feature(exhaustive_patterns)]
//! fn foo(x: Option<!>) {
//! match x {
Expand All @@ -114,8 +113,8 @@
//! Moreover, take the following:
//!
//! ```rust
//! # #![feature(never_type)]
//! # #![feature(exhaustive_patterns)]
#![cfg_attr(bootstrap, doc = "#![feature(never_type)]")]
//! # let x = None::<!>;
//! match x {
//! None => {}
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_resolve/src/late.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3942,8 +3942,8 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
/// A never pattern by definition indicates an unreachable case. For example, matching on
/// `Result<T, &!>` could look like:
/// ```rust
/// # #![feature(never_type)]
/// # #![feature(never_patterns)]
#[cfg_attr(bootstrap, doc = "#![feature(never_type)]")]
/// # fn bar(_x: u32) {}
/// let foo: Result<u32, &!> = Ok(0);
/// match foo {
Expand Down Expand Up @@ -4008,8 +4008,8 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
/// A never pattern by definition indicates an unreachable case. For example, destructuring a
/// `Result<T, &!>` could look like:
/// ```rust
/// # #![feature(never_type)]
/// # #![feature(never_patterns)]
#[cfg_attr(bootstrap, doc = "#![feature(never_type)]")]
/// # fn foo() -> Result<bool, &'static !> { Ok(true) }
/// let (Ok(x) | Err(&!)) = foo();
/// # let _ = x;
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_serialize/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
// tidy-alphabetical-start
#![allow(internal_features)]
#![allow(rustc::internal)]
#![cfg_attr(bootstrap, feature(never_type))]
#![doc(test(attr(allow(unused_variables), deny(warnings), allow(internal_features))))]
#![feature(core_intrinsics)]
#![feature(min_specialization)]
#![feature(never_type)]
#![feature(sized_hierarchy)]
// tidy-alphabetical-end

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_trait_selection/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
//! This API is completely unstable and subject to change.

// tidy-alphabetical-start
#![cfg_attr(bootstrap, feature(never_type))]
#![feature(associated_type_defaults)]
#![feature(box_patterns)]
#![feature(default_field_values)]
#![feature(hash_set_entry)]
#![feature(iter_intersperse)]
#![feature(iterator_try_reduce)]
#![feature(never_type)]
#![feature(strip_circumfix)]
#![feature(try_blocks)]
#![feature(unwrap_infallible)]
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_transmute/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// tidy-alphabetical-start
#![cfg_attr(bootstrap, feature(never_type))]
#![cfg_attr(test, feature(test))]
#![feature(never_type)]
// tidy-alphabetical-end

pub(crate) use rustc_data_structures::fx::{FxIndexMap as Map, FxIndexSet as Set};
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_ty_utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
//! This API is completely unstable and subject to change.

// tidy-alphabetical-start
#![cfg_attr(bootstrap, feature(never_type))]
#![feature(associated_type_defaults)]
#![feature(box_patterns)]
#![feature(iterator_try_collect)]
#![feature(never_type)]
// tidy-alphabetical-end

use rustc_middle::query::Providers;
Expand Down
1 change: 0 additions & 1 deletion library/alloc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@
#![feature(min_specialization)]
#![feature(multiple_supertrait_upcastable)]
#![feature(negative_impls)]
#![feature(never_type)]
#![feature(optimize_attribute)]
#![feature(rustc_attrs)]
#![feature(slice_internals)]
Expand Down
1 change: 0 additions & 1 deletion library/alloctests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
#![feature(const_trait_impl)]
#![feature(dropck_eyepatch)]
#![feature(min_specialization)]
#![feature(never_type)]
#![feature(optimize_attribute)]
#![feature(prelude_import)]
#![feature(rustc_attrs)]
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ mod impls {
bool char
}

#[unstable(feature = "never_type", issue = "35121")]
#[stable(feature = "never_type", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_unstable(feature = "const_clone", issue = "142757")]
impl const Clone for ! {
#[inline]
Expand Down
8 changes: 4 additions & 4 deletions library/core/src/cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2078,7 +2078,7 @@ 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 = "CURRENT_RUSTC_VERSION")]
#[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
impl const PartialEq for ! {
#[inline]
Expand All @@ -2087,11 +2087,11 @@ mod impls {
}
}

#[unstable(feature = "never_type", issue = "35121")]
#[stable(feature = "never_type", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
impl const Eq for ! {}

#[unstable(feature = "never_type", issue = "35121")]
#[stable(feature = "never_type", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
impl const PartialOrd for ! {
#[inline]
Expand All @@ -2100,7 +2100,7 @@ mod impls {
}
}

#[unstable(feature = "never_type", issue = "35121")]
#[stable(feature = "never_type", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_unstable(feature = "const_cmp", issue = "143800")]
impl const Ord for ! {
#[inline]
Expand Down
Loading
Loading