Earlier quoted context omitted.
LFS does not need to do all of that. LFS already uses the host computer's C compiler, so it seems just as reasonable to also use the host computer's rust compiler.
Doesn't part of the Rust compliation chain end up using `cc` anyway eventually for like, linking or something? That might not apply at a "system's" level but I'm guessing in the massive Linux compilation job with module support you're making a bunch of object files with exported symbols?
The Linux Kernel Prepares for Rust 1.77 Upgrade
91–100 of 107 posts
Re: The Linux Kernel Prepares for Rust 1.77 Upgrade
#92Earlier quoted context omitted.
LFS is Linux from Scratch right? ( https://www.linuxfromscratch.org/index.html ) What are the implications of using Rust on building Linux?
The Rust bootstrapping story is ugly. https://guix.gnu.org/blog/2018/bootstrapping-rust/
(For the curious) https://elephly.net/posts/2017-01-09-bootstrapping-haskell-p...
Re: The Linux Kernel Prepares for Rust 1.77 Upgrade
#93Earlier quoted context omitted.
Ah, that is important. I didn't even notice that wasn't possible in the GlobalAlloc API, but you're definitely right that it's not.
GlobalAlloc can be used for fallible allocations: its functions just return a null pointer on failure, as with malloc() and realloc() in C. The main limitations are around the safe heap data structures in the standard library, which don't stably expose any fallible APIs except for Vec::try_reserve().
Re: The Linux Kernel Prepares for Rust 1.77 Upgrade
#94Earlier quoted context omitted.
Hello world deps for C : linux-vdso.so.1 (0x00007fff25cb8000) libc.so.6 => /lib64/libc.so.6 (0x00007fe5f08d9000) /lib64/ld-linux-x86-64.so.2 (0x00007fe5f0ae2000) And for Rust linux-vdso.so.1 (0x00007ffc109f9000) libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f8eda404000) libc.so.6 => /lib64/libc.so.6 (0x00007f8eda222000) /lib64/ld-linux-x86-64.so.2 (0x00007f8eda4a8000) Rather Rust has 1 more dynamically linked library…
You missed the word "statically" in the post you commented on. Dynamically linked libs rarely contribute heavily to binary bloat
Re: The Linux Kernel Prepares for Rust 1.77 Upgrade
#95Curious, why Rust instead of Zig?
Re: The Linux Kernel Prepares for Rust 1.77 Upgrade
#96Earlier quoted context omitted.
The Rust bootstrapping story is ugly. https://guix.gnu.org/blog/2018/bootstrapping-rust/
That honestly doesn’t seem that horrible - particularly compared to some of the nigh-on-impossible tasks like bootstrapping GHC (For the curious) https://elephly.net/posts/2017-01-09-bootstrapping-haskell-p...
Yes, the GHC story is also terrible (and just a tad worse than the rust story). The GHC problem is worse largely because the origins of GHC are murky. While it's still possible to get copies of the early GHC versions through the Internet Archive, the code lives firmly in the 1990s and assumes that you have access to long lost Haskell compilers. Turns out that all these Haskell compilers (with the exception of Hugs) have the same kind of problems that GHC has --- only worse because they are even older, depend on binaries of unreleased previous versions, and are really difficult to build with tools from the last two decades.
Re: The Linux Kernel Prepares for Rust 1.77 Upgrade
#97Earlier quoted context omitted.
> if the ecosystem keeps on trying to download 3Gb of build dependencies because you tried to use some simple little library. Downloading 3GB of dependencies is not a thing that happens in the Rust ecosystem. Reality is orders of magnitude smaller than that. Why are you exaggerating so much? Some people bristle at the thought of external dependencies, but if you want to do common tasks it makes sense to pull in commo…
> Downloading 3GB of dependencies is not a thing that happens in the Rust ecosystem. Reality is orders of magnitude smaller than that. Assuming they're talking about the built size of dependencies that are left lying around after cargo builds a binary, they're really not exaggerating by much. I have no difficulty of believing that there are Rust projects that leave 3GB+ of dependency bloat on your file system after y…
Also why those GNU/Linux repos are actually multiple DVDs nowadays.
Re: The Linux Kernel Prepares for Rust 1.77 Upgrade
#98Earlier quoted context omitted.
I agree, but I have yet to see a single real-world example of a Rust project meaningfully reducing its binary size by switching from monomorphization to dynamic dispatch in its own code. Many Rust developers boast that they virtually never use `dyn`, but then still appeal to it when arguing that Rust has dynamic dispatch so monomorphization is an avoidable cost. Sometimes you can provide `T = Arc/Box ` where `T: Foo`…
That's a fair observation, I know when I was first writing Rust my inclination was to return impl IntoIterator from functions which are going to actually return a Vec because hey, if I change my mind you can still iterate over whatever I give you now instead with no code changes. But of course that's an anti-pattern because they are in reality likely to forever just return Vec and knowing that helps you. My early cho…
Re: The Linux Kernel Prepares for Rust 1.77 Upgrade
#99Earlier quoted context omitted.
That's a fair observation, I know when I was first writing Rust my inclination was to return impl IntoIterator from functions which are going to actually return a Vec because hey, if I change my mind you can still iterate over whatever I give you now instead with no code changes. But of course that's an anti-pattern because they are in reality likely to forever just return Vec and knowing that helps you. My early cho…
Note that `impl Foo` return types don't actually cost anything extra with regards to code-size, the compiler knows what the actual type is and there is no dynamic dispatch. Only actual generics have an impact here, and `impl` in a return position doesn't count.
Re: The Linux Kernel Prepares for Rust 1.77 Upgrade
#100Earlier quoted context omitted.
That's a fair observation, I know when I was first writing Rust my inclination was to return impl IntoIterator from functions which are going to actually return a Vec because hey, if I change my mind you can still iterate over whatever I give you now instead with no code changes. But of course that's an anti-pattern because they are in reality likely to forever just return Vec and knowing that helps you. My early cho…
Note that `impl Foo` return types don't actually cost anything extra with regards to code-size, the compiler knows what the actual type is and there is no dynamic dispatch. Only actual generics have an impact here, and `impl` in a return position doesn't count.
Because I didn't admit you were getting a Vec, if you actually need a Vec you actually can't just use the one I gave you. You must jump though hoops to turn whatever I gave you into a Vec, bloating your code.
The implementation is pretty clever, it is probably not going to meticulously take my Vec to pieces, throw it away and make you a new one, instead just giving the same Vec. But this trick is fragile, so much better not to even need it.