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

Upgrade wasm-bindgen-test to std::future #1558

Closed
najamelan opened this issue May 27, 2019 · 5 comments · Fixed by #1741
Closed

Upgrade wasm-bindgen-test to std::future #1558

najamelan opened this issue May 27, 2019 · 5 comments · Fixed by #1741
Labels
help wanted We could use some help fixing this issue! wasm-bindgen-test The wasm-bindgen-test crate

Comments

@najamelan
Copy link
Contributor

Motivation

Work has been done to start enabling async/await, but the wasm-bindgen-test macro still requires users to return a futures 0.1 future from their test functions. I think it's time we allowed returning a std future.

Proposed Solution

Potentially behind the same futures_0_3 feature as with wasm-bindgen-futures. The relevant code seems to be here.

Alternatives

Wait until it stabelizes completely

@najamelan najamelan added the enhancement New feature or request label May 27, 2019
@alexcrichton alexcrichton added help wanted We could use some help fixing this issue! wasm-bindgen-test The wasm-bindgen-test crate and removed enhancement New feature or request labels May 28, 2019
@fitzgen
Copy link
Member

fitzgen commented Jun 3, 2019

I think we want to wait until it stabilizes completely. We've historically put a lot of effort into getting our toolchain on stable rustc, and I wouldn't want to regress that without extremely strong motivations.

@alexcrichton
Copy link
Contributor

Oh oops sorry I meant to reply to this! I think that we'll want to hold off on changing #[wasm_bindgen_test(async)] until futures are stable, but like with opt-in support for libstd's Future trait I think we could take a strategy like #[wasm_bindgen_test(async_std)] or something like that which means "use std::future::Future" and couple that with a feature of the wasm-bindgen-test crate and we should be able to implement this today without too much impact.

@Pauan
Copy link
Contributor

Pauan commented Jun 3, 2019

Future will be available on Stable on July 4th, so I'm not a fan of short-term solutions.

@ctaggart
Copy link
Contributor

ctaggart commented Aug 8, 2019

moved comment to #1695 (comment)

alexcrichton added a commit to alexcrichton/wasm-bindgen that referenced this issue Aug 28, 2019
This commit defaults all crates in-tree to use `std::future` by default
and none of them support the crates.io `futures` 0.1 crate any more.
This is a breaking change for `wasm-bindgen-futures` and
`wasm-bindgen-test` so they've both received a major version bump to
reflect the new defaults. Historical versions of these crates should
continue to work if necessary, but they won't receive any more
maintenance after this is merged.

The movement here liberally uses `async`/`await` to remove the need for
using any combinators on the `Future` trait. As a result many of the
crates now rely on a much more recent version of the compiler,
especially to run tests.

The `wasm-bindgen-futures` crate was updated to remove all of its
futures-related dependencies and purely use `std::future`, hopefully
improving its compatibility by not having any version compat
considerations over time. The implementations of the executors here are
relatively simple and only delve slightly into the `RawWaker` business
since there are no other stable APIs in `std::task` for wrapping these.

This commit also adds support for:

    #[wasm_bindgen_test]
    async fn foo() {
        // ...
    }

where previously you needed to pass `(async)` now that's inferred
because it's an `async fn`.

Closes rustwasm#1558
Closes rustwasm#1695
alexcrichton added a commit to alexcrichton/wasm-bindgen that referenced this issue Aug 28, 2019
This commit defaults all crates in-tree to use `std::future` by default
and none of them support the crates.io `futures` 0.1 crate any more.
This is a breaking change for `wasm-bindgen-futures` and
`wasm-bindgen-test` so they've both received a major version bump to
reflect the new defaults. Historical versions of these crates should
continue to work if necessary, but they won't receive any more
maintenance after this is merged.

The movement here liberally uses `async`/`await` to remove the need for
using any combinators on the `Future` trait. As a result many of the
crates now rely on a much more recent version of the compiler,
especially to run tests.

The `wasm-bindgen-futures` crate was updated to remove all of its
futures-related dependencies and purely use `std::future`, hopefully
improving its compatibility by not having any version compat
considerations over time. The implementations of the executors here are
relatively simple and only delve slightly into the `RawWaker` business
since there are no other stable APIs in `std::task` for wrapping these.

This commit also adds support for:

    #[wasm_bindgen_test]
    async fn foo() {
        // ...
    }

where previously you needed to pass `(async)` now that's inferred
because it's an `async fn`.

Closes rustwasm#1558
Closes rustwasm#1695
@alexcrichton
Copy link
Contributor

I've posted an initial version of this to #1741

alexcrichton added a commit to alexcrichton/wasm-bindgen that referenced this issue Aug 28, 2019
This commit defaults all crates in-tree to use `std::future` by default
and none of them support the crates.io `futures` 0.1 crate any more.
This is a breaking change for `wasm-bindgen-futures` and
`wasm-bindgen-test` so they've both received a major version bump to
reflect the new defaults. Historical versions of these crates should
continue to work if necessary, but they won't receive any more
maintenance after this is merged.

The movement here liberally uses `async`/`await` to remove the need for
using any combinators on the `Future` trait. As a result many of the
crates now rely on a much more recent version of the compiler,
especially to run tests.

The `wasm-bindgen-futures` crate was updated to remove all of its
futures-related dependencies and purely use `std::future`, hopefully
improving its compatibility by not having any version compat
considerations over time. The implementations of the executors here are
relatively simple and only delve slightly into the `RawWaker` business
since there are no other stable APIs in `std::task` for wrapping these.

This commit also adds support for:

    #[wasm_bindgen_test]
    async fn foo() {
        // ...
    }

where previously you needed to pass `(async)` now that's inferred
because it's an `async fn`.

Closes rustwasm#1558
Closes rustwasm#1695
alexcrichton added a commit to alexcrichton/wasm-bindgen that referenced this issue Sep 5, 2019
This commit defaults all crates in-tree to use `std::future` by default
and none of them support the crates.io `futures` 0.1 crate any more.
This is a breaking change for `wasm-bindgen-futures` and
`wasm-bindgen-test` so they've both received a major version bump to
reflect the new defaults. Historical versions of these crates should
continue to work if necessary, but they won't receive any more
maintenance after this is merged.

The movement here liberally uses `async`/`await` to remove the need for
using any combinators on the `Future` trait. As a result many of the
crates now rely on a much more recent version of the compiler,
especially to run tests.

The `wasm-bindgen-futures` crate was updated to remove all of its
futures-related dependencies and purely use `std::future`, hopefully
improving its compatibility by not having any version compat
considerations over time. The implementations of the executors here are
relatively simple and only delve slightly into the `RawWaker` business
since there are no other stable APIs in `std::task` for wrapping these.

This commit also adds support for:

    #[wasm_bindgen_test]
    async fn foo() {
        // ...
    }

where previously you needed to pass `(async)` now that's inferred
because it's an `async fn`.

Closes rustwasm#1558
Closes rustwasm#1695
alexcrichton added a commit to alexcrichton/wasm-bindgen that referenced this issue Sep 5, 2019
This commit defaults all crates in-tree to use `std::future` by default
and none of them support the crates.io `futures` 0.1 crate any more.
This is a breaking change for `wasm-bindgen-futures` and
`wasm-bindgen-test` so they've both received a major version bump to
reflect the new defaults. Historical versions of these crates should
continue to work if necessary, but they won't receive any more
maintenance after this is merged.

The movement here liberally uses `async`/`await` to remove the need for
using any combinators on the `Future` trait. As a result many of the
crates now rely on a much more recent version of the compiler,
especially to run tests.

The `wasm-bindgen-futures` crate was updated to remove all of its
futures-related dependencies and purely use `std::future`, hopefully
improving its compatibility by not having any version compat
considerations over time. The implementations of the executors here are
relatively simple and only delve slightly into the `RawWaker` business
since there are no other stable APIs in `std::task` for wrapping these.

This commit also adds support for:

    #[wasm_bindgen_test]
    async fn foo() {
        // ...
    }

where previously you needed to pass `(async)` now that's inferred
because it's an `async fn`.

Closes rustwasm#1558
Closes rustwasm#1695
alexcrichton added a commit that referenced this issue Sep 5, 2019
This commit defaults all crates in-tree to use `std::future` by default
and none of them support the crates.io `futures` 0.1 crate any more.
This is a breaking change for `wasm-bindgen-futures` and
`wasm-bindgen-test` so they've both received a major version bump to
reflect the new defaults. Historical versions of these crates should
continue to work if necessary, but they won't receive any more
maintenance after this is merged.

The movement here liberally uses `async`/`await` to remove the need for
using any combinators on the `Future` trait. As a result many of the
crates now rely on a much more recent version of the compiler,
especially to run tests.

The `wasm-bindgen-futures` crate was updated to remove all of its
futures-related dependencies and purely use `std::future`, hopefully
improving its compatibility by not having any version compat
considerations over time. The implementations of the executors here are
relatively simple and only delve slightly into the `RawWaker` business
since there are no other stable APIs in `std::task` for wrapping these.

This commit also adds support for:

    #[wasm_bindgen_test]
    async fn foo() {
        // ...
    }

where previously you needed to pass `(async)` now that's inferred
because it's an `async fn`.

Closes #1558
Closes #1695
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted We could use some help fixing this issue! wasm-bindgen-test The wasm-bindgen-test crate
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants