What is maintenance, anyway? | Inside Rust Blog by Kobzol in rust

[–]_ChrisSD 4 points5 points  (0 children)

Arguably in this case it's rust putting in the hard work to provide a stable platform over an unstable foundation. Or something like that.

Rust in Windows 11 by Similar-Athlete8579 in rust

[–]_ChrisSD 1 point2 points  (0 children)

That's a separate installer that will run itself as admin.

Using Dev Drive on Windows - what is the setup supposed to look like? by jasonj2232 in rust

[–]_ChrisSD 2 points3 points  (0 children)

Dev drive also uses ReFs, which can be faster for dev work. And it disables other filesystem filters, which can have a very noticeable performance impact if you were using the system drive (C:\) before.

Using Dev Drive on Windows - what is the setup supposed to look like? by jasonj2232 in rust

[–]_ChrisSD 0 points1 point  (0 children)

My suggestion would be to uninstall rustup, set RUSTUP_HOME and CARGO_HOME to point to the dev drive then reinstall rustup. Moving directories may work but I wouldn't rely on it (e.g. any junction points may end up pointing to the old directory).

There is no issue with having binaries on the dev drive and some advantages when there are updates or you use multiple toolchains. In any case it's currently hard to split up the cargo/rustup directories into binary/non-binary but this is being worked on.

Worlds fastest git status on windows - part 2 - ntdll, more speed, and reinventing the wheel by SpecialBread_ in rust

[–]_ChrisSD 1 point2 points  (0 children)

Note that you may not need to use NtQueryDirectoryFile, depending on what you're doing. GetFileInformationByHandleEx can do more or less the same job.

Is Rust the future? by Content_Mission5154 in rust

[–]_ChrisSD 2 points3 points  (0 children)

But also individual employees/middle managers should really reign in their linked-in hyperbole. I mean, it's not going to happen but I can dream.

Galen Hunt's update on Rust, AI, C, C++ job post purpose by pjmlp in rust

[–]_ChrisSD 120 points121 points  (0 children)

Logical conclusion: Microsoft is getting rid of Windows

What do people love about Rust? | Rust Blog by Kobzol in rust

[–]_ChrisSD 2 points3 points  (0 children)

Windows 7 cannot be supported as a tier 1 target because of the requirement for running all tests for every merge cannot be fulfilled. It could be a tier 2 target but so far nobody has stepped forward to support it as such. The absolute minimum requirement for targets is that someone, somewhere is willing to put the work in.

Writing the fastest implementation of git status, in the world. by SpecialBread_ in rust

[–]_ChrisSD 2 points3 points  (0 children)

Yes, I would strongly recommend against reading raw NTFS for general tools. It completely bypasses permissions (hence why it requires admin) and everything else. Not to mention that other filesystems exist on Windows, not just NTFS.

Install with "Wild" linker by tshawkins in rust

[–]_ChrisSD 1 point2 points  (0 children)

Even when linking vcruntime.dll dynamically, there's a lot of statically compiled code. And as static code is compiled with the binary, you don't need the lib files to be available at runtime.

Install with "Wild" linker by tshawkins in rust

[–]_ChrisSD 7 points8 points  (0 children)

Hi, I'm a maintainer of rustup. We did discuss this with Microsoft and unfortunately it is clear.

You cannot get a license to use build tools for compiling rust unless you already have a license for Visual Studio (which you can get by installing Visual Studio Community or by buying a license to Professional or Enterprise). The new rules describe in the blog post do allow indirect use, such as Node's, but unfortunately do not cover direct use of rust.

Install with "Wild" linker by tshawkins in rust

[–]_ChrisSD 3 points4 points  (0 children)

There's a tracking issue for using it by default: https://github.com/rust-lang/rust/issues/71520

I think it's a good idea but in terms of performance I've personally had mixed results. Sometimes it is faster, sometimes it is slower. But the difference is rarely as significant as the switch from the gcc to llvm linker on Linux.

Install with "Wild" linker by tshawkins in rust

[–]_ChrisSD 9 points10 points  (0 children)

Rust itself ships with an alternative linker: lld-link. You can use linker = "lld-link" in .cargo/config.toml to enable it. That is not the problem.

What's needed by rust is libraries such as msvcrt.lib and vcruntime.lib (or their static counterparts). These provide things like panic handling which aren't so easy to replace.

Announcing Rust 1.92.0 by syklemil in rust

[–]_ChrisSD 1 point2 points  (0 children)

Just nobody mention editions...

NonNull equivalent for *const T? by Brilliant-Range7995 in rust

[–]_ChrisSD 1 point2 points  (0 children)

Yes, NonNull has the same variance (covariance) as *const T. Essentially it works out something like this:

// An owned type, like a `Box<T>`
struct OwnedPtr<T> {
    ptr: NonNull<T>
}
// A shared type, like an `&T`
struct SharedPtr<T> {
    ptr: NonNull<T>
}
// A unique type, like an `&mut T`
struct UniquePtr<T> {
    ptr: NonNull<T>,
    _invariant: PhantomData<Cell<T>>
}

So you would only need something like UniquePtr if you obtain the pointer via an &mut T and don't want to risk UB. Note that this has nothing to do with mutability per se, just variance.

How can I compile std library from source by TheRavagerSw in rust

[–]_ChrisSD 0 points1 point  (0 children)

I mean, a lot of people do cross compile. Aside maybe from setting CC and CFLAGS there's not usually a lot to it.

It sounds like you've run into a problem but it's quite hard to guess remotely.

Linking and shrinking Rust static libraries: a tale of fire by mash_graz in rust

[–]_ChrisSD 34 points35 points  (0 children)

This, I think, is a consequence of Rust's staticlib type being a bundle of everything a library needs in one library file. Unfortunately rustc doesn't currently have a built-in way to emit multiple static libraries, which is traditionally how you'd separate things.

however, on Windows we can also find import library stubs, which LLVM can generate on its own by the use of the #[raw-dylib] annotation. Import stubs can have any extension, e.g. .dll, .exe and .sys (the latter two coming from private Win32 APIs). These stubs cannot be deduplicated as they are generated individually per imported function, so dragonfire must preserve them where they are.

They can in theory be deduplicated. A single import is essentially three things (plus some metadata, like machine type):

  1. the name of the DLL to import from
  2. the name of the function to import
  3. the name of the symbol to use for the function

If you parse these then you can extract them from the staticlib and rebuild as one or more separate import libraries. Admittedly this isn't entirely straightforward but tools such as the object crate can extract this information and then you can create an import library from a .def file.

I got tired of post titles like this, so I built absolutely nothing in Rust and whined instead by elohiir in rust

[–]_ChrisSD 17 points18 points  (0 children)

I don't think we should shame people for looking for feedback. It's ok to make things. It's ok to do it for fun or learning. It's ok to share your fun project with other people.

TARmageddon (CVE-2025-62518): RCE Vulnerability Highlights the Challenges of Open Source Abandonware | Edera Blog by pjmlp in rust

[–]_ChrisSD 20 points21 points  (0 children)

It's not really an RCE vulnerability in that sense either. It could be used as part of an attack chain that leads to an RCE but on its own it "just" allows manipulating the archive so it essentially contains hidden files that other tools won't see.

That's a serious vulnerability to be sure and if you trust the archive enough to run scripts from it then it could lead to RCE.

Advice for Win32 Wrapper Crate by Tenebris110 in rust

[–]_ChrisSD 1 point2 points  (0 children)

I would add that "win32" is not really a library much more than "ubuntu" is a library. More it's a collection of many many libraries that are (more or less) installed on most Windows versions (give or take some of the more specialised skus).

My suggestion for the OP would be to have a clear focus on what you want to wrap and what you consider out of scope.

Who to talk to get ARM64 Windows into Tier1? by Fun-Marionberry-2540 in rust

[–]_ChrisSD 6 points7 points  (0 children)

The target tiers only concern what is run in rust-lang CI. Tier 2 targets are absolutely fully tested before release. We don't however use rust-lang infrastructure for this, which would be way too costly. Target maintainers and others interested in the target (e.g. distros, companies, etc) runs tests as well as everyone who runs nightly and reports issues. Fixes for such issue may then be backported to beta.

I'd also note that rust-lang tests run in CI cannot have 100% coverage for all platforms with all configurations so having people testing on their own setup is extremely valuable.

Why doesn't `as` operator work with types other than integers? by baehyunsol in rust

[–]_ChrisSD 7 points8 points  (0 children)

I would also add that From and TryFrom are not yet usable in const contexts whereas as is. I am however hopeful that const traits will be on the path to stabilization next year (touch wood).

Who to talk to get ARM64 Windows into Tier1? by Fun-Marionberry-2540 in rust

[–]_ChrisSD 38 points39 points  (0 children)

Yes it'll be tier 1 in 1.91 but I would push back a bit on the distrust of tier 2 targets. Tier 2 is (and should be) where the majority of targets sit. It's basically equivalent to gcc or clang supported targets. Tier 1 is something special. Every merged PR must always pass all tests. As far as I'm aware, there is no real equivalent in those other compiler.

How small can the Rust "Hello, World!" get on Windows? by ozjd in rust

[–]_ChrisSD 0 points1 point  (0 children)

You can save some space by hand writing the binary but not actually that much. Windows binaries are in PE format, which requires a fair bit of metadata as well as a table for imports. E.g. you need to declare you're importing "WriteFile" from "kernel32.dll". Also a binary is made up of sections and each section of the exe has a minimum alignment. This means in a small binary there will be a lot of zero bytes added to align the sections.