[Pre-Pre-RFC] Reviving minimum Rust version (published as RFC 2495)

I agree

I don't thing so, if I start a new crate I wouldn't bother to pin to any rust version before it being halfway stable. But I would ping the channel I'm targeting. Still I might not always use the same compiler as the channel I'm targeting e.g. I might use nightly for some better debug info (e.g. external-macro-backtrace). So it would be rely nice if I could just state that this works on "stable"/"nightly"/"beta". Even better if I e.g. accidentally run cargo publish with a nightly cargo on a rust=stable crate the compiler could tell me that I'm doing stupid thinks.

In context of this discussion I would consider:

  • rust="stable"/"beta" states that it's meant for stable but not jet committed to any min. version through cargo publish can turn the "stable" into the local used stable rustc version
  • and as this is not meant to be for stableish crates we could warn on cargo package if a crate with a version > 1.0.0 has no rust version flag or uses rust="stable"/"beta"

Hm, so if I understood you correctly rust="stable" will be essentially just a failsafe, and exact Rust version number will be still implicitly inserted by cargo using current (stable) toolchain installed on user’s machine, but you will not be able to cargo publish such crate using nightly toolchain? Having such failsafe could be nice (though, I feel that rust="beta" is redundant, as ideally all previous “stable” crates should work on “beta”), but the big drawback will be that rust field will become required, so such change will be more disruptive (though it should help will teaching).

I am interested in that others think about it.

I’ve updated the RFC draft with changes based on the discussion. One of the additions is “cfg based MSRV” extension, which will allow us to formally specify how MSRV depends on features and target, e.g. like this (details can be changed):

rust = "1.30"
rust-cases = [
    { cfg = "x86_64-pc-windows-gnu", version = "1.35" },
    { cfg = 'cfg(feature = "foo")', version = "1.33" },
]

I will submit PR in the following 2-3 days if there is no additionall changes.

Can you clarify how this compares to previous proposals, and why this one has a better chance?

IIUC previous proposals got derailed by cargo schema versioning discussions. We do not need such functionality anymore, as currently cargo accepts unknown fields and issues only a warning for them. Plus I believe that the current proposal is better thought-out than the previous ones and additionally it includes direction for further refinement of MSRV functionality.

The proposal is published as RFC 2945!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.