Desugars contract into the internal AST extensions

Check ensures on early return due to Try / Yeet

Expand these two expressions to include a call to contract checking
This commit is contained in:
Felix S. Klock II
2024-12-03 02:52:29 +00:00
committed by Celina G. Val
parent 38eff16d0a
commit ae7eff0be5
12 changed files with 457 additions and 88 deletions

View File

@@ -1,5 +1,10 @@
//! Unstable module containing the unstable contracts lang items and attribute macros.
#[cfg(not(bootstrap))]
pub use crate::macros::builtin::contracts_ensures as ensures;
#[cfg(not(bootstrap))]
pub use crate::macros::builtin::contracts_requires as requires;
/// Emitted by rustc as a desugaring of `#[requires(PRED)] fn foo(x: X) { ... }`
/// into: `fn foo(x: X) { check_requires(|| PRED) ... }`
#[cfg(not(bootstrap))]