Skip to content

Commit bdae382

Browse files
pnkfelixgitbot
authored andcommitted
Separate contract feature gates for the internal machinery
The extended syntax for function signature that includes contract clauses should never be user exposed versus the interface we want to ship externally eventually.
1 parent 394dcb3 commit bdae382

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

core/src/contracts.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pub use crate::macros::builtin::contracts_requires as requires;
88
/// Emitted by rustc as a desugaring of `#[requires(PRED)] fn foo(x: X) { ... }`
99
/// into: `fn foo(x: X) { check_requires(|| PRED) ... }`
1010
#[cfg(not(bootstrap))]
11-
#[unstable(feature = "rustc_contracts", issue = "none" /* compiler-team#759 */)]
11+
#[unstable(feature = "rustc_contracts_internals", issue = "133866" /* compiler-team#759 */)]
1212
#[lang = "contract_check_requires"]
1313
#[track_caller]
1414
pub fn check_requires<C: FnOnce() -> bool>(c: C) {
@@ -21,7 +21,7 @@ pub fn check_requires<C: FnOnce() -> bool>(c: C) {
2121
/// into: `fn foo() { let _check = build_check_ensures(|ret| PRED) ... [return _check(R);] ... }`
2222
/// (including the implicit return of the tail expression, if any).
2323
#[cfg(not(bootstrap))]
24-
#[unstable(feature = "rustc_contracts", issue = "none" /* compiler-team#759 */)]
24+
#[unstable(feature = "rustc_contracts_internals", issue = "133866" /* compiler-team#759 */)]
2525
#[lang = "contract_build_check_ensures"]
2626
#[track_caller]
2727
pub fn build_check_ensures<Ret, C>(c: C) -> impl (FnOnce(Ret) -> Ret) + Copy

core/src/intrinsics/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4051,8 +4051,8 @@ pub const unsafe fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize)
40514051
/// checking is turned on, so that we can specify contracts in libstd
40524052
/// and let an end user opt into turning them on.
40534053
#[cfg(not(bootstrap))]
4054-
#[rustc_const_unstable(feature = "rustc_contracts", issue = "none" /* compiler-team#759 */)]
4055-
#[unstable(feature = "rustc_contracts", issue = "none" /* compiler-team#759 */)]
4054+
#[rustc_const_unstable(feature = "rustc_contracts_internals", issue = "133866" /* compiler-team#759 */)]
4055+
#[unstable(feature = "rustc_contracts_internals", issue = "133866" /* compiler-team#759 */)]
40564056
#[inline(always)]
40574057
#[rustc_intrinsic]
40584058
pub const fn contract_checks() -> bool {
@@ -4063,14 +4063,14 @@ pub const fn contract_checks() -> bool {
40634063
}
40644064

40654065
#[cfg(not(bootstrap))]
4066-
#[unstable(feature = "rustc_contracts", issue = "none" /* compiler-team#759 */)]
4066+
#[unstable(feature = "rustc_contracts_internals", issue = "133866" /* compiler-team#759 */)]
40674067
#[rustc_intrinsic]
40684068
pub fn contract_check_requires<C: FnOnce() -> bool>(c: C) -> bool {
40694069
c()
40704070
}
40714071

40724072
#[cfg(not(bootstrap))]
4073-
#[unstable(feature = "rustc_contracts", issue = "none" /* compiler-team#759 */)]
4073+
#[unstable(feature = "rustc_contracts_internals", issue = "133866" /* compiler-team#759 */)]
40744074
#[rustc_intrinsic]
40754075
pub fn contract_check_ensures<'a, Ret, C: FnOnce(&'a Ret) -> bool>(ret: &'a Ret, c: C) -> bool {
40764076
c(ret)

core/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ pub mod autodiff {
248248
}
249249

250250
#[cfg(not(bootstrap))]
251-
#[unstable(feature = "rustc_contracts", issue = "none")]
251+
#[unstable(feature = "rustc_contracts", issue = "133866")]
252252
pub mod contracts;
253253

254254
#[unstable(feature = "cfg_match", issue = "115585")]

core/src/macros/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1783,8 +1783,8 @@ pub(crate) mod builtin {
17831783
/// eventually parsed as a unary closure expression that is
17841784
/// invoked on a reference to the return value.
17851785
#[cfg(not(bootstrap))]
1786-
#[unstable(feature = "rustc_contracts", issue = "none")]
1787-
#[allow_internal_unstable(core_intrinsics)]
1786+
#[unstable(feature = "rustc_contracts", issue = "133866")]
1787+
#[allow_internal_unstable(rustc_contracts_internals)]
17881788
#[rustc_builtin_macro]
17891789
pub macro contracts_ensures($item:item) {
17901790
/* compiler built-in */
@@ -1796,8 +1796,8 @@ pub(crate) mod builtin {
17961796
/// eventually parsed as an boolean expression with access to the
17971797
/// function's formal parameters
17981798
#[cfg(not(bootstrap))]
1799-
#[unstable(feature = "rustc_contracts", issue = "none")]
1800-
#[allow_internal_unstable(core_intrinsics)]
1799+
#[unstable(feature = "rustc_contracts", issue = "133866")]
1800+
#[allow_internal_unstable(rustc_contracts_internals)]
18011801
#[rustc_builtin_macro]
18021802
pub macro contracts_requires($item:item) {
18031803
/* compiler built-in */

0 commit comments

Comments
 (0)