diff --git a/tests/ui/mem_discriminant.rs b/tests/ui/mem_discriminant.rs index a7176fb7985..64d056fb2fe 100644 --- a/tests/ui/mem_discriminant.rs +++ b/tests/ui/mem_discriminant.rs @@ -34,6 +34,11 @@ fn main() { mem::discriminant(rro); mem::discriminant(&rro); + macro_rules! mem_discriminant_but_in_a_macro { + ($param:expr) => (mem::discriminant($param)) + } + + mem_discriminant_but_in_a_macro!(&rro); // ok mem::discriminant(&Some(2)); diff --git a/tests/ui/mem_discriminant.stderr b/tests/ui/mem_discriminant.stderr index 5255458d8f8..57e03013392 100644 --- a/tests/ui/mem_discriminant.stderr +++ b/tests/ui/mem_discriminant.stderr @@ -72,5 +72,17 @@ error: calling `mem::discriminant` on non-enum type `&&std::option::Option` | | | help: try dereferencing: `*rro` -error: aborting due to 9 previous errors +error: calling `mem::discriminant` on non-enum type `&&std::option::Option` + --> $DIR/mem_discriminant.rs:38:27 + | +38 | ($param:expr) => (mem::discriminant($param)) + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +... +41 | mem_discriminant_but_in_a_macro!(&rro); + | --------------------------------------- + | | | + | | help: try dereferencing: `*rro` + | in this macro invocation + +error: aborting due to 10 previous errors