Skip to content

[Maintenance] Upgrading projects to the 2021 Rust edition #325

@KianNH

Description

@KianNH

Is there an existing issue for this?

  • I have searched the existing issues

Description

Prompted by an issue caused by the old feature resolver in #324 where mio was being compiled as it was a dependency of tokio when some features were enabled, despite us not enabling any features for tokio. This caused issues since mio doesn't compile to the wasm32-unknown-unknown target.

For the sake of maintenance, and possibly making it easier to migrate to the next Rust edition when that releases, we should consider moving the worker, worker-sys, worker-build, worker-macros and worker-sandbox projects to the 2021 edition.

Aside from any code changes that may be necessary with changing the edition, it would also change the minimum supported Rust version to 1.56. 1.56 was released on October 2021 so I think it's reasonable to expect the majority of users are on it.

Unfortunately we can't use rust-version to indicate to users that their Rust version is too old since that was added in 1.56, so they will just see this on 1.55 and older:

Caused by:
  feature `edition2021` is required

  The package requires the Cargo feature called `edition2021`, but that feature is not stabilized in this version of Cargo (1.55.0 (32da73ab1 2021-08-23)).
  Consider trying a newer version of Cargo (this may require the nightly release).
  See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#edition-2021 for more information about the status of this feature.

The link will tell them that The 2021 edition has been stabilized in the 1.56 release.

Arguably, this issue was only created due to the resolver version so it's also an option that the 2018 edition stays and we just keep the resolver = 2 in Cargo.toml.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions