Skip to content

Tweak and update the transition guide #59

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

Merged
merged 1 commit into from
Jul 22, 2018

Conversation

alexcrichton
Copy link
Member

  • Reflect that rustfix is now just cargo fix and distributed directly with
    Cargo.
  • Update that enabling the 2018 edition doesn't enable any warnings, but mention
    the rust_2018_idioms lint which does indeed enable warnings.
  • Tweak some wording here and there with recent tweaks to the workflow

@alexcrichton
Copy link
Member Author

This shouldn't be merged just yet until rust-lang/rust#52429 is merged and cargo fix actually hits nightlies, but figured it'd be good to get some feedback!

@Centril Centril changed the title Tweak and update the transition guide [DONT MERGE YET] Tweak and update the transition guide Jul 20, 2018
@@ -1,47 +1,30 @@
# Transitioning your code to a new edition

Transitioning between editions is built around lints. Fundamentally, the
process works like this:
New editions might change the way you write Rust -- they add syntax, language,
Copy link
Contributor

Choose a reason for hiding this comment

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

"new" between "add" and "syntax"

Transitioning between editions is built around lints. Fundamentally, the
process works like this:
New editions might change the way you write Rust -- they add syntax, language,
and library features but also remove others. For example, `async`/`await` will
Copy link
Contributor

Choose a reason for hiding this comment

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

remove others -> remove features

process works like this:
New editions might change the way you write Rust -- they add syntax, language,
and library features but also remove others. For example, `async`/`await` will
be available in Rust 2018, but not Rust 2015. Despite this it's our intention
Copy link
Contributor

Choose a reason for hiding this comment

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

Saying that async await will be available in Rust 2018 is true; but not at the release date this year, which a user may reasonably construe from this wording without any info as to the contrary.

* Get your code compiling with no warnings.
* Opt in to the new edition.
* Fix any new warnings that may result.
* Opt in to the new edition, code should compile.
Copy link
Contributor

Choose a reason for hiding this comment

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

"the" before "code"

## Prepare for the next edition

Before we talk about how to move to the new edition, a reminder:
`cargo fix`. It can take suggestions from the compiler and automatically
Copy link
Contributor

Choose a reason for hiding this comment

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

it would be good to say here that the subcommand "fix" is shipped with cargo.


## Fix new warnings
Your crate has now entered the 2018 edition of Rust, congrats! Recall though
that Editions in Rust signify a shift in idioms over time, and while much old
Copy link
Contributor

Choose a reason for hiding this comment

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

Break sentence between "time" and "and".


```rust
// Opt in to unstable features expected for Rust 2018
#![feature(rust_2018_preview)]
Copy link
Contributor

Choose a reason for hiding this comment

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

This code snippet gave the user a crash-course into the new edition.
It is sorta useful if all the user wants to do is test it out but not migrate yet.
I think we should somehow retain the mention of #![feature(rust_2018_preview)] earlier than 1.1 for now.

Copy link
Member Author

Choose a reason for hiding this comment

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

Unfortunately there's a few part of things I think are misleading:

  • This is recommending turning on the rust_2018_idioms lint without properly warning about how underbaked it currently is (huge numbers of warnings and warnings with no real actionable advice)
  • It's enabling the 2018 edition without going through cargo fix which can give people the impression that their crates' hundreds of errors (due to paths) mean the edition is a huge hazard
  • It's jumping the gun a bit in terms of what this all is and how it all interacts with one another.

This is all explained in the transition guide (hopefully in a relatively "quick" fashion) though! I just wanted to make sure we're very careful in this regard as this is a very sensitive topic (migrating to the new edition) and one that I think is important to get right

Copy link
Contributor

Choose a reason for hiding this comment

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

Fair enough :)


```shell
$ cargo +nightly fix --prepare-for 2018
$ cargo +nightly fix --prepare-for 2018 --all-targets
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we get a fix for #19 (comment) somewhere around here as well?

Copy link
Member Author

Choose a reason for hiding this comment

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

The help message is pretty comprehensive, but I can add --all-features for good measure.

@steveklabnik
Copy link
Member

@alexcrichton cargo fix is in the latest nightly, so this is unblocked :)

Do you think you could respond to @Centril 's criticisms sometime in the first half of the day? I'm talking at a meetup tonight europe time and would like to use the latest stuff, which this includes. If you don't have time, I can make the edits myself and merge in too

@steveklabnik
Copy link
Member

oh wait, a nightly hasn't been produced yet, darn

* Reflect that `rustfix` is now just `cargo fix` and distributed directly with
  Cargo.
* Update that enabling the 2018 edition doesn't enable any warnings, but mention
  the `rust_2018_idioms` lint which does indeed enable warnings.
* Tweak some wording here and there with recent tweaks to the workflow
@alexcrichton
Copy link
Member Author

Updated!

@Centril
Copy link
Contributor

Centril commented Jul 20, 2018

Looks all good to me now :)

@alexcrichton alexcrichton changed the title [DONT MERGE YET] Tweak and update the transition guide Tweak and update the transition guide Jul 22, 2018
@alexcrichton
Copy link
Member Author

This is in nightly now, yay!

@alexcrichton alexcrichton merged commit 9685a33 into rust-lang:master Jul 22, 2018
@alexcrichton alexcrichton deleted the tweak branch July 22, 2018 02:19
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