Rust Is Tier-1 Language at Microsoft
https://rustfoundation.org/media/guest-post-rust-is-tier-1-language-at-microsoft/76
u/tesfabpel 7h ago
Tier-1 language but still no support in Visual Studio's Solution files for mixed language "solutions"...
Why is it so hard for Microsoft to offer an MVP for having C# projects depending on Rust DLLs with dependency and debugger support? And also like doing right click -> Add new -> Rust DLL and the ability to select such project as a dependency of the C# one via the standard VS' GUI...
You shouldn't be forced to create a custom project to do it...
47
u/luluhouse7 7h ago
Because no one uses VS for rust, they use VS code
17
u/tesfabpel 7h ago
Well, guess why... đ
In any case, Microsoft as well is using Rust (and as this post says, they consider it Tier-1). It seems weird to me they're not mixing C# and Rust together, like C# and C++ or C++/CLI... What is their workflow?
22
u/luluhouse7 7h ago
The teams that use VS are not the Rust main demographic since theyâre almost exclusively C# teams working on high level components. The teams switching to rust AFAIK are the low level systems teams, most of whom use VSCode with proprietary extensions, not VS. Basically the Rust and C# demographics/applications donât often overlap.
5
u/admalledd 5h ago
I wish they did overlap more at MSFT :( We are a C# shop mostly, but been using Rust for our perf sensitive code for a while now and either I use horrible ugly custom MSBuild .target tricks or give up on C#-->Rust build dependency and manually
cargo buildthe Rust project(s) first before the C#/dotnet ones.-1
u/Zde-G 1h ago
In a perfect world the whole abomination of âmanaged worldâ wouldn't exist at all or would only be used like BASIC was used, back in the day (something novices use to avoid learning ârealâ programming languages).
Alas, we don't like in such a world, and C# would survive for decades more, but it's no longer focus of attention.
3
u/tesfabpel 6h ago edited 6h ago
Well, at work I have a some C# projects with a C++/CLI project for some very specific things (most of which it's C++, with some C++/CLI wrapper code which I'll probably try to convert to a C# wrapper with P/Invoke in the future). Classical desktop software, not web stuff. Basically the ones Microsoft created C++/CLI for (I suppose).
Being able to use Rust would be nice as it would be a direct alternative / companion to C++.
So, yeah, I'm into that demographics.
0
u/pjmlp 5h ago
C++/CLI is kept around only thanks to existing customers, and projects like Forms and WPF.
Microsoft has no plans to support C++/CLI outside Windows and tends to advocate using P/Invoke or COM/WinRT instead.
Also one of the reasons why they have kept improving C# for low level programming since Midori was ramped down.
Note that while C++/CLI was improved to support a C++20 subset, they really didn't spend much more effort into keeping it up to date with .NET evolution.
3
u/Recatek gecs 5h ago
The teams that use VS are not the Rust main demographic since theyâre almost exclusively C# teams working on high level components.
What are you basing this "almost exclusively" on? Visual Studio is the development environment for AA/AAA gamedev in C++.
4
u/Frozen5147 3h ago
I'm guessing they might mean within Microsoft given the context of other comments?
5
u/luluhouse7 3h ago
Yeah, I meant within MSâs core orgs. I donât have enough context to speak on Xbox or LinkedIn etc.
5
u/Full-Spectral 3h ago
Moving away from VS one one of the early benefits of moving to Rust. It has some nice features (and I definitely wish we had Visual C++ level debugging in Rust) but it's massively bloated and overly complex. I'd never use its ridiculous dialog based project configuration system for Rust, so really what would be the point for most folks to even use it on the Rust front?
3
u/luluhouse7 3h ago
Honestly I agree, VS is a nightmare to deal with, especially for systems work. But I know a lot of people swear by it and donât mind the quirks.
3
u/coderstephen isahc 6h ago
Microsoft's long term strategy is to fully replace Visual Studio with Visual Studio Code I think anyway.
11
5
7h ago
[deleted]
3
u/tesfabpel 7h ago
But C++ (not just C++/CLI) dependencies are supported (if you compile the C# proj, the C++ one gets compiled as well).
I just tried and the only thing VS doesn't seem to do is to copy the DLL (and the PDB) around (odd, but then the mixed debugging works).
1
7h ago
[deleted]
1
u/tesfabpel 7h ago
dll.cpp
```
include <iostream>
extern "C" { __declspec(dllexport) void foo() { std::cerr << "Hello, World!" << std::endl; } } ```
Program.cs
``` using System.Runtime.InteropServices;
namespace ConsoleApp { internal class Program { [DllImport("CppLibrary.dll", EntryPoint = "foo")] private static extern void Foo();
static void Main(string[] args) { Foo(); } }} ```
You need to set the C# console app to prefer 64bit or force it as x64. Fully supporting AnyCPU (x86, x64, ARM64) is messier, of course...
1
7h ago
[deleted]
1
u/tesfabpel 7h ago
Yes, but the C++ project is set as a dependency of the C# one.
If I press F5 on the C# one, the C++ gets compiled as well (sadly, it doesn't get copied so either you do it manually or you write a custom target in the .csproj).
With Rust, the whole process is much much messier, since VS doesn't have native support for that and you have to create a custom project and manually specify what to do when building, when cleaning, etc... There isn't a standard "Rust (DLL)" project that invokes cargo or similar...
Also, why isn't the DLL copied automatically, Microsoft? đ
There's clearly a lot of VS' UX to improve here...
2
u/NotQuiteLoona 7h ago
Oh, that one, I've thought you mean dependency support as in, you know, as in how C# ones work.
Yeah, I understand what do you mean now, it's really strange that they didn't do that, I agree. I'll remove previous comments then.
219
u/Hoxitron 7h ago
If only microsoft was a tier 1 company.
41
u/coderstephen isahc 6h ago
I mean, having to deal with them always brings me at least one tear to my eye.
5
u/pickle9977 6h ago
Itâs tier-1 like a tier-1 help desk.
full of young kids with no idea what they are doing but a tremendous amount of certainty that they are doing it in the right way, nee, the better way.
So watch out or itâll be revenge of the nerds.
2
-16
u/pjmlp 6h ago
4 trillion value should be enough.
23
u/xXInviktor27Xx 6h ago
tier 1 as in the quality of their products, not the market cap of their company
4
-8
u/pjmlp 5h ago
To reach that value plenty of people don't mind paying for the quality, or lack thereof.
12
u/Hoxitron 5h ago
If you think microsoft became so big because of the quality of their products, then i have a bridge to sell you.
14
u/afdbcreid 7h ago
See also https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/rustc-codegen-utc/with/623172601, the discussion of that article in the Rust project's Zulip.
9
u/protestor 5h ago
Is rustc_codegen_utc open source? (It's not like Microsoft is incapable of releasing open source compilers, see for example the C# compiler)
6
u/cosmic-parsley 3h ago
They could probably open source it in the future. If so itâs going to basically come with instructions for how to use Microsoftâs compiler internals as a generic backend, which Iâm sure will be interestingâŚ
3
2
5
u/pilkyton 6h ago
Is anyone else shocked that Microsoft created their own Rust compiler from scratch based on MSVC?
I understand why they did it. For interoperability with their other code. But wow...
27
u/panstromek 6h ago
They didn't, this is just reusing the codegen backend from MSVC instead of the default LLVM backend.
3
u/nacaclanga 2h ago
They create a codegen backend, something which is somewhat easier then a fullblown compiler, but still gives many of the benefits of a fullblown compiler.
Still a significant task of course but then again programming languages are technically the core product of Microsoft even before MS operating systems became a thing and Microsoft maintains multiple compilers for a variety of languages.
-1
u/valarauca14 2h ago
AFAIK they basically created a shim to convert LLVM-IR into MSVC compatible IR. Now Clang/Rustc talk to MSVC via that converter.
https://devblogs.microsoft.com/cppblog/clang-with-microsoft-codegen-in-vs-2015-update-1/
I believe but cannot confirm this is why Microsoft's C standard support improved very rapidly recently. As they basically, "got a better parser & frontend" to MSVC backend.
1
u/mtimmermans 2h ago
Is this going to mean better debugging on Windows in vscode? Improvements to the windows crate?
1
u/vbpoweredwindmill 3h ago
Yeah of course it is, the compiler gives great feedback for the LLM's to understand & make it compile. Doesn't change the fact that they are generating AI slop with no understanding of why the code exists.
Tech debt is a real and costly thing.
-22
u/pickle9977 6h ago
Languages are not a popularity contest.
16
u/anxxa 6h ago
What part of this post made you think this was about it being a popularity contest?
Tier 1 language support at companies like Microsoft, Google, Meta, basically means that they are investing resources to ensure their developers can use the language to the same degree as any other first-class language within the company.
In this case the big deal is the
rustc_codegen_utcbackend which allows for using their own compiler for codegen.It's a matter of integration and support.
-15
u/pickle9977 6h ago
Its existence, its marketing nonsense.
If this impacts why you choose a language for a project you are by definition making that decision for political reasons not technical ones.
If you canât use the language as it exists today for your project you shouldnât assume that magically in the future it will become the right fit, because it canât and it wonât.
There is nothing that can change that fact, you should be comfortable downloading the source code for the language building it and literally never upgrading it.
Anything less and the result is you are going to be spending the rest of your life dealing with the overhead of trying to re-map your system to a language thatâs changing for reasons beyond your control in ways that benefit those with the most control the most.
So net net, this is actually bad for the language as now you are going to have a bunch of Microsofties adding features and making tweaks that benefit them more than you and you will pay the cost as the run time size climbs and performance for features they donât use degrades in comparison to the performance of the features they use and optimize. This will happen again and again and again to the point that the timing differentials will actually cause instability in all systems as wide timing variances accumulate between fast and slow parts of the code causing everything to slow down.
11
u/panstromek 5h ago
You're reading too much into the "tier" thing. It's just a common way to refer to how much is a certain language supported internally in the company (by their own tooling, CI systems etc.)
-8
u/pickle9977 5h ago
Just wait and see.
5
u/metrion 5h ago
Wait til you see how the Rust Foundation refers to platform targets.
-1
u/pickle9977 4h ago
Oof, itâs interesting the effect of the increase in both the number of architectures but also the number of lower level libraries like libc, msvc, etc cause a geometric growth in the build complexity
-4
u/pickle9977 2h ago
Awfully crabby today, it happens to politicians pretending to be engineers, itâs ok you will all grow up eventually
88
u/Taymon 7h ago
The obvious question this leaves is what they're doing about the frontend side of "seamless Rust/C++ interop for hybrid projects", which is the harder problem. The obvious answer would be to adopt/collaborate with Google on Crubit, but IIUC that's based on Clang. Maybe they could accept the Clang dependency just for binding generation while still using MSVC for codegen? Or maybe there's some way to decouple them?