From b7860cc734c1857847410aea6b0c6d47219fd027 Mon Sep 17 00:00:00 2001 From: Spencer Judge Date: Wed, 1 Apr 2020 11:01:38 -0700 Subject: [PATCH] chore: Update blocking example drop order (#313) --- examples/src/blocking/client.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/src/blocking/client.rs b/examples/src/blocking/client.rs index 5493594..5326e19 100644 --- a/examples/src/blocking/client.rs +++ b/examples/src/blocking/client.rs @@ -9,12 +9,13 @@ use hello_world::{greeter_client::GreeterClient, HelloReply, HelloRequest}; type StdError = Box; type Result = ::std::result::Result; -// The order of the fields in this struct is important. The runtime must be the first field and the -// client must be the last field so that when `BlockingClient` is dropped the client is dropped +// The order of the fields in this struct is important. They must be ordered +// such that when `BlockingClient` is dropped the client is dropped // before the runtime. Not doing this will result in a deadlock when dropped. +// Rust drops struct fields in declaration order. struct BlockingClient { - rt: Runtime, client: GreeterClient, + rt: Runtime, } impl BlockingClient {