-
Notifications
You must be signed in to change notification settings - Fork 495
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
[Q&A] Is it possible to target edition=2018
instead?
#1699
Comments
Now that the `windows` crate is part of the dependency tree it must be tested specifically for MSRV support. Related to microsoft/windows-rs#1699, let's hope that edition 2018 can be supported or we have to wait.
The Rust edition does not impact dependents, only the version itself matters. Here's the windows-rs/crates/libs/windows/Cargo.toml Line 12 in ecd65e1
And the windows-rs/crates/libs/sys/Cargo.toml Line 11 in ecd65e1
The Rust edition does affect the min version for the crate itself only because older versions of Cargo don't know how to handle newer Rust editions, which seems like an unfortunate oversight. |
So yes, I think it might be possible to use 2018 instead. I switched to 2021 because it simplified a few things and because the docs indicate that interop is seamless. Having switched, I'm not sure what impact it would have to switch back... I'm guessing it will be just as seamless. 😄 |
I think the real issue here is that the pipeline in question is using a version of rustc that falls below MSRV. https://github.com/Byron/vergen/runs/6058258829?check_suite_focus=true#step:10:31 Once that's fixed on the vergen side, everything will be good to go. Will close this as there are no changes needed to the windows crate, but feel free to re-open if I missed something! |
Thanks for your responses, let me summarize what I understand.
Regarding 1) and the concern of breakage when switching to 2018, it's my experience that switching back to older editions is never a problem as backwards compatibility is always maintained. From my experience, breakage when doing that is not a concern. From my interactions with the cargo team I myself trust in this assumption. As I am not an authority in the matter at all let me share some information I gathered while researching point 2 to work up towards my conclusion. I thought using the The excerpt below is edited to highlight they test with Rust 1.6.0 as their MSRV. …
runs-on: windows-latest
strategy:
matrix:
toolchain: [1.6.0-x86_64-msvc, nightly-x86_64-msvc, nightly-i686-msvc, nightly-x86_64-gnu, nightly-i686-gnu
]
… According to the opinion stated in 2) this might be a bug to fix. If that were true and everybody would use the latest version of Rust, it seems there would be no need for an MSRV either. My second research subject was The book starts like this, the highlights are mine.
This again indicates that the MSRV is indeed about the actual Rust version used, while also acknowledging the As For me as a maintainer this would mean I have to use the I hope there is still a chance for |
Thanks for the detailed analysis. To summarize, are you looking for a specific Rust version or specific edition or both? |
Thanks for asking :). In order to support In the grander scheme, I'd hope that
Just now I had an interesting conversation with @joshtriplett who is actually knowledgable in the matter (compared to me) and he highlighted that the MSRV of course should be motivated by an actual need. For Lastly, let me express my gratitude to all the people involved for participating in this discussion as I think it's valuable and necessary for crates who aspire to be a cornerstone of the crate ecosystem. |
I agree that whatever the MSRV is declared as needs to be tested in CI, to make sure it actually works. I don't personally tend to consider MSRV changes a breaking change, though; I'm not even sure I agree with the folks who treat it as a minor-semver bump, but I definitely don't think it's a major bump. I've seen a few projects that treat it as a semver-minor bump, but almost no projects that treat it as semver-major. I do think that it'd be reasonable to check with vergen first to see if their current MSRV is motivated by a specific need/user who requires that version, or if it's just trying to be as minimal as possible for the features they require. If the latter, and they're interested in switching to gitoxide, they might be willing to raise their MSRV to use gitoxide. I'd also check, in general, what their policy for upgrading MSRV is, because you may not want to tie your project to their MSRV requirements if they're much more conservative about MSRV than you want to be. |
First up, we do in fact check MSRV during CI. Here's the windows-rs/.github/workflows/build.yml Lines 62 to 66 in ecd65e1
And here's the windows-rs/.github/workflows/build.yml Lines 48 to 52 in ecd65e1
The But regarding |
This is an interesting stance. Particularly because MSRV changes are breaking downstream, so I don't understand why it wouldn't be considered a breaking change. As a library maintainer I think it's of utmost importance to not break downstream whether by own changes or by those more subtle ones that happen easily with the MSRV in conjunction with one's own dependency tree. I don't even claim I have a full grasp on it and how to properly secure downstream, using semver and version pins in my own dependency as as good as it gets. Pinning versions is probably another topic as those also have side-effects downstream, but they don't mean automatic breakage as far as I know.
That's true, libraries with MSRV might be a reason for potential adopting libraries to raise their MSRV for that, or to opt-out due to a mismatch in policies. @kennykerr I am sorry this came across as 'the MSRV is not tested', I didn't check and I didn't assume it. But I did think the MSRV isn't as prominent as I thought it should be for a crate of this caliber. I also don't think a Rust version as old as 1.6 is desirable at all, that field can be left to Again, for me this means that I hope the edition can be lowered to what's actually, and if it's not feasible that's alright too. Time will bring the Whenever the MSRV topic comes up I think it's a very relevant topic to the crate ecosystem, but somewhat underspecified given its importance (especially in terms of breakage that it can cause). I hope also with @joshtriplett 's presence here that this feeling will change over time within the entire community. Maybe, it's just me though 😅. |
@Byron When is vergen/gitoxide going to upgrade from |
@riverar It's really a question for As for I hope that helps. |
@Byron Great, thanks! I ask because it seems odd to anchor to that old version. The Rust team does a lot of work to maintain semver, so I find it hard to believe there's some breaking issue in 1.55 and 1.56 preventing upgrade. Maybe a small nudge is all they need! |
It's a good idea to ask the question of what would motivate support for old versions in the first place, which seems to be the premise for this entire thread. It's something I assumed to be the inability to upgrade not because one's concern over the Rust compiler breaking compatibility, but ones inability to upgrade for reasons related to package managers. It's an assumption though, and I'd think one can always upgrade by using |
Because Rust itself almost never makes breaking changes (other than occasional soundness fixes or exceptionally careful crater-proven changes), precisely so that people can confidently upgrade Rust. A top-level project that doesn't want to use newer versions of Rust can also just not use newer versions of crates; as long as they keep their working (In general, if there were more people depending on older MSRVs I'd suggest that they develop more tooling to help with the problem of "upgrade to the newest crates that build with the specified MSRV".) I think at this point it'd be a good idea to wait for vergen to identify why they have their current MSRV and what their policy for updating it is. |
When integrating
gitoxide
with other packages, some of them set a minimum supported rust version (MSRV), which may also constrain the maximum supported edition. However, when integrating withvergen
in particular this now fails only for the reason of requiring a higher edition inwindows
than is supported by their MSRV.Currently the
windows
crates requireedition = 2021
and I wonder if it's technically possible to switch them to edition 2018, maybe because no features that would require edition 2021 are actually used.If edition 2021 is indeed required, this issue can be closed. Otherwise I think there is value in supporting a lower edition for greater compatibility.
Note that
gitoxide
was setting higher editions and the latest compiler features for no other reason except for 'novelty', but learned why that would be undesirable when integrating withvergen
. That's the only reason I post this issue here, there might be a chance :).The text was updated successfully, but these errors were encountered: