remove #![feature(never_type)] from the compiler

The reason `rustc_ast_ir` and `rustc_pattern_analysis` have nested
`cfg_attr`s is so that they don't mention `cfg(bootstrap)` when nightly
or rustc cargo feature turned on. If you don't do it like that, they stop
compiling on stable (or rather, they emit unexpected cfg warnings...).
This commit is contained in:
Waffle Lapkin
2025-08-15 02:32:46 +02:00
parent 977c3a7c62
commit f34322b0dc
21 changed files with 25 additions and 25 deletions

View File

@@ -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

View File

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

View File

@@ -2,11 +2,11 @@
// tidy-alphabetical-start
#![allow(internal_features)]
#![cfg_attr(bootstrap, feature(never_type))]
#![feature(default_field_values)]
#![feature(deref_patterns)]
#![feature(file_buffered)]
#![feature(negative_impls)]
#![feature(never_type)]
#![feature(option_into_flat_iter)]
#![feature(rustc_attrs)]
#![feature(stmt_expr_attributes)]

View File

@@ -1,8 +1,8 @@
// tidy-alphabetical-start
#![cfg_attr(bootstrap, feature(never_type))]
#![feature(array_try_map)]
#![feature(decl_macro)]
#![feature(deref_patterns)]
#![feature(never_type)]
#![feature(slice_ptr_get)]
#![feature(trait_alias)]
#![feature(unqualified_local_imports)]

View File

@@ -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)]
@@ -24,7 +25,6 @@
#![feature(map_try_insert)]
#![feature(min_specialization)]
#![feature(negative_impls)]
#![feature(never_type)]
#![feature(nonzero_internals)]
#![feature(pattern_type_macro)]
#![feature(pattern_types)]

View File

@@ -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

View File

@@ -3,11 +3,11 @@
//! This module contains the code for creating and emitting diagnostics.
// tidy-alphabetical-start
#![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)]
// tidy-alphabetical-end
extern crate self as rustc_errors;

View File

@@ -3,6 +3,7 @@
//! [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)]
@@ -10,7 +11,6 @@
#![feature(default_field_values)]
#![feature(derive_const)]
#![feature(exhaustive_patterns)]
#![feature(never_type)]
#![recursion_limit = "256"]
// tidy-alphabetical-end

View File

@@ -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)]

View File

@@ -1,8 +1,8 @@
// tidy-alphabetical-start
#![cfg_attr(bootstrap, feature(never_type))]
#![feature(deref_patterns)]
#![feature(iter_intersperse)]
#![feature(iter_order_by)]
#![feature(never_type)]
#![feature(option_into_flat_iter)]
#![feature(option_reference_flattening)]
#![feature(trim_prefix_suffix)]

View File

@@ -3,11 +3,11 @@
rustc::default_hash_types,
reason = "we like performance but can't use `rustc_data_structures`"
)]
#![cfg_attr(bootstrap, feature(never_type))]
#![deny(
rustc::potential_query_instability,
reason = "macros shall produce deterministic output/errors"
)]
#![feature(never_type)]
#![feature(proc_macro_diagnostic)]
#![feature(proc_macro_tracked_env)]
// tidy-alphabetical-end

View File

@@ -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(option_into_flat_iter)]
#![feature(proc_macro_internals)]
#![feature(trusted_len)]

View File

@@ -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)]
@@ -44,7 +45,6 @@
#![feature(gen_blocks)]
#![feature(min_specialization)]
#![feature(negative_impls)]
#![feature(never_type)]
#![feature(option_into_flat_iter)]
#![feature(ptr_alignment_type)]
#![feature(range_bounds_is_empty)]

View File

@@ -5,7 +5,7 @@
//!
//! # Example
//! ```rust
//! #![feature(never_type)]
#![cfg_attr(bootstrap, doc = "#![feature(never_type)]")]
//! mod a {
//! pub mod b {
//! pub struct SecretlyUninhabited {
@@ -154,7 +154,7 @@ impl<'tcx> Ty<'tcx> {
///
/// # Example
/// ```
/// #![feature(never_type)]
#[cfg_attr(bootstrap, doc = "#![feature(never_type)]")]
/// # fn main() {}
/// enum Void {}
/// mod a {

View File

@@ -1,9 +1,9 @@
// tidy-alphabetical-start
#![cfg_attr(bootstrap, feature(never_type))]
#![feature(associated_type_defaults)]
#![feature(deref_patterns)]
#![feature(exact_size_is_empty)]
#![feature(file_buffered)]
#![feature(never_type)]
#![feature(try_blocks)]
// tidy-alphabetical-end

View File

@@ -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 {
@@ -114,8 +113,8 @@
//! Moreover, take the following:
//!
//! ```rust
//! # #![feature(never_type)]
//! # #![feature(exhaustive_patterns)]
#![cfg_attr(feature = "rustc", cfg_attr(bootstrap, doc = "#![feature(never_type)]"))]
//! # let x = None::<!>;
//! match x {
//! None => {}

View File

@@ -3957,8 +3957,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 {
@@ -4023,8 +4023,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;

View File

@@ -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(nonzero_internals)]
#![feature(sized_hierarchy)]
// tidy-alphabetical-end

View File

@@ -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(default_field_values)]
#![feature(deref_patterns)]
#![feature(hash_set_entry)]
#![feature(iter_intersperse)]
#![feature(iterator_try_reduce)]
#![feature(never_type)]
#![feature(option_into_flat_iter)]
#![feature(try_blocks)]
#![feature(unwrap_infallible)]

View File

@@ -1,6 +1,6 @@
// tidy-alphabetical-start
#![cfg_attr(bootstrap, feature(never_type))]
#![cfg_attr(test, feature(test))]
#![feature(never_type)]
#![feature(option_into_flat_iter)]
// tidy-alphabetical-end

View File

@@ -5,9 +5,9 @@
//! This API is completely unstable and subject to change.
// tidy-alphabetical-start
#![cfg_attr(bootstrap, feature(never_type))]
#![feature(deref_patterns)]
#![feature(iterator_try_collect)]
#![feature(never_type)]
#![feature(option_into_flat_iter)]
// tidy-alphabetical-end