Skip to content

Commit 33e68aa

Browse files
committed
Stabilize generic NonZero.
1 parent f22a0c2 commit 33e68aa

File tree

67 files changed

+69
-111
lines changed

Some content is hidden

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

67 files changed

+69
-111
lines changed

compiler/rustc_attr/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
#![allow(internal_features)]
88
#![feature(rustdoc_internals)]
99
#![doc(rust_logo)]
10-
#![feature(generic_nonzero)]
1110
#![feature(let_chains)]
1211

1312
#[macro_use]

compiler/rustc_const_eval/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ Rust MIR: a lowered representation of Rust.
1111
#![feature(assert_matches)]
1212
#![feature(box_patterns)]
1313
#![feature(decl_macro)]
14-
#![feature(generic_nonzero)]
1514
#![feature(let_chains)]
1615
#![feature(slice_ptr_get)]
1716
#![feature(strict_provenance)]

compiler/rustc_data_structures/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#![feature(cfg_match)]
2121
#![feature(core_intrinsics)]
2222
#![feature(extend_one)]
23-
#![feature(generic_nonzero)]
2423
#![feature(hash_raw_entry)]
2524
#![feature(hasher_prefixfree_extras)]
2625
#![feature(lazy_cell)]

compiler/rustc_errors/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#![feature(box_patterns)]
1616
#![feature(error_reporter)]
1717
#![feature(extract_if)]
18-
#![feature(generic_nonzero)]
1918
#![feature(let_chains)]
2019
#![feature(negative_impls)]
2120
#![feature(never_type)]

compiler/rustc_feature/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
//! symbol to the `accepted` or `removed` modules respectively.
1313
1414
#![allow(internal_features)]
15-
#![feature(generic_nonzero)]
1615
#![feature(rustdoc_internals)]
1716
#![doc(rust_logo)]
1817
#![feature(lazy_cell)]

compiler/rustc_hir_analysis/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ This API is completely unstable and subject to change.
6363
#![feature(rustdoc_internals)]
6464
#![allow(internal_features)]
6565
#![feature(control_flow_enum)]
66-
#![feature(generic_nonzero)]
6766
#![feature(if_let_guard)]
6867
#![feature(is_sorted)]
6968
#![feature(iter_intersperse)]

compiler/rustc_interface/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![feature(decl_macro)]
2-
#![feature(generic_nonzero)]
32
#![feature(lazy_cell)]
43
#![feature(let_chains)]
54
#![feature(thread_spawn_unchecked)]

compiler/rustc_lint/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
#![feature(box_patterns)]
3333
#![feature(control_flow_enum)]
3434
#![feature(extract_if)]
35-
#![feature(generic_nonzero)]
3635
#![feature(if_let_guard)]
3736
#![feature(iter_order_by)]
3837
#![feature(let_chains)]

compiler/rustc_metadata/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#![feature(error_iter)]
77
#![feature(extract_if)]
88
#![feature(coroutines)]
9-
#![feature(generic_nonzero)]
109
#![feature(iter_from_coroutine)]
1110
#![feature(let_chains)]
1211
#![feature(if_let_guard)]

compiler/rustc_middle/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
#![feature(const_type_name)]
3636
#![feature(discriminant_kind)]
3737
#![feature(coroutines)]
38-
#![feature(generic_nonzero)]
3938
#![feature(if_let_guard)]
4039
#![feature(inline_const)]
4140
#![feature(iter_from_coroutine)]

compiler/rustc_passes/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#![doc(rust_logo)]
99
#![feature(rustdoc_internals)]
1010
#![allow(internal_features)]
11-
#![feature(generic_nonzero)]
1211
#![feature(let_chains)]
1312
#![feature(map_try_insert)]
1413
#![feature(try_blocks)]

compiler/rustc_query_impl/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
44
#![doc(rust_logo)]
55
#![feature(rustdoc_internals)]
6-
#![feature(generic_nonzero)]
76
#![feature(min_specialization)]
87
#![feature(rustc_attrs)]
98
#![allow(rustc::potential_query_instability, unused_parens)]

compiler/rustc_query_system/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#![feature(assert_matches)]
22
#![feature(core_intrinsics)]
3-
#![feature(generic_nonzero)]
43
#![feature(hash_raw_entry)]
54
#![feature(min_specialization)]
65
#![feature(let_chains)]

compiler/rustc_serialize/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
#![cfg_attr(bootstrap, feature(associated_type_bounds))]
1212
#![feature(const_option)]
1313
#![feature(core_intrinsics)]
14-
#![feature(generic_nonzero)]
1514
#![feature(inline_const)]
1615
#![feature(min_specialization)]
1716
#![feature(never_type)]

compiler/rustc_session/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![feature(generic_nonzero)]
21
#![feature(let_chains)]
32
#![feature(lazy_cell)]
43
#![feature(option_get_or_insert_default)]

library/alloc/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@
126126
#![feature(extend_one)]
127127
#![feature(fmt_internals)]
128128
#![feature(fn_traits)]
129-
#![feature(generic_nonzero)]
130129
#![feature(hasher_prefixfree_extras)]
131130
#![feature(hint_assert_unchecked)]
132131
#![feature(inline_const)]

library/alloc/tests/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#![feature(core_intrinsics)]
1515
#![feature(extract_if)]
1616
#![feature(exact_size_is_empty)]
17-
#![feature(generic_nonzero)]
1817
#![feature(linked_list_cursors)]
1918
#![feature(map_try_insert)]
2019
#![feature(new_uninit)]

library/core/src/array/mod.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,8 @@ impl<T, const N: usize> [T; N] {
512512
/// # Examples
513513
///
514514
/// ```
515-
/// #![feature(array_try_map, generic_nonzero)]
515+
/// #![feature(array_try_map)]
516+
///
516517
/// let a = ["1", "2", "3"];
517518
/// let b = a.try_map(|v| v.parse::<u32>()).unwrap().map(|v| v + 1);
518519
/// assert_eq!(b, [2, 3, 4]);
@@ -522,8 +523,10 @@ impl<T, const N: usize> [T; N] {
522523
/// assert!(b.is_err());
523524
///
524525
/// use std::num::NonZero;
526+
///
525527
/// let z = [1, 2, 0, 3, 4];
526528
/// assert_eq!(z.try_map(NonZero::new), None);
529+
///
527530
/// let a = [1, 2, 3];
528531
/// let b = a.try_map(NonZero::new);
529532
/// let c = b.map(|x| x.map(NonZero::get));

library/core/src/iter/traits/double_ended.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ pub trait DoubleEndedIterator: Iterator {
118118
/// Basic usage:
119119
///
120120
/// ```
121-
/// #![feature(generic_nonzero, iter_advance_by)]
121+
/// #![feature(iter_advance_by)]
122+
///
122123
/// use std::num::NonZero;
123124
///
124125
/// let a = [3, 4, 5, 6];

library/core/src/iter/traits/iterator.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,8 @@ pub trait Iterator {
288288
/// # Examples
289289
///
290290
/// ```
291-
/// #![feature(generic_nonzero, iter_advance_by)]
291+
/// #![feature(iter_advance_by)]
292+
///
292293
/// use std::num::NonZero;
293294
///
294295
/// let a = [1, 2, 3, 4];
@@ -2939,7 +2940,8 @@ pub trait Iterator {
29392940
/// This also supports other types which implement [`Try`], not just [`Result`].
29402941
///
29412942
/// ```
2942-
/// #![feature(generic_nonzero, try_find)]
2943+
/// #![feature(try_find)]
2944+
///
29432945
/// use std::num::NonZero;
29442946
///
29452947
/// let a = [3, 5, 7, 4, 9, 0, 11u32];

library/core/src/num/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,15 @@ pub use error::ParseIntError;
6767
)]
6868
pub use nonzero::ZeroablePrimitive;
6969

70-
#[unstable(feature = "generic_nonzero", issue = "120257")]
70+
#[stable(feature = "generic_nonzero", since = "CURRENT_RUSTC_VERSION")]
7171
pub use nonzero::NonZero;
7272

73-
#[stable(feature = "nonzero", since = "1.28.0")]
74-
pub use nonzero::{NonZeroU128, NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU8, NonZeroUsize};
75-
7673
#[stable(feature = "signed_nonzero", since = "1.34.0")]
7774
pub use nonzero::{NonZeroI128, NonZeroI16, NonZeroI32, NonZeroI64, NonZeroI8, NonZeroIsize};
7875

76+
#[stable(feature = "nonzero", since = "1.28.0")]
77+
pub use nonzero::{NonZeroU128, NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU8, NonZeroUsize};
78+
7979
#[stable(feature = "try_from", since = "1.34.0")]
8080
pub use error::TryFromIntError;
8181

library/core/src/num/nonzero.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,11 @@ impl_zeroable_primitive!(
105105
/// For example, `Option<NonZero<u32>>` is the same size as `u32`:
106106
///
107107
/// ```
108-
/// #![feature(generic_nonzero)]
109-
/// use core::mem::size_of;
108+
/// use core::{mem::size_of, num::NonZero};
110109
///
111-
/// assert_eq!(size_of::<Option<core::num::NonZero<u32>>>(), size_of::<u32>());
110+
/// assert_eq!(size_of::<Option<NonZero<u32>>>(), size_of::<u32>());
112111
/// ```
113-
#[unstable(feature = "generic_nonzero", issue = "120257")]
112+
#[stable(feature = "generic_nonzero", since = "CURRENT_RUSTC_VERSION")]
114113
#[repr(transparent)]
115114
#[rustc_nonnull_optimization_guaranteed]
116115
#[rustc_diagnostic_item = "NonZero"]
@@ -562,7 +561,8 @@ macro_rules! nonzero_integer {
562561
/// Basic usage:
563562
///
564563
/// ```
565-
/// #![feature(generic_nonzero, non_zero_count_ones)]
564+
/// #![feature(non_zero_count_ones)]
565+
///
566566
/// # fn main() { test().unwrap(); }
567567
/// # fn test() -> Option<()> {
568568
/// # use std::num::*;

library/core/tests/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
#![feature(float_minimum_maximum)]
4343
#![feature(future_join)]
4444
#![feature(generic_assert_internals)]
45-
#![feature(generic_nonzero)]
4645
#![feature(array_try_from_fn)]
4746
#![feature(hasher_prefixfree_extras)]
4847
#![feature(hashmap_internals)]

library/proc_macro/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#![feature(staged_api)]
2727
#![feature(allow_internal_unstable)]
2828
#![feature(decl_macro)]
29-
#![feature(generic_nonzero)]
3029
#![feature(maybe_uninit_write_slice)]
3130
#![feature(negative_impls)]
3231
#![feature(new_uninit)]

library/std/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,6 @@
335335
#![feature(float_minimum_maximum)]
336336
#![feature(float_next_up_down)]
337337
#![feature(fmt_internals)]
338-
#![feature(generic_nonzero)]
339338
#![feature(hasher_prefixfree_extras)]
340339
#![feature(hashmap_internals)]
341340
#![feature(hint_assert_unchecked)]

library/std/src/num.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,12 @@ pub use core::num::{FpCategory, ParseFloatError, ParseIntError, TryFromIntError}
2323
)]
2424
pub use core::num::ZeroablePrimitive;
2525

26-
#[unstable(feature = "generic_nonzero", issue = "120257")]
26+
#[stable(feature = "generic_nonzero", since = "CURRENT_RUSTC_VERSION")]
2727
pub use core::num::NonZero;
2828

2929
#[stable(feature = "signed_nonzero", since = "1.34.0")]
3030
pub use core::num::{NonZeroI128, NonZeroI16, NonZeroI32, NonZeroI64, NonZeroI8, NonZeroIsize};
31+
3132
#[stable(feature = "nonzero", since = "1.28.0")]
3233
pub use core::num::{NonZeroU128, NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU8, NonZeroUsize};
3334

library/std/src/process.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1865,7 +1865,8 @@ impl ExitStatusError {
18651865
/// # Examples
18661866
///
18671867
/// ```
1868-
/// #![feature(exit_status_error, generic_nonzero)]
1868+
/// #![feature(exit_status_error)]
1869+
///
18691870
/// # if cfg!(unix) {
18701871
/// use std::num::NonZero;
18711872
/// use std::process::Command;

library/test/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#![unstable(feature = "test", issue = "50297")]
1818
#![doc(test(attr(deny(warnings))))]
1919
#![doc(rust_logo)]
20-
#![feature(generic_nonzero)]
2120
#![feature(rustdoc_internals)]
2221
#![feature(internal_output_capture)]
2322
#![feature(staged_api)]

src/tools/miri/src/bin/miri.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![feature(generic_nonzero)]
21
#![feature(rustc_private, stmt_expr_attributes)]
32
#![allow(
43
clippy::manual_range_contains,

src/tools/miri/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#![feature(cell_update)]
33
#![feature(const_option)]
44
#![feature(float_gamma)]
5-
#![feature(generic_nonzero)]
65
#![feature(map_try_insert)]
76
#![feature(never_type)]
87
#![feature(try_blocks)]

tests/codegen/array-equality.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//@ compile-flags: -O -Z merge-functions=disabled
22
//@ only-x86_64
33
#![crate_type = "lib"]
4-
#![feature(generic_nonzero)]
54

65
// CHECK-LABEL: @array_eq_value
76
#[no_mangle]

tests/codegen/enum/enum-debug-niche-2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// CHECK: {{.*}}DICompositeType{{.*}}tag: DW_TAG_variant_part,{{.*}}size: 32,{{.*}}
88
// CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}name: "Placeholder",{{.*}}extraData: i128 4294967295{{[,)].*}}
99
// CHECK: {{.*}}DIDerivedType{{.*}}tag: DW_TAG_member,{{.*}}name: "Error",{{.*}}extraData: i128 0{{[,)].*}}
10-
#![feature(generic_nonzero, never_type)]
10+
#![feature(never_type)]
1111

1212
#[derive(Copy, Clone)]
1313
pub struct Entity {

tests/codegen/function-arguments.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//@ compile-flags: -O -C no-prepopulate-passes
22
#![crate_type = "lib"]
33
#![feature(dyn_star)]
4-
#![feature(generic_nonzero)]
54
#![feature(allocator_api)]
65

76
use std::mem::MaybeUninit;

tests/codegen/intrinsics/transmute-niched.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
//@ [DBG] compile-flags: -C opt-level=0 -C no-prepopulate-passes
44
//@ only-64bit (so I don't need to worry about usize)
55
#![crate_type = "lib"]
6-
#![feature(generic_nonzero)]
76

87
use std::mem::transmute;
98
use std::num::NonZero;

tests/codegen/issues/issue-119422.rs

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
//@ compile-flags: -O --edition=2021 -Zmerge-functions=disabled
55
//@ only-64bit (because the LLVM type of i64 for usize shows up)
66
#![crate_type = "lib"]
7-
#![feature(generic_nonzero)]
87

98
use core::ptr::NonNull;
109
use core::num::NonZero;

tests/codegen/loads.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//@ compile-flags: -C no-prepopulate-passes -Zmir-opt-level=0 -O
22

33
#![crate_type = "lib"]
4-
#![feature(generic_nonzero)]
54

65
use std::mem::MaybeUninit;
76
use std::num::NonZero;

tests/codegen/option-as-slice.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//@ compile-flags: -O -Z randomize-layout=no
22
//@ only-x86_64
33
#![crate_type = "lib"]
4-
#![feature(generic_nonzero)]
54

65
extern crate core;
76

tests/codegen/option-niche-eq.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
//@ compile-flags: -O -Zmerge-functions=disabled
22
//@ min-llvm-version: 18
33
#![crate_type = "lib"]
4-
#![feature(generic_nonzero)]
54

65
extern crate core;
76
use core::cmp::Ordering;

tests/codegen/slice-ref-equality.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//@ compile-flags: -O -Zmerge-functions=disabled
22
#![crate_type = "lib"]
3-
#![feature(generic_nonzero)]
43

54
use std::num::NonZero;
65

tests/codegen/transmute-optimized.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//@ compile-flags: -O -Z merge-functions=disabled
22
#![crate_type = "lib"]
3-
#![feature(generic_nonzero)]
43

54
// This tests that LLVM can optimize based on the niches in the source or
65
// destination types for transmutes.

tests/debuginfo/msvc-pretty-enums.rs

-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@
132132
// cdb-command: dx -r2 arbitrary_discr2,d
133133
// cdb-check: arbitrary_discr2,d : Def [Type: enum2$<msvc_pretty_enums::ArbitraryDiscr>]
134134
// cdb-check: [+0x[...]] __0 : 5678 [Type: unsigned int]
135-
#![feature(generic_nonzero)]
136135
#![feature(rustc_attrs)]
137136
#![feature(repr128)]
138137
#![feature(arbitrary_enum_discriminant)]

tests/debuginfo/numeric-types.rs

-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,6 @@
237237

238238
// lldb-command:v nz_usize
239239
// lldb-check:[...] 122 { __0 = { 0 = 122 } }
240-
#![feature(generic_nonzero)]
241240

242241
use std::num::*;
243242
use std::sync::atomic::*;

tests/mir-opt/instsimplify/combine_transmutes.rs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#![crate_type = "lib"]
44
#![feature(core_intrinsics)]
55
#![feature(custom_mir)]
6-
#![feature(generic_nonzero)]
76

87
use std::intrinsics::mir::*;
98
use std::mem::{MaybeUninit, ManuallyDrop, transmute};

0 commit comments

Comments
 (0)