From 213c633b92adf26f355b7441dc867c3bd071346b Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Tue, 10 Dec 2019 16:54:38 +0100 Subject: [PATCH 1/2] Pass &mut std::task::Context to poll --- misc/core-derive/src/lib.rs | 2 +- misc/core-derive/tests/test.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/misc/core-derive/src/lib.rs b/misc/core-derive/src/lib.rs index 4c36f73e..452cc094 100644 --- a/misc/core-derive/src/lib.rs +++ b/misc/core-derive/src/lib.rs @@ -389,7 +389,7 @@ fn build_struct(ast: &DeriveInput, data_struct: &DataStruct) -> TokenStream { syn::NestedMeta::Meta(syn::Meta::NameValue(ref m)) if m.path.is_ident("poll_method") => { if let syn::Lit::Str(ref s) = m.lit { let ident: Ident = syn::parse_str(&s.value()).unwrap(); - poll_method = quote!{#name::#ident(self)}; + poll_method = quote!{#name::#ident(self, cx)}; } } _ => () diff --git a/misc/core-derive/tests/test.rs b/misc/core-derive/tests/test.rs index 31752b1c..2f4ff803 100644 --- a/misc/core-derive/tests/test.rs +++ b/misc/core-derive/tests/test.rs @@ -134,7 +134,7 @@ fn custom_polling() { } #[allow(dead_code)] - fn foo() { + fn foo(_: &mut std::task::Context) { require_net_behaviour::>(); } } @@ -190,7 +190,7 @@ fn custom_event_and_polling() { } #[allow(dead_code)] - fn foo() { + fn foo(_: &mut std::task::Context) { require_net_behaviour::>(); } } From 18bcba94e7a485698b0860d43de7454eda823b05 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Tue, 10 Dec 2019 17:22:40 +0100 Subject: [PATCH 2/2] Err, fix wrong foo functions --- misc/core-derive/tests/test.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/misc/core-derive/tests/test.rs b/misc/core-derive/tests/test.rs index 2f4ff803..8fae16ca 100644 --- a/misc/core-derive/tests/test.rs +++ b/misc/core-derive/tests/test.rs @@ -130,11 +130,11 @@ fn custom_polling() { } impl Foo { - fn foo(&mut self) -> std::task::Poll> { std::task::Poll::Pending } + fn foo(&mut self, _: &mut std::task::Context) -> std::task::Poll> { std::task::Poll::Pending } } #[allow(dead_code)] - fn foo(_: &mut std::task::Context) { + fn foo() { require_net_behaviour::>(); } } @@ -186,11 +186,11 @@ fn custom_event_and_polling() { } impl Foo { - fn foo(&mut self) -> std::task::Poll> { std::task::Poll::Pending } + fn foo(&mut self, _: &mut std::task::Context) -> std::task::Poll> { std::task::Poll::Pending } } #[allow(dead_code)] - fn foo(_: &mut std::task::Context) { + fn foo() { require_net_behaviour::>(); } }