
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.
11 lines
391 B
Text
11 lines
391 B
Text
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
|
|
--> $DIR/contract-const-fn.rs:17:12
|
|
|
|
|
LL | #![feature(contracts)]
|
|
| ^^^^^^^^^
|
|
|
|
|
= note: see issue #128044 <https://github.com/rust-lang/rust/issues/128044> for more information
|
|
= note: `#[warn(incomplete_features)]` on by default
|
|
|
|
warning: 1 warning emitted
|
|
|