Add test case for mem::discriminant inside a macro

This commit is contained in:
HMPerson1 2018-10-21 15:23:51 -04:00
parent 5dbca1f6b1
commit 1a6bfecf38
No known key found for this signature in database
GPG key ID: 1FB477DDD27821CE
2 changed files with 18 additions and 1 deletions

View file

@ -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));

View file

@ -72,5 +72,17 @@ error: calling `mem::discriminant` on non-enum type `&&std::option::Option<i32>`
| |
| help: try dereferencing: `*rro`
error: aborting due to 9 previous errors
error: calling `mem::discriminant` on non-enum type `&&std::option::Option<i32>`
--> $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