Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime: remove needless 'static bounds #17

Merged
merged 4 commits into from
Jan 6, 2020
Merged

runtime: remove needless 'static bounds #17

merged 4 commits into from
Jan 6, 2020

Conversation

hawkw
Copy link
Member

@hawkw hawkw commented Jan 6, 2020

  • current_thread: block_on futures needn't be static

The current_thread runtime's block_on and block_on_std functions
have 'static bounds on the input future type. These are unnecessary,
since the inner tokio 0.2 runtime doesn't require these bounds, and they
aren't required by tokio 0.1, breaking API compatibility.

  • threadpool: run futures needn't be static

Similarly, futures passed to the threadpool's run also don't need
'static bounds. This commit removes them.

Signed-off-by: Eliza Weisman [email protected]

hawkw added 2 commits January 6, 2020 11:56
The current_thread runtime's `block_on` and `block_on_std` functions
have `'static` bounds on the input future type. These are unnecessary,
since the inner tokio 0.2 runtime doesn't require these bounds, and they
aren't required by tokio 0.1, breaking API compatibility.

Signed-off-by: Eliza Weisman <[email protected]>
Similarly, futures passed to the threadpool's `run` also don't need
`'static` bounds. This commit removes them.

Signed-off-by: Eliza Weisman <[email protected]>
@hawkw hawkw requested review from LucioFranco and a team January 6, 2020 19:59
@hawkw hawkw merged commit 1f2137b into master Jan 6, 2020
hawkw added a commit that referenced this pull request Jan 7, 2020
Fixed:

- Removed unnecessary `'static` bounds on the `current_thread` runtime's
  `block_on`/`block_on_std` functions that broke API compatibility with
  Tokio 0.1 (#17)

Added:

- Implementation of `futures` 0.1 `Executor` trait for `TaskExecutor`s
  (#18)

Signed-off-by: Eliza Weisman <[email protected]>
hawkw added a commit that referenced this pull request Jan 8, 2020
Fixed:

- Removed unnecessary `'static` bounds on the `current_thread` runtime's
  `block_on`/`block_on_std` functions that broke API compatibility with
  Tokio 0.1 (#17)

Added:

- Implementation of `futures` 0.1 `Executor` trait for `TaskExecutor`s
  (#18)

Signed-off-by: Eliza Weisman <[email protected]>
@@ -169,7 +167,7 @@ where
F: Future<Output = ()> + Send + 'static,
{
let mut runtime = Runtime::new().expect("failed to start new Runtime");
runtime.block_on_std(future);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change caused a breaking change for us. Not sure that was intended, but in certain scenarios our futures would never return.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jatsrt as I mentioned in 1f2137b#commitcomment-36749058, that definitely wasn't intended — this wasn't supposed to cause any change in behavior. Can you open a new issue (with example code that reproduces this, if possible?)

@taiki-e taiki-e deleted the eliza/unstatic branch May 19, 2020 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants