Skip to content

Commit 5ec4d3b

Browse files
committed
Auto merge of #155501 - WaffleLapkin:dont-reserve-from-never-type, r=<try>
[experiment][2] meow mrrrumph
2 parents b2f1ccf + e92338e commit 5ec4d3b

409 files changed

Lines changed: 1459 additions & 3233 deletions

File tree

Some content is hidden

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

compiler/rustc_arena/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
// tidy-alphabetical-start
1111
#![allow(clippy::mut_from_ref)] // Arena allocators are one place where this pattern is fine.
1212
#![allow(internal_features)]
13+
#![cfg_attr(bootstrap, feature(never_type))]
1314
#![cfg_attr(test, feature(test))]
1415
#![deny(unsafe_op_in_unsafe_fn)]
1516
#![doc(test(no_crate_inject, attr(deny(warnings), allow(internal_features))))]
1617
#![feature(decl_macro)]
1718
#![feature(dropck_eyepatch)]
18-
#![feature(never_type)]
1919
#![feature(rustc_attrs)]
2020
#![feature(unwrap_infallible)]
2121
// tidy-alphabetical-end

compiler/rustc_ast_ir/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
//! `rustc_type_ir` for a single import.
77
88
// tidy-alphabetical-start
9+
#![cfg_attr(all(feature = "nightly", bootstrap), feature(never_type))]
910
#![cfg_attr(feature = "nightly", allow(internal_features))]
10-
#![cfg_attr(feature = "nightly", feature(never_type))]
1111
#![cfg_attr(feature = "nightly", feature(rustc_attrs))]
1212
// tidy-alphabetical-end
1313

compiler/rustc_ast_passes/src/feature_gate.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
288288
// Function pointers cannot be `const`
289289
self.check_late_bound_lifetime_defs(&fn_ptr_ty.generic_params);
290290
}
291-
ast::TyKind::Never => {
292-
gate!(self, never_type, ty.span, "the `!` type is experimental");
293-
}
294291
ast::TyKind::Pat(..) => {
295292
gate!(self, pattern_types, ty.span, "pattern types are unstable");
296293
}
@@ -318,15 +315,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
318315
}
319316

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

compiler/rustc_borrowck/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
33
// tidy-alphabetical-start
44
#![allow(internal_features)]
5+
#![cfg_attr(bootstrap, feature(never_type))]
56
#![feature(box_patterns)]
67
#![feature(default_field_values)]
78
#![feature(file_buffered)]
89
#![feature(negative_impls)]
9-
#![feature(never_type)]
1010
#![feature(rustc_attrs)]
1111
#![feature(stmt_expr_attributes)]
1212
#![feature(try_blocks)]

compiler/rustc_const_eval/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// tidy-alphabetical-start
2+
#![cfg_attr(bootstrap, feature(never_type))]
23
#![feature(array_try_map)]
34
#![feature(box_patterns)]
45
#![feature(decl_macro)]
5-
#![feature(never_type)]
66
#![feature(slice_ptr_get)]
77
#![feature(trait_alias)]
88
#![feature(unqualified_local_imports)]

compiler/rustc_data_structures/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#![allow(internal_features)]
1111
#![allow(rustc::default_hash_types)]
1212
#![allow(rustc::potential_query_instability)]
13+
#![cfg_attr(bootstrap, feature(never_type))]
1314
#![cfg_attr(test, feature(test))]
1415
#![deny(unsafe_op_in_unsafe_fn)]
1516
#![feature(allocator_api)]
@@ -24,7 +25,6 @@
2425
#![feature(map_try_insert)]
2526
#![feature(min_specialization)]
2627
#![feature(negative_impls)]
27-
#![feature(never_type)]
2828
#![feature(pattern_type_macro)]
2929
#![feature(pattern_types)]
3030
#![feature(ptr_alignment_type)]

compiler/rustc_error_codes/src/error_codes/E0725.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ command line flags.
44
Erroneous code example:
55

66
```ignore (can't specify compiler flags from doctests)
7-
#![feature(never_type)] // error: the feature `never_type` is not in
8-
// the list of allowed features
7+
#![feature(extern_item_impls)]
8+
//~^ error: the feature `extern_item_impls`
9+
// is not in the list of allowed features
910
```
1011

1112
Delete the offending feature attribute, or add it to the list of allowed

compiler/rustc_errors/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
// tidy-alphabetical-start
66
#![allow(internal_features)]
77
#![allow(rustc::direct_use_of_rustc_type_ir)]
8+
#![cfg_attr(bootstrap, feature(never_type))]
89
#![feature(associated_type_defaults)]
910
#![feature(default_field_values)]
1011
#![feature(macro_metavar_expr_concat)]
1112
#![feature(negative_impls)]
12-
#![feature(never_type)]
1313
#![feature(rustc_attrs)]
1414
// tidy-alphabetical-end
1515

compiler/rustc_feature/src/accepted.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,8 @@ declare_features! (
326326
(accepted, native_link_modifiers_verbatim, "1.67.0", Some(81490)),
327327
/// Allows specifying the whole-archive link modifier
328328
(accepted, native_link_modifiers_whole_archive, "1.61.0", Some(81490)),
329+
/// Allows the `!` type.
330+
(accepted, never_type, "CURRENT_RUSTC_VERSION", Some(35121)),
329331
/// Allows using non lexical lifetimes (RFC 2094).
330332
(accepted, nll, "1.63.0", Some(43234)),
331333
/// Allows using `#![no_std]`.

compiler/rustc_feature/src/unstable.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -618,8 +618,6 @@ declare_features! (
618618
(unstable, negative_impls, "1.44.0", Some(68318)),
619619
/// Allows the `!` pattern.
620620
(incomplete, never_patterns, "1.76.0", Some(118155)),
621-
/// Allows the `!` type. Does not imply 'exhaustive_patterns' (below) any more.
622-
(unstable, never_type, "1.13.0", Some(35121)),
623621
/// Switch `..` syntax to use the new (`Copy + IntoIterator`) range types.
624622
(unstable, new_range, "1.86.0", Some(123741)),
625623
/// Allows `#![no_core]`.

0 commit comments

Comments
 (0)