From a3d83e5c8f9bfd504e5c6a6bbc6df8d2f451eee1 Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Tue, 31 Jan 2017 10:51:52 +0100 Subject: [PATCH] can't call `assert_eq` on packed struct fields since that takes references --- tests/run-pass/packed_struct.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/run-pass/packed_struct.rs b/tests/run-pass/packed_struct.rs index 93aecbb3d77..5b3f09c0dd0 100644 --- a/tests/run-pass/packed_struct.rs +++ b/tests/run-pass/packed_struct.rs @@ -9,6 +9,11 @@ fn main() { a: 42, b: 99, }; - assert_eq!(x.a, 42); - assert_eq!(x.b, 99); + let a = x.a; + let b = x.b; + assert_eq!(a, 42); + assert_eq!(b, 99); + // can't do `assert_eq!(x.a, 42)`, because `assert_eq!` takes a reference + assert_eq!({x.a}, 42); + assert_eq!({x.b}, 99); }