File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change 11//! Unstable module containing the unstable contracts lang items and attribute macros.
22
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+
38/// Emitted by rustc as a desugaring of `#[requires(PRED)] fn foo(x: X) { ... }`
49/// into: `fn foo(x: X) { check_requires(|| PRED) ... }`
510#[ cfg( not( bootstrap) ) ]
Original file line number Diff line number Diff line change @@ -1777,6 +1777,32 @@ pub(crate) mod builtin {
17771777 /* compiler built-in */
17781778 }
17791779
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+
17801806 /// Attribute macro applied to a function to register it as a handler for allocation failure.
17811807 ///
17821808 /// 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