Skip to content

Commit e5d6586

Browse files
committed
Test for warning of migrating to unstable edition
1 parent 0dc0186 commit e5d6586

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

tests/testsuite/fix.rs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -809,6 +809,7 @@ fn prepare_for_unstable() {
809809
}
810810
};
811811
let latest_stable = Edition::LATEST_STABLE;
812+
let prev = latest_stable.previous().unwrap();
812813
let p = project()
813814
.file(
814815
"Cargo.toml",
@@ -828,13 +829,24 @@ fn prepare_for_unstable() {
828829
// -j1 to make the error more deterministic (otherwise there can be
829830
// multiple errors since they run in parallel).
830831
p.cargo("fix --edition --allow-no-vcs -j1")
831-
.with_status(101)
832-
.with_stderr(&format!("\
832+
.with_stderr(&format_args!("\
833833
[CHECKING] foo [..]
834-
[ERROR] cannot migrate src/lib.rs to edition {next}
834+
[WARNING] `src/lib.rs` is on the latest edition, but trying to migrate to edition {next}.
835835
Edition {next} is unstable and not allowed in this release, consider trying the nightly release channel.
836-
error: could not compile `foo`
837-
", next=next))
836+
837+
If you are trying to migrate from the previous edition ({prev}), the
838+
process requires following these steps:
839+
840+
1. Start with `edition = \"{prev}\"` in `Cargo.toml`
841+
2. Run `cargo fix --edition`
842+
3. Modify `Cargo.toml` to set `edition = \"{latest_stable}\"`
843+
4. Run `cargo build` or `cargo test` to verify the fixes worked
844+
845+
More details may be found at
846+
https://doc.rust-lang.org/edition-guide/editions/transitioning-an-existing-project-to-a-new-edition.html
847+
848+
[FINISHED] [..]
849+
", next=next, latest_stable=latest_stable, prev=prev))
838850
.run();
839851

840852
if !is_nightly() {

0 commit comments

Comments
 (0)