File: contract-captures-via-closure-noncopy.stderr

package info (click to toggle)
rustc 1.86.0%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, forky, sid
  • size: 913,560 kB
  • sloc: xml: 158,127; python: 35,921; javascript: 19,689; sh: 19,600; cpp: 18,906; ansic: 13,124; asm: 4,376; makefile: 708; perl: 29; lisp: 29; ruby: 19; sql: 11
file content (36 lines) | stat: -rw-r--r-- 1,854 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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
   |
   = 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`.