Since Rust will drop support for Windows 7 in 1.76, I was wondering if the x86_64-pc-windows-msvc target could still be used to build a library to be used on Windows 7 in no_std context.
A no_std binary should not interact with the OS at all, so shouldn't be affected by the version, no? Is there anything else that could break? I guess getting an allocator would talk to the OS somehow... What about the final PE, could LLVM generate code that wouldn't run on Windows 7? I've seen that it's dropping support for Windows 7 too, but what is it that LLVM needs on specific Windows versions? It's not processor support since those are separate from the OS. Or does Windows 10 requires CPU features that could be absent on a Windows 7 and thus LLVM could generate invalid (to Windows 7) code?
no_std should not be affected. That said, one thing to watch out for is if Rust decides to bump the default CPU requirements. This would not directly affect running Win7 but would affect very old computers (e.g. those using the very earliest x64 CPUs).
It should also be noted that there is an effort on going to make a Windows 7 target that's maintained in-tree, which would allow you to just switch target and continue as normal. This has not been accepted yet tho so don't quote me on that!
My hope is that we can either jump straight to tier 2 or otherwise get there quickly as it is just splitting off from an existing target. If/when it's tier 2 the std will be available normally through rustup.
With std? Anything. It could work on that OS. It might panic when you try to do something. It might not even reach main. It may appear to work perfectly but then have weird bugs in certain situations.
With no_std (which relies less on the OS) breakage is less likely but still possible. E.g. getting a no_std Rust compiled binary to run on WinXP does require a little bit of extra set up.
Out of interest, why would anyone care about Windows 7 support at this point? It is no longer getting security updates by Microsoft, so it is not at all secure to use (except fully disconnected). For a long time you could also freely upgrade to Windows 10, though I believe that is no longer the case.
So I don't see any reason to still be on Windows 7 where you would also care about building new software for it.
Fair point, but if using a system that isn't connected to the Internet that doesn't matter. If it is connected Windows 7 isn't receiving security updates. Switching to Linux is the better option at that point, and wine/proton is pretty good at running Windows software and games these days. (I use Linux exclusively these days, at home since 2009 and at work since 2018.)
Windows 7 does have telemetry but I'd agree it's beside the point either way. Questioning why some people (or their customers) need Windows 7 support isn't very productive. So long as a third party is willing to do the testing and provide patches when necessary, adding a win7 target should be low maintenance for the Rust project. It can't be tier 1 though because we don't have the infrastructure for automated testing on Windows 7.
I was discussing with a colleague if going no_std could alleviate the support drop but we were not sure if even no_std could be affected. I feel like it's a possibility, but a lot less probable. Thanks for confirming this!
I'll take a look at the PR adding the new target. That might also be an option.
Basically if there's demand for a Windows 7 target and there are people willing to support that (with patches and advice), then Rust can definitely support it.
It is important that it be a separate target though, because we can only have one std per target. And Windows 7 can't be tier 1, while Windows 10 can be.