mirror of
https://github.com/rust-lang/rust.git
synced 2025-12-02 09:27:51 +00:00
Contract variables can be declared in the `requires` clause and can be referenced both in `requires` and `ensures`, subject to usual borrow checking rules. This allows any setup common to both the `requires` and `ensures` clauses to only be done once.
19 lines
671 B
Plaintext
19 lines
671 B
Plaintext
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
|
|
--> $DIR/requires-bool-expr-with-semicolon.rs:3: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
|
|
|
|
error[E0308]: mismatched types
|
|
--> $DIR/requires-bool-expr-with-semicolon.rs:9:1
|
|
|
|
|
LL | #[requires(true;)]
|
|
| ^^^^^^^^^^^^^^^^^^ expected `bool`, found `()`
|
|
|
|
error: aborting due to 1 previous error; 1 warning emitted
|
|
|
|
For more information about this error, try `rustc --explain E0308`.
|