Given the following lib.rs:
fn foo() {}
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
let x = [0u8];
assert_eq!((&x[..]).as_ref(), []);
}
}
Running cargo check --tests succeeds. However, if we add an attribute, #[cfg_attr(test, mutagen::mutate)], to fn foo() {}, then cargo check --tests fails:
error[E0282]: type annotations needed
--> src/lib.rs:9:2
|
9 | assert_eq!((&x[..]).as_ref(), []);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type
|
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
Version information
Using Mutagen pulled from this repository at 94321e5.
$ cargo version
cargo 1.43.0-nightly (bda50510d 2020-03-02)
Given the following
lib.rs:Running
cargo check --testssucceeds. However, if we add an attribute,#[cfg_attr(test, mutagen::mutate)], tofn foo() {}, thencargo check --testsfails:Version information
Using Mutagen pulled from this repository at 94321e5.