Skip to content

Using mutagen breaks type inference in the existing program #164

Description

@joshlf

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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions