Skip to content

Commit 3ff3a1e

Browse files
committed
Stabilize strict_overflow_ops
1 parent e5e79f8 commit 3ff3a1e

File tree

4 files changed

+56
-89
lines changed

4 files changed

+56
-89
lines changed

compiler/rustc_const_eval/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// tidy-alphabetical-start
22
#![allow(internal_features)]
33
#![allow(rustc::diagnostic_outside_of_impl)]
4+
#![cfg_attr(bootstrap, feature(strict_overflow_ops))]
45
#![doc(rust_logo)]
56
#![feature(assert_matches)]
67
#![feature(box_patterns)]
@@ -9,7 +10,6 @@
910
#![feature(never_type)]
1011
#![feature(rustdoc_internals)]
1112
#![feature(slice_ptr_get)]
12-
#![feature(strict_overflow_ops)]
1313
#![feature(trait_alias)]
1414
#![feature(try_blocks)]
1515
#![feature(unqualified_local_imports)]

library/core/src/num/int_macros.rs

Lines changed: 28 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -469,17 +469,16 @@ macro_rules! int_impl {
469469
/// # Examples
470470
///
471471
/// ```
472-
/// #![feature(strict_overflow_ops)]
473472
#[doc = concat!("assert_eq!((", stringify!($SelfT), "::MAX - 2).strict_add(1), ", stringify!($SelfT), "::MAX - 1);")]
474473
/// ```
475474
///
476475
/// The following panics because of overflow:
477476
///
478477
/// ```should_panic
479-
/// #![feature(strict_overflow_ops)]
480478
#[doc = concat!("let _ = (", stringify!($SelfT), "::MAX - 2).strict_add(3);")]
481479
/// ```
482-
#[unstable(feature = "strict_overflow_ops", issue = "118260")]
480+
#[stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")]
481+
#[rustc_const_stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")]
483482
#[must_use = "this returns the result of the operation, \
484483
without modifying the original"]
485484
#[inline]
@@ -560,17 +559,16 @@ macro_rules! int_impl {
560559
/// # Examples
561560
///
562561
/// ```
563-
/// #![feature(strict_overflow_ops)]
564562
#[doc = concat!("assert_eq!(1", stringify!($SelfT), ".strict_add_unsigned(2), 3);")]
565563
/// ```
566564
///
567565
/// The following panics because of overflow:
568566
///
569567
/// ```should_panic
570-
/// #![feature(strict_overflow_ops)]
571568
#[doc = concat!("let _ = (", stringify!($SelfT), "::MAX - 2).strict_add_unsigned(3);")]
572569
/// ```
573-
#[unstable(feature = "strict_overflow_ops", issue = "118260")]
570+
#[stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")]
571+
#[rustc_const_stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")]
574572
#[must_use = "this returns the result of the operation, \
575573
without modifying the original"]
576574
#[inline]
@@ -611,17 +609,16 @@ macro_rules! int_impl {
611609
/// # Examples
612610
///
613611
/// ```
614-
/// #![feature(strict_overflow_ops)]
615612
#[doc = concat!("assert_eq!((", stringify!($SelfT), "::MIN + 2).strict_sub(1), ", stringify!($SelfT), "::MIN + 1);")]
616613
/// ```
617614
///
618615
/// The following panics because of overflow:
619616
///
620617
/// ```should_panic
621-
/// #![feature(strict_overflow_ops)]
622618
#[doc = concat!("let _ = (", stringify!($SelfT), "::MIN + 2).strict_sub(3);")]
623619
/// ```
624-
#[unstable(feature = "strict_overflow_ops", issue = "118260")]
620+
#[stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")]
621+
#[rustc_const_stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")]
625622
#[must_use = "this returns the result of the operation, \
626623
without modifying the original"]
627624
#[inline]
@@ -702,17 +699,16 @@ macro_rules! int_impl {
702699
/// # Examples
703700
///
704701
/// ```
705-
/// #![feature(strict_overflow_ops)]
706702
#[doc = concat!("assert_eq!(1", stringify!($SelfT), ".strict_sub_unsigned(2), -1);")]
707703
/// ```
708704
///
709705
/// The following panics because of overflow:
710706
///
711707
/// ```should_panic
712-
/// #![feature(strict_overflow_ops)]
713708
#[doc = concat!("let _ = (", stringify!($SelfT), "::MIN + 2).strict_sub_unsigned(3);")]
714709
/// ```
715-
#[unstable(feature = "strict_overflow_ops", issue = "118260")]
710+
#[stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")]
711+
#[rustc_const_stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")]
716712
#[must_use = "this returns the result of the operation, \
717713
without modifying the original"]
718714
#[inline]
@@ -753,17 +749,16 @@ macro_rules! int_impl {
753749
/// # Examples
754750
///
755751
/// ```
756-
/// #![feature(strict_overflow_ops)]
757752
#[doc = concat!("assert_eq!(", stringify!($SelfT), "::MAX.strict_mul(1), ", stringify!($SelfT), "::MAX);")]
758753
/// ```
759754
///
760755
/// The following panics because of overflow:
761756
///
762757
/// ``` should_panic
763-
/// #![feature(strict_overflow_ops)]
764758
#[doc = concat!("let _ = ", stringify!($SelfT), "::MAX.strict_mul(2);")]
765759
/// ```
766-
#[unstable(feature = "strict_overflow_ops", issue = "118260")]
760+
#[stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")]
761+
#[rustc_const_stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")]
767762
#[must_use = "this returns the result of the operation, \
768763
without modifying the original"]
769764
#[inline]
@@ -855,24 +850,22 @@ macro_rules! int_impl {
855850
/// # Examples
856851
///
857852
/// ```
858-
/// #![feature(strict_overflow_ops)]
859853
#[doc = concat!("assert_eq!((", stringify!($SelfT), "::MIN + 1).strict_div(-1), ", stringify!($Max), ");")]
860854
/// ```
861855
///
862856
/// The following panics because of overflow:
863857
///
864858
/// ```should_panic
865-
/// #![feature(strict_overflow_ops)]
866859
#[doc = concat!("let _ = ", stringify!($SelfT), "::MIN.strict_div(-1);")]
867860
/// ```
868861
///
869862
/// The following panics because of division by zero:
870863
///
871864
/// ```should_panic
872-
/// #![feature(strict_overflow_ops)]
873865
#[doc = concat!("let _ = (1", stringify!($SelfT), ").strict_div(0);")]
874866
/// ```
875-
#[unstable(feature = "strict_overflow_ops", issue = "118260")]
867+
#[stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")]
868+
#[rustc_const_stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")]
876869
#[must_use = "this returns the result of the operation, \
877870
without modifying the original"]
878871
#[inline]
@@ -924,24 +917,22 @@ macro_rules! int_impl {
924917
/// # Examples
925918
///
926919
/// ```
927-
/// #![feature(strict_overflow_ops)]
928920
#[doc = concat!("assert_eq!((", stringify!($SelfT), "::MIN + 1).strict_div_euclid(-1), ", stringify!($Max), ");")]
929921
/// ```
930922
///
931923
/// The following panics because of overflow:
932924
///
933925
/// ```should_panic
934-
/// #![feature(strict_overflow_ops)]
935926
#[doc = concat!("let _ = ", stringify!($SelfT), "::MIN.strict_div_euclid(-1);")]
936927
/// ```
937928
///
938929
/// The following panics because of division by zero:
939930
///
940931
/// ```should_panic
941-
/// #![feature(strict_overflow_ops)]
942932
#[doc = concat!("let _ = (1", stringify!($SelfT), ").strict_div_euclid(0);")]
943933
/// ```
944-
#[unstable(feature = "strict_overflow_ops", issue = "118260")]
934+
#[stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")]
935+
#[rustc_const_stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")]
945936
#[must_use = "this returns the result of the operation, \
946937
without modifying the original"]
947938
#[inline]
@@ -1092,24 +1083,22 @@ macro_rules! int_impl {
10921083
/// # Examples
10931084
///
10941085
/// ```
1095-
/// #![feature(strict_overflow_ops)]
10961086
#[doc = concat!("assert_eq!(5", stringify!($SelfT), ".strict_rem(2), 1);")]
10971087
/// ```
10981088
///
10991089
/// The following panics because of division by zero:
11001090
///
11011091
/// ```should_panic
1102-
/// #![feature(strict_overflow_ops)]
11031092
#[doc = concat!("let _ = 5", stringify!($SelfT), ".strict_rem(0);")]
11041093
/// ```
11051094
///
11061095
/// The following panics because of overflow:
11071096
///
11081097
/// ```should_panic
1109-
/// #![feature(strict_overflow_ops)]
11101098
#[doc = concat!("let _ = ", stringify!($SelfT), "::MIN.strict_rem(-1);")]
11111099
/// ```
1112-
#[unstable(feature = "strict_overflow_ops", issue = "118260")]
1100+
#[stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")]
1101+
#[rustc_const_stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")]
11131102
#[must_use = "this returns the result of the operation, \
11141103
without modifying the original"]
11151104
#[inline]
@@ -1160,24 +1149,22 @@ macro_rules! int_impl {
11601149
/// # Examples
11611150
///
11621151
/// ```
1163-
/// #![feature(strict_overflow_ops)]
11641152
#[doc = concat!("assert_eq!(5", stringify!($SelfT), ".strict_rem_euclid(2), 1);")]
11651153
/// ```
11661154
///
11671155
/// The following panics because of division by zero:
11681156
///
11691157
/// ```should_panic
1170-
/// #![feature(strict_overflow_ops)]
11711158
#[doc = concat!("let _ = 5", stringify!($SelfT), ".strict_rem_euclid(0);")]
11721159
/// ```
11731160
///
11741161
/// The following panics because of overflow:
11751162
///
11761163
/// ```should_panic
1177-
/// #![feature(strict_overflow_ops)]
11781164
#[doc = concat!("let _ = ", stringify!($SelfT), "::MIN.strict_rem_euclid(-1);")]
11791165
/// ```
1180-
#[unstable(feature = "strict_overflow_ops", issue = "118260")]
1166+
#[stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")]
1167+
#[rustc_const_stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")]
11811168
#[must_use = "this returns the result of the operation, \
11821169
without modifying the original"]
11831170
#[inline]
@@ -1249,17 +1236,16 @@ macro_rules! int_impl {
12491236
/// # Examples
12501237
///
12511238
/// ```
1252-
/// #![feature(strict_overflow_ops)]
12531239
#[doc = concat!("assert_eq!(5", stringify!($SelfT), ".strict_neg(), -5);")]
12541240
/// ```
12551241
///
12561242
/// The following panics because of overflow:
12571243
///
12581244
/// ```should_panic
1259-
/// #![feature(strict_overflow_ops)]
12601245
#[doc = concat!("let _ = ", stringify!($SelfT), "::MIN.strict_neg();")]
12611246
///
1262-
#[unstable(feature = "strict_overflow_ops", issue = "118260")]
1247+
#[stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")]
1248+
#[rustc_const_stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")]
12631249
#[must_use = "this returns the result of the operation, \
12641250
without modifying the original"]
12651251
#[inline]
@@ -1306,17 +1292,16 @@ macro_rules! int_impl {
13061292
/// # Examples
13071293
///
13081294
/// ```
1309-
/// #![feature(strict_overflow_ops)]
13101295
#[doc = concat!("assert_eq!(0x1", stringify!($SelfT), ".strict_shl(4), 0x10);")]
13111296
/// ```
13121297
///
13131298
/// The following panics because of overflow:
13141299
///
13151300
/// ```should_panic
1316-
/// #![feature(strict_overflow_ops)]
13171301
#[doc = concat!("let _ = 0x1", stringify!($SelfT), ".strict_shl(129);")]
13181302
/// ```
1319-
#[unstable(feature = "strict_overflow_ops", issue = "118260")]
1303+
#[stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")]
1304+
#[rustc_const_stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")]
13201305
#[must_use = "this returns the result of the operation, \
13211306
without modifying the original"]
13221307
#[inline]
@@ -1422,17 +1407,16 @@ macro_rules! int_impl {
14221407
/// # Examples
14231408
///
14241409
/// ```
1425-
/// #![feature(strict_overflow_ops)]
14261410
#[doc = concat!("assert_eq!(0x10", stringify!($SelfT), ".strict_shr(4), 0x1);")]
14271411
/// ```
14281412
///
14291413
/// The following panics because of overflow:
14301414
///
14311415
/// ```should_panic
1432-
/// #![feature(strict_overflow_ops)]
14331416
#[doc = concat!("let _ = 0x10", stringify!($SelfT), ".strict_shr(128);")]
14341417
/// ```
1435-
#[unstable(feature = "strict_overflow_ops", issue = "118260")]
1418+
#[stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")]
1419+
#[rustc_const_stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")]
14361420
#[must_use = "this returns the result of the operation, \
14371421
without modifying the original"]
14381422
#[inline]
@@ -1542,17 +1526,16 @@ macro_rules! int_impl {
15421526
/// # Examples
15431527
///
15441528
/// ```
1545-
/// #![feature(strict_overflow_ops)]
15461529
#[doc = concat!("assert_eq!((-5", stringify!($SelfT), ").strict_abs(), 5);")]
15471530
/// ```
15481531
///
15491532
/// The following panics because of overflow:
15501533
///
15511534
/// ```should_panic
1552-
/// #![feature(strict_overflow_ops)]
15531535
#[doc = concat!("let _ = ", stringify!($SelfT), "::MIN.strict_abs();")]
15541536
/// ```
1555-
#[unstable(feature = "strict_overflow_ops", issue = "118260")]
1537+
#[stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")]
1538+
#[rustc_const_stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")]
15561539
#[must_use = "this returns the result of the operation, \
15571540
without modifying the original"]
15581541
#[inline]
@@ -1612,17 +1595,16 @@ macro_rules! int_impl {
16121595
/// # Examples
16131596
///
16141597
/// ```
1615-
/// #![feature(strict_overflow_ops)]
16161598
#[doc = concat!("assert_eq!(8", stringify!($SelfT), ".strict_pow(2), 64);")]
16171599
/// ```
16181600
///
16191601
/// The following panics because of overflow:
16201602
///
16211603
/// ```should_panic
1622-
/// #![feature(strict_overflow_ops)]
16231604
#[doc = concat!("let _ = ", stringify!($SelfT), "::MAX.strict_pow(2);")]
16241605
/// ```
1625-
#[unstable(feature = "strict_overflow_ops", issue = "118260")]
1606+
#[stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")]
1607+
#[rustc_const_stable(feature = "strict_overflow_ops", since = "CURRENT_RUSTC_VERSION")]
16261608
#[must_use = "this returns the result of the operation, \
16271609
without modifying the original"]
16281610
#[inline]

0 commit comments

Comments
 (0)