From 2b68f007223a5ec773fb2e220f147debe225db23 Mon Sep 17 00:00:00 2001 From: Michael Wright Date: Fri, 23 Mar 2018 20:26:52 +0200 Subject: [PATCH] Add tests to ensure that issue #2420 is resolved The issue was probably fixed by ff32d5f7. Closes #2420. --- tests/ui/eq_op.rs | 6 ++++++ tests/ui/eq_op.stderr | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/tests/ui/eq_op.rs b/tests/ui/eq_op.rs index 70c932a6cdf..ef573b2b91a 100644 --- a/tests/ui/eq_op.rs +++ b/tests/ui/eq_op.rs @@ -89,6 +89,12 @@ fn main() { let z = x & &y; check_ignore_macro(); + + // named constants + const A: u32 = 10; + const B: u32 = 10; + const C: u32 = A / B; // ok, different named constants + const D: u32 = A / A; } macro_rules! check_if_named_foo { diff --git a/tests/ui/eq_op.stderr b/tests/ui/eq_op.stderr index 46c0ac108cd..ccf36606208 100644 --- a/tests/ui/eq_op.stderr +++ b/tests/ui/eq_op.stderr @@ -204,5 +204,11 @@ error: taken reference of right operand | = note: `-D op-ref` implied by `-D warnings` -error: aborting due to 33 previous errors +error: equal expressions as operands to `/` + --> $DIR/eq_op.rs:97:20 + | +97 | const D: u32 = A / A; + | ^^^^^ + +error: aborting due to 34 previous errors