frozenlib / test-strategy

Procedural macro to easily write higher-order strategies in proptest.
Apache License 2.0
44 stars 10 forks source link

`proptest` macro removes `mut` from function arguments bindings #3

Closed eugene-babichenko closed 3 years ago

eugene-babichenko commented 3 years ago

Consider this example:

#[proptest]
fn test(mut a: u8) {
    a = 1;
}

This will give an error saying that a is immutable although it is declared as mutable.

frozenlib commented 3 years ago

Is it an error like the following?

error[E0384]: cannot assign twice to immutable variable `a`
 --> src\lib.rs:4:5
  |
3 | fn test(mut a: u8) {
  |             -
  |             |
  |             first assignment to `a`
  |             help: consider making this binding mutable: `mut a`
4 |     a = 1;
  |     ^^^^^ cannot assign twice to immutable variable

I fixed this problem in #2 , so try using version 0.1.2, which includes this fix.