News for hackers. Stuff that matters.
Re:Rust 1.72.0 by vbezhenar on Thursday August 24, 2023 @10:45AM (#37249354)
I don't understand why compilers drop old Windows compatibility. It makes no sense to me. They emit executable code which looks the same on Windows XP or on Windows 11.
Re:Rust 1.72.0 by pie_flavor on Thursday August 24, 2023 @10:58AM (#37249558)
Rust platform support is tiered[0]. Tier 1 targets are automatically tested, tier 2 targets are automatically built, and tier 3 targets are best-effort. Windows 7 is tier 1 and Windows XP is tier 3; what they're going to do is change the tier 1 Windows build to 10, but the Windows XP support isn't going anywhere.

[0]: https://doc.rust-lang.org/nightly/rustc/platform-support.htm...

Re:Rust 1.72.0 by veber-alex on Thursday August 24, 2023 @11:15AM (#37249799)
The tier 3 Windows XP target is no_std only, which makes it useless for the vast majority of developers.

For all intents and purposes Rust is dropping support for anything bellow Windows 10.

It is suggested in the MCP that a new target can be created for older versions of Windows if members of the community will step up to support it.

https://github.com/rust-lang/compiler-team/issues/651

Re:Rust 1.72.0 by queuebert on Thursday August 24, 2023 @11:45AM (#37250221)
The question is why do newer versions of Windows break compatibility so badly?
Re:Rust 1.72.0 by jacoblambda on Thursday August 24, 2023 @12:19PM (#37250738)
It's not that new versions break compatibility. It's that old versions are missing features that new versions have.

Windows is actually astonishingly backwards compatible but the older you want to support in Windows, the more jank your code has to be.

Like for example, in the zulip chat (linked in the issue for this change) they mention that the next versions they may drop are those Windows 10 releases prior to May 2019 as that release finally made UTF-8 the standard text encoding and being able to generally assume UTF-8 simplifies a lot of things for developers.

Re:Rust 1.72.0 by Longhanks on Thursday August 24, 2023 @12:34PM (#37250974)
UTF-8 is still not the standard on Windows, it’s opt-in.
Re:Rust 1.72.0 by e4m2 on Thursday August 24, 2023 @12:53PM (#37251314)
> that release finally made UTF-8 the standard text encoding

This is a bit of a reach unfortunately. UTF-16 (most often broken WTF-16) is still the standard text encoding on NT. The manifest change only makes A-suffixed functions always do a "UTF-8 to UTF-16" conversion, instead of the unhelpful "local codepage to UTF-16" conversion. Sure, that's better, but:

- Microsoft has expressed no interest in switching the actual underlying encoding to UTF-8, they will likely never do so in NT.

- A-suffixed functions only exist for some Win32 API. Newer Win32 functions are defined only taking Unicode strings. All COM, WinRT and native (Rtl/Nt) APIs use Unicode strings as well. The UTF-8 API surface is actually quite small - one might have to step out of the UTF-8 comfort zone in practice.

- Performance is being left on the table. Transcoding still has to be done, it would be more beneficial to at least keep it local for optimization purposes. The most trivial, yet still important use case: constant string conversions can't be optimized across DLL boundaries.

- Unlike, say, DPI awareness mode, there is no official API to change this behavior at runtime. It has to be done through the manifest, a compiler implicitly embedding such a manifest into every executable it produces is not ideal.

TL;DR: It's an improvement, but just barely, so bumping the minimum version just for this "feature" is not worth it IMO. Just bite the bullet and convert to UTF-16 if you have to, it's conceptually simpler and likely faster, too.

Re:Rust 1.72.0 by SkiFire13 on Thursday August 24, 2023 @02:13PM (#37252555)
> A-suffixed functions only exist for some Win32 API. Newer Win32 functions are defined only taking Unicode strings. All COM, WinRT and native (Rtl/Nt) APIs use Unicode strings as well. The UTF-8 API surface is actually quite small - one might have to step out of the UTF-8 comfort zone in practice.

Unicode is not a binary encoding, perhaps you meant UTF-16/WTF-16, which are binary encoding of Unicode?

Re:Rust 1.72.0 by e4m2 on Thursday August 24, 2023 @03:02PM (#37253135)
Yes and no.

My post specifically mentions UTF-16 and WTF-16, too. The term "Unicode string" exists and is well established: https://unicode.org/glossary/#unicode_string.

Windows Unicode strings happen to fit this definition, but of course, so would UTF-8 strings. Either way, in Windows's version of reality the definition is narrowed to mean "potentially ill-formed UTF-16LE encoded string", but that doesn't exactly roll off the tongue, so for better or for worse, "Unicode string" is the consistently and widely used Windows-specific nomenclature.

Re:Rust 1.72.0 by jeremy_wiebe on Thursday August 24, 2023 @11:54AM (#37250362)
It seems like the Rust team isn't saying that compatibility is broken, just that there is no testing or effort to ensure compatibility. In the end it's similar, but like any project, it comes down to allocation of time and resources. For something like Windows XP, I'd guess the pool of folks interested in targeting it is extremely small.
Re:Rust 1.72.0 by TillE on Thursday August 24, 2023 @12:20PM (#37250744)
You can still write code that targets Windows XP and it will run on Windows 11 just fine. There's no compatibility break.

The problem is that newer versions of Windows offer plenty of features which make library implementation simpler and/or give better performance. Someone else mentioned some threading/synchronization APIs, which is also the most common non-XP feature I've found in use in various C++ libraries.

Re:Rust 1.72.0 by lambda_garden on Thursday August 24, 2023 @11:58AM (#37250425)
But why not test? If we don't expect compatibility to break, then it will be little extra effort surely?
Re:Rust 1.72.0 by malcolmgreaves on Thursday August 24, 2023 @12:19PM (#37250729)
If you were in this situation yourself, what would you do if you saw a test failure? Is it different from what you'd do if you found it to be a success?

If you put it into a tier of support that states "I won't be proactively maintaining compatibility and fixing issues here", then your answer is "nothing." A failing test won't spur you to action, because of the support level.

So if the test result doesn't change your behavior, why run the test in the first place?

Re:Rust 1.72.0 by martinky24 on Thursday August 24, 2023 @12:02PM (#37250485)
This is very naive.
Re:Rust 1.72.0 by kibwen on Thursday August 24, 2023 @12:54PM (#37251343)
CI jobs cost money, and every new target has a multiplicative effect on the number of job configurations that need running.
Re:Rust 1.72.0 by Tuna-Fish on Thursday August 24, 2023 @01:09PM (#37251587)
It's quite a lot of extra effort.

The Rust test job is to compile every single public open-source package on the crates.io registry. This is an amazing way to test. But it's also expensive, because that actually takes a lot of machine time.

Re:Rust 1.72.0 by mook on Thursday August 24, 2023 @12:53PM (#37251327)
Given that XP is no_std, it seems plausible that they want to use some newer APIs in the standard library that didn't exist in older versions of Windows?
Re:Rust 1.72.0 by littlestymaar on Thursday August 24, 2023 @12:05PM (#37250522)
> The tier 3 Windows XP target is no_std only, which makes it useless for the vast majority of developers.

Windows XP has been EOL for 9 year already[1], the vast majority of developer don't care about it. And if you happen to be a Rust developer who care about Windows XP you can either stick to an older version of the Rust compiler that still supports it. If you can afford to use a 22-years old OS that hasn't received patches for the past decade, you can probably afford to use an older Rust compiler…

[1]: https://learn.microsoft.com/en-us/lifecycle/products/windows...

Re:Rust 1.72.0 by TillE on Thursday August 24, 2023 @12:22PM (#37250774)
Developers writing XP-compatible software today aren't the ones choosing to use XP, our clients are doing that.
Re:Rust 1.72.0 by littlestymaar on Thursday August 24, 2023 @04:55PM (#37254423)
They're probably not forcing you to use Rust, let alone the latest compiler…
Re:Rust 1.72.0 by rewmie on Thursday August 24, 2023 @03:21PM (#37253395)
> For all intents and purposes Rust is dropping support for anything below Windows 10.

And that's perfectly fine. Windows 8.1 is unsupported by Microsoft since early this year, and all older releases were already unsupported.

Re:Rust 1.72.0 by vbezhenar on Thursday August 24, 2023 @11:03AM (#37249634)
That makes much more sense and wasn't really obvious from the announcement, thanks!
Re:Rust 1.72.0 by jcranmer on Thursday August 24, 2023 @11:34AM (#37250050)
Because newer versions of kernels add new userspace APIs that can be hard to work around if it's not present. For example, Linux 3.7 added getrandom, which is a much easier way to get CSPRNG data from the kernel than /dev/urandom. With regards to Windows, I believe Windows 7 added some multithreading helpers that make mutex support much more performant compared to what you would have to do on XP or Vista.

So, no, the executable code is not the same on XP or 11.

Re:Rust 1.72.0 by masklinn on Thursday August 24, 2023 @11:21AM (#37249876)
> Currently Windows 7 and 8 are listed as Tier 1 supported platforms. However, this has not been true for a long long time. We simply do not have the testing infrastructure. And with so much software now abandoning Windows 7 and 8 (everything from Git to Go to every major browser), continuing to provide the little support that we do is only getting more difficult. There is also a lack of vendor support for these targets.

The main effect is to split out Windows 7 and Windows 8 as their own targets, such that

> it also leaves open the door for new targets that can commit to broader support

And thus

> Individuals or organisation(s) who can commit to providing some level of legacy testing and support should go through the normal process for creating new targets.

Feel free to apply.

Re:Rust 1.72.0 by dijit on Thursday August 24, 2023 @10:46AM (#37249370)
Likely it's not a statement about true compatibility.

More likely it's that they have to keep running CI pipelines on those machines, and that's painful the older the OS gets.

Re:Rust 1.72.0 by aseipp on Thursday August 24, 2023 @11:01AM (#37249595)
Because those people can just keep using older versions of the compiler if they need binaries to run on those platforms (easier than ever with tools like rustup), and because actually maintaining things like build farms and testing a platform takes a lot of work.
Re:Rust 1.72.0 by nevi-me on Thursday August 24, 2023 @10:48AM (#37249397)
Saying you're compatible with a target means that you're testing new changes against that target so it doesn't break.

I don't think they always emit code that looks the same, otherwise Windows wouldn't have that awesome compatibility mode in their binaries, where you could run a Win10 binary as if it's a WinXP one.

Re:Rust 1.72.0 by lionkor on Thursday August 24, 2023 @10:51AM (#37249434)
Call it partial support then
Re:Rust 1.72.0 by nevi-me on Thursday August 24, 2023 @10:53AM (#37249467)
Well, they're talking about "officially support", which sounds like it's sufficient.

The MCP they're referring to goes into some detail about what's likely to happen. Older versions of Windows could still be community-supported if someone is willing to do so.

Re:Rust 1.72.0 by binary132 on Thursday August 24, 2023 @10:55AM (#37249511)
I think support implies a lot that I guess they don’t want to imply.
Re:Rust 1.72.0 by jenadine on Thursday August 24, 2023 @10:58AM (#37249561)
Rust also has a standard library. They may want to use new API for threads, file system access, and other things provided by the std.
Re:Rust 1.72.0 by richardwhiuk on Thursday August 24, 2023 @11:09AM (#37249719)
Tier 1 Rust Targets run all CI tests, and block tools - so it's about CI infrastructure and maintenance of that I think
Re:Rust 1.72.0 by jacoblambda on Thursday August 24, 2023 @11:07AM (#37249695)
I'd recommend reading the MCP[1] they linked regarding the decision as well as their target tier policy [2].

They are dropping tier 1 support for Win 7 and Win 8. That means they are no longer going to guarantee that the project builds on those platforms and passes all tests via CI.

As long as it is feasible they will probably keep CI runs for those platforms and if interested parties step up and provide sufficient maintenance support, it will remain tier 2. i.e a guarantee that it builds on those platforms via CI but not necessarily that all features are supported and guaranteed via passing tests.

If interested parties can provide sufficient maintenance that all tests continue passing, it will be tier 1 in all but name. However the rest of the development community won't waste their time with issues like Win 7 and 8's partial support for UTF-8.

And once CI stops being feasible for the compiler team to host, it'll drop down to tier 3. If there's sufficient interest from the community towards maintaining these targets, in practice you should see comparable support to with tiers 1 or 2 however now any CI will be managed externally by the community and the compiler team will stop worrying about changes that could break compilation on those targets.

TLDR: They aren't saying "it'll no longer work" but rather "if you want it to stay maintained for these targets, you have to pitch in dev hours to maintain it and eventually support the infrastructure to do this because we don't see a reason to continue doing this". So if you care for these targets, you'll have to contribute to keep it maintained.

[1]: https://github.com/rust-lang/compiler-team/issues/651

[2]: https://doc.rust-lang.org/rustc/target-tier-policy.html

Re:Rust 1.72.0 by gilcot on Thursday August 24, 2023 @12:39PM (#37251062)
Thanks for that clarification. Wasn't obvious for everybody at first read.
Re:Rust 1.72.0 by flohofwoe on Thursday August 24, 2023 @11:20AM (#37249856)
I bet that's mainly for stdlib features.
Re:Rust 1.72.0 by drtgh on Thursday August 24, 2023 @12:27PM (#37250862)
It will be interesting in the future to read the "oh, Windows 10 is no longer tier-1 !!" when the bell arrives at their windows.

PS: Good job Microsoft, receive our acknowledgment. Say hello to the busy telemetry guys. /s

Re:Rust 1.72.0 by kibwen on Thursday August 24, 2023 @01:01PM (#37251458)
> It will be interesting in the future to read the "oh, Windows 10 is no longer tier-1 !!" when the bell arrives at their windows.

It's certainly bound to happen someday. Rust has a lower bound on official support for every OS, not just Windows. For example, Rust doesn't support compiling for Linux kernels older than 2012.

Re:Rust 1.72.0 by codelikeawolf on Thursday August 24, 2023 @03:17PM (#37253338)
I've worked pretty extensively with the Win32 API and Go. I needed to target Windows XP and had to use an older version of Go for stuff like reading/writing files, networking, etc. From what I could gather, newer versions of the Win32 API add abstractions that make common operations require less API calls. I remember needing to use 9 separate Win32 API calls just to bring a window to the foreground and set focus to it. So I think part of the reason Go drops support for older versions of Windows is they were able to simplify code on _their_ end by leveraging these new abstractions. I imagine Rust might be doing the same thing? This is all pure speculation and my memory is fuzzy on this, so take this with a grain of salt.
Re:Rust 1.72.0 by pjmlp on Thursday August 24, 2023 @04:56PM (#37254437)
No they don't, Visual C++ and .NET JIT take advantage of CPU instructions as per minimal supported CPU.

There also a couple of Win32 APIs used alongside the related frameworks.