File tree 2 files changed +31
-0
lines changed
2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change 1
1
//! Unstable module containing the unstable contracts lang items and attribute macros.
2
2
3
+ #[ cfg( not( bootstrap) ) ]
4
+ pub use crate :: macros:: builtin:: contracts_ensures as ensures;
5
+ #[ cfg( not( bootstrap) ) ]
6
+ pub use crate :: macros:: builtin:: contracts_requires as requires;
7
+
3
8
/// Emitted by rustc as a desugaring of `#[requires(PRED)] fn foo(x: X) { ... }`
4
9
/// into: `fn foo(x: X) { check_requires(|| PRED) ... }`
5
10
#[ cfg( not( bootstrap) ) ]
Original file line number Diff line number Diff line change @@ -1777,6 +1777,32 @@ pub(crate) mod builtin {
1777
1777
/* compiler built-in */
1778
1778
}
1779
1779
1780
+ /// Attribute macro applied to a function to give it a post-condition.
1781
+ ///
1782
+ /// The attribute carries an argument token-tree which is
1783
+ /// eventually parsed as a unary closure expression that is
1784
+ /// invoked on a reference to the return value.
1785
+ #[ cfg( not( bootstrap) ) ]
1786
+ #[ unstable( feature = "rustc_contracts" , issue = "none" ) ]
1787
+ #[ allow_internal_unstable( core_intrinsics) ]
1788
+ #[ rustc_builtin_macro]
1789
+ pub macro contracts_ensures( $item: item) {
1790
+ /* compiler built-in */
1791
+ }
1792
+
1793
+ /// Attribute macro applied to a function to give it a precondition.
1794
+ ///
1795
+ /// The attribute carries an argument token-tree which is
1796
+ /// eventually parsed as an boolean expression with access to the
1797
+ /// function's formal parameters
1798
+ #[ cfg( not( bootstrap) ) ]
1799
+ #[ unstable( feature = "rustc_contracts" , issue = "none" ) ]
1800
+ #[ allow_internal_unstable( core_intrinsics) ]
1801
+ #[ rustc_builtin_macro]
1802
+ pub macro contracts_requires( $item: item) {
1803
+ /* compiler built-in */
1804
+ }
1805
+
1780
1806
/// Attribute macro applied to a function to register it as a handler for allocation failure.
1781
1807
///
1782
1808
/// See also [`std::alloc::handle_alloc_error`](../../../std/alloc/fn.handle_alloc_error.html).
You can’t perform that action at this time.
0 commit comments