Skip to content

cargo fix --edition gives an unstable error #9782

@jyn514

Description

@jyn514

Problem
I want to convert a crate in a workspace from 2015 to 2018 edition. Because another crate in the workspace already uses 2018 edition, cargo tries to convert it to 2021 and gives an error that 2021 is still unstable.

$ cargo fix --edition
    Checking boring-sys v1.1.1 (/home/jnelson/src/boring/boring-sys)
    Checking boring v1.1.6 (/home/jnelson/src/boring/boring)
error: cannot migrate boring-sys/src/lib.rs to edition 2021
Edition 2021 is unstable and not allowed in this release, consider trying the nightly release channel.
   Migrating boring/src/lib.rs from 2015 edition to 2018
error: could not compile `boring-sys`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...

Steps

  1. git clone https://github.com/cloudflare/boring/
  2. cd boring
  3. cargo fix --edition

Possible Solution(s)

Only try to migrate crates to the latest stable edition unless the user explicitly opts-in to upgrading to the unstable edition.

Notes

Output of cargo version:

cargo 1.54.0 (5ae8d74b3 2021-06-22)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions