diff --git a/tests/ui/matches.rs b/tests/ui/matches.rs index f15a57c4f856..7da2858d6ecd 100644 --- a/tests/ui/matches.rs +++ b/tests/ui/matches.rs @@ -285,6 +285,14 @@ fn match_wild_err_arm() { Err(_) => println!("err") } + // this is a current false positive, see #1996 + match x { + Ok(3) => println!("ok"), + Ok(x) if x*x == 64 => println!("ok 64"), + Ok(_) => println!("ok"), + Err(_) => println!("err") + } + match (x, Some(1i32)) { (Ok(x), Some(_)) => println!("ok {}", x), (Ok(_), Some(x)) => println!("ok {}", x), diff --git a/tests/ui/matches.stderr b/tests/ui/matches.stderr index cc7c5a4fee22..49c0e900d061 100644 --- a/tests/ui/matches.stderr +++ b/tests/ui/matches.stderr @@ -391,20 +391,38 @@ note: consider refactoring into `Ok(3) | Ok(_)` = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: this `match` has identical arm bodies - --> $DIR/matches.rs:290:29 + --> $DIR/matches.rs:292:18 | -290 | (Ok(_), Some(x)) => println!("ok {}", x), +292 | Ok(_) => println!("ok"), + | ^^^^^^^^^^^^^^ + | +note: same as this + --> $DIR/matches.rs:290:18 + | +290 | Ok(3) => println!("ok"), + | ^^^^^^^^^^^^^^ +note: consider refactoring into `Ok(3) | Ok(_)` + --> $DIR/matches.rs:290:18 + | +290 | Ok(3) => println!("ok"), + | ^^^^^^^^^^^^^^ + = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) + +error: this `match` has identical arm bodies + --> $DIR/matches.rs:298:29 + | +298 | (Ok(_), Some(x)) => println!("ok {}", x), | ^^^^^^^^^^^^^^^^^^^^ | note: same as this - --> $DIR/matches.rs:289:29 + --> $DIR/matches.rs:297:29 | -289 | (Ok(x), Some(_)) => println!("ok {}", x), +297 | (Ok(x), Some(_)) => println!("ok {}", x), | ^^^^^^^^^^^^^^^^^^^^ note: consider refactoring into `(Ok(x), Some(_)) | (Ok(_), Some(x))` - --> $DIR/matches.rs:289:29 + --> $DIR/matches.rs:297:29 | -289 | (Ok(x), Some(_)) => println!("ok {}", x), +297 | (Ok(x), Some(_)) => println!("ok {}", x), | ^^^^^^^^^^^^^^^^^^^^ = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)