Skip to content

Commit

Permalink
Add tests for more than one level of reference
Browse files Browse the repository at this point in the history
  • Loading branch information
HMPerson1 committed Oct 25, 2018
1 parent 1a6bfec commit d53e6f8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
6 changes: 6 additions & 0 deletions tests/ui/mem_discriminant.rs
Expand Up @@ -40,10 +40,16 @@ fn main() {

mem_discriminant_but_in_a_macro!(&rro);

let rrrrro = &&&rro;
mem::discriminant(&rrrrro);
mem::discriminant(*rrrrro);

// ok
mem::discriminant(&Some(2));
mem::discriminant(&None::<u8>);
mem::discriminant(&Foo::One(5));
mem::discriminant(&Foo::Two(5));
mem::discriminant(ro);
mem::discriminant(*rro);
mem::discriminant(****rrrrro);
}
18 changes: 17 additions & 1 deletion tests/ui/mem_discriminant.stderr
Expand Up @@ -84,5 +84,21 @@ error: calling `mem::discriminant` on non-enum type `&&std::option::Option<i32>`
| | help: try dereferencing: `*rro`
| in this macro invocation

error: aborting due to 10 previous errors
error: calling `mem::discriminant` on non-enum type `&&&&&std::option::Option<i32>`
--> $DIR/mem_discriminant.rs:44:5
|
44 | mem::discriminant(&rrrrro);
| ^^^^^^^^^^^^^^^^^^-------^
| |
| help: try dereferencing: `****rrrrro`

error: calling `mem::discriminant` on non-enum type `&&&std::option::Option<i32>`
--> $DIR/mem_discriminant.rs:45:5
|
45 | mem::discriminant(*rrrrro);
| ^^^^^^^^^^^^^^^^^^-------^
| |
| help: try dereferencing: `****rrrrro`

error: aborting due to 12 previous errors

0 comments on commit d53e6f8

Please sign in to comment.