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

Backport and Deprecations to 0.14.x from 1.0 #3052

Closed
seanmonstar opened this issue Nov 8, 2022 · 6 comments
Closed

Backport and Deprecations to 0.14.x from 1.0 #3052

seanmonstar opened this issue Nov 8, 2022 · 6 comments
Labels
V-0.14.x 0.14.x versions
Milestone

Comments

@seanmonstar
Copy link
Member

In order to ease the upgrade from 0.14.x to 1.0, a big help would be to backport additions from 1.0, and add deprecation warnings of things that will go away. Ideally, this will allow people using 0.14.x versions to start updating their apps and libraries with guides from the compiler, without having to fully swallow the 1.0 pill yet.

Backports

  • We can't backport everything. Some of the changes are breaking in nature. We can only backport additions.

Deprecations

  • As things are backported, we can add deprecation warnings to the existing types that are removed in 1.0, guiding them to start using the backported APIs.
  • We can also add warnings to types or methods which are just completely gone in 1.0.
  • For types that are moving to hyper-util, we could add a weaker deprecation warning, especially if the type that is moving is easy to copy.

Opt-in / Opt-out

  • We can create a new cargo feature, such as 1.0-backports (or some better name), so people only compile the backports if they want to use them.
  • I'm undecided about whether deprecations should be on by default, possibly with an opt-out cargo feature, or only opt-in.
    • If they are opt-in, people may not realize they could start preparing early.
    • There is already a built-in way to opt-out of a deprecation warning, #[allow(deprecation)].
@seanmonstar seanmonstar added B-rfc Blocked: More comments would be useful in determine next steps. V-0.14.x 0.14.x versions labels Nov 8, 2022
@kate-shine
Copy link

Personally, I'd prefer it to be an opt-out feature.

  • opt-in would, in my experience, result in plenty of projects missing it
  • enabling it without any attached feature would, as you said, allow disabling by #[allow(deprecation)], but I don't think I like the idea of allowing deprecation warnings for all crates because of one

@jcgruenhage
Copy link

A way for the backports to be opt-out would still have to be an opt-in feature that's enabled by default. Features are additive, and should only ever enable new functionality. Code that compiles without a feature enabled should never break when a new feature is enabled. Source: https://doc.rust-lang.org/cargo/reference/features.html?highlight=additive#feature-unification

@seanmonstar
Copy link
Member Author

Yea, backports can simply be opt-in: we'll make a cargo feature you can enable, and won't put it in default.

I'd prefer it to be an opt-out feature.

I assume you mean being able to opt-out of the deprecation warnings. Users wouldn't have to #![allow(deprecated)] and hide all other crates, they can add the allow directly on the import/use line.

@epage
Copy link

epage commented Dec 21, 2022

clap initially did opt-out but switched to opt-in. clap-rs/clap#3822 is the issue that led us to making the switch.

For us, we document in our version migration guide to run cargo check --all-targets -F clap/deprecated before attempting the upgrade (ie generally don't enable it but enable it in one off runs). Granted, a good number of people update without looking at the CHANGELOG and are first to open an Issue or start a Discussion rather than read the CHANGELOG, so it won't help with everyone.

@stephank
Copy link
Contributor

The clap approach sounds considerate. In line with that and on this point specifically:

We can also add warnings to types or methods which are just completely gone in 1.0.

Warnings that cannot be fixed are probably just going to annoy people, so opt-in, I'd say.

@seanmonstar seanmonstar removed the B-rfc Blocked: More comments would be useful in determine next steps. label Jul 19, 2023
@seanmonstar seanmonstar added this to the 1.0 milestone Aug 24, 2023
@seanmonstar
Copy link
Member Author

This was mostly done (see #3053 and #3079).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
V-0.14.x 0.14.x versions
Projects
No open projects
Status: Done
Development

No branches or pull requests

5 participants