Skip to content

assert_contains changed in a semantically-observable manner between 9.5 and 9.6 #11

@shepmaster

Description

@shepmaster
fn main() {
    let s = String::new();
    assertables::assert_contains!(s, "");
    assertables::assert_contains!(s, "");
}
% cargo update -p assertables --precise 9.5.0
    Updating crates.io index

% cargo run
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.01s
     Running `target/debug/repro`
% cargo update -p assertables --precise 9.6.0
    Updating crates.io index
    Updating assertables v9.5.0 -> v9.6.0

% cargo run
   Compiling repro v0.1.0 (/private/tmp/repro)
error[E0382]: use of moved value: `s`
 --> src/main.rs:4:35
  |
2 |     let s = String::new();
  |         - move occurs because `s` has type `String`, which does not implement the `Copy` trait
3 |     assertables::assert_contains!(s, "");
  |                                   - value moved here
4 |     assertables::assert_contains!(s, "");
  |                                   ^ value used here after move
  |
help: consider cloning the value if the performance cost is acceptable
  |
3 |     assertables::assert_contains!(s.clone(), "");
  |                                    ++++++++

For more information about this error, try `rustc --explain E0382`.
error: could not compile `repro` (bin "repro") due to 1 previous error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions