
Invert the order that we pass the arguments to the `contract_check_ensures` function to avoid the warning when the tail of the function is unreachable. Note that the call itself is also unreachable, but we have already handled that case by ignoring unreachable call for contract calls.
37 lines
1.9 KiB
Text
37 lines
1.9 KiB
Text
warning: the feature `contracts` is incomplete and may not be safe to use and/or cause compiler crashes
|
|
--> $DIR/contract-captures-via-closure-noncopy.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[E0277]: the trait bound `Baz: std::marker::Copy` is not satisfied in `{closure@$DIR/contract-captures-via-closure-noncopy.rs:12:42: 12:57}`
|
|
--> $DIR/contract-captures-via-closure-noncopy.rs:12:1
|
|
|
|
|
LL | #[core::contracts::ensures({let old = x; move |ret:&Baz| ret.baz == old.baz*2 })]
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------------------------------------^^^^
|
|
| | |
|
|
| | within this `{closure@$DIR/contract-captures-via-closure-noncopy.rs:12:42: 12:57}`
|
|
| | this tail expression is of type `{closure@contract-captures-via-closure-noncopy.rs:12:42}`
|
|
| unsatisfied trait bound
|
|
| required by a bound introduced by this call
|
|
|
|
|
= help: within `{closure@$DIR/contract-captures-via-closure-noncopy.rs:12:42: 12:57}`, the trait `std::marker::Copy` is not implemented for `Baz`
|
|
note: required because it's used within this closure
|
|
--> $DIR/contract-captures-via-closure-noncopy.rs:12:42
|
|
|
|
|
LL | #[core::contracts::ensures({let old = x; move |ret:&Baz| ret.baz == old.baz*2 })]
|
|
| ^^^^^^^^^^^^^^^
|
|
note: required by a bound in `build_check_ensures`
|
|
--> $SRC_DIR/core/src/contracts.rs:LL:COL
|
|
help: consider annotating `Baz` with `#[derive(Copy)]`
|
|
|
|
|
LL + #[derive(Copy)]
|
|
LL | struct Baz {
|
|
|
|
|
|
|
error: aborting due to 1 previous error; 1 warning emitted
|
|
|
|
For more information about this error, try `rustc --explain E0277`.
|