diff options
| author | Celina G. Val <celinval@amazon.com> | 2025-02-25 13:24:07 -0800 |
|---|---|---|
| committer | Celina G. Val <celinval@amazon.com> | 2025-04-07 11:17:33 -0700 |
| commit | b9754f9e7bfe2d8eed780962b550a25a87118ce4 (patch) | |
| tree | 1d8ef4bffc26b6918e8698db3bcfbebfb9f03d7f /compiler/rustc_hir/src/lang_items.rs | |
| parent | 5337252b9952fdd9482ed6a4add17254e5bd2c40 (diff) | |
| download | rust-b9754f9e7bfe2d8eed780962b550a25a87118ce4.tar.gz rust-b9754f9e7bfe2d8eed780962b550a25a87118ce4.zip | |
Enable contracts for const functions
Use `const_eval_select!()` macro to enable contract checking only at runtime. The existing contract logic relies on closures, which are not supported in constant functions. This commit also removes one level of indirection for ensures clauses, however, it currently has a spurious warning message when the bottom of the function is unreachable.
Diffstat (limited to 'compiler/rustc_hir/src/lang_items.rs')
| -rw-r--r-- | compiler/rustc_hir/src/lang_items.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/compiler/rustc_hir/src/lang_items.rs b/compiler/rustc_hir/src/lang_items.rs index 90fab01ba2d..fd15d054317 100644 --- a/compiler/rustc_hir/src/lang_items.rs +++ b/compiler/rustc_hir/src/lang_items.rs @@ -439,6 +439,8 @@ language_item_table! { DefaultTrait3, sym::default_trait3, default_trait3_trait, Target::Trait, GenericRequirement::None; DefaultTrait2, sym::default_trait2, default_trait2_trait, Target::Trait, GenericRequirement::None; DefaultTrait1, sym::default_trait1, default_trait1_trait, Target::Trait, GenericRequirement::None; + + ContractCheckEnsures, sym::contract_check_ensures, contract_check_ensures_fn, Target::Fn, GenericRequirement::None; } /// The requirement imposed on the generics of a lang item |
